mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 04:17:33 +01:00
b3b4f4b9c6
Fixes https://github.com/Aurorastation/Aurora.3/issues/18951 Fixes https://github.com/Aurorastation/Aurora.3/issues/19447 Fixes https://github.com/Aurorastation/Aurora.3/issues/20283 Fixes https://github.com/Aurorastation/Aurora.3/issues/21395 Overhauls a wide variety of INDRA behaviors and related gas/material properties. changes: - balance: "Fusion reaction modifications. Higher radiation and temperature output, comparable power output." - balance: "Increased rad resistance modifier of Borosilicate Windows from 1 -> 4 and (closed) Blast Doors from 1 -> 6." - balance: "INDRA Field Strength minima/maxima changed from 1-100 -> 20-120. Power costs increased significantly." - balance: "INDRA instability increase per tick now limited, similar to Supermatter (prevents sudden instability spike from instantly nuking it)." - balance: "APC cell charge rate increased 10x." - balance: "Rebalanced contents of INDRA hard storage compartment." - balance: "SMES coils capacities halved, throughputs doubled." - balance: "SMES unit maximum coil capacity increased from 6 -> 8." - balance: "TEG maximum power output increased from 500000 -> 2500000." - balance: "Power wasted from exceeding TEG maximum power output decreased from 50% to 33%." - balance: "Portable generators of all types have had their power generation capacity doubled." - rscadd: "New 'Fusion Codex' app added for all crew with ACCESS_ENGINE that details all available nuclear fusion chains." - rscadd: "Boron added as a singleton/reagent. Poisonous to vaurca, still usable in nuclear fusion as fuel assembly rods." - rscadd: "INDRA Field Strength now scales plasma temperature entropy, power output from temperature multiplier, and instability increase per tick." - refactor: "'Boron' gas renamed to 'Helium-3'. Boron is not a gas. Deal with it." - refactor: "'Steam' gas renamed to 'Water Vapor'." - code_imp: "Descriptions added to gas singletons for future use." - qol: "Minor remap of INDRA control room for usability." - qol: "Standardized gas canister naming conventions." - qol: "INDRA and APC TGUI interfaces now use use kW, MW abbreviations for high wattages." - bugfix: "INDRA Kinetic Harvester no longer rapidly deselects materials for harvest when too many are being generated at once." - bugfix: "INDRA EM Field effect no longer considers the camera within its reactor chamber a destabilizing influence." - bugfix: "INDRA reactor core now produces radiation as intended." - bugfix: "Deuterium and Tritium canisters no longer contain 50% standard hydrogen (inheritance issue)." --------- Signed-off-by: Batrachophreno <Batrochophreno@gmail.com> Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> Co-authored-by: Geeves <22774890+Geevies@users.noreply.github.com>
164 lines
5.9 KiB
Plaintext
164 lines
5.9 KiB
Plaintext
// POWERNET SENSOR
|
|
//
|
|
// Last Change 31.12.2014 by Atlantis
|
|
//
|
|
// Powernet sensors are devices which relay information about connected powernet. This information may be relayed
|
|
// via two procs. Proc return_reading_text will return fully HTML styled string which contains all information. This
|
|
// may be used in PDAs or similar applications. Second proc, return_reading_data will return list containing needed data.
|
|
// This is used in NanoUI, for example.
|
|
|
|
/obj/machinery/power/sensor
|
|
name = "Powernet Sensor"
|
|
desc = "Small machine which transmits data about specific powernet"
|
|
anchored = 1
|
|
density = 0
|
|
level = 1
|
|
icon = 'icons/obj/objects.dmi'
|
|
icon_state = "floor_beacon" // If anyone wants to make better sprite, feel free to do so without asking me.
|
|
|
|
var/name_tag = "#UNKN#" // ID tag displayed in list of powernet sensors. Each sensor should have it's own tag!
|
|
var/long_range = FALSE // If TRUE, sensor readings will show regardless of the zlevel being connected.
|
|
|
|
// Proc: New()
|
|
// Parameters: None
|
|
// Description: Automatically assigns name according to ID tag.
|
|
/obj/machinery/power/sensor/Initialize()
|
|
. = ..()
|
|
auto_set_name()
|
|
SSmachinery.all_sensors += src
|
|
|
|
/obj/machinery/power/sensor/Destroy()
|
|
. = ..()
|
|
SSmachinery.all_sensors -= src
|
|
|
|
// Proc: auto_set_name()
|
|
// Parameters: None
|
|
// Description: Sets name of this sensor according to the ID tag.
|
|
/obj/machinery/power/sensor/proc/auto_set_name()
|
|
name = "[name_tag] - Powernet Sensor"
|
|
|
|
// Proc: check_grid_warning()
|
|
// Parameters: None
|
|
// Description: Checks connected powernet for warnings. If warning is found returns 1
|
|
/obj/machinery/power/sensor/proc/check_grid_warning()
|
|
connect_to_network()
|
|
if(powernet)
|
|
if(powernet.problem)
|
|
return 1
|
|
return 0
|
|
|
|
// Proc: find_apcs()
|
|
// Parameters: None
|
|
// Description: Searches powernet for APCs and returns them in a list.
|
|
/obj/machinery/power/sensor/proc/find_apcs()
|
|
if(!powernet)
|
|
return
|
|
|
|
var/list/L = list()
|
|
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
|
|
L += A
|
|
|
|
return L
|
|
|
|
|
|
// Proc: return_reading_text()
|
|
// Parameters: None
|
|
// Description: Generates string which contains HTML table with reading data.
|
|
/obj/machinery/power/sensor/proc/return_reading_text()
|
|
// No powernet. Try to connect to one first.
|
|
if(!powernet)
|
|
connect_to_network()
|
|
var/out = ""
|
|
if(!powernet) // No powernet.
|
|
out = "# SYSTEM ERROR - NO POWERNET #"
|
|
return out
|
|
|
|
|
|
var/list/L = find_apcs()
|
|
var/total_apc_load = 0
|
|
if(L.len <= 0) // No APCs found.
|
|
out = "<b>No APCs located in connected powernet!</b>"
|
|
else // APCs found. Create very ugly (but working!) HTML table.
|
|
|
|
out += "<table><tr><th>Name<th>AREA_USAGE_EQUIP<th>AREA_USAGE_LIGHT<th>AREA_USAGE_ENVIRON<th>CELL<th>LOAD"
|
|
|
|
// These lists are used as replacement for number based APC settings
|
|
var/list/S = list("M-OFF","A-OFF","M-ON", "A-ON")
|
|
var/list/chg = list("N","C","F")
|
|
|
|
// Split to multiple lines to make it more readable
|
|
for(var/obj/machinery/power/apc/A in L)
|
|
out += "<tr><td>\The [A.area]" // Add area name
|
|
out += "<td>[S[A.equipment+1]]<td>[S[A.lighting+1]]<td>[S[A.environ+1]]" // Show status of channels
|
|
if(A.cell)
|
|
out += "<td>[round(A.cell.percent())]% - [chg[A.charging+1]]"
|
|
else
|
|
out += "<td>NO CELL"
|
|
var/load = A.lastused_total // Load.
|
|
total_apc_load += load
|
|
load = power_wattage_readable(load)
|
|
out += "<td>[load]"
|
|
|
|
out += "<br><b>AREA_USAGE_TOTAL AVAILABLE: [power_wattage_readable(powernet.avail)]</b>"
|
|
out += "<br><b>APC LOAD: [power_wattage_readable(total_apc_load)]</b>"
|
|
out += "<br><b>OTHER LOAD: [power_wattage_readable(max(powernet.load - total_apc_load, 0))]</b>"
|
|
out += "<br><b>AREA_USAGE_TOTAL GRID LOAD: [power_wattage_readable(powernet.viewload)] ([round((powernet.load / powernet.avail) * 100)]%)</b>"
|
|
|
|
if(powernet.problem)
|
|
out += "<br><b>WARNING: Abnormal grid activity detected!</b>"
|
|
return out
|
|
|
|
// Proc: return_reading_data()
|
|
// Parameters: None
|
|
// Description: Generates list containing all powernet data. Optimised for usage with NanoUI
|
|
/obj/machinery/power/sensor/proc/return_reading_data()
|
|
// No powernet. Try to connect to one first.
|
|
if(!powernet)
|
|
connect_to_network()
|
|
var/list/data = list()
|
|
data["name"] = name_tag
|
|
if(!powernet)
|
|
data["error"] = "# SYSTEM ERROR - NO POWERNET #"
|
|
data["alarm"] = 0 // Runtime Prevention
|
|
return data
|
|
|
|
var/list/L = find_apcs()
|
|
var/total_apc_load = 0
|
|
var/list/APC_data = list()
|
|
if(L.len > 0)
|
|
// These lists are used as replacement for number based APC settings
|
|
var/list/S = list("M-OFF","A-OFF","M-ON", "A-ON")
|
|
var/list/chg = list("N","C","F")
|
|
|
|
for(var/obj/machinery/power/apc/A in L)
|
|
var/list/APC_entry = list()
|
|
// Channel Statuses
|
|
APC_entry["s_equipment"] = S[A.equipment+1]
|
|
APC_entry["s_lighting"] = S[A.lighting+1]
|
|
APC_entry["s_environment"] = S[A.environ+1]
|
|
// Cell Status
|
|
APC_entry["cell_charge"] = A.cell ? round(A.cell.percent()) : 0
|
|
APC_entry["cell_status"] = A.cell ? chg[A.charging+1] : 0
|
|
// Other info
|
|
APC_entry["total_load"] = power_wattage_readable(A.lastused_total)
|
|
var/area_display_name = get_area_display_name(A.area)
|
|
APC_entry["name"] = area_display_name
|
|
// Add data into main list of APC data.
|
|
APC_data += list(APC_entry)
|
|
// Add load of this APC to total APC load calculation
|
|
total_apc_load += A.lastused_total
|
|
data["apc_data"] = APC_data
|
|
data["total_avail"] = power_wattage_readable(max(powernet.avail, 0))
|
|
data["total_used_apc"] = power_wattage_readable(max(total_apc_load, 0))
|
|
data["total_used_other"] = power_wattage_readable(max(powernet.viewload - total_apc_load, 0))
|
|
data["total_used_all"] = power_wattage_readable(max(powernet.viewload, 0))
|
|
// Prevents runtimes when avail is 0 (division by zero)
|
|
if(powernet.avail)
|
|
data["load_percentage"] = round((powernet.viewload / powernet.avail) * 100)
|
|
else
|
|
data["load_percentage"] = 100
|
|
data["alarm"] = powernet.problem ? 1 : 0
|
|
return data
|