[READY]Refactors timestops to use fields (#30858)

* kek

* fixes

* Fixes

* fixes

* throw freeze

* woops

* double woops
This commit is contained in:
kevinz000
2017-09-28 19:46:10 -07:00
committed by CitadelStationBot
parent d25894447e
commit 724fa8ce54
7 changed files with 150 additions and 87 deletions

View File

@@ -57,6 +57,9 @@ SUBSYSTEM_DEF(throwing)
var/pure_diagonal
var/diagonal_error
var/datum/callback/callback
var/paused = FALSE
var/delayed_time = 0
var/last_move = 0
/datum/thrownthing/proc/tick()
var/atom/movable/AM = thrownthing
@@ -64,14 +67,20 @@ SUBSYSTEM_DEF(throwing)
finalize()
return
if(paused)
delayed_time += world.time - last_move
return
if (dist_travelled && hitcheck()) //to catch sneaky things moving on our tile while we slept
finalize()
return
var/atom/step
last_move = world.time
//calculate how many tiles to move, making up for any missed ticks.
var/tilestomove = Ceiling(min(((((world.time+world.tick_lag) - start_time) * speed) - (dist_travelled ? dist_travelled : -1)), speed*MAX_TICKS_TO_MAKE_UP) * (world.tick_lag * SSthrowing.wait))
var/tilestomove = Ceiling(min(((((world.time+world.tick_lag) - start_time + delayed_time) * speed) - (dist_travelled ? dist_travelled : -1)), speed*MAX_TICKS_TO_MAKE_UP) * (world.tick_lag * SSthrowing.wait))
while (tilestomove-- > 0)
if ((dist_travelled >= maxrange || AM.loc == target_turf) && AM.has_gravity(AM.loc))
finalize()