Skip to content

Commit

Permalink
[BNTY] Adds shutter/blast construction/deconstruction , fixes door bu…
Browse files Browse the repository at this point in the history
…mping and door attacking. Adds custom configuration for them. (#8344)

* j

* h

* part 2

* e

* fix errors & warnings

* Update signaler.dm

* aaa

* clean up attackby

* fixes + rest of it

* Update blast_door.dm

* bruh

* fix everything

* Update door_control.dm

* s

* Update code/datums/autolathe/parts.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/game/machinery/doors/blast_door.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/modules/assembly/signaler.dm

* Update code/game/machinery/doors/blast_door.dm

* Update code/game/machinery/doors/blast_door.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/game/machinery/doors/blast_door.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/game/machinery/doors/blast_door.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/modules/assembly/signaler.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/modules/assembly/signaler.dm

Co-authored-by: hyperioo <[email protected]>

* Update code/modules/assembly/signaler.dm

Co-authored-by: hyperioo <[email protected]>

---------

Co-authored-by: hyperioo <[email protected]>
  • Loading branch information
MLGTASTICa and hyperioo committed Nov 3, 2023
1 parent b0c1b87 commit 62861fe
Show file tree
Hide file tree
Showing 15 changed files with 599 additions and 42 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
#define COMSIG_AREA_APC_POWER_CHANGE "area_apc_power_change"
#define COMSING_DESTRUCTIVE_ANALIZER "destructive_analizer"
#define COMSIG_TURRENT "create_turrent"
#define COMSIG_DOOR_OPENED "door_opened"
#define COMSIG_DOOR_CLOSED "door_closed"

// /obj/item signals
#define COMSIG_IATTACK "item_attack" //from /mob/ClickOn(): (/atom, /src, /params) If any reply to this returns TRUE, overrides attackby and afterattack
Expand Down
5 changes: 5 additions & 0 deletions code/controllers/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Radio:
Devices:
1451 - tracking implant
1457 - RSD default
1201 - Player-build blast doors and shutters.
On the map:
1311 for prison shuttle console (in fact, it is not used)
Expand Down Expand Up @@ -109,6 +110,9 @@ var/const/COMM_FREQ = 1353
var/const/AI_FREQ = 1343
var/const/DTH_FREQ = 1341
var/const/SYND_FREQ = 1213

// For player built blast doors.
var/const/BLAST_DOOR_FREQ = 1201
var/const/YARR_FREQ = 1220

// department channels
Expand Down Expand Up @@ -206,6 +210,7 @@ var/const/RADIO_AIRLOCK = "radio_airlock"
var/const/RADIO_SECBOT = "radio_secbot"
var/const/RADIO_MULEBOT = "radio_mulebot"
var/const/RADIO_MAGNETS = "radio_magnet"
var/const/RADIO_BLASTDOORS = "radio_blastdoors"

//callback used by objects to react to incoming radio signals
/obj/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
Expand Down
4 changes: 4 additions & 0 deletions code/datums/autolathe/parts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
name = "signaler"
build_path = /obj/item/device/assembly/signaler

/datum/design/autolathe/part/door_signaler
name = "door signaler"
build_path = /obj/item/device/assembly/signaler/door_controller

/datum/design/autolathe/part/sensor_infra
name = "infrared sensor"
build_path = /obj/item/device/assembly/infra
Expand Down
13 changes: 13 additions & 0 deletions code/datums/craft/recipes/airlocks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@
list(CRAFT_MATERIAL, 10, MATERIAL_PLASTEEL)
)

/datum/craft_recipe/airlock/assembly/blast_door
name = "blast door assembly"
result = /obj/machinery/door/blast/regular
steps = list(
list(CRAFT_MATERIAL, 20, MATERIAL_PLASTEEL)
)

/datum/craft_recipe/airlock/assembly/shutter
name = "shutter assembly"
result = /obj/machinery/door/blast/shutters
steps = list(
list(CRAFT_MATERIAL, 5, MATERIAL_PLASTEEL)
)

/datum/craft_recipe/airlock/shutter/emergency_shutter
name = "emergency shutter"
Expand Down
110 changes: 99 additions & 11 deletions code/game/machinery/door_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,107 @@
/obj/machinery/button/remote/blast_door
name = "remote blast door-control"
desc = "It controls blast doors, remotely."
var/datum/radio_frequency/radio_conn
var/door_status = "OPENED"
var/open = 0
var/closed = 0
var/last_message

/obj/machinery/button/remote/blast_door/Initialize()
. = ..()
radio_conn = SSradio.add_object(src, BLAST_DOOR_FREQ, RADIO_BLASTDOORS)
AddComponent(/datum/component/overlay_manager)

/// Update status at initialization!
/obj/machinery/button/remote/blast_door/LateInitialize()
. = ..()
var/datum/signal/signal = new
signal.source = src
signal.encryption = id
signal.data["message"] = "CMD_DOOR_STATE"
radio_conn.post_signal(src, signal, RADIO_BLASTDOORS)



/obj/machinery/button/remote/blast_door/Destroy()
SSradio.remove_object(src, BLAST_DOOR_FREQ)
radio_conn = null
. = ..()

/obj/machinery/button/remote/blast_door/examine(mob/user, distance, infix, suffix)
. = ..()
if(.)
to_chat(user, "Linked doors status is currently [door_status]")

/obj/machinery/button/remote/blast_door/trigger()
for(var/obj/machinery/door/blast/M in GLOB.all_doors)
if(M.id == id)
if(M.density)
spawn(0)
M.open()
return
else
spawn(0)
M.close()
return

door_status = "UNKNOWN"
var/datum/signal/signal = new
signal.source = src
signal.encryption = id
signal.data["message"] = "CMD_DOOR_TOGGLE"
radio_conn.post_signal(src, signal, RADIO_BLASTDOORS)

#define OVERKEY_DOOR_STATUS "door_status"

/obj/machinery/button/remote/blast_door/update_icon()
. = ..()
var/datum/component/overlay_manager/overlay_manager = GetComponent(/datum/component/overlay_manager)
if(!overlay_manager)
return
var/mutable_appearance/appear = mutable_appearance(icon = src.icon, icon_state = "")
appear.dir = src.dir
if(stat & NOPOWER)
overlay_manager.removeOverlay(OVERKEY_DOOR_STATUS)
return
switch(door_status)
if("OPENED")
appear.icon_state = "doorctrl-open"
if("MIXED")
appear.icon_state = "doorctrl-mixed"
if("CLOSED")
appear.icon_state = "doorctrl-closed"
if("UNKNOWN")
appear.icon_state = "doorctrl-unknown"
overlay_manager.updateOverlay(OVERKEY_DOOR_STATUS, appear)

#undef OVERKEY_DOOR_STATUS


/obj/machinery/button/remote/blast_door/receive_signal(datum/signal/signal, receive_method, receive_param)
if(!signal)
return
if(signal.encryption != id)
return
if(stat & NOPOWER)
return
if(last_message < world.time)
closed = 0
open = 0
addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, update_icon)), 2 SECONDS)
switch(signal.data["message"])
if("DATA_DOOR_OPENED")
last_message = world.time + 1 SECOND
open++
if("DATA_DOOR_CLOSED")
last_message = world.time + 1 SECOND
closed++
if("CMD_DOOR_OPEN")
return
if("CMD_DOOR_CLOSE")
return
if("CMD_DOOR_TOGGLE")
return
if("CMD_DOOR_STATE")
return

if(open && closed)
door_status = "MIXED"
else if(open)
door_status = "OPENED"
else if(closed)
door_status = "CLOSED"
else
door_status = "UNKNOWN"

/obj/machinery/button/remote/blast_door/id_card
name = "remote blast id card door-control"
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/doors/airlock_electronics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
var/last_configurator = null
var/locked = TRUE
var/lockable = TRUE
/// Used for blast doors and shutters
var/wifi_id = null

/obj/item/electronics/airlock/attack_self(mob/user)
if (!ishuman(user) && !istype(user,/mob/living/silicon/robot))
Expand Down
Loading

0 comments on commit 62861fe

Please sign in to comment.