0bca862419
* map tweaks/shuttle engines * helpers and defines * global/onclick * controllers and datums * mapping * game folder * some other stuff * some modules * modules that aren't mobs * some mob stuff * new player stuff * mob living * silicon stuff * simple animal things * carbon/ayylmao * update_icons * carbon/human * sounds and tools * icons and stuff * hippie grinder changes + tgui * kitchen.dmi * compile issues fixed * mapfix * Mapfixes 2.0 * mapedit2.0 * mapmerger pls * Revert "mapedit2.0" This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481. * clean up vore folder + 2 hotfixes * admin ticket refinement * Blob tweaks and LAZYADD * LAZYADD IS LAZY * Magic strings purged * DEFINES NEED HIGHER PRIORITIES * Only a sleepless idiot deals in absolute TRUE|FALSE * u h g * progress bar fix * reverts ticket logs * there's always that one guy * fixes and stuff * 2/27 fixes * game folder stuff * stats * some modules again * clothing stuff gets vg clothing out of the main files * everything not mobs again * mob stuff * maps, tgui, sql stuff * icons * additional fixes and compile errors * don't need this anymore * Oh right this isn't needed anymore * maint bar re-added * that doesn't need to be here * stupid events * wtfeven * probably makes Travis happy * don't care to fix the grinder atm * fixes vending sprites, changes turret * lethal, not lethals * overylays are finicky creatures * lazy fix for bleeding edgy (#252) * map tweaks/shuttle engines * helpers and defines * global/onclick * controllers and datums * mapping * game folder * some other stuff * some modules * modules that aren't mobs * some mob stuff * new player stuff * mob living * silicon stuff * simple animal things * carbon/ayylmao * update_icons * carbon/human * sounds and tools * icons and stuff * hippie grinder changes + tgui * kitchen.dmi * compile issues fixed * mapfix * Mapfixes 2.0 * mapedit2.0 * mapmerger pls * Revert "mapedit2.0" This reverts commit 74139a3cacea10df7aafca06c0a10bd3daf3a481. * clean up vore folder + 2 hotfixes * admin ticket refinement * Blob tweaks and LAZYADD * LAZYADD IS LAZY * Magic strings purged * DEFINES NEED HIGHER PRIORITIES * Only a sleepless idiot deals in absolute TRUE|FALSE * u h g * progress bar fix * reverts ticket logs * there's always that one guy * fixes and stuff * 2/27 fixes * game folder stuff * stats * some modules again * clothing stuff gets vg clothing out of the main files * everything not mobs again * mob stuff * maps, tgui, sql stuff * icons * additional fixes and compile errors * don't need this anymore * Oh right this isn't needed anymore * maint bar re-added * that doesn't need to be here * stupid events * wtfeven * probably makes Travis happy * don't care to fix the grinder atm * fixes vending sprites, changes turret * lethal, not lethals * overylays are finicky creatures
74 lines
1.3 KiB
Plaintext
74 lines
1.3 KiB
Plaintext
// the light switch
|
|
// can have multiple per area
|
|
// can also operate on non-loc area through "otherarea" var
|
|
/obj/machinery/light_switch
|
|
name = "light switch"
|
|
icon = 'icons/obj/power.dmi'
|
|
icon_state = "light1"
|
|
anchored = 1
|
|
var/on = 1
|
|
var/area/area = null
|
|
var/otherarea = null
|
|
// luminosity = 1
|
|
|
|
/obj/machinery/light_switch/New()
|
|
..()
|
|
spawn(5)
|
|
src.area = src.loc.loc
|
|
|
|
if(otherarea)
|
|
src.area = locate(text2path("/area/[otherarea]"))
|
|
|
|
if(!name)
|
|
name = "light switch ([area.name])"
|
|
|
|
src.on = src.area.lightswitch
|
|
updateicon()
|
|
|
|
|
|
|
|
/obj/machinery/light_switch/proc/updateicon()
|
|
if(stat & NOPOWER)
|
|
icon_state = "light-p"
|
|
else
|
|
if(on)
|
|
icon_state = "light1"
|
|
else
|
|
icon_state = "light0"
|
|
|
|
/obj/machinery/light_switch/examine(mob/user)
|
|
..()
|
|
user << "It is [on? "on" : "off"]."
|
|
|
|
|
|
/obj/machinery/light_switch/attack_paw(mob/user)
|
|
src.attack_hand(user)
|
|
|
|
/obj/machinery/light_switch/attack_hand(mob/user)
|
|
|
|
on = !on
|
|
|
|
for(var/area/A in area.related)
|
|
A.lightswitch = on
|
|
A.updateicon()
|
|
|
|
for(var/obj/machinery/light_switch/L in A)
|
|
L.on = on
|
|
L.updateicon()
|
|
|
|
area.power_change()
|
|
|
|
/obj/machinery/light_switch/power_change()
|
|
|
|
if(!otherarea)
|
|
if(powered(LIGHT))
|
|
stat &= ~NOPOWER
|
|
else
|
|
stat |= NOPOWER
|
|
|
|
updateicon()
|
|
|
|
/obj/machinery/light_switch/emp_act(severity)
|
|
if(!(stat & (BROKEN|NOPOWER)))
|
|
power_change()
|
|
..() |