Files
CHOMPStation2/code/datums/helper_datums/events.dm
Hawk-v3 bdff096c4c Subject: [PATCH 086/285] TG UPDATES:
- Simple event dispatch system.
- atom.forceMove() proc. Ignores density and other Move()restrictions, but calls Exited() and Entered()
- var/emagged moved to /obj/machinery class - anyprob() helper proc.
- Mecha internal damage varsencapsulated.
- Mech Fabricators now require robotics ID to operate. Emag removes this restriction.
- Added Odysseus Medical Exosuit and it's parts. Has integrated Medical Hud and ability to mount medical modules.
- Added Sleeper Medical module for medical exosuits. Similar to common sleepers, but no ability to inject reagents.
- Added Cable Layer module for exosuits. Load with cable (attack cable with it), activate, walk over dismantled floor.
- Added another exosuit internal damage type - short circuit. Short-circuited exosuits will drain powercell charge and power relay won't work.
- You should be able to send messages to exosuit operators using Exosuit Control Console
- Gygax armour and module capacity nerfed.
- Exosuit weapon recharge time raised.
- Bugfix: EMP actually drains exosuit cell and damages it
2012-03-01 20:50:19 +00:00

60 lines
1.2 KiB
Plaintext

/*
* WARRANTY VOID IF CODE USED
*/
/datum/events
var/list/events
New()
..()
events = new
proc/addEventType(event_type)
if(!(event_type in events) || !islist(events[event_type]))
events[event_type] = list()
return 1
return
proc/addEvent(event_type,proc_holder,proc_name)
if(!event_type || !proc_holder || !proc_name)
return
addEventType(event_type)
var/list/event = events[event_type]
var/datum/event/E = new /datum/event(proc_holder,proc_name)
event += E
return E
proc/fireEvent()
//world << "Events in [args[1]] called"
var/list/event = listgetindex(events,args[1])
if(istype(event))
spawn(-1)
for(var/datum/event/E in event)
if(!E.Fire(arglist(args.Copy(2))))
clearEvent(args[1],E)
return
proc/clearEvent(event_type,datum/event/E)
if(!event_type || !E)
return
var/list/event = listgetindex(events,event_type)
event -= E
return 1
/datum/event
var/listener
var/proc_name
New(tlistener,tprocname)
listener = tlistener
proc_name = tprocname
return ..()
proc/Fire()
//world << "Event fired"
if(listener)
call(listener,proc_name)(arglist(args))
return 1
return