mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
161 lines
4.5 KiB
Plaintext
161 lines
4.5 KiB
Plaintext
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:33
|
|
var/global/list/rad_collectors = list()
|
|
|
|
/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 = 0
|
|
density = 1
|
|
req_access = list(access_engine_equip)
|
|
// use_power = 0
|
|
var/obj/item/weapon/tank/phoron/P = null
|
|
var/last_power = 0
|
|
var/last_power_new = 0
|
|
var/active = 0
|
|
var/locked = 0
|
|
var/drainratio = 1
|
|
|
|
/obj/machinery/power/rad_collector/New()
|
|
..()
|
|
rad_collectors += src
|
|
|
|
/obj/machinery/power/rad_collector/Destroy()
|
|
rad_collectors -= src
|
|
return ..()
|
|
|
|
/obj/machinery/power/rad_collector/process()
|
|
//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)
|
|
var/rads = radiation_repository.get_rads_at_turf(get_turf(src))
|
|
if(rads)
|
|
receive_pulse(rads * 5) //Maths is hard
|
|
|
|
if(P)
|
|
if(P.air_contents.gas["phoron"] == 0)
|
|
investigate_log("<font color='red'>out of fuel</font>.","singulo")
|
|
eject()
|
|
else
|
|
P.air_contents.adjust_gas("phoron", -0.001*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?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [user.key]. [P?"Fuel: [round(P.air_contents.gas["phoron"]/0.29)]%":"<font color='red'>It is empty</font>"].","singulo")
|
|
return
|
|
else
|
|
to_chat(user, "<font color='red'>The controls are locked!</font>")
|
|
return
|
|
|
|
|
|
/obj/machinery/power/rad_collector/attackby(obj/item/W, mob/user)
|
|
if(istype(W, /obj/item/weapon/tank/phoron))
|
|
if(!src.anchored)
|
|
to_chat(user, "<font color='red'>The [src] needs to be secured to the floor first.</font>")
|
|
return 1
|
|
if(src.P)
|
|
to_chat(user, "<font color='red'>There's already a phoron tank loaded.</font>")
|
|
return 1
|
|
user.drop_item()
|
|
src.P = W
|
|
W.loc = src
|
|
update_icons()
|
|
return 1
|
|
else if(W.is_crowbar())
|
|
if(P && !src.locked)
|
|
eject()
|
|
return 1
|
|
else if(W.is_wrench())
|
|
if(P)
|
|
to_chat(user, "<font color='blue'>Remove the phoron tank first.</font>")
|
|
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/weapon/card/id)||istype(W, /obj/item/device/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, "<font color='red'>The controls can only be locked when the [src] is active.</font>")
|
|
else
|
|
to_chat(user, "<font color='red'>Access denied!</font>")
|
|
return 1
|
|
return ..()
|
|
|
|
/obj/machinery/power/rad_collector/examine(mob/user)
|
|
if (..(user, 3))
|
|
to_chat(user, "The meter indicates that \the [src] is collecting [last_power] W.")
|
|
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/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()
|
|
|
|
/obj/machinery/power/rad_collector/proc/receive_pulse(var/pulse_strength)
|
|
if(P && active)
|
|
var/power_produced = 0
|
|
power_produced = P.air_contents.gas["phoron"]*pulse_strength*20
|
|
add_avail(power_produced)
|
|
last_power_new = power_produced
|
|
return
|
|
return
|
|
|
|
|
|
/obj/machinery/power/rad_collector/proc/update_icons()
|
|
overlays.Cut()
|
|
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)
|
|
update_icons()
|
|
return
|
|
|