adjust calculation of mean velocity to consider reduced speed
parent
a5fb2c1a19
commit
d85ae6b216
|
@ -137,11 +137,11 @@ minetest.register_globalstep(function(dtime)
|
||||||
local tvelo=vector.distance(tvel,{x=0,y=0,z=0})
|
local tvelo=vector.distance(tvel,{x=0,y=0,z=0})
|
||||||
if tvelo>0 then
|
if tvelo>0 then
|
||||||
xpfw.player_add_attribute(player,vel_action,tvelo*dtime)
|
xpfw.player_add_attribute(player,vel_action,tvelo*dtime)
|
||||||
|
|
||||||
-- add experience
|
-- add experience
|
||||||
local mean_speed="mean_"..vel_action.."_speed"
|
local mean_speed="mean_"..vel_action.."_speed"
|
||||||
if xpfw.attributes[mean_speed].max ~= nil then
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue