- Added a sprite "7" to the sd lighting file as it was used, even if it didn't exist.

- Piped 3.0.0 a bit.
- Standardized code/modules/power. 

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4242 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-07-31 05:24:37 +00:00
parent 1134022744
commit a3d9123edd
25 changed files with 3655 additions and 3659 deletions

View File

@@ -17,127 +17,127 @@
var/locked = 0
var/drainratio = 1
process()
if(P)
if(P.air_contents.toxins <= 0)
investigate_log("<font color='red'>out of fuel</font>.","singulo")
P.air_contents.toxins = 0
eject()
else
P.air_contents.toxins -= 0.001*drainratio
return
attack_hand(mob/user as mob)
if(anchored)
if(!src.locked)
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.toxins/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
return
else
user << "\red The controls are locked!"
return
..()
attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/device/analyzer))
user << "\blue The [W.name] detects that [last_power]W were recently produced."
return 1
else if(istype(W, /obj/item/weapon/tank/plasma))
if(!src.anchored)
user << "\red The [src] needs to be secured to the floor first."
return 1
if(src.P)
user << "\red There's already a plasma tank loaded."
return 1
user.drop_item()
src.P = W
W.loc = src
updateicon()
else if(istype(W, /obj/item/weapon/crowbar))
if(P && !src.locked)
eject()
return 1
else if(istype(W, /obj/item/weapon/wrench))
if(P)
user << "\blue Remove the plasma tank first."
return 1
playsound(src.loc, 'Ratchet.ogg', 75, 1)
src.anchored = !src.anchored
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
"You [anchored? "secure":"undo"] the external bolts.", \
"You hear a ratchet")
if(anchored)
connect_to_network()
else
disconnect_from_network()
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (src.allowed(user))
if(active)
src.locked = !src.locked
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
src.locked = 0 //just in case it somehow gets locked
user << "\red The controls can only be locked when the [src] is active"
else
user << "\red Access denied!"
return 1
/obj/machinery/power/rad_collector/process()
if(P)
if(P.air_contents.toxins <= 0)
investigate_log("<font color='red'>out of fuel</font>.","singulo")
P.air_contents.toxins = 0
eject()
else
..()
return 1
P.air_contents.toxins -= 0.001*drainratio
return
ex_act(severity)
switch(severity)
if(2, 3)
eject()
return ..()
proc/eject()
locked = 0
var/obj/item/weapon/tank/plasma/Z = src.P
if (!Z)
return
Z.loc = get_turf(src)
Z.layer = initial(Z.layer)
src.P = null
if(active)
/obj/machinery/power/rad_collector/attack_hand(mob/user as mob)
if(anchored)
if(!src.locked)
toggle_power()
else
updateicon()
proc/receive_pulse(var/pulse_strength)
if(P && active)
var/power_produced = 0
power_produced = P.air_contents.toxins*pulse_strength*20
add_avail(power_produced)
last_power = power_produced
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.toxins/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
return
return
proc/updateicon()
overlays = null
if(P)
overlays += image('icons/obj/singularity.dmi', "ptank")
if(stat & (NOPOWER|BROKEN))
return
if(active)
overlays += image('icons/obj/singularity.dmi', "on")
proc/toggle_power()
active = !active
if(active)
icon_state = "ca_on"
flick("ca_active", src)
else
icon_state = "ca"
flick("ca_deactive", src)
user << "\red The controls are locked!"
return
..()
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/device/analyzer))
user << "\blue The [W.name] detects that [last_power]W were recently produced."
return 1
else if(istype(W, /obj/item/weapon/tank/plasma))
if(!src.anchored)
user << "\red The [src] needs to be secured to the floor first."
return 1
if(src.P)
user << "\red There's already a plasma tank loaded."
return 1
user.drop_item()
src.P = W
W.loc = src
updateicon()
return
else if(istype(W, /obj/item/weapon/crowbar))
if(P && !src.locked)
eject()
return 1
else if(istype(W, /obj/item/weapon/wrench))
if(P)
user << "\blue Remove the plasma tank first."
return 1
playsound(src.loc, 'Ratchet.ogg', 75, 1)
src.anchored = !src.anchored
user.visible_message("[user.name] [anchored? "secures":"unsecures"] the [src.name].", \
"You [anchored? "secure":"undo"] the external bolts.", \
"You hear a ratchet")
if(anchored)
connect_to_network()
else
disconnect_from_network()
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
if (src.allowed(user))
if(active)
src.locked = !src.locked
user << "The controls are now [src.locked ? "locked." : "unlocked."]"
else
src.locked = 0 //just in case it somehow gets locked
user << "\red The controls can only be locked when the [src] is active"
else
user << "\red Access denied!"
return 1
else
..()
return 1
/obj/machinery/power/rad_collector/ex_act(severity)
switch(severity)
if(2, 3)
eject()
return ..()
/obj/machinery/power/rad_collector/proc/eject()
locked = 0
var/obj/item/weapon/tank/plasma/Z = src.P
if (!Z)
return
Z.loc = get_turf(src)
Z.layer = initial(Z.layer)
src.P = null
if(active)
toggle_power()
else
updateicon()
/obj/machinery/power/rad_collector/proc/receive_pulse(var/pulse_strength)
if(P && active)
var/power_produced = 0
power_produced = P.air_contents.toxins*pulse_strength*20
add_avail(power_produced)
last_power = power_produced
return
return
/obj/machinery/power/rad_collector/proc/updateicon()
overlays = null
if(P)
overlays += image('icons/obj/singularity.dmi', "ptank")
if(stat & (NOPOWER|BROKEN))
return
if(active)
overlays += image('icons/obj/singularity.dmi', "on")
/obj/machinery/power/rad_collector/proc/toggle_power()
active = !active
if(active)
icon_state = "ca_on"
flick("ca_active", src)
else
icon_state = "ca"
flick("ca_deactive", src)
updateicon()
return