From 5e2d5210aeb4f2b41d338055bc0db203d97077ae Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 18 Jul 2022 17:35:05 +0200 Subject: [PATCH] [MIRROR] Abusing Generosity - Unrestricted Airlock Access Flip [MDB IGNORE] (#15021) * Abusing Generosity - Unrestricted Airlock Access Flip (#68096) * Abusing Generosity - Unrestricted Airlock Access Flip Hey there, We now have a lot of unrestricted access helpers on airlocks, which are neato. However, while spitballing ideas in regards to this a few months ago, someone suggested to make it such that you can use the airlock wires to "flip" the directional way. I decided to sit down and code it in today. The high details are this: You can only do it if the airlock has a directional Request-to-Exit sensor (which is just a thing I made up, you can't get this in-game outside of mapping it in via a directional helper). You can tell if a door has it the same way you can tell if any door is a directional door, or you can simply just check to see if the Unrestricted Access Display is "on" in any capcity (the airlock will not have the sensor if the display is off). It's effectively a dud without the "sensor". However, if it does have it, you can either pulse it (to switch the direction by 180 degrees) or cut the wire (to disable the direction entirely). When you mend the wire though, it'll activate to a random direction (could even be inside a wall). You can keep cutting and mending until you get what you want, though. If it gets stuck in a wall though... shouldn't have cut it. While in the area, I alphabetized a bunch of lists, added a new color of airlock wire, and probably some other stuff. * Adds this behavior to building new airlocks I also renamed it to "sensor" so it's a bit clearer across all the potential contexts. It does seem to handle setting multiple directions on creating a new mapload, cutting/pulsing will condense the nice multi-directional stuff into one direction (i am okay with this). Co-authored-by: spookydonut Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com> * Abusing Generosity - Unrestricted Airlock Access Flip Co-authored-by: san7890 Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com> --- code/__DEFINES/wires.dm | 15 +++---- code/datums/wires/_wires.dm | 5 ++- code/datums/wires/airlock.dm | 41 ++++++++++++++++--- .../machinery/doors/airlock_electronics.dm | 4 +- code/game/machinery/doors/door.dm | 5 ++- code/game/objects/structures/door_assembly.dm | 2 + code/game/turfs/open/floor.dm | 1 + code/game/turfs/open/misc.dm | 1 + code/modules/mapping/mapping_helpers.dm | 1 + 9 files changed, 59 insertions(+), 16 deletions(-) diff --git a/code/__DEFINES/wires.dm b/code/__DEFINES/wires.dm index c485681eaf7..a251eef4dcb 100644 --- a/code/__DEFINES/wires.dm +++ b/code/__DEFINES/wires.dm @@ -3,8 +3,9 @@ #define WIRE_INTERACTION_SUCCESSFUL 1 #define WIRE_INTERACTION_BLOCK 2 //don't do anything else rather than open wires and whatever else. -#define WIRE_DUD_PREFIX "__dud" +#define WIRE_ACCEPT "Scan Success" #define WIRE_ACTIVATE "Activate" +#define WIRE_AGELIMIT "Age Limit" #define WIRE_AI "AI Connection" #define WIRE_ALARM "Alarm" #define WIRE_AVOIDANCE "Avoidance" @@ -16,8 +17,10 @@ #define WIRE_CAMERA "Camera" #define WIRE_CONTRABAND "Contraband" #define WIRE_DELAY "Delay" +#define WIRE_DENY "Scan Fail" #define WIRE_DISABLE "Disable" #define WIRE_DISARM "Disarm" +#define WIRE_DUD_PREFIX "__dud" #define WIRE_HACK "Hack" #define WIRE_IDSCAN "ID Scan" #define WIRE_INTERFACE "Interface" @@ -33,9 +36,12 @@ #define WIRE_POWER "Power" #define WIRE_POWER1 "Main Power 1" #define WIRE_POWER2 "Main Power 2" +#define WIRE_PRIZEVEND "Emergency Prize Vend" #define WIRE_PROCEED "Proceed" -#define WIRE_RX "Receive" #define WIRE_RESET_MODEL "Reset Model" +#define WIRE_RESETOWNER "Reset Owner" +#define WIRE_UNRESTRICTED_EXIT "Unrestricted Exit" +#define WIRE_RX "Receive" #define WIRE_SAFETY "Safety" #define WIRE_SHOCK "High Voltage Ground" #define WIRE_SIGNAL "Signal" @@ -48,8 +54,3 @@ #define WIRE_ZAP "High Voltage Circuit" #define WIRE_ZAP1 "High Voltage Circuit 1" #define WIRE_ZAP2 "High Voltage Circuit 2" -#define WIRE_PRIZEVEND "Emergency Prize Vend" -#define WIRE_RESETOWNER "Reset Owner" -#define WIRE_AGELIMIT "Age Limit" -#define WIRE_ACCEPT "Scan Success" -#define WIRE_DENY "Scan Fail" diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index 3bf5f345dcd..7565f67f44a 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -87,8 +87,9 @@ "crimson", "cyan", "gold", - "grey", "green", + "grey", + "lime", "magenta", "orange", "pink", @@ -97,7 +98,7 @@ "silver", "violet", "white", - "yellow" + "yellow", ) var/list/my_possible_colors = possible_colors.Copy() diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 4149672cec4..ee906fc908b 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -45,11 +45,21 @@ /datum/wires/airlock/New(atom/holder) wires = list( - WIRE_POWER1, WIRE_POWER2, - WIRE_BACKUP1, WIRE_BACKUP2, - WIRE_OPEN, WIRE_BOLTS, WIRE_IDSCAN, WIRE_AI, - WIRE_SHOCK, WIRE_SAFETY, WIRE_TIMING, WIRE_LIGHT, - WIRE_ZAP1, WIRE_ZAP2 + WIRE_AI, + WIRE_BACKUP1, + WIRE_BACKUP2, + WIRE_BOLTS, + WIRE_IDSCAN, + WIRE_LIGHT, + WIRE_OPEN, + WIRE_POWER1, + WIRE_POWER2, + WIRE_SAFETY, + WIRE_SHOCK, + WIRE_TIMING, + WIRE_UNRESTRICTED_EXIT, + WIRE_ZAP1, + WIRE_ZAP2, ) add_duds(2) ..() @@ -84,6 +94,12 @@ status += "The timer is powered [A.autoclose ? "on" : "off"]." status += "The speed light is [A.normalspeed ? "on" : "off"]." status += "The emergency light is [A.emergency ? "on" : "off"]." + + if(A.unres_sensor) + status += "The unrestricted exit display is [A.unres_sides ? "indicating that it is letting people pass from the [dir2text(REVERSE_DIR(A.unres_sides))]" : "faintly flickering"]." + else + status += "The unrestricted exit display is completely inactive." + return status /datum/wires/airlock/on_pulse(wire) @@ -134,6 +150,11 @@ if(WIRE_LIGHT) A.lights = !A.lights A.update_appearance() + if(WIRE_UNRESTRICTED_EXIT) // Pulse to switch the direction around by 180 degrees (North goes to South, East goes to West, vice-versa) + if(!A.unres_sensor) //only works if the "sensor" is installed (a variable that we assign to the door either upon creation of a door with unrestricted directions or if an unrestricted helper is added to a door in mapping) + return + A.unres_sides = DIRFLIP(A.unres_sides) + A.update_appearance() /obj/machinery/door/airlock/proc/reset_ai_wire() if(aiControlDisabled == AI_WIRE_DISABLED) @@ -192,6 +213,16 @@ if(WIRE_ZAP1, WIRE_ZAP2) // Ouch. if(isliving(usr)) A.shock(usr, 50) + if(WIRE_UNRESTRICTED_EXIT) // If you cut this wire, the unrestricted helper goes way. If you mend it, it'll go "haywire" and pick a new direction at random. Might have to cut/mend a time or two to get the direction you want. + if(!A.unres_sensor) //only works if the "sensor" is installed (a variable that we assign to the door either upon creation of a door with unrestricted directions or if an unrestricted helper is added to a door in mapping) + return + if(mend) + A.unres_sides = pick(NORTH, SOUTH, EAST, WEST) + A.update_appearance() + else + A.unres_sides = NONE + A.update_appearance() + /datum/wires/airlock/can_reveal_wires(mob/user) if(HAS_TRAIT(user, TRAIT_KNOW_ENGI_WIRES)) diff --git a/code/game/machinery/doors/airlock_electronics.dm b/code/game/machinery/doors/airlock_electronics.dm index bf454d5f929..355aa4a3d6a 100644 --- a/code/game/machinery/doors/airlock_electronics.dm +++ b/code/game/machinery/doors/airlock_electronics.dm @@ -5,8 +5,10 @@ var/list/accesses = list() /// If the airlock should require ALL or only ONE of the listed accesses var/one_access = 0 + /// Checks to see if this airlock has an unrestricted helper (will set to TRUE if present). + var/unres_sensor = FALSE /// Unrestricted sides, or sides of the airlock that will open regardless of access - var/unres_sides = 0 + var/unres_sides = NONE ///what name are we passing to the finished airlock var/passed_name ///what string are we passing to the finished airlock as the cycle ID diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 6b09eab24a3..acb802829b0 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -38,7 +38,10 @@ var/datum/effect_system/spark_spread/spark_system var/real_explosion_block //ignore this, just use explosion_block var/red_alert_access = FALSE //if TRUE, this door will always open on red alert - var/unres_sides = 0 //Unrestricted sides. A bitflag for which direction (if any) can open the door with no access + /// Checks to see if this airlock has an unrestricted "sensor" within (will set to TRUE if present). + var/unres_sensor = FALSE + /// Unrestricted sides. A bitflag for which direction (if any) can open the door with no access + var/unres_sides = NONE var/can_crush = TRUE /// Whether or not the door can crush mobs. var/can_open_with_hands = TRUE /// Whether or not the door can be opened by hand (used for blast doors and shutters) diff --git a/code/game/objects/structures/door_assembly.dm b/code/game/objects/structures/door_assembly.dm index bcfcaaa688a..584c1325df6 100644 --- a/code/game/objects/structures/door_assembly.dm +++ b/code/game/objects/structures/door_assembly.dm @@ -281,6 +281,8 @@ if(electronics.passed_cycle_id) door.closeOtherId = electronics.passed_cycle_id door.update_other_id() + if(door.unres_sides) + door.unres_sensor = TRUE door.previous_airlock = previous_assembly electronics.forceMove(door) door.update_appearance() diff --git a/code/game/turfs/open/floor.dm b/code/game/turfs/open/floor.dm index 3324277d720..c34436bcd26 100644 --- a/code/game/turfs/open/floor.dm +++ b/code/game/turfs/open/floor.dm @@ -313,6 +313,7 @@ new_airlock.req_access = new_airlock.electronics.accesses if(new_airlock.electronics.unres_sides) new_airlock.unres_sides = new_airlock.electronics.unres_sides + new_airlock.unres_sensor = TRUE if(new_airlock.electronics.passed_name) new_airlock.name = sanitize(new_airlock.electronics.passed_name) if(new_airlock.electronics.passed_cycle_id) diff --git a/code/game/turfs/open/misc.dm b/code/game/turfs/open/misc.dm index b9be093bf21..e706198136e 100644 --- a/code/game/turfs/open/misc.dm +++ b/code/game/turfs/open/misc.dm @@ -141,6 +141,7 @@ new_airlock.req_access = new_airlock.electronics.accesses if(new_airlock.electronics.unres_sides) new_airlock.unres_sides = new_airlock.electronics.unres_sides + new_airlock.unres_sensor = TRUE if(new_airlock.electronics.passed_name) new_airlock.name = sanitize(new_airlock.electronics.passed_name) if(new_airlock.electronics.passed_cycle_id) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 5f146b73f47..532038e6d6a 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -194,6 +194,7 @@ /obj/effect/mapping_helpers/airlock/unres/payload(obj/machinery/door/airlock/airlock) airlock.unres_sides ^= dir + airlock.unres_sensor = TRUE /obj/effect/mapping_helpers/airlock/abandoned name = "airlock abandoned helper"