[MIRROR] Thermomachines no longer self-destruct when built on blocked ports [MDB IGNORE] (#19664)

* Thermomachines no longer self-destruct when built on blocked ports (#73580)

## About The Pull Request

Ever felt the utter pain when you make a new thermomachine, hook it up
perfectly and then screwdriver it only for it to immediately become a
pile of iron and components without warning? This PR fixes that.

Instead of doing what it did previously, it unanchors itself and opens
its panel.

Right, almost forgot to mention, failing to wrench down a thermomachine
no longer bonks it with the wrench.

Due to not being allowed to use visual messages for when the port is
blocked, I've added a mob/user variable to all on_construction() procs.
(This allowed me to use balloon messages instead.)
## Why It's Good For The Game

Saves a lot of unnecessary headaches when working with thermomachines.
## Changelog
🆑
fix: Atmosians have finally convinced the thermomachines to not
self-destruct when built on blocked ports.
fix: Failing to wrench down a thermomachine no longer hits it with the
wrench.
/🆑

* Thermomachines no longer self-destruct when built on blocked ports

---------

Co-authored-by: RikuTheKiller <88713943+RikuTheKiller@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-03-04 19:53:44 -08:00
committed by GitHub
co-authored by RikuTheKiller
parent 3f1372f597
commit 320cb90555
13 changed files with 23 additions and 19 deletions
@@ -461,7 +461,7 @@
PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
return pipe_overlay
/obj/machinery/atmospherics/on_construction(obj_color, set_layer = PIPING_LAYER_DEFAULT)
/obj/machinery/atmospherics/on_construction(mob/user, obj_color, set_layer = PIPING_LAYER_DEFAULT)
if(can_unwrench)
add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY)
set_pipe_color(obj_color)
@@ -97,7 +97,7 @@
airs[i] = null
return ..()
/obj/machinery/atmospherics/components/on_construction()
/obj/machinery/atmospherics/components/on_construction(mob/user)
. = ..()
update_parents()
@@ -563,7 +563,7 @@
var/obj/machinery/atmospherics/components/tank/new_tank = new(build_location)
var/list/new_custom_materials = list((material_end_product) = TANK_PLATING_SHEETS * MINERAL_MATERIAL_AMOUNT)
new_tank.set_custom_materials(new_custom_materials)
new_tank.on_construction(new_tank.pipe_color, new_tank.piping_layer)
new_tank.on_construction(user, new_tank.pipe_color, new_tank.piping_layer)
to_chat(user, span_notice("[new_tank] has been sealed and is ready to accept gases."))
qdel(src)
@@ -147,8 +147,8 @@
. = ..()
update_appearance()
/obj/machinery/atmospherics/components/unary/cryo_cell/on_construction()
..(dir, dir)
/obj/machinery/atmospherics/components/unary/cryo_cell/on_construction(mob/user)
..(user, dir, dir)
/obj/machinery/atmospherics/components/unary/cryo_cell/RefreshParts()
. = ..()
@@ -49,16 +49,20 @@
return FALSE
. = ..()
/obj/machinery/atmospherics/components/unary/thermomachine/on_construction(obj_color, set_layer)
/obj/machinery/atmospherics/components/unary/thermomachine/on_construction(mob/user, obj_color, set_layer)
var/obj/item/circuitboard/machine/thermomachine/board = circuit
if(board)
piping_layer = board.pipe_layer
set_layer = piping_layer
..() //Skipping the rest of on_construction() would be a bad idea so we clean up after it instead.
if(check_pipe_on_turf())
deconstruct(TRUE)
return
return..()
set_anchored(FALSE)
set_panel_open(TRUE)
change_pipe_connection(TRUE)
icon_state = "thermo-open"
balloon_alert(user, "the port is already in use!")
/obj/machinery/atmospherics/components/unary/thermomachine/RefreshParts()
. = ..()
@@ -213,13 +217,13 @@
if(device == src)
continue
if(device.piping_layer == piping_layer)
visible_message(span_warning("A pipe is hogging the port, remove the obstruction or change the machine piping layer."))
return TRUE
return FALSE
/obj/machinery/atmospherics/components/unary/thermomachine/wrench_act_secondary(mob/living/user, obj/item/tool)
if(!panel_open || check_pipe_on_turf())
return
visible_message(span_warning("A pipe is hogging the port, remove the obstruction or change the machine piping layer."))
return TOOL_ACT_TOOLTYPE_SUCCESS
if(default_unfasten_wrench(user, tool))
return TOOL_ACT_TOOLTYPE_SUCCESS
return
@@ -13,7 +13,7 @@
/obj/machinery/atmospherics/components/unary/set_init_directions()
initialize_directions = dir
/obj/machinery/atmospherics/components/unary/on_construction()
/obj/machinery/atmospherics/components/unary/on_construction(mob/user)
..()
update_appearance()
+1 -1
View File
@@ -32,7 +32,7 @@
. = ..()
packin_up()
/obj/machinery/computer/cargo/express/on_construction()
/obj/machinery/computer/cargo/express/on_construction(mob/user)
. = ..()
packin_up()
+1 -1
View File
@@ -85,7 +85,7 @@
board.obj_flags |= EMAGGED
update_static_data(user)
/obj/machinery/computer/cargo/on_construction()
/obj/machinery/computer/cargo/on_construction(mob/user)
. = ..()
circuit.configure_machine(src)
+1 -1
View File
@@ -102,7 +102,7 @@
DropFuel()
return ..()
/obj/machinery/power/port_gen/pacman/on_construction()
/obj/machinery/power/port_gen/pacman/on_construction(mob/user)
var/obj/item/circuitboard/machine/pacman/our_board = circuit
if(our_board.high_production_profile)
icon_state = "portgen1_0"