mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-29 15:08:34 +01:00
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:
@@ -18,6 +18,7 @@
|
||||
use_power = USE_POWER_OFF //doesn't use APC power
|
||||
var/charge_rate = 100000 //100 kW
|
||||
var/obj/machinery/shield_gen/owned_gen
|
||||
interact_offline = TRUE
|
||||
|
||||
/obj/machinery/shield_capacitor/advanced
|
||||
name = "advanced shield capacitor"
|
||||
@@ -67,36 +68,30 @@
|
||||
/obj/machinery/shield_capacitor/attack_hand(mob/user)
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
interact(user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/shield_capacitor/interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=shield_capacitor")
|
||||
return
|
||||
var/t = "<B>Shield Capacitor Control Console</B><br><br>"
|
||||
if(locked)
|
||||
t += "<i>Swipe your ID card to begin.</i>"
|
||||
else
|
||||
t += "This capacitor is: [active ? "<font color=green>Online</font>" : "<font color=red>Offline</font>" ] <a href='?src=\ref[src];toggle=1'>[active ? "\[Deactivate\]" : "\[Activate\]"]</a><br>"
|
||||
t += "Capacitor Status: [time_since_fail > 2 ? "<font color=green>OK.</font>" : "<font color=red>Discharging!</font>"]<br>"
|
||||
t += "Stored Energy: [format_SI(stored_charge, "J")] ([100 * round(stored_charge/max_charge, 0.01)]%)<br>"
|
||||
t += "Charge Rate: \
|
||||
<a href='?src=\ref[src];charge_rate=-100000'>\[----\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=-10000'>\[---\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=-1000'>\[--\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=-100'>\[-\]</a>[format_SI(charge_rate, "W")]\
|
||||
<a href='?src=\ref[src];charge_rate=100'>\[+\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=1000'>\[++\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=10000'>\[+++\]</a> \
|
||||
<a href='?src=\ref[src];charge_rate=100000'>\[++++\]</a><br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src]'>Refresh</A> "
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
/obj/machinery/shield_capacitor/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ShieldCapacitor", name)
|
||||
ui.open()
|
||||
|
||||
user << browse(t, "window=shield_capacitor;size=500x400")
|
||||
user.set_machine(src)
|
||||
/obj/machinery/shield_capacitor/tgui_status(mob/user)
|
||||
if(stat & BROKEN)
|
||||
return STATUS_CLOSE
|
||||
return ..()
|
||||
|
||||
/obj/machinery/shield_capacitor/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["active"] = active
|
||||
data["time_since_fail"] = time_since_fail
|
||||
data["stored_charge"] = stored_charge
|
||||
data["max_charge"] = max_charge
|
||||
data["charge_rate"] = charge_rate
|
||||
data["max_charge_rate"] = max_charge_rate
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/shield_capacitor/process()
|
||||
if (!anchored)
|
||||
@@ -119,21 +114,20 @@
|
||||
time_since_fail = 0 //losing charge faster than we can draw from PN
|
||||
last_stored_charge = stored_charge
|
||||
|
||||
/obj/machinery/shield_capacitor/Topic(href, href_list[])
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=shield_capacitor")
|
||||
usr.unset_machine()
|
||||
return
|
||||
if( href_list["toggle"] )
|
||||
if(!active && !anchored)
|
||||
to_chat(usr, "<font color='red'>The [src] needs to be firmly secured to the floor first.</font>")
|
||||
return
|
||||
active = !active
|
||||
if( href_list["charge_rate"] )
|
||||
charge_rate = between(10000, charge_rate + text2num(href_list["charge_rate"]), max_charge_rate)
|
||||
/obj/machinery/shield_capacitor/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
updateDialog()
|
||||
switch(action)
|
||||
if("toggle")
|
||||
if(!active && !anchored)
|
||||
to_chat(usr, "<font color='red'>The [src] needs to be firmly secured to the floor first.</font>")
|
||||
return
|
||||
active = !active
|
||||
. = TRUE
|
||||
if("charge_rate")
|
||||
charge_rate = clamp(text2num(params["rate"]), 10000, max_charge_rate)
|
||||
. = TRUE
|
||||
|
||||
/obj/machinery/shield_capacitor/power_change()
|
||||
if(stat & BROKEN)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
var/energy_conversion_rate = 0.0006 //how many renwicks per watt? Higher numbers equals more effiency.
|
||||
var/z_range = 0 // How far 'up and or down' to extend the shield to, in z-levels. Only works on MultiZ supported z-levels.
|
||||
use_power = USE_POWER_OFF //doesn't use APC power
|
||||
interact_offline = TRUE // don't check stat & NOPOWER|BROKEN for our UI. We check BROKEN ourselves.
|
||||
var/id //for button usage
|
||||
|
||||
/obj/machinery/shield_gen/advanced
|
||||
@@ -95,59 +96,50 @@
|
||||
/obj/machinery/shield_gen/attack_hand(mob/user)
|
||||
if(stat & (BROKEN))
|
||||
return
|
||||
interact(user)
|
||||
tgui_interact(user)
|
||||
|
||||
/obj/machinery/shield_gen/interact(mob/user)
|
||||
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN)) )
|
||||
if (!istype(user, /mob/living/silicon))
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=shield_generator")
|
||||
return
|
||||
var/t = "<B>Shield Generator Control Console</B><BR><br>"
|
||||
if(locked)
|
||||
t += "<i>Swipe your ID card to begin.</i>"
|
||||
else
|
||||
t += "[capacitors.len ? "<font color=green>Charge capacitor(s) connected.</font>" : "<font color=red>Unable to locate charge capacitor!</font>"]<br>"
|
||||
var/i = 0
|
||||
for(var/obj/machinery/shield_capacitor/capacitor in capacitors)
|
||||
i++
|
||||
t += "Capacitor #[i]: [capacitor.active ? "<font color=green>Online.</font>" : "<font color=red>Offline.</font>"] \
|
||||
Charge: [round(capacitor.stored_charge/1000, 0.1)] kJ ([100 * round(capacitor.stored_charge/capacitor.max_charge, 0.01)]%) \
|
||||
Status: [capacitor.time_since_fail > 2 ? "<font color=green>OK.</font>" : "<font color=red>Discharging!</font>"]<br>"
|
||||
t += "This generator is: [active ? "<font color=green>Online</font>" : "<font color=red>Offline</font>" ] <a href='?src=\ref[src];toggle=1'>[active ? "\[Deactivate\]" : "\[Activate\]"]</a><br>"
|
||||
t += "Field Status: [time_since_fail > 2 ? "<font color=green>Stable</font>" : "<font color=red>Unstable</font>"]<br>"
|
||||
t += "Coverage Radius (restart required): \
|
||||
<a href='?src=\ref[src];change_radius=-50'>---</a> \
|
||||
<a href='?src=\ref[src];change_radius=-5'>--</a> \
|
||||
<a href='?src=\ref[src];change_radius=-1'>-</a> \
|
||||
[field_radius] m \
|
||||
<a href='?src=\ref[src];change_radius=1'>+</a> \
|
||||
<a href='?src=\ref[src];change_radius=5'>++</a> \
|
||||
<a href='?src=\ref[src];change_radius=50'>+++</a><br>"
|
||||
if(HasAbove(src.z) || HasBelow(src.z)) // Won't show up on maps lacking MultiZ support.
|
||||
t += "Vertical Shielding (restart required): \
|
||||
<a href='?src=\ref[src];z_range=-1'>-</a> \
|
||||
[z_range] Vertical Range \
|
||||
<a href='?src=\ref[src];z_range=1'>+</a><br>"
|
||||
t += "Overall Field Strength: [round(average_field_strength, 0.01)] Renwick ([target_field_strength ? round(100 * average_field_strength / target_field_strength, 0.1) : "NA"]%)<br>"
|
||||
t += "Upkeep Power: [format_SI(round(field.len * max(average_field_strength * dissipation_rate, min_dissipation) / energy_conversion_rate), "W")]<br>"
|
||||
t += "Charge Rate: <a href='?src=\ref[src];strengthen_rate=-0.1'>--</a> \
|
||||
[strengthen_rate] Renwick/s \
|
||||
<a href='?src=\ref[src];strengthen_rate=0.1'>++</a><br>"
|
||||
t += "Shield Generation Power: [format_SI(round(field.len * min(strengthen_rate, target_field_strength - average_field_strength) / energy_conversion_rate), "W")]<br>"
|
||||
t += "Maximum Field Strength: \
|
||||
<a href='?src=\ref[src];target_field_strength=-10'>\[min\]</a> \
|
||||
<a href='?src=\ref[src];target_field_strength=-5'>--</a> \
|
||||
<a href='?src=\ref[src];target_field_strength=-1'>-</a> \
|
||||
[target_field_strength] Renwick \
|
||||
<a href='?src=\ref[src];target_field_strength=1'>+</a> \
|
||||
<a href='?src=\ref[src];target_field_strength=5'>++</a> \
|
||||
<a href='?src=\ref[src];target_field_strength=10'>\[max\]</a><br>"
|
||||
t += "<hr>"
|
||||
t += "<A href='?src=\ref[src]'>Refresh</A> "
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
user << browse(t, "window=shield_generator;size=500x400")
|
||||
user.set_machine(src)
|
||||
/obj/machinery/shield_gen/tgui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ShieldGenerator", name)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/shield_gen/tgui_status(mob/user)
|
||||
if(stat & BROKEN)
|
||||
return STATUS_CLOSE
|
||||
return ..()
|
||||
|
||||
/obj/machinery/shield_gen/tgui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["locked"] = locked
|
||||
data["lockedData"] = list()
|
||||
if(!locked)
|
||||
data["lockedData"]["capacitors"] = list()
|
||||
for(var/obj/machinery/shield_capacitor/C in capacitors)
|
||||
data["lockedData"]["capacitors"].Add(list(list(
|
||||
"active" = C.active,
|
||||
"stored_charge" = C.stored_charge,
|
||||
"max_charge" = C.max_charge,
|
||||
"failing" = (C.time_since_fail <= 2),
|
||||
)))
|
||||
|
||||
data["lockedData"]["active"] = active
|
||||
data["lockedData"]["failing"] = (time_since_fail <= 2)
|
||||
data["lockedData"]["radius"] = field_radius
|
||||
data["lockedData"]["max_radius"] = max_field_radius
|
||||
data["lockedData"]["z_range"] = z_range
|
||||
data["lockedData"]["max_z_range"] = 10
|
||||
data["lockedData"]["average_field_strength"] = average_field_strength
|
||||
data["lockedData"]["target_field_strength"] = target_field_strength
|
||||
data["lockedData"]["max_field_strength"] = max_field_strength
|
||||
data["lockedData"]["shields"] = LAZYLEN(field)
|
||||
data["lockedData"]["upkeep"] = round(field.len * max(average_field_strength * dissipation_rate, min_dissipation) / energy_conversion_rate)
|
||||
data["lockedData"]["strengthen_rate"] = strengthen_rate
|
||||
data["lockedData"]["max_strengthen_rate"] = max_strengthen_rate
|
||||
data["lockedData"]["gen_power"] = round(field.len * min(strengthen_rate, target_field_strength - average_field_strength) / energy_conversion_rate)
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/shield_gen/process()
|
||||
if (!anchored && active)
|
||||
@@ -206,30 +198,32 @@
|
||||
else
|
||||
average_field_strength = 0
|
||||
|
||||
/obj/machinery/shield_gen/Topic(href, href_list[])
|
||||
..()
|
||||
if( href_list["close"] )
|
||||
usr << browse(null, "window=shield_generator")
|
||||
usr.unset_machine()
|
||||
return
|
||||
else if( href_list["toggle"] )
|
||||
if (!active && !anchored)
|
||||
to_chat(usr, "<font color='red'>The [src] needs to be firmly secured to the floor first.</font>")
|
||||
return
|
||||
toggle()
|
||||
else if( href_list["change_radius"] )
|
||||
field_radius = between(0, field_radius + text2num(href_list["change_radius"]), max_field_radius)
|
||||
else if( href_list["strengthen_rate"] )
|
||||
strengthen_rate = between(0, strengthen_rate + text2num(href_list["strengthen_rate"]), max_strengthen_rate)
|
||||
else if( href_list["target_field_strength"] )
|
||||
target_field_strength = between(1, target_field_strength + text2num(href_list["target_field_strength"]), max_field_strength)
|
||||
else if( href_list["z_range"] )
|
||||
z_range = between(0, z_range + text2num(href_list["z_range"]), 10) // Max is extending ten z-levels up and down. Probably too big of a number but it shouldn't matter.
|
||||
/obj/machinery/shield_gen/tgui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("toggle")
|
||||
if (!active && !anchored)
|
||||
to_chat(usr, "<font color='red'>The [src] needs to be firmly secured to the floor first.</font>")
|
||||
return
|
||||
toggle()
|
||||
. = TRUE
|
||||
if("change_radius")
|
||||
field_radius = clamp(text2num(params["val"]), 0, max_field_radius)
|
||||
. = TRUE
|
||||
if("strengthen_rate")
|
||||
strengthen_rate = clamp(text2num(params["val"]), 0, max_strengthen_rate)
|
||||
. = TRUE
|
||||
if("target_field_strength")
|
||||
target_field_strength = clamp(text2num(params["val"]), 1, max_field_strength)
|
||||
. = TRUE
|
||||
if("z_range")
|
||||
z_range = clamp(text2num(params["val"]), 0, 10)
|
||||
. = TRUE
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/shield_gen/ex_act(var/severity)
|
||||
|
||||
if(active)
|
||||
toggle()
|
||||
return ..()
|
||||
|
||||
Reference in New Issue
Block a user