Files
CHOMPStation2/code/game/machinery/lightswitch.dm
johnsonmt88@gmail.com dc599e776b Added emp_act() to some machines.
- Cell charger: Now calls battery emp_act() as well.

- Security Barrier: Now has a chance to toggle the lock.

- Flasher (portable and wall mounted machines, not the item): Now has a chance to flash.

- Wall-Mounted Sparker: Creates sparks.

- Light switch: Toggles the lights when emp'd (not that it'll matter since the lights will probably all have gone out anyway.)

- Weapon Recharger: Calls the energy gun's battery's emp_act() for guns and in the case of stun batons, it sets their charges to 0.

- Cyborg Recharge Station: Cyborgs now get ejected, then emp'd. There would probably be issues with emping the cyborg inside the machine, like being trapped forever or something.

- Sleeper: Eject's the patient. I kind of wish I could make it inject random chems, but it wants a usr and I'm not inclined to start mucking with sleeper code just for this.

- Space Heater: Calls the emp_act() for the battery inside the heater.

- Status Display: Causes the blue screen of death.

- Portable Atmos Pumps: Randomly changes the pressure, has a chance to flip the direction and turn the machine on/off.

- Portable Atmos Scrubber: Has a chance to toggle the machine on/off.

- Arcade Machine: Spits out some random prizes.

- Medical record computer: Runs through the medical records and has a chance to scramble the name, age, sex, blood type, physical or mental state of patients as well as a small chance to delete entries entirely.

- Security record computer: Runs through the security records and has a chance to scramble the name, age, sex, criminal status, physical or mental state of entries as well as a small chance to delete entries entirely.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5237 316c924e-a436-60f5-8080-3fe189b3f50e
2012-12-01 00:45:32 +00:00

68 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/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()
set src in oview(1)
if(usr && !usr.stat)
usr << "A light switch. 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.master.related)
A.lightswitch = on
A.updateicon()
for(var/obj/machinery/light_switch/L in A)
L.on = on
L.updateicon()
area.master.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))
..(severity)
return
power_change()
..(severity)