Skip to content

Commit

Permalink
Allows deconstruction of wide airlocks and cleans up the airlock code…
Browse files Browse the repository at this point in the history
… a bit (#4690)

# About the pull request

Allows disassembly of wide airlocks and fixes the bugs which... caused
it to be disabled in the first place. Since moving multi-tile objects is
a bit... inconsistent at best, unwrenching of wide airlock assemblies is
disabled.

Also renamed a lot of single-letter variables and added sprites to wide
airlock assembly and generic solid wide airlock since for some reason I
couldn't find it.

And fixes #4638.
# Explain why it's good for the game

Inconsistent behavior bad. Unable to disassemble wide airlocks bad. Able
to disassemble all airlocks good.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


https://media.discordapp.net/attachments/703724778825187332/1163117987943944242/wide_airlock.mp4


https://cdn.discordapp.com/attachments/703724778825187332/1163151828251324536/wide_airlock_solid_v2.mp4

</details>


# Changelog
:cl: MrDas
fix: You can now disassemble wide airlocks. (You can't unwrench them
though)
spellcheck: Fixed a few typos in airlock assembly.
imageadd: Added wide airlock assembly and generic solid wide airlock
sprites.
/:cl:
  • Loading branch information
Das15 authored Oct 19, 2023
1 parent dba4afd commit 199b695
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 137 deletions.
82 changes: 40 additions & 42 deletions code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,13 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
add_fingerprint(usr)
update_icon()

/obj/structure/machinery/door/airlock/attackby(obj/item/C, mob/user)
if(SEND_SIGNAL(C, COMSIG_ITEM_ATTACK_AIRLOCK, src, user) & COMPONENT_CANCEL_AIRLOCK_ATTACK)
/obj/structure/machinery/door/airlock/attackby(obj/item/attacking_item, mob/user)
if(SEND_SIGNAL(attacking_item, COMSIG_ITEM_ATTACK_AIRLOCK, src, user) & COMPONENT_CANCEL_AIRLOCK_ATTACK)
return

if(istype(C, /obj/item/clothing/mask/cigarette))
if(istype(attacking_item, /obj/item/clothing/mask/cigarette))
if(isElectrified())
var/obj/item/clothing/mask/cigarette/L = C
var/obj/item/clothing/mask/cigarette/L = attacking_item
L.light(SPAN_NOTICE("[user] lights their [L] on an electrical arc from the [src]"))
return

Expand All @@ -567,7 +567,7 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(

add_fingerprint(user)

if(istype(C, /obj/item/weapon/zombie_claws) && (welded || locked))
if(istype(attacking_item, /obj/item/weapon/zombie_claws) && (welded || locked))
user.visible_message(SPAN_NOTICE("[user] starts tearing into the door on the [src]!"), \
SPAN_NOTICE("You start prying your hand into the gaps of the door with your fingers... This will take about 30 seconds."), \
SPAN_NOTICE("You hear tearing noises!"))
Expand All @@ -584,8 +584,8 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(

return

if((iswelder(C) && !operating && density))
var/obj/item/tool/weldingtool/W = C
if((iswelder(attacking_item) && !operating && density))
var/obj/item/tool/weldingtool/W = attacking_item
var/weldtime = 50
if(!HAS_TRAIT(W, TRAIT_TOOL_BLOWTORCH))
weldtime = 70
Expand All @@ -609,7 +609,7 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
update_icon()
return

else if(HAS_TRAIT(C, TRAIT_TOOL_SCREWDRIVER))
else if(HAS_TRAIT(attacking_item, TRAIT_TOOL_SCREWDRIVER))
if(no_panel)
to_chat(user, SPAN_WARNING("\The [src] has no panel to open!"))
return
Expand All @@ -619,17 +619,17 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
update_icon()
return

else if(HAS_TRAIT(C, TRAIT_TOOL_WIRECUTTERS))
else if(HAS_TRAIT(attacking_item, TRAIT_TOOL_WIRECUTTERS))
return attack_hand(user)

else if(HAS_TRAIT(C, TRAIT_TOOL_MULTITOOL))
else if(HAS_TRAIT(attacking_item, TRAIT_TOOL_MULTITOOL))
return attack_hand(user)

else if(isgun(C))
var/obj/item/weapon/gun/G = C
for(var/slot in G.attachments)
if(istype(G.attachments[slot], /obj/item/attachable/bayonet))
var/obj/item/attachable/bayonet/a_bayonet = G.attachments[slot]
else if(isgun(attacking_item))
var/obj/item/weapon/gun/gun_item = attacking_item
for(var/slot in gun_item.attachments)
if(istype(gun_item.attachments[slot], /obj/item/attachable/bayonet))
var/obj/item/attachable/bayonet/a_bayonet = gun_item.attachments[slot]
if(arePowerSystemsOn())
to_chat(user, SPAN_WARNING("The airlock's motors resist your efforts to force it."))
else if(locked)
Expand All @@ -647,58 +647,56 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
if(do_after(user, a_bayonet.pry_delay, INTERRUPT_ALL, BUSY_ICON_FRIENDLY))
close(1)

else if(C.pry_capable)
if(C.pry_capable == IS_PRY_CAPABLE_CROWBAR && panel_open && welded)
else if(attacking_item.pry_capable)
if(attacking_item.pry_capable == IS_PRY_CAPABLE_CROWBAR && panel_open && welded)
if(!skillcheck(user, SKILL_ENGINEER, SKILL_ENGINEER_ENGI))
to_chat(user, SPAN_WARNING("You don't seem to know how to deconstruct machines."))
return
if(width > 1)
to_chat(user, SPAN_WARNING("Large doors seem impossible to disassemble."))
return
playsound(loc, 'sound/items/Crowbar.ogg', 25, 1)
user.visible_message("[user] starts removing the electronics from the airlock assembly.", "You start removing electronics from the airlock assembly.")
if(do_after(user, 40, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
to_chat(user, SPAN_NOTICE(" You removed the airlock electronics!"))

var/obj/structure/airlock_assembly/da = new assembly_type(loc)
if(istype(da, /obj/structure/airlock_assembly/multi_tile))
da.setDir(dir)
var/obj/structure/airlock_assembly/doors_assembly = new assembly_type(loc)
if(istype(doors_assembly, /obj/structure/airlock_assembly/multi_tile))
doors_assembly.setDir(dir)
doors_assembly.update_collision_box()

da.anchored = TRUE
doors_assembly.anchored = TRUE
if(mineral)
da.glass = mineral
doors_assembly.glass = mineral
//else if(glass)
else if(glass && !da.glass)
da.glass = 1
da.state = 0
da.created_name = name
da.update_icon()
else if(glass && !doors_assembly.glass)
doors_assembly.glass = TRUE
doors_assembly.state = 0
doors_assembly.created_name = name
doors_assembly.update_icon()

var/obj/item/circuitboard/airlock/ae
var/obj/item/circuitboard/airlock/airlock_electronics
if(!electronics)
ae = new/obj/item/circuitboard/airlock( loc )
airlock_electronics = new/obj/item/circuitboard/airlock(loc)
if(!req_access || !req_one_access)
check_access()
if(req_access.len)
ae.conf_access = req_access
airlock_electronics.conf_access = req_access
else if(req_one_access.len)
ae.conf_access = req_one_access
ae.one_access = 1
airlock_electronics.conf_access = req_one_access
airlock_electronics.one_access = TRUE
else
ae = electronics
airlock_electronics = electronics
electronics = null
ae.forceMove(loc)
airlock_electronics.forceMove(loc)
if(operating == -1)
ae.fried = TRUE
ae.update_icon()
airlock_electronics.fried = TRUE
airlock_electronics.update_icon()
operating = 0

msg_admin_niche("[key_name(user)] deconstructed [src] in [get_area(user)] ([user.loc.x],[user.loc.y],[user.loc.z])")
SEND_SIGNAL(user, COMSIG_MOB_DISASSEMBLE_AIRLOCK, src)
deconstruct()
return

else if(arePowerSystemsOn() && C.pry_capable != IS_PRY_CAPABLE_FORCE)
else if(arePowerSystemsOn() && attacking_item.pry_capable != IS_PRY_CAPABLE_FORCE)
to_chat(user, SPAN_WARNING("The airlock's motors resist your efforts to force it."))

else if(locked)
Expand All @@ -707,7 +705,7 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(
else if(welded)
to_chat(user, SPAN_WARNING("The airlock is welded shut."))

else if(C.pry_capable == IS_PRY_CAPABLE_FORCE)
else if(attacking_item.pry_capable == IS_PRY_CAPABLE_FORCE)
return FALSE //handled by the item's afterattack

else if(!operating)
Expand All @@ -719,7 +717,7 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list(

return TRUE //no afterattack call

if(istype(C, /obj/item/large_shrapnel))
if(istype(attacking_item, /obj/item/large_shrapnel))
return FALSE //trigger afterattack call
else
return ..()
Expand Down
50 changes: 28 additions & 22 deletions code/game/machinery/doors/multi_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@
/obj/structure/machinery/door/airlock/multi_tile
width = 2
damage_cap = 650 // Bigger = more endurable
assembly_type = /obj/structure/airlock_assembly/multi_tile

/obj/structure/machinery/door/airlock/multi_tile/close() //Nasty as hell O(n^2) code but unfortunately necessary
for(var/turf/T in locs)
for(var/obj/vehicle/multitile/M in T)
if(M) return 0
for(var/turf/turf_tile in locs)
for(var/obj/vehicle/multitile/vehicle_tile in turf_tile)
if(vehicle_tile) return 0

return ..()

/obj/structure/machinery/door/airlock/multi_tile/Initialize()
. = ..()
handle_multidoor()
update_icon()

/obj/structure/machinery/door/airlock/multi_tile/glass
name = "Glass Airlock"
icon = 'icons/obj/structures/doors/Door2x1glass.dmi'
opacity = FALSE
glass = 1
glass = TRUE
assembly_type = /obj/structure/airlock_assembly/multi_tile

/obj/structure/machinery/door/airlock/multi_tile/glass/colony
Expand All @@ -25,7 +31,7 @@
name = "Security Airlock"
icon = 'icons/obj/structures/doors/Door2x1security.dmi'
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/security/colony
req_access = null
Expand All @@ -35,7 +41,7 @@
name = "Command Airlock"
icon = 'icons/obj/structures/doors/Door2x1command.dmi'
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/command/colony
req_access = null
Expand All @@ -45,7 +51,7 @@
name = "Medical Airlock"
icon = 'icons/obj/structures/doors/Door2x1medbay.dmi'
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/medical/colony
req_access = null
Expand All @@ -55,7 +61,7 @@
name = "Engineering Airlock"
icon = 'icons/obj/structures/doors/Door2x1engine.dmi'
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/engineering/colony
req_access = null
Expand All @@ -65,7 +71,7 @@
name = "Research Airlock"
icon = 'icons/obj/structures/doors/Door2x1research.dmi'
opacity = FALSE
glass = 1
glass = TRUE
req_one_access = list(ACCESS_MARINE_RESEARCH, ACCESS_WY_RESEARCH, ACCESS_WY_EXEC)

/obj/structure/machinery/door/airlock/multi_tile/research/colony
Expand Down Expand Up @@ -103,7 +109,7 @@
name = "Secure Airlock"
icon = 'icons/obj/structures/doors/Door2x1_secure2_glass.dmi'
opacity = FALSE
glass = 1
glass = TRUE
openspeed = 31
req_access = null

Expand Down Expand Up @@ -141,10 +147,10 @@
. = ..()
relativewall_neighbours()

/obj/structure/machinery/door/airlock/multi_tile/almayer/take_damage(dam, mob/M)
var/damage_check = max(0, damage + dam)
if(damage_check >= damage_cap && M && is_mainship_level(z))
SSclues.create_print(get_turf(M), M, "The fingerprint contains bits of wire and metal specks.")
/obj/structure/machinery/door/airlock/multi_tile/almayer/take_damage(taken_damage, mob/damaging_mob)
var/damage_check = max(0, damage + taken_damage)
if(damage_check >= damage_cap && damaging_mob && is_mainship_level(z))
SSclues.create_print(get_turf(damaging_mob), damaging_mob, "The fingerprint contains bits of wire and metal specks.")
..()

/obj/structure/machinery/door/airlock/multi_tile/almayer/generic
Expand All @@ -156,6 +162,11 @@
/obj/structure/machinery/door/airlock/multi_tile/almayer/generic/autoname
autoname = TRUE

/obj/structure/machinery/door/airlock/multi_tile/almayer/generic/solid
icon = 'icons/obj/structures/doors/2x1generic_solid.dmi'
opacity = TRUE
glass = FALSE

/obj/structure/machinery/door/airlock/multi_tile/almayer/medidoor
name = "\improper Medical Airlock"
icon = 'icons/obj/structures/doors/2x1medidoor.dmi'
Expand Down Expand Up @@ -223,15 +234,10 @@
req_one_access = list(ACCESS_CIVILIAN_BRIG, ACCESS_CIVILIAN_COMMAND, ACCESS_WY_COLONIAL)

/obj/structure/machinery/door/airlock/multi_tile/almayer/handle_multidoor()
. = ..()
if(!(width > 1)) return //Bubblewrap

update_filler_turfs()
if(dir in list(NORTH, SOUTH))
bound_height = world.icon_size * width
bound_width = world.icon_size
else if(dir in list(EAST, WEST))
bound_width = world.icon_size * width
bound_height = world.icon_size

//We have to find these again since these doors are used on shuttles a lot so the turfs changes
/obj/structure/machinery/door/airlock/multi_tile/almayer/proc/update_filler_turfs()
Expand Down Expand Up @@ -427,7 +433,7 @@
/obj/structure/machinery/door/airlock/multi_tile/elevator/access
icon = 'icons/obj/structures/doors/4x1_elevator_access.dmi'
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/elevator/access/research
name = "\improper Research Elevator Hatch"
Expand Down Expand Up @@ -547,7 +553,7 @@
icon = 'icons/obj/structures/doors/prepdoor.dmi'
req_one_access = list(ACCESS_MARINE_PREP, ACCESS_MARINE_DATABASE, ACCESS_MARINE_CARGO, ACCESS_MARINE_ALPHA, ACCESS_MARINE_BRAVO, ACCESS_MARINE_CHARLIE, ACCESS_MARINE_DELTA)
opacity = FALSE
glass = 1
glass = TRUE

/obj/structure/machinery/door/airlock/multi_tile/almayer/marine/shared/alpha_bravo
name = "\improper Alpha-Bravo Squads Preparations"
Expand Down
Loading

0 comments on commit 199b695

Please sign in to comment.