From 3c908fc2803eb46ce29f13eacc9b11f266efbdc2 Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Thu, 26 Jan 2023 01:35:53 +0530 Subject: [PATCH] Some more RCD Designs & Patches (#72757) ## About The Pull Request Adds some more stuff you can build with the RCD 1. Under structures you can now build/deconstruct catwalks & construct Reflector Frames. Destorying a catwalk will cut any cable on it leaving pieces of it behind ![Screenshot (92)](https://user-images.githubusercontent.com/110812394/212850493-b7a5d25a-dab5-42e4-bd56-8e7045023984.png) 2. If you have the frames upgrade you can construct APC, Air Alarm & Fire Alarm frames on walls & Flood light fixtures[fully wired]. It only creates the wall mount and sticks it on the wall. Wiring, Circuits and finishing the frame is still your job ![Screenshot (94)](https://user-images.githubusercontent.com/110812394/214264787-188c7783-473a-4f34-84c1-00ad73520f22.png) 3. If you have the furnishing upgrade you can create racks & beds & additional bar stool ![Screenshot (95)](https://user-images.githubusercontent.com/110812394/214264893-96b52fc9-1502-45af-bee3-724cce1935af.png) **Important Code Refractors** 1. `/turf/closed/wall/proc/try_wallmount()` will return true only after you have successfully mounted the wallframe or stuck an poster on it & not simply check if you are trying to mount a valid thing on it 2. `apc_tool_act/rcd_act()` was incorrectly checking passed_mode for the simple circuit upgrade and not the `the_rcd.upgrade `flag. Thats fixed now to 3. newly created APC's weren't assigning themselves to their areas allowing multiple to be created in one area. Thats fixed now 4. Walls, Airlocks & other stuff could be built on tiles having something dense that would block it. For example a wall could be build on top of a machine frame!!. Thats also fixed now ## Why It's Good For The Game More stuff you can build rapidly with the RCD ## Changelog :cl: add: more designs for the rcd refactor:` try_wallmount()` to return true only after successful mount fix: `apc_tool_act/rcd_act()` incorrecly checking for simple circuits upgrade in the wrong variable fix: newly created APC's not assigning themselves to their areas. fix: rcd building structures [walls, airlocks etc] on turf's that already have structures on them /:cl: --- code/__DEFINES/construction.dm | 5 ++ code/game/machinery/firealarm.dm | 4 +- code/game/objects/effects/poster.dm | 1 + code/game/objects/items/RCD.dm | 71 +++++++++++------ code/game/objects/structures/lattice.dm | 21 +++++ code/game/turfs/closed/walls.dm | 14 +++- code/game/turfs/open/floor.dm | 19 +++++ code/game/turfs/open/space/space.dm | 17 +++- code/modules/asset_cache/assets/rcd.dm | 10 ++- .../machinery/air_alarm/air_alarm_interact.dm | 4 +- code/modules/power/apc/apc_main.dm | 77 ++++++++----------- code/modules/power/apc/apc_tool_act.dm | 7 +- .../interfaces/RapidConstructionDevice.tsx | 4 +- 13 files changed, 172 insertions(+), 82 deletions(-) diff --git a/code/__DEFINES/construction.dm b/code/__DEFINES/construction.dm index 446cc74ae9b..d627e668bed 100644 --- a/code/__DEFINES/construction.dm +++ b/code/__DEFINES/construction.dm @@ -130,6 +130,11 @@ #define RCD_MACHINE 4 #define RCD_COMPUTER 5 #define RCD_FURNISHING 6 +#define RCD_CATWALK 7 +#define RCD_FLOODLIGHT 8 +#define RCD_WALLFRAME 9 +#define RCD_REFLECTOR 10 + #define RCD_UPGRADE_FRAMES (1<<0) #define RCD_UPGRADE_SIMPLE_CIRCUITS (1<<1) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index cef95421321..7a56f0242dc 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -356,12 +356,12 @@ /obj/machinery/firealarm/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) if((buildstage == 0) && (the_rcd.upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS)) - return list("mode" = RCD_UPGRADE_SIMPLE_CIRCUITS, "delay" = 20, "cost" = 1) + return list("mode" = RCD_WALLFRAME, "delay" = 20, "cost" = 1) return FALSE /obj/machinery/firealarm/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) switch(passed_mode) - if(RCD_UPGRADE_SIMPLE_CIRCUITS) + if(RCD_WALLFRAME) user.visible_message(span_notice("[user] fabricates a circuit and places it into [src]."), \ span_notice("You adapt a fire alarm circuit and slot it into the assembly.")) buildstage = 1 diff --git a/code/game/objects/effects/poster.dm b/code/game/objects/effects/poster.dm index c5850a782b4..13a51477ffc 100644 --- a/code/game/objects/effects/poster.dm +++ b/code/game/objects/effects/poster.dm @@ -269,6 +269,7 @@ return placed_poster.on_placed_poster(user) + return TRUE /obj/structure/sign/poster/proc/snowflake_wall_turf_check(atom/hopefully_still_a_wall_turf) //since turfs never get deleted but instead change type, make sure we're still being placed on a wall. return iswallturf(hopefully_still_a_wall_turf) diff --git a/code/game/objects/items/RCD.dm b/code/game/objects/items/RCD.dm index 940ad9e07a3..e329df46daf 100644 --- a/code/game/objects/items/RCD.dm +++ b/code/game/objects/items/RCD.dm @@ -278,6 +278,7 @@ RLD #define WINDOW_GLASS "window_glass" #define WINDOW_SIZE "window_size" #define COMPUTER_DIR "computer_dir" +#define WALLFRAME_TYPE "wallframe_type" #define FURNISH_TYPE "furnish_type" #define FURNISH_COST "furnish_cost" #define FURNISH_DELAY "furnish_delay" @@ -317,6 +318,8 @@ RLD list(CONSTRUCTION_MODE = RCD_WINDOWGRILLE, WINDOW_TYPE = /obj/structure/window/reinforced, WINDOW_GLASS = RCD_WINDOW_REINFORCED, WINDOW_SIZE = RCD_WINDOW_DIRECTIONAL, ICON = "windowtype", TITLE = "Directional Reinforced Window"), list(CONSTRUCTION_MODE = RCD_WINDOWGRILLE, WINDOW_TYPE = /obj/structure/window/fulltile, WINDOW_GLASS = RCD_WINDOW_NORMAL, WINDOW_SIZE = RCD_WINDOW_FULLTILE, ICON = "window0", TITLE = "Full Tile Window"), list(CONSTRUCTION_MODE = RCD_WINDOWGRILLE, WINDOW_TYPE = /obj/structure/window/reinforced/fulltile, WINDOW_GLASS = RCD_WINDOW_REINFORCED, WINDOW_SIZE = RCD_WINDOW_FULLTILE, ICON = "rwindow0", TITLE = "Full Tile Reinforced Window"), + list(CONSTRUCTION_MODE = RCD_CATWALK, ICON = "catwalk-0", TITLE = "Catwalk"), + list(CONSTRUCTION_MODE = RCD_REFLECTOR, ICON = "reflector_base", TITLE = "Reflector"), ), //Computers & Machine Frames @@ -326,14 +329,21 @@ RLD list(CONSTRUCTION_MODE = RCD_COMPUTER, COMPUTER_DIR = 2, ICON = "csouth", TITLE = "Computer South"), list(CONSTRUCTION_MODE = RCD_COMPUTER, COMPUTER_DIR = 4, ICON = "ceast", TITLE = "Computer East"), list(CONSTRUCTION_MODE = RCD_COMPUTER, COMPUTER_DIR = 8, ICON = "cwest", TITLE = "Computer West"), + list(CONSTRUCTION_MODE = RCD_FLOODLIGHT, ICON = "floodlight_c1", TITLE = "FloodLight Frame"), + list(CONSTRUCTION_MODE = RCD_WALLFRAME, WALLFRAME_TYPE = /obj/item/wallframe/apc, ICON = "apc", TITLE = "APC WallFrame"), + list(CONSTRUCTION_MODE = RCD_WALLFRAME, WALLFRAME_TYPE = /obj/item/wallframe/airalarm, ICON = "alarm_bitem", TITLE = "AirAlarm WallFrame"), + list(CONSTRUCTION_MODE = RCD_WALLFRAME, WALLFRAME_TYPE = /obj/item/wallframe/firealarm, ICON = "fire_bitem", TITLE = "FireAlarm WallFrame"), ), //Interior Design[construction_mode = RCD_FURNISHING is implied] "Furniture" = list( list(FURNISH_TYPE = /obj/structure/chair, FURNISH_COST = 8, FURNISH_DELAY = 10, ICON = "chair", TITLE = "Chair"), list(FURNISH_TYPE = /obj/structure/chair/stool, FURNISH_COST = 8, FURNISH_DELAY = 10, ICON = "stool", TITLE = "Stool"), + list(FURNISH_TYPE = /obj/structure/chair/stool/bar, FURNISH_COST = 4, FURNISH_DELAY = 5, ICON = "bar", TITLE = "Bar Stool"), list(FURNISH_TYPE = /obj/structure/table, FURNISH_COST = 16, FURNISH_DELAY = 20, ICON = "table",TITLE = "Table"), list(FURNISH_TYPE = /obj/structure/table/glass, FURNISH_COST = 16, FURNISH_DELAY = 20, ICON = "glass_table", TITLE = "Glass Table"), + list(FURNISH_TYPE = /obj/structure/rack, FURNISH_COST = 20, FURNISH_DELAY = 25, ICON = "rack", TITLE = "Rack"), + list(FURNISH_TYPE = /obj/structure/bed, FURNISH_COST = 10, FURNISH_DELAY = 15, ICON = "bed", TITLE = "Bed"), ), ), @@ -403,6 +413,7 @@ RLD var/window_type = /obj/structure/window/fulltile var/window_glass = RCD_WINDOW_NORMAL var/window_size = RCD_WINDOW_FULLTILE + var/obj/item/wallframe/wallframe_type = /obj/item/wallframe/apc var/furnish_type = /obj/structure/chair var/furnish_cost = 8 var/furnish_delay = 10 @@ -526,27 +537,47 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) return SHAME /obj/item/construction/rcd/proc/rcd_create(atom/A, mob/user) + //does this atom allow for rcd actions? var/list/rcd_results = A.rcd_vals(user, src) if(!rcd_results) return FALSE + var/turf/target_turf = get_turf(A) + //start animation & check resource for the action var/delay = rcd_results["delay"] * delay_mod - var/obj/effect/constructing_effect/rcd_effect = new(get_turf(A), delay, src.mode) + var/obj/effect/constructing_effect/rcd_effect = new(target_turf, delay, src.mode) if(!checkResource(rcd_results["cost"], user)) qdel(rcd_effect) return FALSE - if(rcd_results["mode"] == RCD_MACHINE || rcd_results["mode"] == RCD_COMPUTER || rcd_results["mode"] == RCD_FURNISHING) - var/turf/target_turf = get_turf(A) - //ignore all directional windows on the turf - var/static/list/ignored_atoms = list(/obj/structure/window, /obj/structure/window/reinforced) - var/list/ignored_content = list() - for(var/atom/movable/movable_content in target_turf) - if(is_type_in_list(movable_content, ignored_atoms)) - ignored_content += movable_content - //check if the machine can fit on this turf - if(target_turf.is_blocked_turf(exclude_mobs = TRUE, source_atom = null, ignore_atoms = ignored_content)) - playsound(loc, 'sound/machines/click.ogg', 50, TRUE) - qdel(rcd_effect) - return FALSE + /** + *For anything that does not go an a wall we have to make sure that turf is clear for us to put the structure on it + *If we are just trying to destory something then this check is not nessassary + *RCD_WALLFRAME is also returned as the mode when upgrading apc, airalarm, firealarm using simple circuits upgrade + */ + if(rcd_results["mode"] != RCD_WALLFRAME && rcd_results["mode"] != RCD_DECONSTRUCT) + //if we are trying to build a window on top of a grill [only if there isnt already a window there] then we skip this check because thats normal behaviour + if(rcd_results["mode"] == RCD_WINDOWGRILLE && locate(/obj/structure/grille, target_turf) && (!locate(/obj/structure/window, target_turf) && !locate(/obj/structure/window/reinforced, target_turf))) + //no checks proceed + else + //structures which are small enough to fit on turfs containing directional windows. + var/static/list/small_structures = list( + RCD_MACHINE, + RCD_COMPUTER, + RCD_REFLECTOR, + RCD_FLOODLIGHT, + RCD_FURNISHING + ) + //find all directional windows on the turf + var/list/ignored_content = list() + if(rcd_results["mode"] in small_structures) + var/static/list/ignored_atoms = list(/obj/structure/window, /obj/structure/window/reinforced) + for(var/atom/movable/movable_content in target_turf) + if(is_type_in_list(movable_content, ignored_atoms)) + ignored_content += movable_content + //check if the structure can fit on this turf + if(target_turf.is_blocked_turf(exclude_mobs = FALSE, source_atom = null, ignore_atoms = ignored_content)) + playsound(loc, 'sound/machines/click.ogg', 50, TRUE) + qdel(rcd_effect) + return FALSE if(!do_after(user, delay, target = A)) qdel(rcd_effect) return FALSE @@ -705,6 +736,8 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) construction_mode = design[CONSTRUCTION_MODE] if(design[COMPUTER_DIR] != null) computer_dir = design[COMPUTER_DIR] + if(design[WALLFRAME_TYPE] != null) + wallframe_type = design[WALLFRAME_TYPE] else if(category_name == "Furniture") construction_mode = RCD_FURNISHING furnish_type = design[FURNISH_TYPE] @@ -725,17 +758,9 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) . = ..() ui_interact(user) -/obj/item/construction/rcd/proc/target_check(atom/A, mob/user) // only returns true for stuff the device can actually work with - if((isturf(A) && A.density && mode == RCD_DECONSTRUCT) || (isturf(A) && !A.density) || (istype(A, /obj/machinery/door/airlock) && mode == RCD_DECONSTRUCT) || istype(A, /obj/structure/grille) || (istype(A, /obj/structure/window) && mode == RCD_DECONSTRUCT) || istype(A, /obj/structure/girder)) - return TRUE - else - return FALSE - /obj/item/construction/rcd/pre_attack(atom/A, mob/user, params) . = ..() mode = construction_mode - if(!A.rcd_vals(user, src)) - return rcd_create(A, user) return TRUE @@ -747,7 +772,6 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) rcd_create(target, user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - /obj/item/construction/rcd/proc/detonate_pulse() audible_message("[src] begins to vibrate and \ buzz loudly!","[src] begins \ @@ -824,6 +848,7 @@ GLOBAL_VAR_INIT(icon_holographic_window, init_holographic_window()) #undef WINDOW_GLASS #undef WINDOW_SIZE #undef COMPUTER_DIR +#undef WALLFRAME_TYPE #undef FURNISH_TYPE #undef FURNISH_COST #undef FURNISH_DELAY diff --git a/code/game/objects/structures/lattice.dm b/code/game/objects/structures/lattice.dm index eb7a0d0196e..82fba11d0e2 100644 --- a/code/game/objects/structures/lattice.dm +++ b/code/game/objects/structures/lattice.dm @@ -59,6 +59,8 @@ /obj/structure/lattice/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) if(the_rcd.mode == RCD_FLOORWALL) return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 2) + if(the_rcd.mode == RCD_CATWALK) + return list("mode" = RCD_CATWALK, "delay" = 0, "cost" = 1) /obj/structure/lattice/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) if(passed_mode == RCD_FLOORWALL) @@ -68,6 +70,12 @@ T.PlaceOnTop(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR) qdel(src) return TRUE + if(passed_mode == RCD_CATWALK) + to_chat(user, span_notice("You build a catwalk.")) + var/turf/turf = loc + qdel(src) + new /obj/structure/lattice/catwalk(turf) + return TRUE return FALSE /obj/structure/lattice/singularity_pull(S, current_size) @@ -101,6 +109,19 @@ C.deconstruct() ..() +/obj/structure/lattice/catwalk/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) + if(the_rcd.mode == RCD_DECONSTRUCT) + return list("mode" = RCD_DECONSTRUCT, "delay" = 10, "cost" = 5) + return FALSE + +/obj/structure/lattice/catwalk/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) + if(passed_mode == RCD_DECONSTRUCT) + var/turf/turf = loc + for(var/obj/structure/cable/cable_coil in turf) + cable_coil.deconstruct() + qdel(src) + return TRUE + /obj/structure/lattice/catwalk/mining name = "reinforced catwalk" desc = "A heavily reinforced catwalk used to build bridges in hostile environments. It doesn't look like anything could make this budge." diff --git a/code/game/turfs/closed/walls.dm b/code/game/turfs/closed/walls.dm index c9363912add..b761591b3c4 100644 --- a/code/game/turfs/closed/walls.dm +++ b/code/game/turfs/closed/walls.dm @@ -222,11 +222,11 @@ var/obj/item/wallframe/F = W if(F.try_build(src, user)) F.attach(src, user) - return TRUE + return TRUE + return FALSE //Poster stuff else if(istype(W, /obj/item/poster) && Adjacent(user)) //no tk memes. - place_poster(W,user) - return TRUE + return place_poster(W,user) return FALSE @@ -277,10 +277,18 @@ switch(the_rcd.mode) if(RCD_DECONSTRUCT) return list("mode" = RCD_DECONSTRUCT, "delay" = 40, "cost" = 26) + if(RCD_WALLFRAME) + return list("mode" = RCD_WALLFRAME, "delay" = 10, "cost" = 25) return FALSE /turf/closed/wall/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) switch(passed_mode) + if(RCD_WALLFRAME) + var/obj/item/wallframe/new_wallmount = new the_rcd.wallframe_type(user.drop_location()) + if(!try_wallmount(new_wallmount, user, src)) + qdel(new_wallmount) + return FALSE + return TRUE if(RCD_DECONSTRUCT) to_chat(user, span_notice("You deconstruct the wall.")) ScrapeAway() diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 67ac43aaab6..03576ed64da 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -260,6 +260,8 @@ list("mode" = RCD_FLOORWALL, "delay" = 2 SECONDS, "cost" = 16), src, RCD_MEMORY_WALL, ) + if(RCD_REFLECTOR) + return list("mode" = RCD_REFLECTOR, "delay" = 20, "cost" = 30) if(RCD_AIRLOCK) if(the_rcd.airlock_glass) return list("mode" = RCD_AIRLOCK, "delay" = 50, "cost" = 20) @@ -276,6 +278,8 @@ return list("mode" = RCD_MACHINE, "delay" = 20, "cost" = 25) if(RCD_COMPUTER) return list("mode" = RCD_COMPUTER, "delay" = 20, "cost" = 25) + if(RCD_FLOODLIGHT) + return list("mode" = RCD_FLOODLIGHT, "delay" = 30, "cost" = 35) if(RCD_FURNISHING) return list("mode" = RCD_FURNISHING, "delay" = the_rcd.furnish_delay, "cost" = the_rcd.furnish_cost) return FALSE @@ -290,6 +294,12 @@ to_chat(user, span_notice("You build a wall.")) PlaceOnTop(/turf/closed/wall) return TRUE + if(RCD_REFLECTOR) + if(locate(/obj/structure/reflector) in src) + return FALSE + var/obj/structure/reflector/reflector_base = new(src) + reflector_base.set_anchored(TRUE) + return TRUE if(RCD_AIRLOCK) for(var/obj/machinery/door/door in src) if(door.sub_door) @@ -366,6 +376,15 @@ new_computer.state = 1 new_computer.setDir(the_rcd.computer_dir) return TRUE + if(RCD_FLOODLIGHT) + if(locate(/obj/structure/floodlight_frame) in src) + return FALSE + var/obj/structure/floodlight_frame/new_floodlight = new(src) + new_floodlight.name = "secured [new_floodlight.name]" + new_floodlight.desc = "A bare metal frame that looks like a floodlight. Requires a light tube to complete." + new_floodlight.icon_state = "floodlight_c3" + new_floodlight.state = FLOODLIGHT_NEEDS_LIGHTS + return TRUE if(RCD_FURNISHING) if(locate(the_rcd.furnish_type) in src) return FALSE diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index bd2f6e7e22c..28f91340186 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -196,11 +196,17 @@ switch(the_rcd.mode) if(RCD_FLOORWALL) - var/obj/structure/lattice/L = locate(/obj/structure/lattice, src) - if(L) + var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, src) + if(lattice) return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 1) else return list("mode" = RCD_FLOORWALL, "delay" = 0, "cost" = 3) + if(RCD_CATWALK) + var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, src) + if(lattice) + return list("mode" = RCD_CATWALK, "delay" = 0, "cost" = 1) + else + return list("mode" = RCD_CATWALK, "delay" = 0, "cost" = 2) return FALSE /turf/open/space/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) @@ -209,6 +215,13 @@ to_chat(user, span_notice("You build a floor.")) PlaceOnTop(/turf/open/floor/plating, flags = CHANGETURF_INHERIT_AIR) return TRUE + if(RCD_CATWALK) + to_chat(user, span_notice("You build a catwalk.")) + var/obj/structure/lattice/lattice = locate(/obj/structure/lattice, src) + if(lattice) + qdel(lattice) + new /obj/structure/lattice/catwalk(src) + return TRUE return FALSE /turf/open/space/rust_heretic_act() diff --git a/code/modules/asset_cache/assets/rcd.dm b/code/modules/asset_cache/assets/rcd.dm index 23e7d0e552d..fc50707866b 100644 --- a/code/modules/asset_cache/assets/rcd.dm +++ b/code/modules/asset_cache/assets/rcd.dm @@ -6,9 +6,15 @@ //load all category essential icon_states. format is icon_file = list of icon states we need from that file var/list/essentials = list( - 'icons/hud/radial.dmi' = list("wallfloor", "windowsize", "windowtype", "cnorth", "csouth", "ceast", "cwest", "chair", "stool", "windoor", "secure_windoor"), - 'icons/obj/structures.dmi' = list("window0", "rwindow0", "table", "glass_table"), + 'icons/obj/chairs.dmi' = list("bar"), + 'icons/obj/lighting.dmi' = list("floodlight_c1"), + 'icons/obj/monitors.dmi' = list("alarm_bitem", "fire_bitem"), + 'icons/obj/wallframe.dmi' = list("apc"), 'icons/obj/stock_parts.dmi' = list("box_1"), + 'icons/obj/objects.dmi' = list("bed", "rack"), + 'icons/obj/smooth_structures/catwalk.dmi' = list("catwalk-0"), + 'icons/hud/radial.dmi' = list("cnorth", "csouth", "ceast", "cwest", "chair", "secure_windoor", "stool", "wallfloor", "windowsize", "windowtype", "windoor"), + 'icons/obj/structures.dmi' = list("glass_table", "rwindow0", "reflector_base", "table", "window0"), ) var/icon/icon diff --git a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm index 15ab632aa3b..732fadc56e4 100644 --- a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm +++ b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm @@ -47,12 +47,12 @@ /obj/machinery/airalarm/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd) if((buildstage == AIR_ALARM_BUILD_NO_CIRCUIT) && (the_rcd.upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS)) - return list("mode" = RCD_UPGRADE_SIMPLE_CIRCUITS, "delay" = 20, "cost" = 1) + return list("mode" = RCD_WALLFRAME, "delay" = 20, "cost" = 1) return FALSE /obj/machinery/airalarm/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) switch(passed_mode) - if(RCD_UPGRADE_SIMPLE_CIRCUITS) + if(RCD_WALLFRAME) user.visible_message(span_notice("[user] fabricates a circuit and places it into [src]."), \ span_notice("You adapt an air alarm circuit and slot it into the assembly.")) buildstage = AIR_ALARM_BUILD_NO_WIRES diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index cc2c138f656..c6f045f5f83 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -120,24 +120,16 @@ fire = 90 acid = 50 -/obj/machinery/power/apc/New(turf/loc, ndir, building=0) +/obj/machinery/power/apc/Initialize(mapload, ndir) + . = ..() + //Initialize name & access of the apc if(!req_access) req_access = list(ACCESS_ENGINE_EQUIP) - ..() - GLOB.apcs_list += src - - wires = new /datum/wires/apc(src) - - if(building) - area = get_area(src) - opened = APC_COVER_OPENED - operating = FALSE + if(auto_name) name = "\improper [get_area_name(area, TRUE)] APC" - set_machine_stat(machine_stat | MAINT) - update_appearance() - addtimer(CALLBACK(src, PROC_REF(update)), 5) - dir = ndir + //Pixel offset its appearance based on its direction + dir = ndir switch(dir) if(NORTH) offset_old = pixel_y @@ -152,22 +144,8 @@ offset_old = pixel_x pixel_x = -APC_PIXEL_OFFSET -/obj/machinery/power/apc/Initialize(mapload) - . = ..() - AddElement(/datum/element/atmos_sensitive, mapload) - alarm_manager = new(src) - - if(!mapload) - return - has_electronics = APC_ELECTRONICS_SECURED - // is starting with a power cell installed, create it and set its charge level - if(cell_type) - cell = new cell_type(src) - cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value) - + //Assign it to its area. If mappers already assigned an area string fast load the area from it else get the current area var/area/our_area = get_area(loc) - - //if area isn't specified use current if(areastring) area = get_area_instance_from_text(areastring) if(!area) @@ -175,28 +153,39 @@ stack_trace("Bad areastring path for [src], [areastring]") else if(isarea(our_area) && areastring == null) area = our_area - - if(auto_name) - name = "\improper [get_area_name(area, TRUE)] APC" - if(area) if(area.apc) log_mapping("Duplicate APC created at [AREACOORD(src)] [area.type]. Original at [AREACOORD(area.apc)] [area.type].") area.apc = src + //Initialize its electronics + wires = new /datum/wires/apc(src) + alarm_manager = new(src) + AddElement(/datum/element/atmos_sensitive, mapload) + // for apcs created during map load make them fully functional + if(mapload) + has_electronics = APC_ELECTRONICS_SECURED + // is starting with a power cell installed, create it and set its charge level + if(cell_type) + cell = new cell_type(src) + cell.charge = start_charge * cell.maxcharge / 100 // (convert percentage to actual value) + make_terminal() + ///This is how we test to ensure that mappers use the directional subtypes of APCs, rather than use the parent and pixel-shift it themselves. + if(abs(offset_old) != APC_PIXEL_OFFSET) + log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!") + // For apcs created during the round players need to configure them from scratch + else + opened = APC_COVER_OPENED + operating = FALSE + set_machine_stat(machine_stat | MAINT) + + //Make the apc visually interactive + register_context() + addtimer(CALLBACK(src, PROC_REF(update)), 5) + RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide)) update_appearance() - make_terminal() - - addtimer(CALLBACK(src, PROC_REF(update)), 5) - - register_context() - - ///This is how we test to ensure that mappers use the directional subtypes of APCs, rather than use the parent and pixel-shift it themselves. - if(abs(offset_old) != APC_PIXEL_OFFSET) - log_mapping("APC: ([src]) at [AREACOORD(src)] with dir ([dir] | [uppertext(dir2text(dir))]) has pixel_[dir & (WEST|EAST) ? "x" : "y"] value [offset_old] - should be [dir & (SOUTH|EAST) ? "-" : ""][APC_PIXEL_OFFSET]. Use the directional/ helpers!") - - RegisterSignal(SSdcs, COMSIG_GLOB_GREY_TIDE, PROC_REF(grey_tide)) + GLOB.apcs_list += src /obj/machinery/power/apc/Destroy() GLOB.apcs_list -= src diff --git a/code/modules/power/apc/apc_tool_act.dm b/code/modules/power/apc/apc_tool_act.dm index 0f918b8e9f2..0c1cf6652a2 100644 --- a/code/modules/power/apc/apc_tool_act.dm +++ b/code/modules/power/apc/apc_tool_act.dm @@ -129,20 +129,21 @@ if(machine_stat & BROKEN) balloon_alert(user, "frame is too damaged!") return FALSE - return list("mode" = RCD_UPGRADE_SIMPLE_CIRCUITS, "delay" = 20, "cost" = 1) + return list("mode" = RCD_WALLFRAME, "delay" = 20, "cost" = 1) if(!cell) if(machine_stat & MAINT) balloon_alert(user, "no board for a cell!") return FALSE - return list("mode" = RCD_UPGRADE_SIMPLE_CIRCUITS, "delay" = 50, "cost" = 10) //16 for a wall + return list("mode" = RCD_WALLFRAME, "delay" = 50, "cost" = 10) balloon_alert(user, "has both board and cell!") return FALSE /obj/machinery/power/apc/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode) - if(!(passed_mode & RCD_UPGRADE_SIMPLE_CIRCUITS)) + if(!(the_rcd.upgrade & RCD_UPGRADE_SIMPLE_CIRCUITS) || passed_mode != RCD_WALLFRAME) return FALSE + if(!has_electronics) if(machine_stat & BROKEN) balloon_alert(user, "frame is too damaged!") diff --git a/tgui/packages/tgui/interfaces/RapidConstructionDevice.tsx b/tgui/packages/tgui/interfaces/RapidConstructionDevice.tsx index 3a03463980d..37400b62287 100644 --- a/tgui/packages/tgui/interfaces/RapidConstructionDevice.tsx +++ b/tgui/packages/tgui/interfaces/RapidConstructionDevice.tsx @@ -133,7 +133,9 @@ const DesignSection = (props, context) => { className={classes(['rcd-tgui32x32', design.icon])} style={{ transform: - design.icon === 'window0' || design.icon === 'rwindow0' + design.icon === 'window0' || + design.icon === 'rwindow0' || + design.icon === 'catwalk0' ? 'scale(0.7)' : 'scale(1.0)', }}