Event

by Kaiochao
Events and event handlers [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Kaiochao.Event##version=7

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Kaiochao.Event##version=7

1007 downloads
Version 7
Date added: Jul 5 2016
Last updated: Jul 21 2016
1 fan
Example usage:
obj/door
proc/Open(obj/button/Button)
world << "The door is opened by [Button]!"

obj/button
var tmp/event/OnPressed = new // (obj/button)

// when a mob steps on this button, fire the OnPressed event
Crossed(atom/movable/M)
if(OnPressed && ismob(M))
OnPressed.Fire(src)

// hook-up procedure:

var obj/door/door = // ...
var obj/button/button = // ...

// whenever button.OnPressed is fired, door.Open(button) is called!
EVENT_ADD(button.OnPressed, door, /obj/door/proc/Open)