adjust calculation of mean velocity to consider reduced speed

master
A. Demant 2019-01-03 15:53:34 +01:00
parent a5fb2c1a19
commit d85ae6b216
1 changed files with 2 additions and 2 deletions

View File

@ -137,11 +137,11 @@ minetest.register_globalstep(function(dtime)
local tvelo=vector.distance(tvel,{x=0,y=0,z=0})
if tvelo>0 then
xpfw.player_add_attribute(player,vel_action,tvelo*dtime)
-- add experience
local mean_speed="mean_"..vel_action.."_speed"
if xpfw.attributes[mean_speed].max ~= nil then
xpfw.player_add_attribute(player,mean_speed,xpfw.attributes[mean_speed].max)
-- normal max velocity is 4. If slowed down than also reducing the mean value
xpfw.player_add_attribute(player,mean_speed,xpfw.attributes[mean_speed].max*tvelo/4)
end
end
end