diff --git a/_maps/map_files/EchoStation/EchoStation.dmm b/_maps/map_files/EchoStation/EchoStation.dmm
index c39a1ef28cded..45fa8166c48f0 100644
--- a/_maps/map_files/EchoStation/EchoStation.dmm
+++ b/_maps/map_files/EchoStation/EchoStation.dmm
@@ -3572,13 +3572,13 @@
/turf/open/floor/plating,
/area/storage/tech)
"brs" = (
-/obj/machinery/telecomms/hub/preset,
/obj/effect/turf_decal/stripes/line{
dir = 6
},
/obj/machinery/airalarm/directional/north,
/obj/machinery/firealarm/directional/west,
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4,
+/obj/machinery/blackbox_recorder,
/turf/open/floor/circuit/telecomms/mainframe{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
@@ -29301,10 +29301,10 @@
/area/hydroponics)
"oOM" = (
/obj/structure/cable,
-/obj/machinery/blackbox_recorder,
/obj/effect/turf_decal/stripes/line{
dir = 1
},
+/obj/machinery/telecomms/hub/preset,
/turf/open/floor/circuit/green/telecomms/mainframe,
/area/tcommsat/server)
"oOS" = (
diff --git a/_maps/map_files/RadStation/RadStation.dmm b/_maps/map_files/RadStation/RadStation.dmm
index e868e2ba67069..0860f3be74112 100644
--- a/_maps/map_files/RadStation/RadStation.dmm
+++ b/_maps/map_files/RadStation/RadStation.dmm
@@ -7033,6 +7033,15 @@
/obj/machinery/meter,
/turf/open/floor/iron/tech,
/area/engine/engine_room)
+"cqV" = (
+/obj/machinery/firealarm/directional/south,
+/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{
+ dir = 1
+ },
+/turf/open/floor/iron/dark/telecomms{
+ initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
+ },
+/area/tcommsat/computer)
"cqW" = (
/obj/machinery/light{
dir = 4
@@ -14195,6 +14204,18 @@
/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4,
/turf/open/floor/iron/white,
/area/science/research)
+"eAA" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/machinery/atmospherics/components/unary/thermomachine/freezer/on{
+ dir = 8;
+ initialize_directions = 8
+ },
+/turf/open/floor/circuit/telecomms/mainframe{
+ initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
+ },
+/area/tcommsat/computer)
"eAC" = (
/turf/closed/wall,
/area/security/checkpoint/medical)
@@ -34417,20 +34438,6 @@
dir = 8
},
/area/hallway/primary/central)
-"kYm" = (
-/obj/item/radio/intercom{
- pixel_y = -35
- },
-/obj/machinery/atmospherics/components/unary/portables_connector{
- dir = 1
- },
-/obj/machinery/airalarm/directional/south,
-/obj/machinery/portable_atmospherics/canister/plasma,
-/obj/effect/mapping_helpers/atmos_auto_connect,
-/turf/open/floor/iron/dark/telecomms{
- initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
- },
-/area/engine/gravity_generator)
"kYr" = (
/obj/structure/sign/warning/nosmoking,
/turf/closed/wall,
@@ -36083,18 +36090,6 @@
dir = 1
},
/area/science/research)
-"lxG" = (
-/obj/effect/turf_decal/stripes/line{
- dir = 8
- },
-/obj/machinery/atmospherics/components/unary/thermomachine/freezer/on{
- dir = 8;
- initialize_directions = 8
- },
-/turf/open/floor/circuit/telecomms/mainframe{
- initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
- },
-/area/engine/gravity_generator)
"lyc" = (
/obj/effect/spawner/structure/window,
/turf/open/floor/plating,
@@ -43941,6 +43936,16 @@
},
/turf/open/floor/iron,
/area/quartermaster/sorting)
+"nTp" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 4
+ },
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/machinery/telecomms/hub/preset,
+/turf/open/floor/circuit/green/telecomms/mainframe,
+/area/tcommsat/server)
"nTI" = (
/obj/structure/chair/wood/wings,
/turf/open/floor/carpet/green,
@@ -44165,28 +44170,6 @@
"nXU" = (
/turf/closed/wall,
/area/hallway/secondary/exit/departure_lounge)
-"nXV" = (
-/obj/machinery/status_display/evac{
- pixel_y = 32
- },
-/obj/structure/table/reinforced,
-/obj/effect/spawner/lootdrop/aimodule_harmful,
-/obj/effect/spawner/lootdrop/aimodule_harmful,
-/obj/effect/spawner/lootdrop/aimodule_harmful,
-/obj/structure/window/reinforced/spawner/east{
- dir = 8
- },
-/obj/machinery/door/window/brigdoor/northright{
- dir = 2;
- name = "Security Boards";
- req_access_txt = "16"
- },
-/obj/effect/turf_decal/stripes/line,
-/obj/machinery/camera/autoname/directional/east{
- network = list("aiupload")
- },
-/turf/open/floor/circuit,
-/area/ai_monitored/turret_protected/ai_upload)
"nYc" = (
/obj/structure/cable/yellow{
icon_state = "1-2"
@@ -48451,6 +48434,28 @@
/obj/machinery/advanced_airlock_controller/directional/north,
/turf/open/floor/iron,
/area/hallway/secondary/entry)
+"plH" = (
+/obj/machinery/status_display/evac{
+ pixel_y = 32
+ },
+/obj/structure/table/reinforced,
+/obj/effect/spawner/lootdrop/aimodule_harmful,
+/obj/effect/spawner/lootdrop/aimodule_harmful,
+/obj/effect/spawner/lootdrop/aimodule_harmful,
+/obj/structure/window/reinforced/spawner/east{
+ dir = 8
+ },
+/obj/machinery/door/window/brigdoor/northright{
+ dir = 2;
+ name = "Security Boards";
+ req_access_txt = "16"
+ },
+/obj/effect/turf_decal/stripes/line,
+/obj/machinery/camera/autoname/directional/east{
+ network = list("aiupload")
+ },
+/turf/open/floor/circuit,
+/area/ai_monitored/turret_protected/ai_upload)
"plT" = (
/obj/machinery/airalarm/directional/west,
/obj/effect/turf_decal/tile/blue/half/contrasted{
@@ -48874,6 +48879,15 @@
},
/turf/open/floor/iron/tech,
/area/engine/atmos)
+"psP" = (
+/obj/effect/turf_decal/stripes/line{
+ dir = 8
+ },
+/obj/machinery/blackbox_recorder,
+/turf/open/floor/circuit/telecomms/mainframe{
+ initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
+ },
+/area/tcommsat/computer)
"psU" = (
/obj/effect/turf_decal/bot,
/obj/machinery/light{
@@ -49390,15 +49404,6 @@
dir = 1
},
/area/hallway/primary/central)
-"pBi" = (
-/obj/machinery/firealarm/directional/south,
-/obj/machinery/atmospherics/components/unary/vent_pump/on/layer2{
- dir = 1
- },
-/turf/open/floor/iron/dark/telecomms{
- initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
- },
-/area/engine/gravity_generator)
"pBt" = (
/obj/structure/table/reinforced,
/obj/effect/turf_decal/stripes/line{
@@ -51580,6 +51585,20 @@
/obj/effect/decal/cleanable/cobweb/cobweb2,
/turf/open/floor/plating,
/area/vacant_room/commissary/commissary1)
+"qjt" = (
+/obj/item/radio/intercom{
+ pixel_y = -35
+ },
+/obj/machinery/atmospherics/components/unary/portables_connector{
+ dir = 1
+ },
+/obj/machinery/airalarm/directional/south,
+/obj/machinery/portable_atmospherics/canister/plasma,
+/obj/effect/mapping_helpers/atmos_auto_connect,
+/turf/open/floor/iron/dark/telecomms{
+ initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
+ },
+/area/tcommsat/computer)
"qjH" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/structure/curtain/directional{
@@ -52409,32 +52428,25 @@
},
/turf/open/floor/plating,
/area/maintenance/solars/starboard/fore)
-"qvV" = (
-/obj/machinery/power/apc/auto_name/directional/south,
-/obj/machinery/light_switch/tcomms{
- pixel_x = 12;
- pixel_y = -21
- },
-/obj/machinery/light_switch{
- name = "Control Room light switch";
- pixel_x = -10;
- pixel_y = -21
+"qwL" = (
+/obj/structure/sign/poster/random,
+/turf/closed/wall,
+/area/gateway)
+"qwX" = (
+/obj/structure/extinguisher_cabinet{
+ pixel_y = -33
},
-/obj/machinery/light,
/obj/structure/cable{
- icon_state = "0-4"
+ icon_state = "1-8"
},
-/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4{
- dir = 1
+/obj/machinery/atmospherics/pipe/simple/general/hidden{
+ dir = 5
},
+/obj/machinery/space_heater,
/turf/open/floor/iron/dark/telecomms{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
-/area/engine/gravity_generator)
-"qwL" = (
-/obj/structure/sign/poster/random,
-/turf/closed/wall,
-/area/gateway)
+/area/tcommsat/computer)
"qwZ" = (
/obj/effect/decal/cleanable/dirt/dust,
/obj/effect/landmark/blobstart,
@@ -70281,15 +70293,6 @@
"wfM" = (
/turf/open/floor/plating,
/area/maintenance/port/aft)
-"wfO" = (
-/obj/effect/turf_decal/stripes/line{
- dir = 8
- },
-/obj/machinery/telecomms/hub/preset,
-/turf/open/floor/circuit/telecomms/mainframe{
- initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
- },
-/area/tcommsat/computer)
"wfX" = (
/obj/structure/disposalpipe/segment,
/obj/effect/turf_decal/guideline/guideline_half_edge/blue{
@@ -70663,6 +70666,28 @@
/obj/structure/table/wood,
/turf/open/floor/carpet/green,
/area/hallway/secondary/exit/departure_lounge)
+"wmK" = (
+/obj/machinery/power/apc/auto_name/directional/south,
+/obj/machinery/light_switch/tcomms{
+ pixel_x = 12;
+ pixel_y = -21
+ },
+/obj/machinery/light_switch{
+ name = "Control Room light switch";
+ pixel_x = -10;
+ pixel_y = -21
+ },
+/obj/machinery/light,
+/obj/structure/cable{
+ icon_state = "0-4"
+ },
+/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4{
+ dir = 1
+ },
+/turf/open/floor/iron/dark/telecomms{
+ initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
+ },
+/area/tcommsat/computer)
"wng" = (
/obj/machinery/door/firedoor,
/obj/structure/cable/yellow{
@@ -74009,16 +74034,6 @@
},
/turf/open/floor/iron,
/area/hallway/primary/aft)
-"xtz" = (
-/obj/effect/turf_decal/stripes/line{
- dir = 4
- },
-/obj/effect/turf_decal/stripes/line{
- dir = 8
- },
-/obj/machinery/blackbox_recorder,
-/turf/open/floor/circuit/green/telecomms/mainframe,
-/area/tcommsat/server)
"xtE" = (
/obj/effect/turf_decal/tile/dark_green/fourcorners/contrasted,
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{
@@ -75339,21 +75354,6 @@
},
/turf/open/floor/engine,
/area/security/nuke_storage)
-"xMj" = (
-/obj/structure/extinguisher_cabinet{
- pixel_y = -33
- },
-/obj/structure/cable{
- icon_state = "1-8"
- },
-/obj/machinery/atmospherics/pipe/simple/general/hidden{
- dir = 5
- },
-/obj/machinery/space_heater,
-/turf/open/floor/iron/dark/telecomms{
- initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
- },
-/area/engine/gravity_generator)
"xMx" = (
/obj/effect/turf_decal/stripes/line,
/obj/structure/cable{
@@ -110049,7 +110049,7 @@ eyz
mTR
uTv
uTv
-nXV
+plH
cLD
ogV
buw
@@ -110088,7 +110088,7 @@ cMI
iST
iST
tHK
-ebF
+iST
ebF
ebF
ebF
@@ -110345,7 +110345,7 @@ eSO
qgB
jeN
ief
-kYm
+qjt
ebF
aSY
cSN
@@ -110602,7 +110602,7 @@ xCR
cSZ
oaZ
jHW
-pBi
+cqV
ebF
iUV
eId
@@ -110859,7 +110859,7 @@ pYb
iwO
ghe
kAi
-qvV
+wmK
ebF
oVd
bsT
@@ -111116,7 +111116,7 @@ rEu
qVF
omg
aWq
-xMj
+qwX
ebF
bsT
sYx
@@ -111369,11 +111369,11 @@ uSx
rEW
cJD
kPu
-xtz
+nTp
hoG
oDI
-wfO
-lxG
+psP
+eAA
ebF
tqN
bHa
@@ -111630,7 +111630,7 @@ cMI
iST
iST
iST
-ebF
+iST
ebF
ebF
ebF
diff --git a/beestation.dme b/beestation.dme
index b8d52d1a0c4bc..bd163a329a524 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -509,6 +509,7 @@
#include "code\controllers\subsystem\processing\processing.dm"
#include "code\controllers\subsystem\processing\projectiles.dm"
#include "code\controllers\subsystem\processing\quirks.dm"
+#include "code\controllers\subsystem\processing\servers.dm"
#include "code\controllers\subsystem\processing\singulo.dm"
#include "code\controllers\subsystem\processing\station.dm"
#include "code\controllers\subsystem\processing\wet_floors.dm"
@@ -678,6 +679,7 @@
#include "code\datums\components\remote_materials.dm"
#include "code\datums\components\riding.dm"
#include "code\datums\components\rotation.dm"
+#include "code\datums\components\server.dm"
#include "code\datums\components\seclight_attachable.dm"
#include "code\datums\components\shell.dm"
#include "code\datums\components\shielded.dm"
diff --git a/code/__DEFINES/dcs/signals/signals_obj/signals_machine/signals_machinery.dm b/code/__DEFINES/dcs/signals/signals_obj/signals_machine/signals_machinery.dm
index 0ee2c981e4acd..21102eba3950d 100644
--- a/code/__DEFINES/dcs/signals/signals_obj/signals_machine/signals_machinery.dm
+++ b/code/__DEFINES/dcs/signals/signals_obj/signals_machine/signals_machinery.dm
@@ -16,6 +16,8 @@
#define COMSIG_MACHINERY_POWER_RESTORED "machinery_power_restored"
///from /obj/machinery/set_occupant(atom/movable/O): (new_occupant)
#define COMSIG_MACHINERY_SET_OCCUPANT "machinery_set_occupant"
+///from /obj/machinery/proc/use_power(): (power_used)
+#define COMSIG_MACHINERY_POWER_USED "machinery_power_used"
// /obj/machinery/atmospherics/components/unary/cryo_cell signals
diff --git a/code/__DEFINES/networks.dm b/code/__DEFINES/networks.dm
index c938cdbfb0f9b..31eecf7b0690d 100644
--- a/code/__DEFINES/networks.dm
+++ b/code/__DEFINES/networks.dm
@@ -49,6 +49,7 @@
#define __NETWORK_CARGO "CARGO"
#define __NETWORK_BOTS "BOTS"
#define __NETWORK_COMPUTER "COMPUTER"
+#define __NETWORK_SERVER "SERVER"
#define __NETWORK_CARDS "CARDS"
#define __NETWORK_CIRCUITS "CIRCUITS"
@@ -132,3 +133,6 @@
#define NETWORK_ERROR_BAD_NETWORK "network_error_bad_network"
#define NETWORK_ERROR_BAD_RECEIVER_ID "network_error_bad_receiver_id"
#define NETWORK_ERROR_UNAUTHORIZED "network_error_bad_unauthorized"
+
+// Packet types
+#define PACKET_TYPE_PING "ping"
diff --git a/code/__DEFINES/stat.dm b/code/__DEFINES/stat.dm
index 889c183b21e92..199191d4e68ae 100644
--- a/code/__DEFINES/stat.dm
+++ b/code/__DEFINES/stat.dm
@@ -13,10 +13,12 @@
#define MAX_SATIETY 600
// bitflags for machine stat variable
-#define BROKEN (1<<0)
-#define NOPOWER (1<<1)
-#define MAINT (1<<2) // under maintaince
-#define EMPED (1<<3) // temporary broken by EMP pulse
+#define BROKEN (1<<0)
+#define NOPOWER (1<<1)
+#define MAINT (1<<2) //! under maintenance
+#define EMPED (1<<3) //! temporary broken by EMP pulse
+#define OVERHEATED (1<<4) //! overheated
+#define TURNED_OFF (1<<5) //! turned off
//ai power requirement defines
#define POWER_REQ_ALL 1
diff --git a/code/controllers/subsystem/processing/servers.dm b/code/controllers/subsystem/processing/servers.dm
new file mode 100644
index 0000000000000..8e47f663e45dd
--- /dev/null
+++ b/code/controllers/subsystem/processing/servers.dm
@@ -0,0 +1,4 @@
+PROCESSING_SUBSYSTEM_DEF(servers)
+ name = "Servers"
+ wait = 0.2 SECONDS
+ stat_tag = "SP"
diff --git a/code/controllers/subsystem/research.dm b/code/controllers/subsystem/research.dm
index bc208fcf8f4ae..e39e83a0b1c04 100644
--- a/code/controllers/subsystem/research.dm
+++ b/code/controllers/subsystem/research.dm
@@ -63,9 +63,10 @@ SUBSYSTEM_DEF(research)
bitcoins[i] = bitcoins[i]? bitcoins[i] + result[i] : result[i]
else
for(var/obj/machinery/rnd/server/miner in servers)
- if(miner.working)
- bitcoins = single_server_income.Copy()
- break //Just need one to work.
+ if(miner.machine_stat)
+ continue
+ bitcoins = single_server_income.Copy()
+ break //Just need one to work.
if (!isnull(last_income))
var/income_time_difference = world.time - last_income
science_tech.last_bitcoins = bitcoins // Doesn't take tick drift into account
@@ -77,8 +78,9 @@ SUBSYSTEM_DEF(research)
/datum/controller/subsystem/research/proc/calculate_server_coefficient() //Diminishing returns.
var/list/obj/machinery/rnd/server/active = new()
for(var/obj/machinery/rnd/server/miner in servers)
- if(miner.working)
- active.Add(miner)
+ if(miner.machine_stat)
+ continue
+ active.Add(miner)
var/amt = active.len
if(!amt)
return 0
diff --git a/code/datums/components/ntnet_interface.dm b/code/datums/components/ntnet_interface.dm
index 784eae9e12ece..671bffe09e0ab 100644
--- a/code/datums/components/ntnet_interface.dm
+++ b/code/datums/components/ntnet_interface.dm
@@ -8,7 +8,7 @@
* Arguments:
* * packet_data - Either a list() or a /datum/netdata. If its netdata, the other args are ignored
* * target_id - Target hardware id or network_id for this packet. If we are a network id, then its
- broadcasted to that network.
+ * * broadcasted to that network.
* * passkey - Authentication for the packet. If the target doesn't authenticate the packet is dropped
*/
/datum/proc/ntnet_send(packet_data, target_id = null, passkey = null)
diff --git a/code/datums/components/server.dm b/code/datums/components/server.dm
new file mode 100644
index 0000000000000..ae8cb5a501a8f
--- /dev/null
+++ b/code/datums/components/server.dm
@@ -0,0 +1,72 @@
+#define SPARK_COOLDOWN_TIME 10 SECONDS
+
+// Server component
+// will generate a heat based on the power usage of the machine
+// use only with /obj/machinery
+
+
+
+/datum/component/server
+
+ var/efficiency = 1 // 0 to 1 range
+
+ var/temperature = T20C // current temperature
+ var/warning_temp = T0C + 50 // 50C
+ var/overheated_temp = T0C + 100 // 100C - temperature at which the server stops working
+ var/heat_capacity = 2500 // Used for auxmos heat transfer
+
+ var/heat_generation = 0 // heat generated by the machine
+
+ // if it sparks when overheated
+ var/sparks = TRUE
+ COOLDOWN_DECLARE(spark_cooldown)
+
+/datum/component/server/Initialize()
+ if(!ismachinery(parent)) // currently only compatible with machinery
+ return COMPONENT_INCOMPATIBLE
+ RegisterSignal(parent, COMSIG_MACHINERY_POWER_USED, PROC_REF(ParentPowerUsed))
+ START_PROCESSING(SSservers, src)
+
+/datum/component/server/Destroy(force, silent)
+ . = ..()
+ UnregisterSignal(parent, COMSIG_MACHINERY_POWER_USED)
+ STOP_PROCESSING(SSservers, src)
+
+/datum/component/server/proc/ParentPowerUsed(source, amount, chan)
+ heat_generation += amount * 1000
+
+// server is overheated and doesn't work
+/datum/component/server/proc/overheated(is_overheated)
+ if(is_overheated && sparks && COOLDOWN_FINISHED(src, spark_cooldown))
+ do_sparks(5, FALSE, parent)
+ COOLDOWN_START(src, spark_cooldown, SPARK_COOLDOWN_TIME)
+
+
+/datum/component/server/process(delta_time)
+ var/obj/machinery/parent_machine = parent
+ if(!calculate_temperature())
+ return
+ if(temperature > overheated_temp)
+ if(!(parent_machine.machine_stat & OVERHEATED))
+ overheated(TRUE)
+ parent_machine.set_machine_stat(parent_machine.machine_stat | OVERHEATED)
+ return
+ efficiency = 0
+ else
+ if(parent_machine.machine_stat & OVERHEATED)
+ overheated(FALSE)
+ parent_machine.set_machine_stat(parent_machine.machine_stat & ~OVERHEATED)
+ var/efficiency_change = ((temperature - T20C) / (overheated_temp - T20C))
+ efficiency = clamp(1 - efficiency_change, 0, 1)
+ temperature += heat_generation / heat_capacity
+ heat_generation = 0
+
+/datum/component/server/proc/calculate_temperature()
+ var/turf/turf = get_turf(parent)
+ if(!turf)
+ return FALSE
+ var/datum/gas_mixture/environment = turf.return_air()
+
+ temperature = environment.temperature_share(null, OPEN_HEAT_TRANSFER_COEFFICIENT, temperature, heat_capacity)
+
+#undef SPARK_COOLDOWN_TIME
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 7e6497177ac85..9c90e2b6dcbcb 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -588,10 +588,12 @@ Class Procs:
if(!panel_open)
panel_open = TRUE
icon_state = icon_state_open
+ set_machine_stat(machine_stat & MAINT)
to_chat(user, "You open the maintenance hatch of [src].")
else
panel_open = FALSE
icon_state = icon_state_closed
+ set_machine_stat(machine_stat & ~MAINT)
to_chat(user, "You close the maintenance hatch of [src].")
return 1
return 0
diff --git a/code/game/machinery/telecomms/computers/telemonitor.dm b/code/game/machinery/telecomms/computers/telemonitor.dm
index 048bd813e8bcb..c249c6b615127 100644
--- a/code/game/machinery/telecomms/computers/telemonitor.dm
+++ b/code/game/machinery/telecomms/computers/telemonitor.dm
@@ -1,7 +1,6 @@
/*
- Telecomms monitor tracks the overall trafficing of a telecommunications network
- and displays a heirarchy of linked machines.
+ Telecommunications Monitoring Console displays the status of the telecommunications network it's connected to.
*/
@@ -9,118 +8,80 @@
name = "telecommunications monitoring console"
icon_screen = "comm_monitor"
desc = "Monitors the details of the telecommunications network it's synced with."
-
- var/screen = 0 // the screen number:
- var/list/machinelist = list() // the machines located by the computer
- var/obj/machinery/telecomms/SelectedMachine
-
+ circuit = /obj/item/circuitboard/computer/comm_monitor
+ network_id = __NETWORK_SERVER // if its connected to the default one we will ignore it
var/network = "NULL" // the network to probe
+ var/list/servers = list() // the servers in the network
- var/temp = "" // temporary feedback messages
- circuit = /obj/item/circuitboard/computer/comm_monitor
-/obj/machinery/computer/telecomms/monitor/ui_interact(mob/user)
+/obj/machinery/computer/telecomms/monitor/Initialize(mapload)
. = ..()
- var/dat = "
Telecommunications MonitorTelecommunications Monitor"
-
- switch(screen)
-
-
- // --- Main Menu ---
-
- if(0)
- dat += "
[temp]
"
- dat += "
Current Network: [network]
"
- if(machinelist.len)
- dat += "
Detected Network Entities:"
- for(var/obj/machinery/telecomms/T in machinelist)
- dat += "- [REF(T)] [T.name] ([T.id])
"
- dat += "
"
- dat += "
\[Flush Buffer\]"
- else
- dat += "\[Probe Network\]"
-
-
- // --- Viewing Machine ---
-
- if(1)
- dat += "
[temp]
"
- dat += "\[Main Menu\]"
- dat += "
Current Network: [network]
"
- dat += "Selected Network Entity: [SelectedMachine.name] ([SelectedMachine.id])
"
- dat += "Linked Entities: "
- for(var/obj/machinery/telecomms/T in SelectedMachine.links)
- if(!T.hide)
- dat += "- [REF(T.id)] [T.name] ([T.id])
"
- dat += "
"
-
-
-
- user << browse(dat, "window=comm_monitor;size=575x400")
- onclose(user, "server_control")
-
- temp = ""
- return
-
-
-/obj/machinery/computer/telecomms/monitor/Topic(href, href_list)
- if(..())
- return
-
-
- add_fingerprint(usr)
- usr.set_machine(src)
-
- if(href_list["viewmachine"])
- screen = 1
- for(var/obj/machinery/telecomms/T in machinelist)
- if(T.id == href_list["viewmachine"])
- SelectedMachine = T
- break
-
- if(href_list["operation"])
- switch(href_list["operation"])
-
- if("release")
- machinelist = list()
- screen = 0
-
- if("mainmenu")
- screen = 0
-
- if("probe")
- if(machinelist.len > 0)
- temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -"
-
- else
- for(var/obj/machinery/telecomms/T in urange(25, src))
- if(T.network == network)
- machinelist.Add(T)
+ update_network()
+ RegisterSignal(src, COMSIG_COMPONENT_NTNET_RECEIVE, PROC_REF(ntnet_receive))
- if(!machinelist.len)
- temp = "- FAILED: UNABLE TO LOCATE NETWORK ENTITIES IN \[[network]\] -"
- else
- temp = "- [machinelist.len] ENTITIES LOCATED & BUFFERED -"
-
- screen = 0
-
-
- if(href_list["network"])
-
- var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
- if(newnet && (get_dist(usr, src) <= 1 || issilicon(usr)))
- if(length(newnet) > 15)
- temp = "- FAILED: NETWORK TAG STRING TOO LENGHTLY -"
+/obj/machinery/computer/telecomms/monitor/Destroy()
+ . = ..()
+ UnregisterSignal(src, COMSIG_COMPONENT_NTNET_RECEIVE)
- else
- network = newnet
- screen = 0
- machinelist = list()
- temp = "- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -"
- updateUsrDialog()
- return
+/obj/machinery/computer/telecomms/monitor/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "Telemonitor")
+ ui.set_autoupdate(TRUE)
+ ui.open()
-/obj/machinery/computer/telecomms/monitor/attackby()
+/obj/machinery/computer/telecomms/monitor/ui_act(action, params)
. = ..()
- updateUsrDialog()
+ if(.)
+ return
+ if(action == "change_network")
+ network = params["network_name"]
+ update_network()
+ return TRUE
+ if(action == "delete_server")
+ servers -= params["server_id"]
+
+/obj/machinery/computer/telecomms/monitor/ui_data(mob/user)
+ var/list/data = list()
+ data["network_id"] = network
+ data["current_time"] = world.time
+ data["servers"] = servers
+
+ return data
+
+/obj/machinery/computer/telecomms/monitor/process()
+ get_server_status()
+
+/obj/machinery/computer/telecomms/monitor/proc/get_server_status()
+ if(network_id == __NETWORK_SERVER)
+ return
+ var/data = list()
+ data["type"] = PACKET_TYPE_PING
+ ntnet_send(data, network_id)
+
+/obj/machinery/computer/telecomms/monitor/proc/ntnet_receive(datum/source, datum/netdata/data)
+ if(islist(data.receiver_id))
+ return // if its broadcasting we don't want that packet, its probably our ping
+ servers[data.sender_id] = data.data
+ servers[data.sender_id]["last_update"] = world.time
+ servers[data.sender_id]["sender_id"] = data.sender_id
+
+/obj/machinery/computer/telecomms/monitor/proc/update_network()
+ servers = list()
+ if(!network || network == "NULL")
+ return
+ var/new_network_id = NETWORK_NAME_COMBINE(__NETWORK_SERVER, network) // should result in something like SERVER.TCOMMSAT
+ var/area/A = get_area(src)
+ if(A)
+ if(!A.network_root_id)
+ log_telecomms("Area '[A.name]([REF(A)])' has no network network_root_id, force assigning in object [src]([REF(src)])")
+ SSnetworks.lookup_area_root_id(A)
+ new_network_id = NETWORK_NAME_COMBINE(A.network_root_id, new_network_id) // should result in something like SS13.SERVER.TCOMMSAT
+ else
+ log_telecomms("Created [src]([REF(src)] in nullspace, assuming network to be in station")
+ new_network_id = NETWORK_NAME_COMBINE(STATION_NETWORK_ROOT, new_network_id) // should result in something like SS13.SERVER.TCOMMSAT
+ new_network_id = simple_network_name_fix(new_network_id) // make sure the network name is valid
+ var/datum/ntnet/new_network = SSnetworks.create_network_simple(new_network_id)
+ new_network.move_interface(GetComponent(/datum/component/ntnet_interface), new_network_id, network_id)
+ network_id = new_network_id
diff --git a/code/game/machinery/telecomms/machine_interactions.dm b/code/game/machinery/telecomms/machine_interactions.dm
index 25ca9b563a6e8..5667bebb77478 100644
--- a/code/game/machinery/telecomms/machine_interactions.dm
+++ b/code/game/machinery/telecomms/machine_interactions.dm
@@ -116,6 +116,7 @@
network = params["value"]
links = list()
log_game("[key_name(usr)] has changed the network for [src] at [AREACOORD(src)] to [network].")
+ update_network()
. = TRUE
if("tempfreq")
if(params["value"])
diff --git a/code/game/machinery/telecomms/machines/broadcaster.dm b/code/game/machinery/telecomms/machines/broadcaster.dm
index 7ae10d4ffbbae..87ac18365802a 100644
--- a/code/game/machinery/telecomms/machines/broadcaster.dm
+++ b/code/game/machinery/telecomms/machines/broadcaster.dm
@@ -15,7 +15,8 @@ GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages
telecomms_type = /obj/machinery/telecomms/broadcaster
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 25
+ idle_power_usage = 5
+ active_power_usage = 20
circuit = /obj/item/circuitboard/machine/telecomms/broadcaster
/obj/machinery/telecomms/broadcaster/receive_information(datum/signal/subspace/signal, obj/machinery/telecomms/machine_from)
@@ -46,6 +47,7 @@ GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages
sleep(signal.data["slow"]) // simulate the network lag if necessary
signal.broadcast()
+ use_power(active_power_usage)
if(!GLOB.message_delay)
GLOB.message_delay = 1
diff --git a/code/game/machinery/telecomms/machines/bus.dm b/code/game/machinery/telecomms/machines/bus.dm
index 6846d57098455..f960969eaa841 100644
--- a/code/game/machinery/telecomms/machines/bus.dm
+++ b/code/game/machinery/telecomms/machines/bus.dm
@@ -15,7 +15,8 @@
telecomms_type = /obj/machinery/telecomms/bus
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 50
+ idle_power_usage = 10
+ active_power_usage = 50
netspeed = 40
circuit = /obj/item/circuitboard/machine/telecomms/bus
var/change_frequency = 0
diff --git a/code/game/machinery/telecomms/machines/hub.dm b/code/game/machinery/telecomms/machines/hub.dm
index d8c9b3f478041..7b97ff04b8e7f 100644
--- a/code/game/machinery/telecomms/machines/hub.dm
+++ b/code/game/machinery/telecomms/machines/hub.dm
@@ -15,7 +15,8 @@
telecomms_type = /obj/machinery/telecomms/hub
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 80
+ idle_power_usage = 10
+ active_power_usage = 40
long_range_link = TRUE
netspeed = 40
circuit = /obj/item/circuitboard/machine/telecomms/hub
diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm
index a1c489fe4467b..8879663f62add 100644
--- a/code/game/machinery/telecomms/machines/message_server.dm
+++ b/code/game/machinery/telecomms/machines/message_server.dm
@@ -77,7 +77,7 @@
density = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = 10
- active_power_usage = 100
+ active_power_usage = 40
circuit = /obj/item/circuitboard/machine/telecomms/message_server
var/list/datum/data_tablet_msg/modular_msgs = list()
diff --git a/code/game/machinery/telecomms/machines/processor.dm b/code/game/machinery/telecomms/machines/processor.dm
index 5c6a3f92a9eba..ab5c3c175f7fc 100644
--- a/code/game/machinery/telecomms/machines/processor.dm
+++ b/code/game/machinery/telecomms/machines/processor.dm
@@ -13,7 +13,8 @@
telecomms_type = /obj/machinery/telecomms/processor
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 30
+ idle_power_usage = 10
+ active_power_usage = 30
circuit = /obj/item/circuitboard/machine/telecomms/processor
var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals
diff --git a/code/game/machinery/telecomms/machines/receiver.dm b/code/game/machinery/telecomms/machines/receiver.dm
index 1f0a2ec4753fe..89e1c31cd883a 100644
--- a/code/game/machinery/telecomms/machines/receiver.dm
+++ b/code/game/machinery/telecomms/machines/receiver.dm
@@ -13,7 +13,8 @@
telecomms_type = /obj/machinery/telecomms/receiver
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 30
+ idle_power_usage = 5
+ active_power_usage = 20
circuit = /obj/item/circuitboard/machine/telecomms/receiver
/obj/machinery/telecomms/receiver/receive_signal(datum/signal/subspace/signal)
diff --git a/code/game/machinery/telecomms/machines/relay.dm b/code/game/machinery/telecomms/machines/relay.dm
index 27652e4af2e2a..2d06dd11f8240 100644
--- a/code/game/machinery/telecomms/machines/relay.dm
+++ b/code/game/machinery/telecomms/machines/relay.dm
@@ -12,8 +12,7 @@
desc = "A mighty piece of hardware used to send massive amounts of data far away."
telecomms_type = /obj/machinery/telecomms/relay
density = TRUE
- use_power = IDLE_POWER_USE
- idle_power_usage = 30
+ use_power = NO_POWER_USE // made only so they don't overheat in whatever places they usually are in (exploration shuttle, small rooms in multi-z maps etc.)
netspeed = 5
long_range_link = 1
circuit = /obj/item/circuitboard/machine/telecomms/relay
diff --git a/code/game/machinery/telecomms/machines/server.dm b/code/game/machinery/telecomms/machines/server.dm
index a90f707e6a7be..a967533160486 100644
--- a/code/game/machinery/telecomms/machines/server.dm
+++ b/code/game/machinery/telecomms/machines/server.dm
@@ -12,7 +12,8 @@
telecomms_type = /obj/machinery/telecomms/server
density = TRUE
use_power = IDLE_POWER_USE
- idle_power_usage = 15
+ idle_power_usage = 5
+ active_power_usage = 10
circuit = /obj/item/circuitboard/machine/telecomms/server
var/list/log_entries = list()
var/totaltraffic = 0 // gigabytes (if > 1024, divide by 1024 -> terrabytes)
diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm
index 183c75955b45d..62fc15fd0d93f 100644
--- a/code/game/machinery/telecomms/telecomunications.dm
+++ b/code/game/machinery/telecomms/telecomunications.dm
@@ -18,7 +18,8 @@ GLOBAL_LIST_EMPTY(telecomms_list)
icon = 'icons/obj/machines/telecomms.dmi'
critical_machine = TRUE
light_color = LIGHT_COLOR_CYAN
- /// list of machines this machine is linked to
+ network_id = __NETWORK_SERVER
+ /// /// list of machines this machine is linked to
var/list/links = list()
/**
* associative lazylist list of the telecomms_type of linked telecomms machines and a list of said machines.
@@ -49,6 +50,8 @@ GLOBAL_LIST_EMPTY(telecomms_list)
/// Is it a hidden machine?
var/hide = FALSE
+ var/datum/component/server/server_component
+
/// relay signal to all linked machinery that are of type [filter]. If signal has been sent [amount] times, stop sending
/obj/machinery/telecomms/proc/relay_information(datum/signal/subspace/signal, filter, copysig, amount = 20)
@@ -59,12 +62,16 @@ GLOBAL_LIST_EMPTY(telecomms_list)
CRASH("null or non /obj/machinery/telecomms typepath given as the filter argument! given typepath: [filter]")
var/send_count = 0
-
// Apply some lag based on traffic rates
var/netlag = round(traffic / 50)
if(netlag > signal.data["slow"])
signal.data["slow"] = netlag
+ // Aply some lag from throttling
+ var/efficiency = get_efficiency()
+ var/throttling = (10 - 10 * efficiency)
+ signal.data["slow"] += throttling
+
// Loop through all linked machines and send the signal or copy.
for(var/obj/machinery/telecomms/filtered_machine in links_by_telecomms_type?[filter])
@@ -86,7 +93,7 @@ GLOBAL_LIST_EMPTY(telecomms_list)
if(send_count > 0 && is_freq_listening(signal))
traffic++
-
+ use_power(active_power_usage)
return send_count
/obj/machinery/telecomms/proc/relay_direct_information(datum/signal/signal, obj/machinery/telecomms/machine)
@@ -103,6 +110,9 @@ GLOBAL_LIST_EMPTY(telecomms_list)
/obj/machinery/telecomms/Initialize(mapload)
. = ..()
+ server_component = AddComponent(/datum/component/server) // they generate heat
+ update_network() // we try to connect to NTnet
+ RegisterSignal(src, COMSIG_COMPONENT_NTNET_RECEIVE, PROC_REF(ntnet_receive))
GLOB.telecomms_list += src
if(mapload && autolinkers.len)
return INITIALIZE_HINT_LATELOAD
@@ -114,12 +124,23 @@ GLOBAL_LIST_EMPTY(telecomms_list)
add_automatic_link(telecomms_machine)
/obj/machinery/telecomms/Destroy()
+ UnregisterSignal(src, COMSIG_COMPONENT_NTNET_RECEIVE)
+ server_component = null
GLOB.telecomms_list -= src
for(var/obj/machinery/telecomms/comm in GLOB.telecomms_list)
remove_link(comm)
links = list()
return ..()
+/obj/machinery/telecomms/proc/get_temperature()
+ return server_component.temperature
+
+/obj/machinery/telecomms/proc/get_efficiency()
+ return server_component.efficiency
+
+/obj/machinery/telecomms/proc/get_overheat_temperature()
+ return server_component.overheated_temp
+
// Used in auto linking
/obj/machinery/telecomms/proc/add_automatic_link(obj/machinery/telecomms/T)
var/turf/position = get_turf(src)
@@ -136,6 +157,39 @@ GLOBAL_LIST_EMPTY(telecomms_list)
add_new_link(T)
return
+/obj/machinery/telecomms/proc/update_network()
+ var/area/A = get_area(src)
+ if(!network || network == "NULL" || !A)
+ return
+ var/new_network_id = NETWORK_NAME_COMBINE(__NETWORK_SERVER, network) // should result in something like SERVER.TCOMMSAT
+ if(!A.network_root_id)
+ log_telecomms("Area '[A.name]([REF(A)])' has no network network_root_id, force assigning in object [src]([REF(src)])")
+ SSnetworks.lookup_area_root_id(A)
+ new_network_id = NETWORK_NAME_COMBINE(A.network_root_id, new_network_id) // should result in something like SS13.SERVER.TCOMMSAT
+ else
+ log_telecomms("Created [src]([REF(src)] in nullspace, assuming network to be in station")
+ new_network_id = NETWORK_NAME_COMBINE(STATION_NETWORK_ROOT, new_network_id) // should result in something like SS13.SERVER.TCOMMSAT
+ new_network_id = simple_network_name_fix(new_network_id) // make sure the network name is valid
+ var/datum/ntnet/new_network = SSnetworks.create_network_simple(new_network_id)
+ new_network.move_interface(GetComponent(/datum/component/ntnet_interface), new_network_id, network_id)
+ network_id = new_network_id
+
+/obj/machinery/telecomms/proc/ntnet_receive(datum/source, datum/netdata/data)
+
+ //Check radio signal jamming
+ if(is_jammed(JAMMER_PROTECTION_WIRELESS) || machine_stat & (BROKEN|NOPOWER|MAINT|EMPED))
+ return
+
+ switch(data.data["type"])
+ if(PACKET_TYPE_PING) // we respond to the ping with our status
+ var/list/send_data = list()
+ send_data["name"] = name
+ send_data["temperature"] = get_temperature()
+ send_data["overheat_temperature"] = get_overheat_temperature()
+ send_data["efficiency"] = get_efficiency()
+ send_data["overheated"] = (machine_stat & OVERHEATED)
+
+ ntnet_send(send_data, data["sender_id"])
/obj/machinery/telecomms/update_icon()
if(on)
@@ -153,7 +207,7 @@ GLOBAL_LIST_EMPTY(telecomms_list)
var/newState = on
if(toggled)
- if(machine_stat & (BROKEN|NOPOWER|EMPED)) // if powered, on. if not powered, off. if too damaged, off
+ if(machine_stat & (BROKEN|NOPOWER|EMPED|OVERHEATED)) // if powered, on. if not powered, off. if too damaged, off
newState = FALSE
else
newState = TRUE
diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm
index 687f9da811192..9e728db502056 100644
--- a/code/modules/power/power.dm
+++ b/code/modules/power/power.dm
@@ -78,7 +78,7 @@
return TRUE
if(!loc)
return FALSE
- if(machine_stat & EMPED)
+ if(machine_stat & (EMPED|OVERHEATED))
return FALSE
var/area/A = get_area(src) // make sure it's in an area
if(!A)
@@ -94,6 +94,7 @@
return
if(chan == -1)
chan = power_channel
+ SEND_SIGNAL(src, COMSIG_MACHINERY_POWER_USED, amount, chan)
A.use_power(amount, chan)
/obj/machinery/proc/addStaticPower(value, powerchannel)
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index 2ea70ed407f99..0645cd91e86c3 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -3,11 +3,12 @@
desc = "A computer system running a deep neural network that processes arbitrary information to produce data useable in the development of new technologies. In layman's terms, it makes research points."
icon = 'icons/obj/machines/research.dmi'
icon_state = "RD-server-on"
+ circuit = /obj/item/circuitboard/machine/rdserver
+
+ idle_power_usage = 5 // having servers online uses a little bit of power
+ active_power_usage = 50 // mining uses a lot of power
+
var/datum/techweb/stored_research
- //Code for point mining here.
- var/overheated = FALSE
- var/working = TRUE
- var/research_disabled = FALSE
var/server_id = 0
var/heat_gen = 1
// some notes on this number
@@ -17,24 +18,12 @@
// 7.40./2 = 3.70 (note, all these values are rounded). This is howw this number was found.
var/base_mining_income = 3.70
- // Heating is weird. Since the servers are stored in a room that sucks air in one vent, into a pipe network, to a
- // T1 freezer, then out another vent at standard presure, the rooms temps could vary as wieldy as 100K. The T1 freezer
- // has 10000 heat power at the start, so each of the servers produce that but only heat a quarter of the turf
- // This allows the servers to rapidly heat up in under 5 min to the shut off point and make it annoying to cool back
- // down, giving time for RD to fire the guy who shut off the cooler
-
- var/heating_power = 10000 // Changed the value from 40000. Just enough for a T1 freezer to keep up with 2 of them
- var/heating_effecency = 0.25
- var/temp_tolerance_low = T0C
- var/temp_tolerance_high = T20C
- var/temp_tolerance_damage = T0C + 200 // Most CPUS get up to 200C they start breaking. TODO: Start doing damage to the server?
- var/temp_penalty_coefficient = 0.5 //1 = -1 points per degree above high tolerance. 0.5 = -0.5 points per degree above high tolerance.
- var/current_temp = -1
req_access = list(ACCESS_RD_SERVER) //ONLY THE R&D, AND WHO HAVE THE ACCESS TO CAN CHANGE SERVER SETTINGS.
+ var/datum/component/server/server_component
/obj/machinery/rnd/server/Initialize(mapload)
. = ..()
-
+ server_component = AddComponent(/datum/component/server)
server_id = 0
while(server_id == 0)
var/test_id = rand(1,65535)
@@ -47,10 +36,9 @@
name += " [uppertext(num2hex(server_id, -1))]" //gives us a random four-digit hex number as part of the name. Y'know, for fluff.
SSresearch.servers |= src
stored_research = SSresearch.science_tech
- // The +10 is so the sparks work
- RefreshParts()
/obj/machinery/rnd/server/Destroy()
+ server_component = null
SSresearch.servers -= src
return ..()
@@ -58,7 +46,7 @@
var/tot_rating = 0
for(var/obj/item/stock_parts/SP in src)
tot_rating += SP.rating
- heat_gen = initial(src.heat_gen) / max(1, tot_rating)
+ active_power_usage = initial(src.active_power_usage) / max(1, tot_rating)
/obj/machinery/rnd/server/update_icon()
if (panel_open)
@@ -67,95 +55,37 @@
if (machine_stat & EMPED || machine_stat & NOPOWER)
icon_state = "RD-server-off"
return
- if (research_disabled || overheated)
+ if (machine_stat & (TURNED_OFF|OVERHEATED))
icon_state = "RD-server-halt"
return
icon_state = "RD-server-on"
-/obj/machinery/rnd/server/power_change()
- . = ..()
- refresh_working()
- return
-
-/obj/machinery/rnd/server/process()
- if(!working)
- current_temp = -1
- return
- var/turf/L = get_turf(src)
- var/datum/gas_mixture/env
- if(istype(L))
- env = L.return_air()
- // This is from the RD server code. It works well enough but I need to move over the
- // sspace heater code so we can caculate power used per tick as well and making this both
- // exothermic and an endothermic component
- if(env)
- var/perc = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient / base_mining_income
-
- env.adjust_heat(heating_power * perc * heat_gen)
- air_update_turf()
- src.air_update_turf()
- else
- current_temp = env ? env.return_temperature() : -1
-
-/obj/machinery/rnd/server/proc/get_env_temp()
- // if we are on and ran though one tick
- if(working && current_temp >= 0)
- return current_temp
- else
- // otherwise we get the temp from the turf
- var/turf/L = get_turf(src)
- var/datum/gas_mixture/env
- if(istype(L))
- env = L.return_air()
- return env ? env.return_temperature() : T20C // env might be null at round start. This stops runtimes
-
-/obj/machinery/rnd/server/proc/refresh_working()
- var/current_temp = get_env_temp()
-
- // Once we go over the damage temp, the breaker is flipped
- // Power is still going to the server
- if(!overheated && current_temp >= temp_tolerance_damage)
- investigate_log("[src] overheated!", INVESTIGATE_RESEARCH) // Do we need this?
- overheated = TRUE
-
- // If we are over heated, the server will not restart till
- // eveything is at a safe temp
- if(overheated && current_temp <= temp_tolerance_low)
- overheated = FALSE
-
- // If we are overheateed, start shooting out sparks
- // don't shoot them if we have no power
- if(overheated && !(machine_stat & NOPOWER) && prob(40))
- do_sparks(5, FALSE, src)
-
- if(overheated || research_disabled || machine_stat & EMPED || machine_stat & NOPOWER)
- working = FALSE
- else
- working = TRUE
-
- update_icon()
-
-/obj/machinery/rnd/server/emp_act()
- . = ..()
- refresh_working()
-
-/obj/machinery/rnd/server/emp_reset()
- ..()
- refresh_working()
/obj/machinery/rnd/server/proc/toggle_disable()
- research_disabled = !research_disabled
- refresh_working()
+ set_machine_stat(machine_stat ^ TURNED_OFF)
/obj/machinery/rnd/server/proc/mine()
- // Cheap way to refresh if we are operational or not. mine() is run on the tech web
- // subprocess. This saves us having to run our own subprocess
- refresh_working()
- if(working)
- var/penalty = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient
- return list(TECHWEB_POINT_TYPE_GENERIC = max(base_mining_income - penalty, 0))
- else
- return list(TECHWEB_POINT_TYPE_GENERIC = 0)
+ use_power(active_power_usage, power_channel)
+ var/efficiency = get_efficiency()
+ if(!powered() || efficiency <= 0 && machine_stat)
+ return null
+ return list(TECHWEB_POINT_TYPE_GENERIC = max(base_mining_income * efficiency, 0))
+
+/obj/machinery/rnd/server/proc/get_temperature()
+ return server_component.temperature
+
+/obj/machinery/rnd/server/proc/get_overheat_temperature()
+ return server_component.overheated_temp
+
+/obj/machinery/rnd/server/proc/get_warning_temperature()
+ return server_component.warning_temp
+
+/obj/machinery/rnd/server/proc/get_efficiency()
+ return server_component.efficiency
+
+/obj/machinery/rnd/server/on_set_machine_stat(old_value)
+ . = ..()
+ update_appearance()
/obj/machinery/computer/rdservercontrol
name = "R&D Server Controller"
@@ -182,11 +112,11 @@
servers += list(list(
"name" = S.name,
"server_id" = S.server_id,
- "temperature" = S.get_env_temp(),
- "temperature_warning" = S.temp_tolerance_high,
- "temperature_max" = S.temp_tolerance_damage,
- "enabled" = !S.research_disabled,
- "overheated" = S.overheated,
+ "temperature" = S.get_temperature(),
+ "temperature_warning" = S.get_warning_temperature(),
+ "temperature_max" = S.get_overheat_temperature(),
+ "enabled" = !(S.machine_stat & TURNED_OFF), // displays state of the power button as you can turn on/off servers using this console
+ "overheated" = (S.machine_stat & OVERHEATED),
))
data["servers"] = servers
@@ -222,7 +152,7 @@
if(S.server_id == test_id)
S.toggle_disable()
- investigate_log("[S.name] was turned [S.research_disabled ? "off" : "on"] by [key_name(usr)]", INVESTIGATE_RESEARCH)
+ investigate_log("[S.name] was turned [(S.machine_stat & TURNED_OFF) ? "off" : "on"] by [key_name(usr)]", INVESTIGATE_RESEARCH)
. = TRUE
break
diff --git a/tgui/packages/tgui/interfaces/Telemonitor.tsx b/tgui/packages/tgui/interfaces/Telemonitor.tsx
new file mode 100644
index 0000000000000..9c034a2d325ae
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/Telemonitor.tsx
@@ -0,0 +1,79 @@
+import { useBackend } from '../backend';
+import { Input, Section, Stack, ProgressBar, Button, Flex } from '../components';
+import { Window } from '../layouts';
+type Tdata = {
+ network_id: string;
+ current_time: number; // world.time during ui_update
+ servers: {
+ name: string; // name of the server
+ sender_id: string; // hardware id of the server
+ temperature: number; // Kelvins
+ overheat_temperature: number; // Kelvins
+ efficiency: number; // 0-1 range
+ last_update: number; // world.time of last update
+ overheated: boolean; // true/false
+ }[];
+};
+export const Telemonitor = (props, context) => {
+ const { act, data } = useBackend(context);
+ const isOnline = function (server) {
+ return Math.floor((data.current_time - server.last_update) / 10) < 10;
+ };
+ return (
+
+
+
+ {data.servers.length === 0 ? (
+
+
+ Searching for servers
+ .
+ .
+ .
+
+
+ ) : (
+
+ {Object.values(data.servers).map((server) => (
+
+
+ {isOnline(server) ? (server.overheated ? 'OVERHEATED' : 'ONLINE') : 'OFFLINE'}
+
+ }>
+ Efficiency:{' '}
+
+ Temperature: {Math.round(server.temperature)}K
+
+
+ ))}
+
+ )}
+
+
+ );
+};