mirror of
https://github.com/goonstation/goonstation-2016.git
synced 2026-08-22 05:26:12 +01:00
**Key Features:**
- /obj/adventurepuzzle/element_link
- allows you to set up trigger-triggerable relationships on .dmm files
- /obj/adventurepuzzle/triggerable/targetable
- groups together various targetable triggerables for use by target_link
- /obj/adventurepuzzle/invisible/target_link
- allows you to set a target for targetable triggerables on .dmm files
- adv_test.dmm
- map for showcasing the various adventure elements and some of their functionality
**Other Changes:**
I had to edit several of the existing elements to make their member variables editable on the .dmm editor
I also instantiated a bunch of variables that marquesas didn't instantiate, and fixed a bug with timed doors
85 lines
1.6 KiB
Plaintext
85 lines
1.6 KiB
Plaintext
/obj/adventurepuzzle/triggerable/light
|
|
icon_state = "light_emitter"
|
|
name = "Light emitter"
|
|
desc = "Light is emitted out of this point."
|
|
density = 0
|
|
opacity = 0
|
|
anchored = 1
|
|
invisibility = 20
|
|
|
|
var/is_on = 0
|
|
|
|
var/on_brig = 5
|
|
var/on_cred = 1
|
|
var/on_cgreen = 1
|
|
var/on_cblue = 1
|
|
var/datum/light/light
|
|
|
|
var/static/list/triggeracts = list("Do nothing" = "nop", "Toggle" = "toggle", "Turn on" = "on", "Turn off" = "off")
|
|
|
|
New()
|
|
..()
|
|
src.light = new /datum/light/point
|
|
src.light.attach(src)
|
|
src.light.set_color(on_cred,on_cgreen,on_cblue)
|
|
src.light.set_brightness(on_brig)
|
|
if(src.is_on)
|
|
src.light.enable()
|
|
blink(src.loc)
|
|
|
|
proc/on()
|
|
if (!is_on)
|
|
light.enable()
|
|
is_on = 1
|
|
|
|
proc/off()
|
|
if (is_on)
|
|
light.disable()
|
|
is_on = 0
|
|
|
|
proc/toggle()
|
|
if (is_on)
|
|
off()
|
|
else
|
|
on()
|
|
|
|
trigger_actions()
|
|
return triggeracts
|
|
|
|
trigger(var/act)
|
|
switch (act)
|
|
if ("on")
|
|
src.on()
|
|
return
|
|
if ("off")
|
|
src.off()
|
|
return
|
|
if ("toggle")
|
|
src.toggle()
|
|
return
|
|
|
|
serialize(var/savefile/F, var/path, var/datum/sandbox/sandbox)
|
|
..()
|
|
F["[path].is_on"] << is_on
|
|
F["[path].on_brig"] << on_brig
|
|
F["[path].on_cred"] << on_cred
|
|
F["[path].on_cgreen"] << on_cgreen
|
|
F["[path].on_cblue"] << on_cblue
|
|
|
|
deserialize(var/savefile/F, var/path, var/datum/sandbox/sandbox)
|
|
. = ..()
|
|
F["[path].is_on"] >> is_on
|
|
F["[path].on_brig"] >> on_brig
|
|
F["[path].on_cred"] >> on_cred
|
|
F["[path].on_cgreen"] >> on_cgreen
|
|
F["[path].on_cblue"] >> on_cblue
|
|
|
|
return . | DESERIALIZE_NEED_POSTPROCESS
|
|
|
|
deserialize_postprocess()
|
|
..()
|
|
light.set_color(on_cred, on_cgreen, on_cblue)
|
|
light.set_brightness(on_brig / 7)
|
|
if (is_on)
|
|
is_on = 0
|
|
on() |