Goonstation Forums
[FEATURE/FIX] Dynamic Timers - Printable Version

+- Goonstation Forums (https://forum.ss13.co)
+-- Forum: Discussion (https://forum.ss13.co/forumdisplay.php?fid=6)
+--- Forum: Patches (https://forum.ss13.co/forumdisplay.php?fid=30)
+---- Forum: Rejected (https://forum.ss13.co/forumdisplay.php?fid=33)
+---- Thread: [FEATURE/FIX] Dynamic Timers (/showthread.php?tid=6427)



[FEATURE/FIX] Dynamic Timers - Erik - 05-24-2016

This patch intends to add a system to easily allow developers to create dynamic proc calls that need to happen after a given amount of time, the main usecase for this is to get rid of a lot of awful and bad code that heavily relies on spawn() to do it's work.

This patch does NOT refactor the entire codebase to use this new system, but I'm more than willing to provide a patch that refactors all current sleeps into proper call_after calls.

A simple example can be found below, and timer.dm contains basic documentation.



Code:
            target.bioHolder.AddEffect("bad_eyesight")
            spawn(450)
                if (target) target.bioHolder.RemoveEffect("bad_eyesight")

this could easily be replaced with

Code:
            target.bioHolder.AddEffect("bad_eyesight")
            call_after(target.bioHolder, "RemoveEffect", 450, "bad_eyesight")

CODEhttps://github.com/DoomStation/doom/compare/fx-performance-3


RE: [FEATURE/FIX] Dynamic Timers - ZeWaka - 05-31-2017

well the link is broken so welp anyways