From e8d1502beaf5120362b9df31d2ea46b591e7e3b2 Mon Sep 17 00:00:00 2001
From: SkyratBot <59378654+SkyratBot@users.noreply.github.com>
Date: Thu, 28 Dec 2023 16:44:34 +0100
Subject: [PATCH] [MIRROR] Reverts Canister Wiring (#80265) [MDB IGNORE]
(#25875)
* Reverts Canister Wiring (#80265) (#80607)
## About The Pull Request
Reverts #80265
It's a cool idea, but the ability to toggle valves/control pressure make
this just a ttv but without the access issues we tie to that.
Eats into that space way too much.
Removing those but not the rest results in disappointment, so I'm just
full removing this.
I am keeping the code quality changes, screentips, that sort of thing
tho. That bit goes hard.
Also, refactored a few procs slightly to make them easier to read. Early
returns, sane loops, etc.
## Why It's Good For The Game
Closes #80604
Cheap remote mass producible maxcaps are a bad idea actually
Sorry I didn't catch this in review, been resting for the week
## Changelog
:cl:
del: Removes the wires from canisters. It's a cool idea, but cheap
controlled maxcaps are bad actually
/:cl:
* Reverts Canister Wiring (#80265)
---------
Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
---
code/__DEFINES/wires.dm | 6 -
code/datums/wires/canister.dm | 33 ----
.../machinery/portable/canister.dm | 151 ++++++------------
tgstation.dme | 1 -
4 files changed, 45 insertions(+), 146 deletions(-)
delete mode 100644 code/datums/wires/canister.dm
diff --git a/code/__DEFINES/wires.dm b/code/__DEFINES/wires.dm
index 633dcc360c2..2b4c528abc2 100644
--- a/code/__DEFINES/wires.dm
+++ b/code/__DEFINES/wires.dm
@@ -64,12 +64,6 @@
#define WIRE_ZAP1 "High Voltage Circuit 1"
#define WIRE_ZAP2 "High Voltage Circuit 2"
#define WIRE_OVERCLOCK "Overclock"
-#define WIRE_VALVE "Valve"
-#define WIRE_SHIELDING "Shielding"
-#define WIRE_REGULATOR_MIN "Minimize Regulator Pressure"
-#define WIRE_REGULATOR_MAX "Maximize Regulator Pressure"
-#define WIRE_TANK_EJECT "Eject Tank"
-#define WIRE_REACTION_SUPPRESSION "Reaction Suppression"
// Wire states for the AI
#define AI_WIRE_NORMAL 0
diff --git a/code/datums/wires/canister.dm b/code/datums/wires/canister.dm
deleted file mode 100644
index c692ff22872..00000000000
--- a/code/datums/wires/canister.dm
+++ /dev/null
@@ -1,33 +0,0 @@
-/datum/wires/canister
- holder_type = /obj/machinery/portable_atmospherics/canister
- proper_name = "Canister"
-
-/datum/wires/canister/New(atom/holder)
- wires = list(WIRE_VALVE, WIRE_SHIELDING, WIRE_REGULATOR_MIN, WIRE_REGULATOR_MAX, WIRE_TANK_EJECT, WIRE_REACTION_SUPPRESSION)
- ..()
-
-/datum/wires/canister/on_pulse(wire)
- var/obj/machinery/portable_atmospherics/canister/the_canister = holder
- if(!the_canister.internal_cell)
- return
- switch(wire)
- if(WIRE_VALVE)
- the_canister.toggle_valve(usr, wire_pulsed = TRUE)
- if(WIRE_SHIELDING)
- the_canister.toggle_shielding(usr, wire_pulsed = TRUE)
- if(WIRE_TANK_EJECT)
- the_canister.eject_tank(usr, wire_pulsed = TRUE)
- if(WIRE_REGULATOR_MIN)
- the_canister.release_pressure = CAN_MIN_RELEASE_PRESSURE
- the_canister.investigate_log("was set to [the_canister.release_pressure] kPa by [key_name(usr)] via wire pulse.", INVESTIGATE_ATMOS)
- if(WIRE_REGULATOR_MAX)
- the_canister.release_pressure = CAN_MAX_RELEASE_PRESSURE
- the_canister.investigate_log("was set to [the_canister.release_pressure] kPa by [key_name(usr)] via wire pulse.", INVESTIGATE_ATMOS)
- if(WIRE_REACTION_SUPPRESSION)
- the_canister.toggle_reaction_suppression(usr, wire_pulsed = TRUE)
-
-/datum/wires/canister/can_reveal_wires(mob/user)
- if(HAS_TRAIT(user, TRAIT_KNOW_ENGI_WIRES))
- return TRUE
-
- return ..()
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index bef8eb7300d..18fe9817e81 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -38,12 +38,6 @@
var/obj/item/stock_parts/cell/internal_cell
///used while processing to update appearance only when its pressure state changes
var/current_pressure_state
- /// An assembly attached to the canister
- var/obj/item/assembly_holder/rig = null
- /// The person who attached an assembly to this canister, usually for ignition purposes in tandem with valve wire pulse
- var/mob/last_rigger = ""
- //overlay of attached assemblies
- var/mutable_appearance/assemblies_overlay
/datum/armor/portable_atmospherics_canister
melee = 50
@@ -60,8 +54,6 @@
if(mapload)
internal_cell = new /obj/item/stock_parts/cell/high(src)
- set_wires(new /datum/wires/canister(src))
-
if(existing_mixture)
air_contents.copy_from(existing_mixture)
else
@@ -81,17 +73,6 @@
AddComponent(/datum/component/gas_leaker, leak_rate=0.01)
register_context()
-/obj/machinery/portable_atmospherics/canister/Destroy()
- QDEL_NULL(wires)
- return ..()
-
-/obj/machinery/portable_atmospherics/canister/Exited(atom/movable/gone)
- if(gone == rig)
- rig = null
- last_rigger = null
- cut_overlays(assemblies_overlay)
- return ..()
-
/obj/machinery/portable_atmospherics/canister/interact(mob/user)
. = ..()
if(!allowed(user))
@@ -101,14 +82,10 @@
/obj/machinery/portable_atmospherics/canister/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
- if(rig)
- context[SCREENTIP_CONTEXT_RMB] = "Remove rigged device"
if(holding)
context[SCREENTIP_CONTEXT_ALT_LMB] = "Remove tank"
if(!held_item)
return CONTEXTUAL_SCREENTIP_SET
- if(istype(held_item, /obj/item/assembly_holder))
- context[SCREENTIP_CONTEXT_LMB] = "Rig"
if(istype(held_item, /obj/item/stock_parts/cell))
context[SCREENTIP_CONTEXT_LMB] = "Insert cell"
switch(held_item.tool_behaviour)
@@ -132,11 +109,6 @@
. += span_notice("Warning, no cell installed, use a screwdriver to open the hatch and insert one.")
if(panel_open)
. += span_notice("Hatch open, close it with a screwdriver.")
- if(get_dist(user, src) <= 2)
- if(rig)
- . += span_warning("There is some kind of device rigged to the canister!")
- else
- . += span_notice("It looks like you could rig a device to the canister.")
// Please keep the canister types sorted
// Basic canister per gas below here
@@ -411,50 +383,8 @@
balloon_alert(user, "you install the cell")
internal_cell = active_cell
return TRUE
- if(is_wire_tool(item) && panel_open)
- wires.interact(user)
- return
- if(istype(item, /obj/item/assembly_holder))
- if(rig)
- balloon_alert(user, "another device is in the way!")
- return ..()
- var/obj/item/assembly_holder/holder = item
-
- user.balloon_alert_to_viewers("attaching rig...")
- add_fingerprint(user)
- if(!do_after(user, 2 SECONDS, target = src) || !user.transferItemToLoc(holder, src))
- return
- rig = holder
- holder.master = src
- holder.on_attach()
- assemblies_overlay = holder
- assemblies_overlay.layer = 3.3
- assemblies_overlay.pixel_y -= 5
- add_overlay(assemblies_overlay)
- log_bomber(user, "attached [holder.name] to ", src)
- last_rigger = user
- user.balloon_alert_to_viewers("attached rig")
- return
-
return ..()
-/obj/machinery/portable_atmospherics/canister/attack_hand_secondary(mob/user, list/modifiers)
- if(!rig)
- return
- // mousetrap rigs only make sense if you can set them off, can't step on them
- // If you see a mousetrap-rigged fuel tank, just leave it alone
- rig.on_found()
- if(QDELETED(src))
- return
- user.balloon_alert_to_viewers("detaching rig...")
- if(!do_after(user, 2 SECONDS, target = src))
- return
- user.balloon_alert_to_viewers("detached rig")
- user.log_message("detached [rig] from [src].", LOG_GAME)
- if(!user.put_in_hands(rig))
- rig.forceMove(get_turf(user))
- return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN
-
/obj/machinery/portable_atmospherics/canister/screwdriver_act(mob/living/user, obj/item/screwdriver)
if(default_deconstruction_screwdriver(user, icon_state, icon_state, screwdriver))
update_appearance()
@@ -723,39 +653,47 @@
update_appearance()
-
/// Opens/closes the canister valve
/obj/machinery/portable_atmospherics/canister/proc/toggle_valve(mob/user, wire_pulsed = FALSE)
- var/logmsg
- var/admin_msg
- var/danger = FALSE
- var/n = 0
valve_open = !valve_open
- if(valve_open)
- SSair.start_processing_machine(src)
- logmsg = "Valve was opened by [key_name(user)] [wire_pulsed ? "via wire pulse" : ""], starting a transfer into \the [holding || "air"].
"
- if(!holding)
- var/list/gaseslog = list() //list for logging all gases in canister
- for(var/id in air_contents.gases)
- var/gas = air_contents.gases[id]
- gaseslog[gas[GAS_META][META_GAS_NAME]] = gas[MOLES] //adds gases to gaseslog
- if(!gas[GAS_META][META_GAS_DANGER])
- continue
- if(gas[MOLES] > (gas[GAS_META][META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
- danger = TRUE //at least 1 danger gas
- logmsg = "[key_name(user)] opened a canister [wire_pulsed ? "via wire pulse" : ""] that contains the following:"
- admin_msg = "[ADMIN_LOOKUPFLW(user)] opened a canister [wire_pulsed ? "via wire pulse" : ""] that contains the following at [ADMIN_VERBOSEJMP(src)]:"
- for(var/name in gaseslog)
- n = n + 1
- logmsg += "\n[name]: [gaseslog[name]] moles."
- if(n <= 5) //the first five gases added
- admin_msg += "\n[name]: [gaseslog[name]] moles."
- if(n == 5 && length(gaseslog) > 5) //message added if more than 5 gases
- admin_msg += "\nToo many gases to log. Check investigate log."
- if(danger) //sent to admin's chat if contains dangerous gases
- message_admins(admin_msg)
- else
- logmsg = "valve was closed by [key_name(user)] [wire_pulsed ? "via wire pulse" : ""], stopping the transfer into \the [holding || "air"].
"
+ if(!valve_open)
+ var/logmsg = "valve was closed by [key_name(user)] [wire_pulsed ? "via wire pulse" : ""], stopping the transfer into \the [holding || "air"].
"
+ investigate_log(logmsg, INVESTIGATE_ATMOS)
+ release_log += logmsg
+ return
+
+ SSair.start_processing_machine(src)
+ if(holding)
+ var/logmsg = "Valve was opened by [key_name(user)] [wire_pulsed ? "via wire pulse" : ""], starting a transfer into \the [holding || "air"].
"
+ investigate_log(logmsg, INVESTIGATE_ATMOS)
+ release_log += logmsg
+ return
+
+ // Go over the gases in canister, pull all their info and mark the spooky ones
+ var/list/output = list()
+ output += "[key_name(user)] opened a canister [wire_pulsed ? "via wire pulse" : ""] that contains the following:"
+ var/list/admin_output = list()
+ admin_output += "[ADMIN_LOOKUPFLW(user)] opened a canister [wire_pulsed ? "via wire pulse" : ""] that contains the following at [ADMIN_VERBOSEJMP(src)]:"
+ var/list/gases = air_contents.gases
+ var/danger = FALSE
+ for(var/gas_index in 1 to length(gases))
+ var/list/gas_info = gases[gases[gas_index]]
+ var/list/meta = gas_info[GAS_META]
+ var/name = meta[META_GAS_NAME]
+ var/moles = gas_info[MOLES]
+
+ output += "[name]: [moles] moles."
+ if(gas_index <= 5) //the first five gases added
+ admin_output += "[name]: [moles] moles."
+ else if(gas_index == 6) // anddd the warning
+ admin_output += "Too many gases to log. Check investigate log."
+ //if moles_visible is undefined, default to default visibility
+ if(meta[META_GAS_DANGER] && moles > (meta[META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE))
+ danger = TRUE
+
+ if(danger) //sent to admin's chat if contains dangerous gases
+ message_admins(admin_output.Join("\n"))
+ var/logmsg = output.Join("\n")
investigate_log(logmsg, INVESTIGATE_ATMOS)
release_log += logmsg
@@ -769,12 +707,13 @@
/// Ejects tank from canister, if any
/obj/machinery/portable_atmospherics/canister/proc/eject_tank(mob/user, wire_pulsed = FALSE)
- if(holding)
- if(valve_open)
- message_admins("[ADMIN_LOOKUPFLW(user)] removed [holding] from [src] with valve still open [wire_pulsed ? "via wire pulse" : ""] at [ADMIN_VERBOSEJMP(src)] releasing contents into the [span_boldannounce("air")].")
- user.investigate_log("removed the [holding] [wire_pulsed ? "via wire pulse" : ""], leaving the valve open and transferring into the [span_boldannounce("air")].", INVESTIGATE_ATMOS)
- replace_tank(user, FALSE)
- return TRUE
+ if(!holding)
+ return FALSE
+ if(valve_open)
+ message_admins("[ADMIN_LOOKUPFLW(user)] removed [holding] from [src] with valve still open [wire_pulsed ? "via wire pulse" : ""] at [ADMIN_VERBOSEJMP(src)] releasing contents into the [span_boldannounce("air")].")
+ user.investigate_log("removed the [holding] [wire_pulsed ? "via wire pulse" : ""], leaving the valve open and transferring into the [span_boldannounce("air")].", INVESTIGATE_ATMOS)
+ replace_tank(user, FALSE)
+ return TRUE
/// Turns hyper-noblium crystal reaction suppression in the canister on or off
/obj/machinery/portable_atmospherics/canister/proc/toggle_reaction_suppression(mob/user, wire_pulsed = FALSE)
diff --git a/tgstation.dme b/tgstation.dme
index b06cf4b55b9..1615237a9b7 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -1904,7 +1904,6 @@
#include "code\datums\wires\airlock.dm"
#include "code\datums\wires\apc.dm"
#include "code\datums\wires\autolathe.dm"
-#include "code\datums\wires\canister.dm"
#include "code\datums\wires\conveyor.dm"
#include "code\datums\wires\ecto_sniffer.dm"
#include "code\datums\wires\emitter.dm"