Replace gravity magic numbers with cvar

This commit is contained in:
rakiru 2015-03-27 20:25:59 +00:00
parent 8f944ae81c
commit df5e281ffc
3 changed files with 4 additions and 4 deletions

View File

@ -99,7 +99,7 @@ function new_nade(settings)
this.vz = this.vz * MODE_NADE_ADAMP this.vz = this.vz * MODE_NADE_ADAMP
end end
this.vy = this.vy + 5*9.81*MODE_NADE_STEP*MODE_NADE_STEP this.vy = this.vy + 5*MODE_GRAVITY*MODE_NADE_STEP*MODE_NADE_STEP
end end
function this.explode_dmg() function this.explode_dmg()

View File

@ -139,7 +139,7 @@ function new_particle(settings)
this.vz = this.vz * this.adamp this.vz = this.vz * this.adamp
end end
this.vy = this.vy + 5*9.81*this.step*this.step this.vy = this.vy + 5*MODE_GRAVITY*this.step*this.step
end end
function this.tick(sec_current, sec_delta) function this.tick(sec_current, sec_delta)

View File

@ -46,7 +46,7 @@ function wobj_new(settings)
-- Calculate jump speed required to jump d blocks high. -- Calculate jump speed required to jump d blocks high.
function this.get_jump_speed(d) function this.get_jump_speed(d)
local grav = this.grav or 1.0 local grav = this.grav or 1.0
local acc = 9.81*4.0*grav local acc = MODE_GRAVITY*4.0*grav
-- d = a*t*t/2 -- d = a*t*t/2
-- d, a known; find t -- d, a known; find t
@ -96,7 +96,7 @@ function wobj_new(settings)
-- d = v*t + (a*t*t)/2 -- d = v*t + (a*t*t)/2
-- Tested to be consistent over a wide variety of sec_delta values. -- Tested to be consistent over a wide variety of sec_delta values.
if this.grav then if this.grav then
local acc = 9.81*4.0*this.grav local acc = MODE_GRAVITY*4.0*this.grav
this.vg.y = this.vg.y + sec_delta*acc this.vg.y = this.vg.y + sec_delta*acc
end end