TGUI Engineering: Squashed Edition (Commits Below)

TGUI APCs

 TGUI vending machines

 Fix AI default_tgui_interaction

 TGUI Airlocks

 Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes

 TGUI Air Alarms & Central Atmospheric Control

 Airlock TGUI

 TG... got rid of UI for fire alarm. í´·

 TGUI Gas Heating/Cooling System

 TGUI Gas Pump & Passive Gate + Fixes

 TGUI Omni Atmospherics

 TGUI Pipe Dispensers & RPD

 TGUI IntelliCore & Vending Fix

 TGUI Handheld Tanks

 TGUI Portable Pump & Scrubber

 TGUI Tank Dispenser & Canisters

 TGUI Radios

 TGUI SMES & Air Alarm adjustment

 Tweak vending machine interfaces a tad

 TGUI Algae Farm

 TGUI general_air_control

 - Distro & Waste Console
 - Riot Control Console
 - Atmos Intake Console
 - Engine Cooling Console

 TGUI Heavy Scrubber Control (and body scanner fix)

 TGUI trinary devices & shutoff monitor

 TGUI Telecomms Log Browser

 TGUI Telecomms Machine Browser

 TGUI Spaceheater Internal Panel

 TGUI Gravity Generator

 TGUI Id Cards & Fix ID Card Images

 TGUI Id Card Redesign

 TGUI Turbolift

 TGUI Suit Cycler & Suit Storage Unit & Vending Fixes

 TGUI Power Monitor

 TGUI Signalers

 TGUI Employment Records

 TGUI Drone Console

 TGUI RIGSuits

 TGUI PA & PACMAN, and Margin Fix

 TGUI Solar Panels & Fix Power Monitor

 Adjust TGUI modules & their interaction with NTOS

 TGUI RCON

 TGUI Message Monitor

 Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002)

 TGUI Exonet & NTNet Relay

 TGUI Telecomms Multitool Menu

 TGUI Shield Capacitor & Shield Generator

 TGUI Supermatter-everything & Refactors
This commit is contained in:
ShadowLarkens
2020-08-09 04:46:31 -07:00
parent f1a95c31f8
commit 951f37d2e3
222 changed files with 13749 additions and 9249 deletions
+214 -234
View File
@@ -27,9 +27,19 @@ GLOBAL_LIST_EMPTY(apcs)
#define APC_UPOVERLAY_LOCKED 4096
#define APC_UPOVERLAY_OPERATING 8192
#define APC_UPDATE_ICON_COOLDOWN 100 // 10 seconds
// main_status var
#define APC_EXTERNAL_POWER_NOTCONNECTED 0
#define APC_EXTERNAL_POWER_NOENERGY 1
#define APC_EXTERNAL_POWER_GOOD 2
// has_electronics var
#define APC_HAS_ELECTRONICS_NONE 0
#define APC_HAS_ELECTRONICS_WIRED 1
#define APC_HAS_ELECTRONICS_SECURED 2
// the Area Power Controller (APC), formerly Power Distribution Unit (PDU)
// one per area, needs wire conection to power network through a terminal
@@ -101,13 +111,13 @@ GLOBAL_LIST_EMPTY(apcs)
var/lastused_environ = 0
var/lastused_charging = 0
var/lastused_total = 0
var/main_status = 0
var/main_status = APC_EXTERNAL_POWER_NOTCONNECTED
var/mob/living/silicon/ai/hacker = null // Malfunction var. If set AI hacked the APC and has full control.
var/wiresexposed = 0
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
var/debug= 0
var/autoflag= 0 // 0 = off, 1= eqp and lights off, 2 = eqp off, 3 = all on.
var/has_electronics = 0 // 0 - none, 1 - plugged in, 2 - secured by screwdriver
var/has_electronics = APC_HAS_ELECTRONICS_NONE // 0 - none, 1 - plugged in, 2 - secured by screwdriver
var/beenhit = 0 // used for counting how many times it has been hit, used for Aliens at the moment
var/longtermpower = 10
var/datum/wires/apc/wires = null
@@ -131,7 +141,7 @@ GLOBAL_LIST_EMPTY(apcs)
var/last_nightshift_switch = 0
/obj/machinery/power/apc/updateDialog()
if (stat & (BROKEN|MAINT))
if(stat & (BROKEN|MAINT))
return
..()
@@ -175,12 +185,12 @@ GLOBAL_LIST_EMPTY(apcs)
// offset 24 pixels in direction of dir
// this allows the APC to be embedded in a wall, yet still inside an area
if (building)
if(building)
set_dir(ndir)
pixel_x = (src.dir & 3)? 0 : (src.dir == 4 ? 26 : -26) //VOREStation Edit -> 24 to 26
pixel_y = (src.dir & 3)? (src.dir ==1 ? 26 : -26) : 0 //VOREStation Edit -> 24 to 26
if (building==0)
pixel_x = (dir & 3)? 0 : (dir == 4 ? 26 : -26) //VOREStation Edit -> 24 to 26
pixel_y = (dir & 3)? (dir ==1 ? 26 : -26) : 0 //VOREStation Edit -> 24 to 26
if(building==0)
init()
else
area = get_area(src)
@@ -189,11 +199,11 @@ GLOBAL_LIST_EMPTY(apcs)
operating = 0
name = "[area.name] APC"
stat |= MAINT
src.update_icon()
update_icon()
/obj/machinery/power/apc/Destroy()
GLOB.apcs -= src
src.update()
update()
area.apc = null
area.power_light = 0
area.power_equip = 0
@@ -216,11 +226,11 @@ GLOBAL_LIST_EMPTY(apcs)
// APCs are pixel-shifted, so they need to be updated.
/obj/machinery/power/apc/set_dir(new_dir)
..()
pixel_x = (src.dir & 3)? 0 : (src.dir == 4 ? 24 : -24)
pixel_y = (src.dir & 3)? (src.dir ==1 ? 24 : -24) : 0
pixel_x = (dir & 3)? 0 : (dir == 4 ? 24 : -24)
pixel_y = (dir & 3)? (dir ==1 ? 24 : -24) : 0
if(terminal)
terminal.disconnect_from_network()
terminal.set_dir(src.dir) // Terminal has same dir as master
terminal.set_dir(dir) // Terminal has same dir as master
terminal.connect_to_network() // Refresh the network the terminal is connected to.
return
@@ -230,25 +240,25 @@ GLOBAL_LIST_EMPTY(apcs)
/obj/machinery/power/apc/proc/make_terminal()
// create a terminal object at the same position as original turf loc
// wires will attach to this
terminal = new/obj/machinery/power/terminal(src.loc)
terminal = new/obj/machinery/power/terminal(loc)
terminal.set_dir(dir)
terminal.master = src
/obj/machinery/power/apc/proc/init()
has_electronics = 2 //installed and secured
has_electronics = APC_HAS_ELECTRONICS_SECURED //installed and secured
// is starting with a power cell installed, create it and set its charge level
if(cell_type)
src.cell = new cell_type(src)
cell = new cell_type(src)
cell.charge = start_charge * cell.maxcharge / 100.0 // (convert percentage to actual value)
var/area/A = src.loc.loc
var/area/A = loc.loc
//if area isn't specified use current
if(isarea(A) && src.areastring == null)
src.area = A
if(isarea(A) && !areastring)
area = A
name = "\improper [area.name] APC"
else
src.area = get_area_name(areastring)
area = get_area_name(areastring)
name = "\improper [area.name] APC"
area.apc = src
@@ -260,7 +270,7 @@ GLOBAL_LIST_EMPTY(apcs)
make_terminal()
spawn(5)
src.update()
update()
/obj/machinery/power/apc/examine(mob/user)
. = ..()
@@ -271,17 +281,17 @@ GLOBAL_LIST_EMPTY(apcs)
else if(opened)
if(has_electronics && terminal)
. += "The cover is [opened == 2 ? "removed" : "open"] and [ cell ? "a power cell is installed" : "the power cell is missing"]."
else if (!has_electronics && terminal)
else if(!has_electronics && terminal)
. += "The frame is wired, but the electronics are missing."
else if (has_electronics && !terminal)
else if(has_electronics && !terminal)
. += "The electronics are installed, but not wired."
else /* if (!has_electronics && !terminal) */
else /* if(!has_electronics && !terminal) */
. += "It's just an empty metal frame."
else
if (wiresexposed)
if(wiresexposed)
. += "The cover is closed and the wires are exposed."
else if ((locked && emagged) || hacker) //Some things can cause locked && emagged. Malf AI causes hacker.
else if((locked && emagged) || hacker) //Some things can cause locked && emagged. Malf AI causes hacker.
. += "The cover is closed, but the panel is unresponsive."
else if(!locked && emagged) //Normal emag does this.
. += "The cover is closed, but the panel is flashing an error."
@@ -292,7 +302,7 @@ GLOBAL_LIST_EMPTY(apcs)
// update the APC icon to show the three base states
// also add overlays for indicator lights
/obj/machinery/power/apc/update_icon()
if (!status_overlays)
if(!status_overlays)
status_overlays = 1
status_overlays_lock = new
status_overlays_charging = new
@@ -424,7 +434,7 @@ GLOBAL_LIST_EMPTY(apcs)
else if(charging == 2)
update_overlay |= APC_UPOVERLAY_CHARGEING2
if (!equipment)
if(!equipment)
update_overlay |= APC_UPOVERLAY_EQUIPMENT0
else if(equipment == 1)
update_overlay |= APC_UPOVERLAY_EQUIPMENT1
@@ -468,35 +478,34 @@ GLOBAL_LIST_EMPTY(apcs)
//attack with an item - open/close cover, insert cell, or (un)lock interface
/obj/machinery/power/apc/attackby(obj/item/W, mob/user)
if (istype(user, /mob/living/silicon) && get_dist(src,user)>1)
return src.attack_hand(user)
src.add_fingerprint(user)
if (W.is_crowbar() && opened)
if (has_electronics==1)
if (terminal)
if(issilicon(user) && get_dist(src,user) > 1)
return attack_hand(user)
add_fingerprint(user)
if(W.is_crowbar() && opened)
if(has_electronics == APC_HAS_ELECTRONICS_WIRED)
if(terminal)
to_chat(user, "<span class='warning'>Disconnect the wires first.</span>")
return
playsound(src, W.usesound, 50, 1)
to_chat(user, "You begin to remove the power control board...") //lpeters - fixed grammar issues //Ner - grrrrrr
if(do_after(user, 50 * W.toolspeed))
if (has_electronics==1)
has_electronics = 0
if ((stat & BROKEN))
if(has_electronics == APC_HAS_ELECTRONICS_WIRED)
has_electronics = APC_HAS_ELECTRONICS_NONE
if((stat & BROKEN))
user.visible_message(\
"<span class='warning'>[user.name] has broken the charred power control board inside [src.name]!</span>",\
"<span class='warning'>[user.name] has broken the charred power control board inside [name]!</span>",\
"<span class='notice'>You broke the charred power control board and remove the remains.</span>",
"You hear a crack!")
//ticker.mode:apcs-- //XSI said no and I agreed. -rastaf0
else
user.visible_message(\
"<span class='warning'>[user.name] has removed the power control board from [src.name]!</span>",\
"<span class='warning'>[user.name] has removed the power control board from [name]!</span>",\
"<span class='notice'>You remove the power control board.</span>")
new /obj/item/weapon/module/power_control(loc)
else if (opened!=2) //cover isn't removed
else if(opened != 2) //cover isn't removed
opened = 0
update_icon()
else if (W.is_crowbar() && !(stat & BROKEN) )
else if(W.is_crowbar() && !(stat & BROKEN) )
if(coverlocked && !(stat & MAINT))
to_chat(user, "<span class='warning'>The cover is locked and cannot be opened.</span>")
return
@@ -505,9 +514,9 @@ GLOBAL_LIST_EMPTY(apcs)
update_icon()
else if (istype(W, /obj/item/weapon/cell) && opened) // trying to put a cell inside
if(cell)
to_chat(user, "The [src.name] already has a power cell installed.")
to_chat(user, "The [name] already has a power cell installed.")
return
if (stat & MAINT)
if(stat & MAINT)
to_chat(user, "<span class='warning'>You need to install the wiring and electronics first.</span>")
return
if(W.w_class != ITEMSIZE_NORMAL)
@@ -518,27 +527,27 @@ GLOBAL_LIST_EMPTY(apcs)
W.forceMove(src)
cell = W
user.visible_message(\
"<span class='warning'>[user.name] has inserted a power cell into [src.name]!</span>",\
"<span class='warning'>[user.name] has inserted a power cell into [name]!</span>",\
"<span class='notice'>You insert the power cell.</span>")
chargecount = 0
update_icon()
else if (W.is_screwdriver()) // haxing
if(opened)
if (cell)
if(cell)
to_chat(user, "<span class='warning'>Remove the power cell first.</span>")
return
else
if (has_electronics==1 && terminal)
has_electronics = 2
if(has_electronics == APC_HAS_ELECTRONICS_WIRED && terminal)
has_electronics = APC_HAS_ELECTRONICS_SECURED
stat &= ~MAINT
playsound(src, W.usesound, 50, 1)
to_chat(user, "You screw the circuit electronics into place.")
else if (has_electronics==2)
has_electronics = 1
else if(has_electronics == APC_HAS_ELECTRONICS_SECURED)
has_electronics = APC_HAS_ELECTRONICS_WIRED
stat |= MAINT
playsound(src, W.usesound, 50, 1)
to_chat(user, "You unfasten the electronics.")
else /* has_electronics==0 */
else /* has_electronics == APC_HAS_ELECTRONICS_NONE */
to_chat(user, "<span class='warning'>There is nothing to secure.</span>")
return
update_icon()
@@ -548,10 +557,10 @@ GLOBAL_LIST_EMPTY(apcs)
playsound(src, W.usesound, 50, 1)
update_icon()
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
togglelock()
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
togglelock(user)
else if (istype(W, /obj/item/stack/cable_coil) && !terminal && opened && has_electronics!=2)
else if(istype(W, /obj/item/stack/cable_coil) && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
var/turf/T = loc
if(istype(T) && !T.is_plating())
to_chat(user, "<span class='warning'>You must remove the floor plating in front of the APC first.</span>")
@@ -564,9 +573,9 @@ GLOBAL_LIST_EMPTY(apcs)
"You start adding cables to the APC frame...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 20))
if (C.amount >= 10 && !terminal && opened && has_electronics != 2)
if(C.amount >= 10 && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
var/obj/structure/cable/N = T.get_cable_node()
if (prob(50) && electrocute_mob(usr, N, N))
if(prob(50) && electrocute_mob(usr, N, N))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
@@ -578,7 +587,7 @@ GLOBAL_LIST_EMPTY(apcs)
"You add cables to the APC frame.")
make_terminal()
terminal.connect_to_network()
else if (W.is_wirecutter() && terminal && opened && has_electronics!=2)
else if(W.is_wirecutter() && terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
var/turf/T = loc
if(istype(T) && !T.is_plating())
to_chat(user, "<span class='warning'>You must remove the floor plating in front of the APC first.</span>")
@@ -587,8 +596,8 @@ GLOBAL_LIST_EMPTY(apcs)
"You begin to cut the cables...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 50 * W.toolspeed))
if(terminal && opened && has_electronics!=2)
if (prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
if(terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
if(prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(5, 1, src)
s.start()
@@ -597,22 +606,22 @@ GLOBAL_LIST_EMPTY(apcs)
new /obj/item/stack/cable_coil(loc,10)
to_chat(user, "<span class='notice'>You cut the cables and dismantle the power terminal.</span>")
qdel(terminal)
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && !((stat & BROKEN)))
else if(istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics == APC_HAS_ELECTRONICS_NONE && !((stat & BROKEN)))
user.visible_message("<span class='warning'>[user.name] inserts the power control board into [src].</span>", \
"You start to insert the power control board into the frame...")
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
if(do_after(user, 10))
if(has_electronics==0)
has_electronics = 1
if(has_electronics == APC_HAS_ELECTRONICS_NONE)
has_electronics = APC_HAS_ELECTRONICS_WIRED
reboot()
to_chat(user, "<span class='notice'>You place the power control board inside the frame.</span>")
qdel(W)
else if (istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics==0 && ((stat & BROKEN)))
else if(istype(W, /obj/item/weapon/module/power_control) && opened && has_electronics == APC_HAS_ELECTRONICS_NONE && ((stat & BROKEN)))
to_chat(user, "<span class='warning'>The [src] is too broken for that. Repair it first.</span>")
return
else if (istype(W, /obj/item/weapon/weldingtool) && opened && has_electronics==0 && !terminal)
else if(istype(W, /obj/item/weapon/weldingtool) && opened && has_electronics == APC_HAS_ELECTRONICS_NONE && !terminal)
var/obj/item/weapon/weldingtool/WT = W
if (WT.get_fuel() < 3)
if(WT.get_fuel() < 3)
to_chat(user, "<span class='warning'>You need more welding fuel to complete this task.</span>")
return
user.visible_message("<span class='warning'>[user.name] begins cutting apart [src] with the [WT.name].</span>", \
@@ -621,7 +630,7 @@ GLOBAL_LIST_EMPTY(apcs)
playsound(src, WT.usesound, 25, 1)
if(do_after(user, 50 * WT.toolspeed))
if(!src || !WT.remove_fuel(3, user)) return
if (emagged || (stat & BROKEN) || opened==2)
if(emagged || (stat & BROKEN) || opened==2)
new /obj/item/stack/material/steel(loc)
user.visible_message(\
"<span class='warning'>[src] has been cut apart by [user.name] with the [WT.name].</span>",\
@@ -635,8 +644,8 @@ GLOBAL_LIST_EMPTY(apcs)
"You hear welding.")
qdel(src)
return
else if (opened && ((stat & BROKEN) || hacker || emagged))
if (istype(W, /obj/item/frame/apc) && (stat & BROKEN))
else if(opened && ((stat & BROKEN) || hacker || emagged))
if(istype(W, /obj/item/frame/apc) && (stat & BROKEN))
if(cell)
to_chat(user, "<span class='warning'>You need to remove the power cell first.</span>")
return
@@ -648,10 +657,10 @@ GLOBAL_LIST_EMPTY(apcs)
qdel(W)
stat &= ~BROKEN
reboot()
if (opened==2)
if(opened==2)
opened = 1
update_icon()
else if (istype(W, /obj/item/device/multitool) && (hacker || emagged))
else if(istype(W, /obj/item/device/multitool) && (hacker || emagged))
if(cell)
to_chat(user, "<span class='warning'>You need to remove the power cell first.</span>")
return
@@ -663,12 +672,12 @@ GLOBAL_LIST_EMPTY(apcs)
playsound(src, 'sound/machines/chime.ogg', 25, 1)
reboot()
else
if ((stat & BROKEN) \
if((stat & BROKEN) \
&& !opened \
&& W.force >= 5 \
&& W.w_class >= ITEMSIZE_SMALL )
user.visible_message("<span class='danger'>The [src.name] has been hit with the [W.name] by [user.name]!</span>", \
"<span class='danger'>You hit the [src.name] with your [W.name]!</span>", \
user.visible_message("<span class='danger'>The [name] has been hit with the [W.name] by [user.name]!</span>", \
"<span class='danger'>You hit the [name] with your [W.name]!</span>", \
"You hear a bang!")
if(prob(20))
opened = 2
@@ -677,12 +686,12 @@ GLOBAL_LIST_EMPTY(apcs)
"You hear a bang!")
update_icon()
else
if (istype(user, /mob/living/silicon))
return src.attack_hand(user)
if (!opened && wiresexposed && (istype(W, /obj/item/device/multitool) || W.is_wirecutter() || istype(W, /obj/item/device/assembly/signaler)))
return src.attack_hand(user)
if(istype(user, /mob/living/silicon))
return attack_hand(user)
if(!opened && wiresexposed && (istype(W, /obj/item/device/multitool) || W.is_wirecutter() || istype(W, /obj/item/device/assembly/signaler)))
return attack_hand(user)
//Placeholder until someone can do take_damage() for APCs or something.
to_chat(user, "<span class='notice'>The [src.name] looks too sturdy to bash open with \the [W.name].</span>")
to_chat(user, "<span class='notice'>The [name] looks too sturdy to bash open with \the [W.name].</span>")
// attack with hand - remove cell (if cover open) or interact with the APC
@@ -698,7 +707,7 @@ GLOBAL_LIST_EMPTY(apcs)
else if(hacker)
to_chat(user, "<span class='warning'>Access denied.</span>")
else
if(src.allowed(usr) && !wires.is_cut(WIRE_IDSCAN))
if(allowed(user) && !wires.is_cut(WIRE_IDSCAN))
locked = !locked
to_chat(user, "You [ locked ? "lock" : "unlock"] the APC interface.")
update_icon()
@@ -707,10 +716,10 @@ GLOBAL_LIST_EMPTY(apcs)
/obj/machinery/power/apc/AltClick(mob/user)
..()
togglelock()
togglelock(user)
/obj/machinery/power/apc/emag_act(var/remaining_charges, var/mob/user)
if (!(emagged || hacker)) // trying to unlock with an emag card
if(!(emagged || hacker)) // trying to unlock with an emag card
if(opened)
to_chat(user, "You must close the cover to do that.")
else if(wiresexposed)
@@ -719,7 +728,7 @@ GLOBAL_LIST_EMPTY(apcs)
to_chat(user, "The [src] isn't working.")
else
flick("apc-spark", src)
if (do_after(user,6))
if(do_after(user,6))
emagged = 1
locked = 0
to_chat(user, "<span class='notice'>You emag the APC interface.</span>")
@@ -733,11 +742,9 @@ GLOBAL_LIST_EMPTY(apcs)
update_icon()
/obj/machinery/power/apc/attack_hand(mob/user)
// if (!can_use(user)) This already gets called in interact() and in topic()
// return
if(!user)
return
src.add_fingerprint(user)
add_fingerprint(user)
//Human mob special interaction goes here.
if(istype(user,/mob/living/carbon/human))
@@ -745,20 +752,20 @@ GLOBAL_LIST_EMPTY(apcs)
if(H.species.can_shred(H))
user.setClickCooldown(user.get_attack_speed())
user.visible_message("<span call='warning'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>")
user.visible_message("<span call='warning'>[user.name] slashes at the [name]!</span>", "<span class='notice'>You slash at the [name]!</span>")
playsound(src, 'sound/weapons/slash.ogg', 100, 1)
var/allcut = wires.is_all_cut()
if(beenhit >= pick(3, 4) && wiresexposed != 1)
wiresexposed = 1
src.update_icon()
src.visible_message("<span call='warning'>The [src.name]'s cover flies open, exposing the wires!</span>")
update_icon()
visible_message("<span call='warning'>The [name]'s cover flies open, exposing the wires!</span>")
else if(wiresexposed == 1 && allcut == 0)
wires.cut_all()
src.update_icon()
src.visible_message("<span call='warning'>The [src.name]'s wires are shredded!</span>")
update_icon()
visible_message("<span call='warning'>The [name]'s wires are shredded!</span>")
else
beenhit += 1
return
@@ -769,16 +776,21 @@ GLOBAL_LIST_EMPTY(apcs)
cell.add_fingerprint(user)
cell.update_icon()
src.cell = null
user.visible_message("<span class='warning'>[user.name] removes the power cell from [src.name]!</span>",\
cell = null
user.visible_message("<span class='warning'>[user.name] removes the power cell from [name]!</span>",\
"<span class='notice'>You remove the power cell.</span>")
charging = 0
src.update_icon()
update_icon()
return
if(stat & (BROKEN|MAINT))
return
// do APC interaction
src.interact(user)
interact(user)
/obj/machinery/power/apc/attack_ghost(mob/user)
if(panel_open)
return wires.Interact(user)
return tgui_interact(user)
/obj/machinery/power/apc/interact(mob/user)
if(!user)
@@ -788,15 +800,18 @@ GLOBAL_LIST_EMPTY(apcs)
wires.Interact(user)
return //The panel is visibly dark when the wires are exposed, so we shouldn't be able to interact with it.
return ui_interact(user)
return tgui_interact(user)
/obj/machinery/power/apc/tgui_interact(mob/user, datum/tgui/ui = null)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "APC", name) // 510, 460
ui.open()
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(!user)
return
/obj/machinery/power/apc/tgui_data(mob/user)
var/list/data = list(
"locked" = locked,
"normallyLocked" = locked,
"emagged" = emagged,
"isOperating" = operating,
"externalPower" = main_status,
@@ -808,7 +823,7 @@ GLOBAL_LIST_EMPTY(apcs)
"failTime" = failure_timer * 2,
"gridCheck" = grid_check,
"coverLocked" = coverlocked,
"siliconUser" = issilicon(user) || isobserver(user), //I add observer here so admins can have more control, even if it makes 'siliconUser' seem inaccurate.
"siliconUser" = issilicon(user) || (isobserver(user) && is_admin(user)), //I add observer here so admins can have more control, even if it makes 'siliconUser' seem inaccurate.
"emergencyLights" = !emergency_lights,
"nightshiftLights" = nightshift_lights,
"nightshiftSetting" = nightshift_setting,
@@ -847,18 +862,7 @@ GLOBAL_LIST_EMPTY(apcs)
)
)
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 520, data["siliconUser"] ? 490 : 465)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
return data
/obj/machinery/power/apc/proc/report()
return "[area.name] : [equipment]/[lighting]/[environ] ([lastused_equip+lastused_light+lastused_environ]) : [cell? cell.percent() : "N/C"] ([charging])"
@@ -868,23 +872,23 @@ GLOBAL_LIST_EMPTY(apcs)
area.power_light = (lighting >= POWERCHAN_ON)
area.power_equip = (equipment >= POWERCHAN_ON)
area.power_environ = (environ >= POWERCHAN_ON)
// if (area.name == "AI Chamber")
// if(area.name == "AI Chamber")
// spawn(10)
// to_world(" [area.name] [area.power_equip]")
else
area.power_light = 0
area.power_equip = 0
area.power_environ = 0
// if (area.name == "AI Chamber")
// if(area.name == "AI Chamber")
// to_world("[area.power_equip]")
area.power_change()
/obj/machinery/power/apc/proc/can_use(mob/user as mob, var/loud = 0) //used by attack_hand() and Topic()
if(!user.client)
return 0
if(isobserver(user) && is_admin(user) ) //This is to allow nanoUI interaction by ghost admins.
if(isobserver(user) && is_admin(user)) //This is to allow nanoUI interaction by ghost admins.
return 1
if (user.stat)
if(user.stat)
return 0
if(inoperable())
return 0
@@ -897,7 +901,7 @@ GLOBAL_LIST_EMPTY(apcs)
to_chat(user, "<span class='warning'>You must stand to use [src]!</span>")
return 0
autoflag = 5
if (istype(user, /mob/living/silicon))
if(istype(user, /mob/living/silicon))
var/permit = 0 // Malfunction variable. If AI hacks APC it can control it even without AI control wire.
var/mob/living/silicon/ai/AI = user
var/mob/living/silicon/robot/robot = user
@@ -912,122 +916,90 @@ GLOBAL_LIST_EMPTY(apcs)
to_chat(user, "<span class='danger'>\The AI control for [src] has been disabled!</span>")
return 0
else
if (!in_range(src, user) || !istype(src.loc, /turf))
if(!in_range(src, user) || !istype(loc, /turf))
return 0
var/mob/living/carbon/human/H = user
if (istype(H) && prob(H.getBrainLoss()))
if(istype(H) && prob(H.getBrainLoss()))
to_chat(user, "<span class='danger'>You momentarily forget how to use [src].</span>")
return 0
return 1
/obj/machinery/power/apc/Topic(href, href_list)
if(..())
return 1
/obj/machinery/power/apc/tgui_act(action, params)
if(..() || !can_use(usr, TRUE))
return TRUE
if(!can_use(usr, 1))
return 1
// There's a handful of cases where we want to allow users to bypass the `locked` variable.
// If can_admin_interact() wasn't only defined on observers, this could just be part of a single-line
// conditional.
var/locked_exception = FALSE
if(issilicon(usr) || action == "nightshift")
locked_exception = TRUE
if(isobserver(usr))
var/mob/observer/dead/D = usr
if(D.can_admin_interact())
locked_exception = TRUE
if(href_list["nightshift"])
if(last_nightshift_switch > world.time - 10 SECONDS) // don't spam...
to_chat(usr, "<span class='warning'>[src]'s night lighting circuit breaker is still cycling!</span>")
return 0
last_nightshift_switch = world.time
nightshift_setting = text2num(href_list["nightshift"])
update_nightshift()
return 1
if(locked && !locked_exception)
return
if(locked && !issilicon(usr) )
if(isobserver(usr) )
var/mob/observer/dead/O = usr //Added to allow admin nanoUI interactions.
if(!O.can_admin_interact() ) //NanoUI /should/ make this not needed, but better safe than sorry.
to_chat(usr, "Try as you might, your ghostly fingers can't press the buttons.")
return 1
else
to_chat(usr, "You must unlock the panel to use this!")
return 1
if (href_list["lock"])
coverlocked = !coverlocked
else if (href_list["reboot"])
failure_timer = 0
update_icon()
update()
else if (href_list["emergency_lighting"])
emergency_lights = !emergency_lights
for(var/obj/machinery/light/L in area)
if(!initial(L.no_emergency)) //If there was an override set on creation, keep that override
L.no_emergency = emergency_lights
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
CHECK_TICK
else if (href_list["breaker"])
toggle_breaker()
else if (href_list["cmode"])
chargemode = !chargemode
if(!chargemode)
charging = 0
. = TRUE
switch(action)
if("lock")
if(locked_exception) // Yay code reuse
if(emagged || (stat & (BROKEN|MAINT)))
to_chat(usr, "The APC does not respond to the command.")
return
locked = !locked
update_icon()
if("cover")
coverlocked = !coverlocked
if("breaker")
toggle_breaker()
if("nightshift")
if(last_nightshift_switch > world.time - 10 SECONDS) // don't spam...
to_chat(usr, "<span class='warning'>[src]'s night lighting circuit breaker is still cycling!</span>")
return 0
last_nightshift_switch = world.time
nightshift_setting = params["nightshift"]
update_nightshift()
if("charge")
chargemode = !chargemode
if(!chargemode)
charging = 0
update_icon()
if("channel")
if(params["eqp"])
equipment = setsubsystem(text2num(params["eqp"]))
update_icon()
update()
else if(params["lgt"])
lighting = setsubsystem(text2num(params["lgt"]))
update_icon()
update()
else if(params["env"])
environ = setsubsystem(text2num(params["env"]))
update_icon()
update()
if("reboot")
failure_timer = 0
update_icon()
else if (href_list["eqp"])
var/val = text2num(href_list["eqp"])
equipment = setsubsystem(val)
update_icon()
update()
else if (href_list["lgt"])
var/val = text2num(href_list["lgt"])
lighting = setsubsystem(val)
update_icon()
update()
else if (href_list["env"])
var/val = text2num(href_list["env"])
environ = setsubsystem(val)
update_icon()
update()
else if (href_list["overload"])
if(istype(usr, /mob/living/silicon))
src.overload_lighting()
else if (href_list["toggleaccess"])
if(istype(usr, /mob/living/silicon))
if(emagged || (stat & (BROKEN|MAINT)))
to_chat(usr, "The APC does not respond to the command.")
return
locked = !locked
update_icon()
return 0
update()
if("emergency_lighting")
emergency_lights = !emergency_lights
for(var/obj/machinery/light/L in area)
if(!initial(L.no_emergency)) //If there was an override set on creation, keep that override
L.no_emergency = emergency_lights
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
CHECK_TICK
if("overload")
if(locked_exception) // Reusing for simplicity!
overload_lighting()
/obj/machinery/power/apc/proc/toggle_breaker()
operating = !operating
src.update()
update()
update_icon()
//This isn't used for now, so might as well disable it
/*
/obj/machinery/power/apc/proc/ion_act()
if(prob(3))
src.locked = 1
if (src.cell.charge > 0)
src.cell.charge = 0
cell.corrupt()
update_icon()
var/datum/effect/effect/system/smoke_spread/smoke = new /datum/effect/effect/system/smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
visible_message("<span class='danger'>The [src.name] suddenly lets out a blast of smoke and some sparks!</span>", \
"<span class='danger'>You hear sizzling electronics.</span>")
*/
/obj/machinery/power/apc/surplus()
if(terminal)
return terminal.surplus()
@@ -1083,12 +1055,12 @@ GLOBAL_LIST_EMPTY(apcs)
var/excess = surplus()
if(!src.avail())
main_status = 0
if(!avail())
main_status = APC_EXTERNAL_POWER_NOTCONNECTED
else if(excess < 0)
main_status = 1
main_status = APC_EXTERNAL_POWER_NOENERGY
else
main_status = 2
main_status = APC_EXTERNAL_POWER_GOOD
if(debug)
log_debug("Status: [main_status] - Excess: [excess] - Last Equip: [lastused_equip] - Last Light: [lastused_light] - Longterm: [longtermpower]")
@@ -1122,7 +1094,7 @@ GLOBAL_LIST_EMPTY(apcs)
// now trickle-charge the cell
lastused_charging = 0 // Clear the variable for new use.
if(src.attempt_charging())
if(attempt_charging())
if(excess > 0) // check to make sure we have enough to charge
// Max charge is capped to % per second constant
var/ch = min(excess*CELLRATE, cell.maxcharge*chargelevel)
@@ -1170,7 +1142,7 @@ GLOBAL_LIST_EMPTY(apcs)
force_update = 0
queue_icon_update()
update()
else if (last_ch != charging)
else if(last_ch != charging)
queue_icon_update()
/obj/machinery/power/apc/proc/update_channels()
@@ -1212,7 +1184,7 @@ GLOBAL_LIST_EMPTY(apcs)
// val 0=off, 1=off(auto) 2=on 3=on(auto)
// on 0=off, 1=on, 2=autooff
// defines a state machine, returns the new state
obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
/obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
switch(cur_state)
//if(POWERCHAN_OFF); //autoset will never turn on a channel set to off
if(POWERCHAN_OFF_AUTO)
@@ -1253,24 +1225,24 @@ obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
switch(severity)
if(1)
//set_broken() //now qdel() do what we need
if (cell)
if(cell)
cell.ex_act(1) // more lags woohoo
qdel(src)
return
if(2)
if (prob(75))
if(prob(75))
set_broken()
if (cell && prob(50))
if(cell && prob(50))
cell.ex_act(2)
if(3)
if (prob(50))
if(prob(50))
set_broken()
if (cell && prob(50))
if(cell && prob(50))
cell.ex_act(3)
if(4)
if (prob(25))
if(prob(25))
set_broken()
if (cell && prob(50))
if(cell && prob(50))
cell.ex_act(3)
return
@@ -1282,7 +1254,7 @@ obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
/obj/machinery/power/apc/proc/set_broken()
// Aesthetically much better!
spawn(rand(2,5))
src.visible_message("<span class='warning'>[src]'s screen flickers suddenly, then explodes in a rain of sparks and small debris!</span>")
visible_message("<span class='warning'>[src]'s screen flickers suddenly, then explodes in a rain of sparks and small debris!</span>")
stat |= BROKEN
operating = 0
update_icon()
@@ -1314,7 +1286,7 @@ obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
/obj/machinery/power/apc/proc/ai_hack(var/mob/living/silicon/ai/A = null)
if(!A || !A.hacked_apcs || hacker || aidisabled || A.stat == DEAD)
return 0
src.hacker = A
hacker = A
A.hacked_apcs += src
locked = 1
update_icon()
@@ -1406,3 +1378,11 @@ obj/machinery/power/apc/proc/autoset(var/cur_state, var/on)
CHECK_TICK
#undef APC_UPDATE_ICON_COOLDOWN
#undef APC_EXTERNAL_POWER_NOTCONNECTED
#undef APC_EXTERNAL_POWER_NOENERGY
#undef APC_EXTERNAL_POWER_GOOD
#undef APC_HAS_ELECTRONICS_NONE
#undef APC_HAS_ELECTRONICS_WIRED
#undef APC_HAS_ELECTRONICS_SECURED
+1 -1
View File
@@ -25,7 +25,7 @@
for(var/obj/structure/cable/C in src.loc)
qdel(C)
. = ..()
for(var/datum/nano_module/rcon/R in world)
for(var/datum/tgui_module/rcon/R in world)
R.FindDevices()
/obj/machinery/power/breakerbox/Initialize()
+29 -39
View File
@@ -192,58 +192,48 @@ GLOBAL_LIST_EMPTY(all_turbines)
if(stat & (BROKEN|NOPOWER) || !anchored) return
if(!circ1 || !circ2) //Just incase the middle part of the TEG was not wrenched last.
reconnect()
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/generator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/power/generator/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "TEGenerator", name)
ui.open()
/obj/machinery/power/generator/tgui_data(mob/user)
// this is the data which will be sent to the ui
var/vertical = 0
if (dir == NORTH || dir == SOUTH)
vertical = 1
var/data[0]
data["totalOutput"] = effective_gen/1000
data["maxTotalOutput"] = max_power/1000
data["thermalOutput"] = last_thermal_gen/1000
data["circConnected"] = 0
var/list/data = list()
data["totalOutput"] = effective_gen
data["maxTotalOutput"] = max_power
data["thermalOutput"] = last_thermal_gen
data["primary"] = list()
if(circ1)
//The one on the left (or top)
data["primaryDir"] = vertical ? "top" : "left"
data["primaryOutput"] = last_circ1_gen/1000
data["primaryFlowCapacity"] = circ1.volume_capacity_used*100
data["primaryInletPressure"] = circ1.air1.return_pressure()
data["primaryInletTemperature"] = circ1.air1.temperature
data["primaryOutletPressure"] = circ1.air2.return_pressure()
data["primaryOutletTemperature"] = circ1.air2.temperature
data["primary"]["dir"] = vertical ? "top" : "left"
data["primary"]["output"] = last_circ1_gen
data["primary"]["flowCapacity"] = circ1.volume_capacity_used*100
data["primary"]["inletPressure"] = circ1.air1.return_pressure()
data["primary"]["inletTemperature"] = circ1.air1.temperature
data["primary"]["outletPressure"] = circ1.air2.return_pressure()
data["primary"]["outletTemperature"] = circ1.air2.temperature
data["secondary"] = list()
if(circ2)
//Now for the one on the right (or bottom)
data["secondaryDir"] = vertical ? "bottom" : "right"
data["secondaryOutput"] = last_circ2_gen/1000
data["secondaryFlowCapacity"] = circ2.volume_capacity_used*100
data["secondaryInletPressure"] = circ2.air1.return_pressure()
data["secondaryInletTemperature"] = circ2.air1.temperature
data["secondaryOutletPressure"] = circ2.air2.return_pressure()
data["secondaryOutletTemperature"] = circ2.air2.temperature
data["secondary"]["dir"] = vertical ? "bottom" : "right"
data["secondary"]["output"] = last_circ2_gen
data["secondary"]["flowCapacity"] = circ2.volume_capacity_used*100
data["secondary"]["inletPressure"] = circ2.air1.return_pressure()
data["secondary"]["inletTemperature"] = circ2.air1.temperature
data["secondary"]["outletPressure"] = circ2.air2.return_pressure()
data["secondary"]["outletTemperature"] = circ2.air2.temperature
if(circ1 && circ2)
data["circConnected"] = 1
else
data["circConnected"] = 0
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "generator.tmpl", "Thermoelectric Generator", 450, 500)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
return data
/obj/machinery/power/generator/power_change()
..()
+19 -18
View File
@@ -240,11 +240,16 @@ GLOBAL_LIST_EMPTY(gravity_generators)
/obj/machinery/gravity_generator/main/attack_hand(mob/user)
if((. = ..()))
return
if(CanUseTopic(user, global.default_state) > STATUS_CLOSE)
ui_interact(user)
return TRUE
tgui_interact(user)
return TRUE
/obj/machinery/gravity_generator/main/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/gravity_generator/main/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "GravityGenerator", name)
ui.open()
/obj/machinery/gravity_generator/main/tgui_data(mob/user)
var/data[0]
data["breaker"] = breaker
@@ -253,22 +258,18 @@ GLOBAL_LIST_EMPTY(gravity_generators)
data["on"] = on
data["operational"] = (stat & BROKEN) ? FALSE : TRUE
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "gravity_generator.tmpl", src.name, 500, 400)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
return data
/obj/machinery/gravity_generator/main/Topic(href, href_list, datum/topic_state/state = default_state)
if((. = ..()))
return
/obj/machinery/gravity_generator/main/tgui_act(action, params)
if((..()))
return TRUE
if(href_list["gentoggle"])
breaker = !breaker
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", "gravity")
set_power()
return TOPIC_REFRESH
switch(action)
if("gentoggle")
breaker = !breaker
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", "gravity")
set_power()
return TOPIC_REFRESH
// Power and Icon States
+65 -75
View File
@@ -7,6 +7,7 @@
density = 1
anchored = 0
use_power = USE_POWER_OFF
interact_offline = TRUE
var/active = 0
var/power_gen = 5000
@@ -28,13 +29,22 @@
/obj/machinery/power/port_gen/proc/handleInactive()
return
/obj/machinery/power/port_gen/proc/TogglePower()
if(active)
active = FALSE
icon_state = "[initial(icon_state)]"
// soundloop.stop()
else if(HasFuel())
active = TRUE
icon_state = "[initial(icon_state)]on"
// soundloop.start()
/obj/machinery/power/port_gen/process()
if(active && HasFuel() && !IsBroken() && anchored && powernet)
add_avail(power_gen * power_output)
UseFuel()
src.updateDialog()
else
active = 0
active = FALSE
icon_state = initial(icon_state)
handleInactive()
@@ -121,7 +131,7 @@
return ..()
/obj/machinery/power/port_gen/pacman/dismantle()
while ( sheets > 0 )
while( sheets > 0 )
DropFuel()
return ..()
@@ -212,16 +222,16 @@
/obj/machinery/power/port_gen/pacman/handleInactive()
var/cooling_temperature = 20
var/datum/gas_mixture/environment = loc.return_air()
if (environment)
if(environment)
var/ratio = min(environment.return_pressure()/ONE_ATMOSPHERE, 1)
var/ambient = environment.temperature - T20C
cooling_temperature += ambient*ratio
if (temperature > cooling_temperature)
if(temperature > cooling_temperature)
var/temp_loss = (temperature - cooling_temperature)/TEMPERATURE_DIVISOR
temp_loss = between(2, round(temp_loss, 1), TEMPERATURE_CHANGE_MAX)
temperature = max(temperature - temp_loss, cooling_temperature)
src.updateDialog()
updateDialog()
if(overheating)
overheating--
@@ -287,97 +297,77 @@
..()
if (!anchored)
return
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/port_gen/pacman/attack_ai(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/port_gen/pacman/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/power/port_gen/tgui_status(mob/user, datum/tgui_state/state)
if(IsBroken())
return
return STATUS_CLOSE
return ..()
/obj/machinery/power/port_gen/pacman/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "PortableGenerator", name)
ui.open()
/obj/machinery/power/port_gen/pacman/tgui_data(mob/user)
var/list/data = list()
var/data[0]
data["active"] = active
if(istype(user, /mob/living/silicon/ai))
data["is_ai"] = 1
data["is_ai"] = TRUE
else if(istype(user, /mob/living/silicon/robot) && !Adjacent(user))
data["is_ai"] = 1
data["is_ai"] = TRUE
else
data["is_ai"] = 0
data["output_set"] = power_output
data["output_max"] = max_power_output
data["output_safe"] = max_safe_output
data["output_watts"] = power_output * power_gen
data["temperature_current"] = src.temperature
data["temperature_max"] = src.max_temperature
data["temperature_overheat"] = overheating
// 1 sheet = 1000cm3?
data["is_ai"] = FALSE
data["sheet_name"] = capitalize(sheet_name)
data["fuel_stored"] = round((sheets * 1000) + (sheet_left * 1000))
data["fuel_capacity"] = round(max_sheets * 1000, 0.1)
data["fuel_usage"] = active ? round((power_output / time_per_sheet) * 1000) : 0
data["fuel_type"] = sheet_name
data["anchored"] = anchored
data["connected"] = (powernet == null ? 0 : 1)
data["ready_to_boot"] = anchored && HasFuel()
data["power_generated"] = DisplayPower(power_gen)
data["power_output"] = DisplayPower(power_gen * power_output)
data["unsafe_output"] = power_output > max_safe_output
data["power_available"] = (powernet == null ? 0 : DisplayPower(avail()))
data["temperature_current"] = temperature
data["temperature_max"] = max_temperature
data["temperature_overheat"] = overheating
// 1 sheet = 1000cm3?
return data
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "pacman.tmpl", src.name, 500, 560)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/*
/obj/machinery/power/port_gen/pacman/interact(mob/user)
if (get_dist(src, user) > 1 )
if (!istype(user, /mob/living/silicon/ai))
user.unset_machine()
user << browse(null, "window=port_gen"
return
user.set_machine(src)
var/dat = text("<b>[name]</b><br>")
if (active)
dat += text("Generator: <A href='?src=\ref[src];action=disable'>On</A><br>")
else
dat += text("Generator: <A href='?src=\ref[src];action=enable'>Off</A><br>")
dat += text("[capitalize(sheet_name)]: [sheets] - <A href='?src=\ref[src];action=eject'>Eject</A><br>")
var/stack_percent = round(sheet_left * 100, 1)
dat += text("Current stack: [stack_percent]% <br>")
dat += text("Power output: <A href='?src=\ref[src];action=lower_power'>-</A> [power_gen * power_output] Watts<A href='?src=\ref[src];action=higher_power'>+</A><br>")
dat += text("Power current: [(powernet == null ? "Unconnected" : "[avail()]")]<br>")
var/tempstr = "Temperature: [temperature]&deg;C<br>"
dat += (overheating)? "<span class='danger'>[tempstr]</span>" : tempstr
dat += "<br><A href='?src=\ref[src];action=close'>Close</A>"
user << browse("[dat]", "window=port_gen")
onclose(user, "port_gen")
*/
/obj/machinery/power/port_gen/pacman/Topic(href, href_list)
/obj/machinery/power/port_gen/pacman/tgui_act(action, params)
if(..())
return
src.add_fingerprint(usr)
if(href_list["action"])
if(href_list["action"] == "enable")
if(!active && HasFuel() && !IsBroken())
active = 1
icon_state = "[initial(icon_state)]on" //VOREStation Edit
if(href_list["action"] == "disable")
if (active)
active = 0
icon_state = initial(icon_state) //VOREStation Edit
if(href_list["action"] == "eject")
add_fingerprint(usr)
switch(action)
if("toggle_power")
TogglePower()
. = TRUE
if("eject")
if(!active)
DropFuel()
if(href_list["action"] == "lower_power")
if (power_output > 1)
. = TRUE
if("lower_power")
if(power_output > 1)
power_output--
if (href_list["action"] == "higher_power")
if (power_output < max_power_output || (emagged && power_output < round(max_power_output*2.5)))
. = TRUE
if("higher_power")
if(power_output < max_power_output || (emagged && power_output < round(max_power_output * 2.5)))
power_output++
. = TRUE
/obj/machinery/power/port_gen/pacman/super
name = "S.U.P.E.R.P.A.C.M.A.N.-type Portable Generator"
+3 -1
View File
@@ -5,6 +5,7 @@
var/load = 0 // the current load on the powernet, increased by each machine at processing
var/newavail = 0 // what available power was gathered last tick, then becomes...
var/avail = 0 //...the current available power in the powernet
var/viewavail = 0 // the availability as it appears on the power console (gradually updated)
var/viewload = 0 // the load as it appears on the power console (gradually updated)
var/number = 0 // Unused //TODEL
@@ -134,7 +135,8 @@
S.restore(perc)
//updates the viewed load (as seen on power computers)
viewload = round(load)
viewavail = round(0.8 * viewavail + 0.2 * avail)
viewload = round(0.8 * viewload + 0.2 * load)
//reset the powernet
load = 0
+71 -2
View File
@@ -19,12 +19,22 @@
var/name_tag = "#UNKN#" // ID tag displayed in list of powernet sensors. Each sensor should have it's own tag!
var/long_range = 0 // If 1, sensor reading will show on all computers, regardless of Zlevel
var/list/history = list()
var/record_size = 60
var/record_interval = 50
var/next_record = 0
var/is_secret_monitor = FALSE
// Proc: New()
// Parameters: None
// Description: Automatically assigns name according to ID tag.
/obj/machinery/power/sensor/New()
..()
auto_set_name()
/obj/machinery/power/sensor/Initialize()
. = ..()
history["supply"] = list()
history["demand"] = list()
// Proc: auto_set_name()
// Parameters: None
@@ -38,6 +48,8 @@
for(var/obj/machinery/computer/power_monitor/PM in machines)
if(PM.power_monitor)
PM.power_monitor.refresh_sensors()
history.Cut()
history = null
// Proc: check_grid_warning()
// Parameters: None
@@ -51,10 +63,67 @@
// Proc: process()
// Parameters: None
// Description: This has to be here because we need sensors to remain in Machines list.
// Description: This tracks historical usage, for TGUI power monitors
/obj/machinery/power/sensor/process()
if(!powernet)
use_power = USE_POWER_IDLE
connect_to_network()
else
use_power = USE_POWER_ACTIVE
record()
return 1
// This tracks historical usage, for TGUI power monitors
/obj/machinery/power/sensor/proc/record()
if(world.time >= next_record)
next_record = world.time + record_interval
var/datum/powernet/connected_powernet = powernet
var/list/supply = history["supply"]
if(connected_powernet)
supply += connected_powernet.viewavail
if(supply.len > record_size)
supply.Cut(1, 2)
var/list/demand = history["demand"]
if(connected_powernet)
demand += connected_powernet.viewload
if(demand.len > record_size)
demand.Cut(1, 2)
/obj/machinery/power/sensor/tgui_data()
var/list/data = list()
data["name"] = name_tag
data["stored"] = record_size
data["interval"] = record_interval / 10
data["attached"] = !!powernet
data["history"] = history
data["areas"] = list()
if(powernet)
for(var/obj/machinery/power/terminal/term in powernet.nodes)
if(istype(term.master, /obj/machinery/power/apc))
var/obj/machinery/power/apc/A = term.master
if(istype(A))
var/cell_charge
if(!A.cell)
cell_charge = 0
else
cell_charge = A.cell.percent()
data["areas"] += list(list(
"name" = A.area.name,
"charge" = cell_charge,
"load" = DisplayPower(A.lastused_total),
"charging" = A.charging,
"eqp" = A.equipment,
"lgt" = A.lighting,
"env" = A.environ,
))
return data
// Proc: reading_to_text()
// Parameters: 1 (amount - Power in Watts to be converted to W, kW or MW)
// Description: Helper proc that converts reading in Watts to kW or MW (returns string version of amount parameter)
@@ -178,7 +247,7 @@
APC_entry["total_load"] = reading_to_text(A.lastused_total)
// Hopefully removes those goddamn \improper s which are screwing up the UI
var/N = A.area.name
if(findtext(N, "ÿ"))
if(findtext(N, ""))
N = copytext(N, 3)
APC_entry["name"] = N
// Add data into main list of APC data.
@@ -18,7 +18,7 @@
use_power = USE_POWER_IDLE
idle_power_usage = 300
active_power_usage = 300
var/datum/nano_module/power_monitor/power_monitor
var/datum/tgui_module/power_monitor/power_monitor
// Checks the sensors for alerts. If change (alerts cleared or detected) occurs, calls for icon update.
/obj/machinery/computer/power_monitor/process()
@@ -47,12 +47,11 @@
if(stat & (BROKEN|NOPOWER))
return
ui_interact(user)
tgui_interact(user)
// Uses dark magic to operate the NanoUI of this computer.
/obj/machinery/computer/power_monitor/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
power_monitor.ui_interact(user, ui_key, ui, force_open)
/obj/machinery/computer/power_monitor/tgui_interact(mob/user, var/datum/tgui/ui = null)
power_monitor.tgui_interact(user, ui)
// Verifies if any warnings were registered by connected sensors.
/obj/machinery/computer/power_monitor/proc/check_warnings()
@@ -36,7 +36,7 @@
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
if(construction_state >= 3)
interact(user)
tgui_interact(user)
else if(construction_state == 2) // Wires exposed
wires.Interact(user)
@@ -77,36 +77,6 @@
else
icon_state = "[reference]c"
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
..()
//Ignore input if we are broken, !silicon guy cant touch us, or nonai controlling from super far away
if(stat & (BROKEN|NOPOWER) || (get_dist(src, usr) > 1 && !istype(usr, /mob/living/silicon)) || (get_dist(src, usr) > 8 && !istype(usr, /mob/living/silicon/ai)))
usr.unset_machine()
usr << browse(null, "window=pacontrol")
return
if( href_list["close"] )
usr << browse(null, "window=pacontrol")
usr.unset_machine()
return
if(href_list["togglep"])
if(!wires.is_cut(WIRE_PARTICLE_POWER))
toggle_power()
else if(href_list["scan"])
part_scan()
else if(href_list["strengthup"])
if(!wires.is_cut(WIRE_PARTICLE_STRENGTH))
add_strength()
else if(href_list["strengthdown"])
if(!wires.is_cut(WIRE_PARTICLE_STRENGTH))
remove_strength()
updateDialog()
update_icon()
/obj/machinery/particle_accelerator/control_box/proc/strength_change()
for(var/obj/structure/particle_accelerator/part in connected_parts)
part.strength = strength
@@ -230,33 +200,54 @@
part.update_icon()
return 1
/obj/machinery/particle_accelerator/control_box/proc/is_interactive(mob/user)
if(!interface_control)
to_chat(user, "<span class='alert'>ERROR: Request timed out. Check wire contacts.</span>")
return FALSE
if(construction_state != 3)
return FALSE
return TRUE
/obj/machinery/particle_accelerator/control_box/interact(mob/user)
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
if(!istype(user, /mob/living/silicon))
user.unset_machine()
user << browse(null, "window=pacontrol")
return
user.set_machine(src)
/obj/machinery/particle_accelerator/control_box/tgui_status(mob/user)
if(is_interactive(user))
return ..()
return STATUS_CLOSE
var/dat = ""
dat += "Particle Accelerator Control Panel<BR>"
dat += "<A href='?src=\ref[src];close=1'>Close</A><BR><BR>"
dat += "Status:<BR>"
if(!assembled)
dat += "Unable to detect all parts!<BR>"
dat += "<A href='?src=\ref[src];scan=1'>Run Scan</A><BR><BR>"
else
dat += "All parts in place.<BR><BR>"
dat += "Power:"
if(active)
dat += "On<BR>"
else
dat += "Off <BR>"
dat += "<A href='?src=\ref[src];togglep=1'>Toggle Power</A><BR><BR>"
dat += "Particle Strength: [src.strength] "
dat += "<A href='?src=\ref[src];strengthdown=1'>--</A>|<A href='?src=\ref[src];strengthup=1'>++</A><BR><BR>"
/obj/machinery/particle_accelerator/control_box/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "ParticleAccelerator", name)
ui.open()
user << browse(dat, "window=pacontrol;size=420x500")
onclose(user, "pacontrol")
return
/obj/machinery/particle_accelerator/control_box/tgui_data(mob/user)
var/list/data = list()
data["assembled"] = assembled
data["power"] = active
data["strength"] = strength
return data
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
if(..())
return
switch(action)
if("power")
if(wires.is_cut(WIRE_POWER))
return
toggle_power()
. = TRUE
if("scan")
part_scan()
. = TRUE
if("add_strength")
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
return
add_strength()
. = TRUE
if("remove_strength")
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
return
remove_strength()
. = TRUE
update_icon()
+72 -66
View File
@@ -263,11 +263,11 @@ GLOBAL_LIST_EMPTY(smeses)
/obj/machinery/power/smes/attack_ai(mob/user)
add_hiddenprint(user)
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/smes/attack_hand(mob/user)
add_fingerprint(user)
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/smes/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
@@ -344,78 +344,84 @@ GLOBAL_LIST_EMPTY(smeses)
return FALSE
return TRUE
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(stat & BROKEN)
return
// this is the data which will be sent to the ui
var/data[0]
data["nameTag"] = name_tag
data["storedCapacity"] = round(100.0*charge/capacity, 0.1)
data["storedCapacityAbs"] = round(charge/(1000*60), 0.1)
data["storedCapacityMax"] = round(capacity/(1000*60))
data["charging"] = inputting
data["chargeMode"] = input_attempt
data["chargeLevel"] = round(input_level/1000, 0.1)
data["chargeMax"] = round(input_level_max/1000)
data["chargeLoad"] = round(input_available/1000, 0.1)
data["outputOnline"] = output_attempt
data["outputLevel"] = round(output_level/1000, 0.1)
data["outputMax"] = round(output_level_max/1000)
data["outputLoad"] = round(output_used/1000, 0.1)
data["outputting"] = outputting
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "smes.tmpl", "SMES Unit", 540, 380)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
/obj/machinery/power/smes/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Smes", name)
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(1)
/obj/machinery/power/smes/tgui_data()
var/list/data = list(
"capacity" = capacity,
"capacityPercent" = round(100*charge/capacity, 0.1),
"charge" = charge,
"inputAttempt" = input_attempt,
"inputting" = inputting,
"inputLevel" = input_level,
"inputLevel_text" = DisplayPower(input_level),
"inputLevelMax" = input_level_max,
"inputAvailable" = input_available,
"outputAttempt" = output_attempt,
"outputting" = outputting,
"outputLevel" = output_level,
"outputLevel_text" = DisplayPower(output_level),
"outputLevelMax" = output_level_max,
"outputUsed" = output_used,
)
return data
/obj/machinery/power/smes/proc/Percentage()
if(!capacity)
return 0
return round(100.0*charge/capacity, 0.1)
/obj/machinery/power/smes/Topic(href, href_list)
if(..())
return 1
if( href_list["cmode"] )
inputting(!input_attempt)
update_icon()
return 1
else if( href_list["online"] )
outputting(!output_attempt)
update_icon()
return 1
else if( href_list["input"] )
switch( href_list["input"] )
if("min")
input_level = 0
if("max")
input_level = input_level_max
if("set")
input_level = (input(usr, "Enter new input level (0-[input_level_max/1000] kW)", "SMES Input Power Control", input_level/1000) as num) * 1000
input_level = max(0, min(input_level_max, input_level)) // clamp to range
return 1
else if( href_list["output"] )
switch( href_list["output"] )
if("min")
output_level = 0
if("max")
output_level = output_level_max
if("set")
output_level = (input(usr, "Enter new output level (0-[output_level_max/1000] kW)", "SMES Output Power Control", output_level/1000) as num) * 1000
output_level = max(0, min(output_level_max, output_level)) // clamp to range
return 1
/obj/machinery/power/smes/tgui_act(action, params)
if(..())
return TRUE
switch(action)
if("tryinput")
inputting(!input_attempt)
update_icon()
. = TRUE
if("tryoutput")
outputting(!output_attempt)
update_icon()
. = TRUE
if("input")
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "min")
target = 0
. = TRUE
else if(target == "max")
target = input_level_max
. = TRUE
else if(adjust)
target = input_level + adjust
. = TRUE
else if(text2num(target) != null)
target = text2num(target)
. = TRUE
if(.)
input_level = clamp(target, 0, input_level_max)
if("output")
var/target = params["target"]
var/adjust = text2num(params["adjust"])
if(target == "min")
target = 0
. = TRUE
else if(target == "max")
target = output_level_max
. = TRUE
else if(adjust)
target = output_level + adjust
. = TRUE
else if(text2num(target) != null)
target = text2num(target)
. = TRUE
if(.)
output_level = clamp(target, 0, output_level_max)
/obj/machinery/power/smes/proc/inputting(var/do_input)
input_attempt = do_input
+1 -1
View File
@@ -84,7 +84,7 @@
/obj/machinery/power/smes/buildable/Destroy()
qdel(wires)
wires = null
for(var/datum/nano_module/rcon/R in world)
for(var/datum/tgui_module/rcon/R in world)
R.FindDevices()
return ..()
+60 -71
View File
@@ -399,38 +399,32 @@ GLOBAL_LIST_EMPTY(solars_list)
return
/obj/machinery/power/solar_control/attack_hand(mob/user)
if(!..())
interact(user)
if(..())
return TRUE
tgui_interact(user)
/obj/machinery/power/solar_control/interact(mob/user)
/obj/machinery/power/solar_control/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "SolarControl", name)
ui.open()
var/t = "<B><span class='highlight'>Generated power</span></B> : [round(lastgen)] W<BR>"
t += "<B><span class='highlight'>Star Orientation</span></B>: [SSsun.sun.angle]&deg ([angle2text(SSsun.sun.angle)])<BR>"
t += "<B><span class='highlight'>Array Orientation</span></B>: [rate_control(src,"cdir","[cdir]&deg",1,15)] ([angle2text(cdir)])<BR>"
t += "<B><span class='highlight'>Tracking:</span></B><div class='statusDisplay'>"
switch(track)
if(0)
t += "<span class='linkOn'>Off</span> <A href='?src=\ref[src];track=1'>Timed</A> <A href='?src=\ref[src];track=2'>Auto</A><BR>"
if(1)
t += "<A href='?src=\ref[src];track=0'>Off</A> <span class='linkOn'>Timed</span> <A href='?src=\ref[src];track=2'>Auto</A><BR>"
if(2)
t += "<A href='?src=\ref[src];track=0'>Off</A> <A href='?src=\ref[src];track=1'>Timed</A> <span class='linkOn'>Auto</span><BR>"
/obj/machinery/power/solar_control/tgui_data()
var/data = list()
t += "Tracking Rate: [rate_control(src,"tdir","[trackrate] deg/h ([trackrate<0 ? "CCW" : "CW"])",1,30,180)]</div><BR>"
data["generated"] = round(lastgen)
data["generated_ratio"] = data["generated"] / round(max(connected_panels.len, 1) * GLOB.solar_gen_rate)
t += "<B><span class='highlight'>Connected devices:</span></B><div class='statusDisplay'>"
data["sun_angle"] = SSsun.sun.angle
data["array_angle"] = cdir
data["rotation_rate"] = trackrate
data["max_rotation_rate"] = 7200
data["tracking_state"] = track
t += "<A href='?src=\ref[src];search_connected=1'>Search for devices</A><BR>"
t += "Solar panels : [connected_panels.len] connected<BR>"
t += "Solar tracker : [connected_tracker ? "<span class='good'>Found</span>" : "<span class='bad'>Not found</span>"]</div><BR>"
data["connected_panels"] = connected_panels.len
data["connected_tracker"] = (connected_tracker ? TRUE : FALSE)
t += "<A href='?src=\ref[src];close=1'>Close</A>"
var/datum/browser/popup = new(user, "solar", name)
popup.set_content(t)
popup.open()
return
return data
/obj/machinery/power/solar_control/attackby(obj/item/I, user as mob)
if(I.is_screwdriver())
@@ -481,51 +475,52 @@ GLOBAL_LIST_EMPTY(solars_list)
updateDialog()
/obj/machinery/power/solar_control/Topic(href, href_list)
/obj/machinery/power/solar_control/tgui_act(action, params)
if(..())
usr << browse(null, "window=solcon")
usr.unset_machine()
return 0
if(href_list["close"] )
usr << browse(null, "window=solcon")
usr.unset_machine()
return 0
return TRUE
if(href_list["rate control"])
if(href_list["cdir"])
src.cdir = dd_range(0,359,(360+src.cdir+text2num(href_list["cdir"]))%360)
src.targetdir = src.cdir
if(track == 2) //manual update, so losing auto-tracking
track = 0
spawn(1)
switch(action)
if("azimuth")
var/adjust = text2num(params["adjust"])
var/value = text2num(params["value"])
if(adjust)
value = cdir + adjust
if(value != null)
cdir = value
set_panels(cdir)
if(href_list["tdir"])
src.trackrate = dd_range(-7200,7200,src.trackrate+text2num(href_list["tdir"]))
if(src.trackrate) nexttime = world.time + 36000/abs(trackrate)
return TRUE
return FALSE
if("azimuth_rate")
var/adjust = text2num(params["adjust"])
var/value = text2num(params["value"])
if(adjust)
value = trackrate + adjust
if(value != null)
trackrate = round(clamp(value, -7200, 7200), 0.01)
if(trackrate)
nexttime = world.time + 36000 / abs(trackrate)
return TRUE
return TRUE
if("tracking")
var/mode = text2num(params["mode"])
track = mode
if(track == 2)
if(connected_tracker)
connected_tracker.set_angle(SSsun.sun.angle)
set_panels(cdir)
else if(track == 1) //begin manual tracking
targetdir = cdir
if(trackrate)
nexttime = world.time + 36000/abs(trackrate)
set_panels(targetdir)
return TRUE
if(href_list["track"])
track = text2num(href_list["track"])
if(track == 2)
if(connected_tracker)
connected_tracker.set_angle(SSsun.sun.angle)
set_panels(cdir)
else if (track == 1) //begin manual tracking
src.targetdir = src.cdir
if(src.trackrate) nexttime = world.time + 36000/abs(trackrate)
set_panels(targetdir)
if(href_list["search_connected"])
src.search_for_connected()
if(connected_tracker && track == 2)
connected_tracker.set_angle(SSsun.sun.angle)
src.set_panels(cdir)
interact(usr)
return 1
if("refresh")
search_for_connected()
return TRUE
//rotates the panel to the passed angle
/obj/machinery/power/solar_control/proc/set_panels(var/cdir)
for(var/obj/machinery/power/solar/S in connected_panels)
S.adir = cdir //instantly rotates the panel
S.occlusion()//and
@@ -547,7 +542,7 @@ GLOBAL_LIST_EMPTY(solars_list)
/obj/machinery/power/solar_control/ex_act(severity)
switch(severity)
if(1.0)
//SN src = null
//SN = null
qdel(src)
return
if(2.0)
@@ -565,9 +560,3 @@ GLOBAL_LIST_EMPTY(solars_list)
/obj/item/weapon/paper/solar
name = "paper- 'Going green! Setup your own solar array instructions.'"
info = "<h1>Welcome</h1><p>At greencorps we love the environment, and space. With this package you are able to help mother nature and produce energy without any usage of fossil fuel or phoron! Singularity energy is dangerous while solar energy is safe, which is why it's better. Now here is how you setup your own solar array.</p><p>You can make a solar panel by wrenching the solar assembly onto a cable node. Adding a glass panel, reinforced or regular glass will do, will finish the construction of your solar panel. It is that easy!</p><p>Now after setting up 19 more of these solar panels you will want to create a solar tracker to keep track of our mother nature's gift, the SSsun.sun. These are the same steps as before except you insert the tracker equipment circuit into the assembly before performing the final step of adding the glass. You now have a tracker! Now the last step is to add a computer to calculate the SSsun.sun's movements and to send commands to the solar panels to change direction with the SSsun.sun. Setting up the solar computer is the same as setting up any computer, so you should have no trouble in doing that. You do need to put a wire node under the computer, and the wire needs to be connected to the tracker.</p><p>Congratulations, you should have a working solar array. If you are having trouble, here are some tips. Make sure all solar equipment are on a cable node, even the computer. You can always deconstruct your creations if you make a mistake.</p><p>That's all to it, be safe, be green!</p>"
/proc/rate_control(var/S, var/V, var/C, var/Min=1, var/Max=5, var/Limit=null) //How not to name vars
var/href = "<A href='?src=\ref[S];rate control=1;[V]"
var/rate = "[href]=-[Max]'>-</A>[href]=-[Min]'>-</A> [(C?C : 0)] [href]=[Min]'>+</A>[href]=[Max]'>+</A>"
if(Limit) return "[href]=-[Limit]'>-</A>"+rate+"[href]=[Limit]'>+</A>"
return rate
+11 -10
View File
@@ -390,11 +390,11 @@
if(Adjacent(user))
return attack_hand(user)
else
ui_interact(user)
tgui_interact(user)
return
/obj/machinery/power/supermatter/attack_ai(mob/user as mob)
ui_interact(user)
tgui_interact(user)
/obj/machinery/power/supermatter/attack_hand(mob/user as mob)
var/datum/gender/TU = gender_datums[user.get_visible_gender()]
@@ -404,9 +404,15 @@
Consume(user)
/obj/machinery/power/supermatter/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AiSupermatter", name)
ui.open()
// This is purely informational UI that may be accessed by AIs or robots
/obj/machinery/power/supermatter/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
/obj/machinery/power/supermatter/tgui_data(mob/user)
var/list/data = list()
data["integrity_percentage"] = round(get_integrity())
var/datum/gas_mixture/env = null
@@ -421,12 +427,7 @@
data["ambient_pressure"] = round(env.return_pressure())
data["detonating"] = grav_pulling
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "supermatter_crystal.tmpl", "Supermatter Crystal", 500, 300)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
return data
/obj/machinery/power/supermatter/attackby(obj/item/weapon/W as obj, mob/living/user as mob)