Skip to content

Commit

Permalink
RCD, Airlock QoL (#8195)
Browse files Browse the repository at this point in the history
* stuff

* requested changes part 1

* 515

* sanitize, fix conflicts

* prettierX

* fix mat inserting, remove duplicate attackby

* radial

* fix glass table radials
  • Loading branch information
Tsar-Salat authored Dec 14, 2023
1 parent 886ffe5 commit 59712fa
Show file tree
Hide file tree
Showing 21 changed files with 395 additions and 115 deletions.
29 changes: 19 additions & 10 deletions code/__DEFINES/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,26 @@
#define CAT_DRINK "Drinks"
#define CAT_STRUCTURE "Structures"


// rcd buildtype defines
#define RCD_FLOORWALL 1
#define RCD_AIRLOCK 2
#define RCD_DECONSTRUCT 3
#define RCD_WINDOWGRILLE 4
#define RCD_LADDER 5
#define RCD_MACHINE 8
#define RCD_COMPUTER 16

#define RCD_UPGRADE_FRAMES (1<<0)
// these aren't even used as bitflags so who even knows why they are treated like them
#define RCD_FLOORWALL (1<<0)
#define RCD_AIRLOCK (1<<1)
#define RCD_DECONSTRUCT (1<<2)
#define RCD_WINDOWGRILLE (1<<3)
#define RCD_MACHINE (1<<4)
#define RCD_COMPUTER (1<<5)
#define RCD_FURNISHING (1<<6)
#define RCD_LADDER (1<<7)

#define RCD_UPGRADE_FRAMES (1<<0)
#define RCD_UPGRADE_SIMPLE_CIRCUITS (1<<1)
#define RCD_UPGRADE_SILO_LINK (1<<2)
#define RCD_UPGRADE_SILO_LINK (1<<2)
#define RCD_UPGRADE_FURNISHING (1<<3)

#define RCD_WINDOW_FULLTILE "full tile"
#define RCD_WINDOW_DIRECTIONAL "directional"
#define RCD_WINDOW_NORMAL "glass"
#define RCD_WINDOW_REINFORCED "reinforced glass"

#define RPD_UPGRADE_UNWRENCH (1<<0)
9 changes: 8 additions & 1 deletion code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@
/obj/machinery/door/airlock/proc/update_other_id()
for(var/obj/machinery/door/airlock/Airlock in GLOB.airlocks)
if(Airlock.closeOtherId == closeOtherId && Airlock != src)
close_others += Airlock
if(!(Airlock in close_others))
close_others += Airlock
if(!(src in Airlock.close_others))
Airlock.close_others += src

/obj/machinery/door/airlock/proc/cyclelinkairlock()
if (cyclelinkedairlock)
Expand Down Expand Up @@ -721,6 +724,10 @@

/obj/machinery/door/airlock/examine(mob/user)
. = ..()
if(closeOtherId)
. += "<span_class='warning'>This airlock cycles on ID: [sanitize(closeOtherId)].</span>"
if(obj_flags & EMAGGED)
. += "<span class='warning'>Its access panel is smoking slightly.</span>"
if(charge && !panel_open && in_range(user, src))
. += "<span class='warning'>The maintenance panel seems haphazardly fastened.</span>"
if(charge && panel_open)
Expand Down
14 changes: 14 additions & 0 deletions code/game/machinery/doors/airlock_electronics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
var/one_access = 0
/// Unrestricted sides, or sides of the airlock that will open regardless of access
var/unres_sides = 0
///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
var/passed_cycle_id
/// A holder of the electronics, in case of them working as an integrated part
var/holder

Expand Down Expand Up @@ -51,6 +55,8 @@
data["accesses"] = accesses
data["oneAccess"] = one_access
data["unres_direction"] = unres_sides
data["passedName"] = passed_name
data["passedCycleId"] = passed_cycle_id
return data

/obj/item/electronics/airlock/ui_act(action, params)
Expand Down Expand Up @@ -90,6 +96,14 @@
return
accesses -= get_region_accesses(region)
. = TRUE
if("passedName")
var/new_name = trim(sanitize("[params["passedName"]]"), 30)
passed_name = new_name
. = TRUE
if("passedCycleId")
var/new_cycle_id = trim(sanitize(params["passedCycleId"]), 30)
passed_cycle_id = new_cycle_id
. = TRUE

/obj/item/electronics/airlock/ui_host()
if(holder)
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@
return TRUE
return ..()

/obj/machinery/door/proc/unrestricted_side(mob/M) //Allows for specific side of airlocks to be unrestrected (IE, can exit maint freely, but need access to enter)
return get_dir(src, M) & unres_sides
/obj/machinery/door/proc/unrestricted_side(mob/opener) //Allows for specific side of airlocks to be unrestrected (IE, can exit maint freely, but need access to enter)
return get_dir(src, opener) & unres_sides

/obj/machinery/door/proc/try_to_weld(obj/item/weldingtool/W, mob/user)
return
Expand Down
42 changes: 38 additions & 4 deletions code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
var/cable = 1
var/list/debris = list()

/obj/machinery/door/window/Initialize(mapload, set_dir)
/obj/machinery/door/window/Initialize(mapload, set_dir, unres_sides)
. = ..()
if(set_dir)
setDir(set_dir)
Expand All @@ -40,13 +40,30 @@
if(cable)
debris += new /obj/item/stack/cable_coil(src, cable)

if(unres_sides)
//remove unres_sides from directions it can't be bumped from
switch(dir)
if(NORTH,SOUTH)
unres_sides &= ~EAST
unres_sides &= ~WEST
if(EAST,WEST)
unres_sides &= ~NORTH
unres_sides &= ~SOUTH

src.unres_sides = unres_sides
update_icon()

var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
)

AddElement(/datum/element/connect_loc, loc_connections)
RegisterSignal(src, COMSIG_COMPONENT_NTNET_RECEIVE, PROC_REF(ntnet_receive))

/obj/machinery/door/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/ntnet_interface)

/obj/machinery/door/window/Destroy()
set_density(FALSE)
air_update_turf(1)
Expand Down Expand Up @@ -343,7 +360,7 @@
// Cutting WIRE_IDSCAN grants remote access... or it would, if we could hack windowdoors.
return id_scan_hacked() || ..()

/obj/machinery/door/window/proc/ntnet_receive(datum/source, datum/netdata/data)
/obj/machinery/door/window/proc/ntnet_receive(datum/netdata/data)
// Check if the airlock is powered.
if(!hasPower())
return
Expand All @@ -352,10 +369,13 @@
if(is_jammed(JAMMER_PROTECTION_WIRELESS))
return

// Check packet access level.
if(!check_access_ntnet(data))
return

// Handle received packet.
var/command = data.data["data"]
var/command_value = data.data["data_secondary"]
var/command = lowertext(data.data["data"])
var/command_value = lowertext(data.data["data_secondary"])
switch(command)
if("open")
if(command_value == "on" && !density)
Expand All @@ -371,6 +391,20 @@
if("touch")
INVOKE_ASYNC(src, PROC_REF(open_and_close))

/obj/machinery/door/window/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
switch(the_rcd.mode)
if(RCD_DECONSTRUCT)
return list("mode" = RCD_DECONSTRUCT, "delay" = 50, "cost" = 32)
return FALSE

/obj/machinery/door/window/rcd_act(mob/user, obj/item/construction/rcd/the_rcd, passed_mode)
switch(passed_mode)
if(RCD_DECONSTRUCT)
to_chat(user, "<span class='notice'>You deconstruct the windoor.</span>")
qdel(src)
return TRUE
return FALSE

/obj/machinery/door/window/brigdoor
name = "secure door"
icon_state = "leftsecure"
Expand Down
Loading

0 comments on commit 59712fa

Please sign in to comment.