mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
A lot of fixes that became intertwined. - rscadd: "BEAMS! Emitters now put out a constant beam of energy, which is far less laggy that the old bullet-based method. They also look cooler." - rscadd: "Prisms can combine emitter beams that multiply the damage." - rscadd: "Infrared triggers use the same system as emitters." - rscadd: "Burst HE pipes have their own sprite" - rscadd: "High-performance event observers (needed for beams)" - rscadd: "Supermatter audio alerts" - rscadd: "Added radiation floor decals." - bugfix: "Burst pipes are no longer baleeted by their own explosions." - bugfix: "Pipes are given time to release pressure before the next round of pressure checks." - bugfix: "Explosions are slightly delayed to avoid choruses of simultaneous explosions" - bugfix: "Gas miners no longer melt."
39 lines
803 B
Plaintext
39 lines
803 B
Plaintext
/**
|
|
* /vg/ Events System
|
|
*
|
|
* Intended to replace the hook system.
|
|
* Eventually. :V
|
|
*/
|
|
|
|
// Buggy bullshit requires shitty workarounds
|
|
#define INVOKE_EVENT(event,args) if(istype(event)) event.Invoke(args)
|
|
|
|
/**
|
|
* Event dispatcher
|
|
*/
|
|
/event
|
|
var/list/handlers=list() // List of [\ref, Function]
|
|
|
|
/event/proc/Add(var/objectRef,var/procName)
|
|
var/key="\ref[objectRef]:[procName]"
|
|
handlers[key]=list("o"=objectRef,"p"=procName)
|
|
return key
|
|
|
|
/event/proc/Remove(var/key)
|
|
handlers.Remove(handlers[key])
|
|
|
|
/event/proc/Invoke(var/list/args)
|
|
if(handlers.len==0)
|
|
return
|
|
for(var/key in handlers)
|
|
var/list/handler=handlers[key]
|
|
if(!handler)
|
|
continue
|
|
|
|
var/objRef = handler["o"]
|
|
var/procName = handler["p"]
|
|
|
|
if(objRef == null)
|
|
handlers.Remove(handler)
|
|
continue
|
|
call(objRef,procName)(args) |