From 46d4ac9d8e6e58b2c35482bf1dbe3c1444ff3b58 Mon Sep 17 00:00:00 2001
From: Waterpig <49160555+Majkl-J@users.noreply.github.com>
Date: Wed, 13 Nov 2024 12:57:48 +0100
Subject: [PATCH] Mech fabricator output direction can now be changed with a
drag pull (#87828)
## About The Pull Request
See name, makes it consistent with all the other printing machines. For
some reason we have three different paths for all of them but
refactoring is out of scope for me.
Comes with updatepaths too
## Why It's Good For The Game
No more confusion with how to change the direction, it's the same as all
the other ones now.
## Changelog
:cl:
qol: mech fabricator output direction can now be changed with a drag
pull
/:cl:
---------
Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
---
_maps/map_files/Birdshot/birdshot.dmm | 2 +-
.../map_files/Deltastation/DeltaStation2.dmm | 2 +-
_maps/map_files/MetaStation/MetaStation.dmm | 4 +--
.../map_files/NebulaStation/NebulaStation.dmm | 2 +-
_maps/map_files/NorthStar/north_star.dmm | 4 +--
_maps/map_files/wawastation/wawastation.dmm | 4 +--
_maps/shuttles/ruin_cyborg_mothership.dmm | 2 +-
.../modules/vehicles/mecha/mech_fabricator.dm | 30 ++++++++++++-------
.../Scripts/87828_exofab_directions.txt | 1 +
9 files changed, 30 insertions(+), 21 deletions(-)
create mode 100644 tools/UpdatePaths/Scripts/87828_exofab_directions.txt
diff --git a/_maps/map_files/Birdshot/birdshot.dmm b/_maps/map_files/Birdshot/birdshot.dmm
index b42c05f4ea4..ed07ca2ba67 100644
--- a/_maps/map_files/Birdshot/birdshot.dmm
+++ b/_maps/map_files/Birdshot/birdshot.dmm
@@ -29342,7 +29342,7 @@
"jYr" = (
/obj/effect/turf_decal/tile/neutral/fourcorners,
/obj/machinery/mecha_part_fabricator{
- dir = 8
+ drop_direction = 8
},
/obj/effect/turf_decal/stripes/box,
/turf/open/floor/iron/dark,
diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm
index 3cc15f7deff..13c2c019fdb 100644
--- a/_maps/map_files/Deltastation/DeltaStation2.dmm
+++ b/_maps/map_files/Deltastation/DeltaStation2.dmm
@@ -59893,7 +59893,7 @@
/area/station/service/abandoned_gambling_den/gaming)
"pcJ" = (
/obj/machinery/mecha_part_fabricator{
- dir = 4
+ drop_direction = 4
},
/obj/effect/turf_decal/bot_red,
/obj/effect/turf_decal/tile/neutral/full,
diff --git a/_maps/map_files/MetaStation/MetaStation.dmm b/_maps/map_files/MetaStation/MetaStation.dmm
index 68433b52785..0455a78b4c0 100644
--- a/_maps/map_files/MetaStation/MetaStation.dmm
+++ b/_maps/map_files/MetaStation/MetaStation.dmm
@@ -43417,7 +43417,7 @@
dir = 4
},
/obj/machinery/mecha_part_fabricator{
- dir = 4
+ drop_direction = 4
},
/obj/structure/noticeboard/directional/west,
/turf/open/floor/iron,
@@ -51130,7 +51130,7 @@
dir = 4
},
/obj/machinery/mecha_part_fabricator{
- dir = 4
+ drop_direction = 4
},
/turf/open/floor/iron,
/area/station/science/robotics/lab)
diff --git a/_maps/map_files/NebulaStation/NebulaStation.dmm b/_maps/map_files/NebulaStation/NebulaStation.dmm
index 7a3b22d254f..9be370d5fc1 100644
--- a/_maps/map_files/NebulaStation/NebulaStation.dmm
+++ b/_maps/map_files/NebulaStation/NebulaStation.dmm
@@ -141111,7 +141111,7 @@
/area/station/hallway/primary/central)
"uYT" = (
/obj/machinery/mecha_part_fabricator{
- dir = 1
+ drop_direction = 1
},
/obj/effect/turf_decal/delivery,
/turf/open/floor/iron/dark,
diff --git a/_maps/map_files/NorthStar/north_star.dmm b/_maps/map_files/NorthStar/north_star.dmm
index 973b6209da8..95c02b17936 100644
--- a/_maps/map_files/NorthStar/north_star.dmm
+++ b/_maps/map_files/NorthStar/north_star.dmm
@@ -16182,7 +16182,7 @@
dir = 8
},
/obj/machinery/mecha_part_fabricator{
- dir = 4
+ drop_direction = 4
},
/obj/machinery/light/small/directional/west,
/turf/open/floor/iron/white/smooth_large,
@@ -41584,7 +41584,7 @@
dir = 4
},
/obj/machinery/mecha_part_fabricator{
- dir = 8
+ drop_direction = 8
},
/obj/machinery/light/small/directional/east,
/turf/open/floor/iron/white/smooth_large,
diff --git a/_maps/map_files/wawastation/wawastation.dmm b/_maps/map_files/wawastation/wawastation.dmm
index 66345284283..322a7fb8209 100644
--- a/_maps/map_files/wawastation/wawastation.dmm
+++ b/_maps/map_files/wawastation/wawastation.dmm
@@ -5609,7 +5609,7 @@
/area/station/security/lockers)
"bYo" = (
/obj/machinery/mecha_part_fabricator{
- dir = 1
+ drop_direction = 1
},
/obj/effect/turf_decal/delivery,
/obj/structure/sign/poster/contraband/borg_fancy_1/directional/south,
@@ -39502,7 +39502,7 @@
/area/station/maintenance/central/lesser)
"oac" = (
/obj/machinery/mecha_part_fabricator{
- dir = 1
+ drop_direction = 1
},
/obj/effect/turf_decal/delivery,
/obj/machinery/digital_clock/directional/south,
diff --git a/_maps/shuttles/ruin_cyborg_mothership.dmm b/_maps/shuttles/ruin_cyborg_mothership.dmm
index 7864564eab1..ea07e4354de 100644
--- a/_maps/shuttles/ruin_cyborg_mothership.dmm
+++ b/_maps/shuttles/ruin_cyborg_mothership.dmm
@@ -346,7 +346,7 @@
"ry" = (
/obj/machinery/mecha_part_fabricator/maint{
name = "forgotten exosuit fabricator";
- dir = 8
+ drop_direction = 8
},
/obj/machinery/conveyor{
dir = 8;
diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm
index 54f8cee9ed4..ad28886d99f 100644
--- a/code/modules/vehicles/mecha/mech_fabricator.dm
+++ b/code/modules/vehicles/mecha/mech_fabricator.dm
@@ -10,6 +10,7 @@
subsystem_type = /datum/controller/subsystem/processing/fastprocess
+ interaction_flags_atom = parent_type::interaction_flags_atom | INTERACT_ATOM_MOUSEDROP_IGNORE_CHECKS
/// Current items in the build queue.
var/list/datum/design/queue = list()
@@ -49,12 +50,15 @@
/// All designs in the techweb that can be fabricated by this machine, since the last update.
var/list/datum/design/cached_designs
- //looping sound for printing items
+ /// Looping sound for printing items
var/datum/looping_sound/lathe_print/print_sound
/// Local designs that only this mechfab have(using when mechfab emaged so it's illegal designs).
var/list/datum/design/illegal_local_designs
+ /// Direction the produced items will drop (0 means on top of us)
+ var/drop_direction = SOUTH
+
/obj/machinery/mecha_part_fabricator/Initialize(mapload)
print_sound = new(src, FALSE)
rmat = AddComponent(/datum/component/remote_materials, mapload && link_on_init)
@@ -136,15 +140,19 @@
. = ..()
if(in_range(user, src) || isobserver(user))
. += span_notice("The status display reads: Storing up to [rmat.local_size] material units.
Material consumption at [component_coeff*100]%.
Build time reduced by [100-time_coeff*100]%.")
- if(panel_open)
- . += span_notice("Alt-click to rotate the output direction.")
+ . += span_notice("Currently configured to drop printed objects [dir2text(drop_direction)].")
-/obj/machinery/mecha_part_fabricator/click_alt(mob/user)
- if(!panel_open)
- return CLICK_ACTION_BLOCKING
- dir = turn(dir, -90)
- balloon_alert(user, "rotated to [dir2text(dir)].")
- return CLICK_ACTION_SUCCESS
+/obj/machinery/mecha_part_fabricator/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
+ if(!can_interact(user) || (!HAS_SILICON_ACCESS(user) && !isAdminGhostAI(user)) && !Adjacent(user))
+ return
+ if(being_built)
+ balloon_alert(user, "printing started!")
+ return
+ var/direction = get_dir(src, over_location)
+ if(!direction)
+ return
+ drop_direction = direction
+ balloon_alert(user, "dropping [dir2text(drop_direction)]")
/obj/machinery/mecha_part_fabricator/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
@@ -267,7 +275,7 @@
/obj/machinery/mecha_part_fabricator/process()
// If there's a stored part to dispense due to an obstruction, try to dispense it.
if(stored_part)
- var/turf/exit = get_step(src,(dir))
+ var/turf/exit = get_step(src, drop_direction)
if(exit.density)
return TRUE
@@ -305,7 +313,7 @@
being_built = null
- var/turf/exit = get_step(src,(dir))
+ var/turf/exit = get_step(src, drop_direction)
if(exit.density)
say("Error! The part outlet is obstructed.")
desc = "It's trying to dispense the fabricated [dispensed_design.name], but the part outlet is obstructed."
diff --git a/tools/UpdatePaths/Scripts/87828_exofab_directions.txt b/tools/UpdatePaths/Scripts/87828_exofab_directions.txt
new file mode 100644
index 00000000000..468bc23847a
--- /dev/null
+++ b/tools/UpdatePaths/Scripts/87828_exofab_directions.txt
@@ -0,0 +1 @@
+/obj/machinery/mecha_part_fabricator/@SUBTYPES{dir = @ANY} : /obj/machinery/mecha_part_fabricator/@SUBTYPES{@OLD;dir=@SKIP;drop_direction=@OLD:dir}