Merge pull request #11 from TheTermos/fix

Fix undeclared globals and dtime bug
master
TheTermos 2019-11-13 11:57:25 +01:00 committed by GitHub
commit e577b53e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -538,8 +538,8 @@ function mobkit.get_next_waypoint(self,tpos)
end end
end end
--scan rear --scan rear
height, pos2, liq = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,4)) height, pos2, liquidflag = mobkit.is_neighbor_node_reachable(self,mobkit.neighbor_shift(neighbor,4))
if height and not liq if height and not liquidflag
and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then and not (nogopos and mobkit.isnear2d(pos2,nogopos,0.1)) then
update_pos_history(self,pos2) update_pos_history(self,pos2)
return height,pos2 return height,pos2
@ -836,7 +836,7 @@ end
function mobkit.vitals(self) function mobkit.vitals(self)
-- vitals: fall damage -- vitals: fall damage
vel = self.object:get_velocity() local vel = self.object:get_velocity()
local velocity_delta = abs(self.lastvelocity.y - vel.y) local velocity_delta = abs(self.lastvelocity.y - vel.y)
if velocity_delta > mobkit.safe_velocity then if velocity_delta > mobkit.safe_velocity then
self.hp = self.hp - floor(self.max_hp * min(1, velocity_delta/mobkit.terminal_velocity)) self.hp = self.hp - floor(self.max_hp * min(1, velocity_delta/mobkit.terminal_velocity))
@ -919,7 +919,7 @@ function mobkit.actfunc(self, staticdata, dtime_s)
end end
function mobkit.stepfunc(self,dtime) -- not intended to be modified function mobkit.stepfunc(self,dtime) -- not intended to be modified
self.dtime = max(dtime,0.05) self.dtime = min(dtime,0.2)
self.height = mobkit.get_box_height(self) self.height = mobkit.get_box_height(self)
-- physics comes first -- physics comes first
-- self.object:set_acceleration({x=0,y=mobkit.gravity,z=0}) -- self.object:set_acceleration({x=0,y=mobkit.gravity,z=0})
@ -1277,8 +1277,8 @@ function mobkit.hq_hunt(self,prty,tgtobj)
end end
function mobkit.hq_warn(self,prty,tgtobj) function mobkit.hq_warn(self,prty,tgtobj)
timer=0 local timer=0
tgttime = 0 local tgttime = 0
local func = function(self) local func = function(self)
if not mobkit.is_alive(tgtobj) then return true end if not mobkit.is_alive(tgtobj) then return true end
local pos = mobkit.get_stand_pos(self) local pos = mobkit.get_stand_pos(self)