mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-18 20:59:56 +01:00
cbc4151bfb
* Part 1 * WIP * The rest of these * More stuff * Whoops, did that wrong * typo * gweeen * This all works * SHOWER * Rads * awa * rad * Update life.dm * edits * Makes lvl 3 rads give you a warning. You should already know by this point, but this makes it EXTRA clear you're getting fucked * Update vorestation.dme * aaa * propagate * gwah * more fixes * AAA * Update radiation.dm * Update radiation.dm * mobs rads * rads * fix this * Update _reagents.dm * these * Get rid of these * rad * Update config.txt * fixed * Update radiation_effects.dm
165 lines
4.7 KiB
Plaintext
165 lines
4.7 KiB
Plaintext
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
|
/obj/machinery/power/rad_collector
|
|
name = "Radiation Collector Array"
|
|
desc = "A device which uses Hawking Radiation and phoron to produce power."
|
|
icon = 'icons/obj/singularity.dmi'
|
|
icon_state = "ca"
|
|
anchored = FALSE
|
|
density = TRUE
|
|
req_access = list(ACCESS_ENGINE_EQUIP)
|
|
// use_power = 0
|
|
var/obj/item/tank/phoron/P = null
|
|
var/last_power = 0
|
|
var/last_power_new = 0
|
|
var/active = 0
|
|
var/locked = 0
|
|
var/drainratio = 1
|
|
rad_insulation = RAD_EXTREME_INSULATION //It sucks up the radiation. If you're standing behind it, you're pretty safe.
|
|
|
|
/obj/machinery/power/rad_collector/Initialize(mapload)
|
|
. = ..()
|
|
GLOB.rad_collectors += src
|
|
AddElement(/datum/element/climbable)
|
|
RegisterSignal(src, COMSIG_IN_RANGE_OF_IRRADIATION, PROC_REF(process_rads))
|
|
|
|
/obj/machinery/power/rad_collector/Destroy()
|
|
GLOB.rad_collectors -= src
|
|
UnregisterSignal(src, COMSIG_IN_RANGE_OF_IRRADIATION)
|
|
return ..()
|
|
|
|
/obj/machinery/power/rad_collector/proc/process_rads(datum/source, datum/radiation_pulse_information/pulse_information)
|
|
SIGNAL_HANDLER
|
|
//so that we don't zero out the meter if the SM is processed first.
|
|
last_power = last_power_new
|
|
last_power_new = 0
|
|
|
|
|
|
if(P && active)
|
|
if(pulse_information)
|
|
var/amount_of_rads = pulse_information.strength
|
|
receive_pulse((amount_of_rads))
|
|
|
|
if(P.air_contents.gas[GAS_PHORON] == 0)
|
|
investigate_log(span_red("out of fuel") + ".","singulo")
|
|
eject()
|
|
else
|
|
P.air_contents.adjust_gas(GAS_PHORON, -0.0001*drainratio)
|
|
return
|
|
|
|
|
|
/obj/machinery/power/rad_collector/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?span_green("on"): span_red("off")] by [user.key]. [P?"Fuel: [round(P.air_contents.gas[GAS_PHORON]/0.29)]%":span_red("It is empty")].","singulo")
|
|
return
|
|
else
|
|
to_chat(user, span_red("The controls are locked!"))
|
|
return
|
|
|
|
|
|
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/tank/phoron))
|
|
if(!src.anchored)
|
|
to_chat(user, span_red("The [src] needs to be secured to the floor first."))
|
|
return 1
|
|
if(src.P)
|
|
to_chat(user, span_red("There's already a phoron tank loaded."))
|
|
return 1
|
|
user.drop_item()
|
|
src.P = W
|
|
W.loc = src
|
|
update_icons()
|
|
return 1
|
|
else if(W.has_tool_quality(TOOL_CROWBAR))
|
|
if(P && !src.locked)
|
|
eject()
|
|
return 1
|
|
else if(W.has_tool_quality(TOOL_WRENCH))
|
|
if(P)
|
|
to_chat(user, span_blue("Remove the phoron tank first."))
|
|
return 1
|
|
playsound(src, W.usesound, 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()
|
|
return 1
|
|
else if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda))
|
|
if (src.allowed(user))
|
|
if(active)
|
|
src.locked = !src.locked
|
|
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
|
|
else
|
|
src.locked = 0 //just in case it somehow gets locked
|
|
to_chat(user, span_red("The controls can only be locked when the [src] is active."))
|
|
else
|
|
to_chat(user, span_red("Access denied!"))
|
|
return 1
|
|
return ..()
|
|
|
|
/obj/machinery/power/rad_collector/examine(mob/user)
|
|
. = ..()
|
|
if(get_dist(user, src) <= 3)
|
|
. += "The meter indicates that it is collecting [last_power] W."
|
|
|
|
/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/tank/phoron/Z = src.P
|
|
if (!Z)
|
|
return
|
|
Z.loc = get_turf(src)
|
|
Z.layer = initial(Z.layer)
|
|
src.P = null
|
|
if(active)
|
|
toggle_power()
|
|
else
|
|
update_icons()
|
|
|
|
// Continuing here, SM giving us ~170 rads per pulse, a phoron canister full of 30 mols, and * 20 we get:
|
|
// 102000W per collector...So 10 collectors will give us ~1MW.
|
|
/obj/machinery/power/rad_collector/proc/receive_pulse(var/pulse_strength)
|
|
if(P && active)
|
|
var/power_produced = 0
|
|
power_produced = P.air_contents.gas[GAS_PHORON]*pulse_strength*20
|
|
if(power_produced)
|
|
add_avail(power_produced)
|
|
last_power_new = power_produced
|
|
return
|
|
return
|
|
|
|
|
|
/obj/machinery/power/rad_collector/proc/update_icons()
|
|
cut_overlays()
|
|
if(P)
|
|
add_overlay("ptank")
|
|
if(stat & (NOPOWER|BROKEN))
|
|
return
|
|
if(active)
|
|
add_overlay("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)
|
|
update_icons()
|
|
return
|