Allows wooden airlocks to be made and removes another text2path function. (#19199)

* Fixes #18882 and refactors for door assemblies

* Removes text2path, makes wooden airlocks buildable

* Use mineral crafting menu

* Minor oversight

* Comments improvement

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* Review suggestions

* Removes unneeded vars

* Fixed tab spacing

Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
DevanStrife
2022-10-16 20:04:50 +02:00
committed by GitHub
parent d9903511e8
commit bb2e2a9d45
4 changed files with 25 additions and 42 deletions
+11 -40
View File
@@ -7,8 +7,11 @@
max_integrity = 200
var/overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
var/state = AIRLOCK_ASSEMBLY_NEEDS_WIRES
/// String value. Used in user chat messages
var/mineral
/// mineral object path.
var/mineral_type
var/base_name = "airlock"
var/obj/item/airlock_electronics/electronics
var/airlock_type = /obj/machinery/door/airlock //the type path of the airlock once completed
@@ -17,7 +20,6 @@
var/polarized_glass = FALSE
var/created_name
var/heat_proof_finished = FALSE //whether to heat-proof the finished airlock
var/previous_assembly = /obj/structure/door_assembly
var/noglass = FALSE //airlocks with no glass version, also cannot be modified with sheets
var/material_type = /obj/item/stack/sheet/metal
var/material_amt = 4
@@ -47,11 +49,7 @@
. += "<span class='notice'>The circuit is <b>connected loosely</b> to its slot, but the maintenance panel is <i>unscrewed and open</i>.</span>"
if(glass)
. += "<span class='notice'>The assembly has its electrochromic windows <b>[polarized_glass ? "enabled" : "disabled"]</b> and can be <i>configured</i>.</span>"
if(!mineral && !glass && !noglass)
. += "<span class='notice'>There is a small <i>paper</i> placard on the assembly[doorname]. There are <i>empty</i> slots for glass windows and mineral covers.</span>"
else if(!mineral && glass && !noglass)
. += "<span class='notice'>There is a small <i>paper</i> placard on the assembly[doorname]. There are <i>empty</i> slots for mineral covers.</span>"
else if(mineral && !glass && !noglass)
if(!glass && !noglass)
. += "<span class='notice'>There is a small <i>paper</i> placard on the assembly[doorname]. There are <i>empty</i> slots for glass windows.</span>"
else
. += "<span class='notice'>There is a small <i>paper</i> placard on the assembly[doorname].</span>"
@@ -111,22 +109,6 @@
to_chat(user, "<span class='notice'>You install regular glass windows into the airlock assembly.</span>")
S.use(1)
glass = TRUE
if(!mineral)
if(istype(S, /obj/item/stack/sheet/mineral) && S.sheettype)
var/M = S.sheettype
if(S.get_amount() >= 2)
playsound(loc, S.usesound, 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly...")
if(do_after(user, 40 * S.toolspeed, target = src))
if(S.get_amount() < 2 || mineral)
return
to_chat(user, "<span class='notice'>You install [M] plating into the airlock assembly.</span>")
S.use(2)
var/mineralassembly = text2path("/obj/structure/door_assembly/door_assembly_[M]")
var/obj/structure/door_assembly/MA = new mineralassembly(loc)
transfer_assembly_vars(src, MA, TRUE)
else
to_chat(user, "<span class='warning'>You need at least two sheets to add a mineral cover!</span>")
else
to_chat(user, "<span class='warning'>You cannot add [S] to [src]!</span>")
else
@@ -187,7 +169,6 @@
door.name = created_name
else
door.name = base_name
door.previous_airlock = previous_assembly
electronics.forceMove(door)
electronics = null
qdel(src)
@@ -226,18 +207,7 @@
. = TRUE
if(!I.tool_use_check(user, 0))
return
if(mineral)
var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
user.visible_message("<span class='notice'>[user] welds the [mineral] plating off [src].</span>",\
"<span class='notice'>You start to weld the [mineral] plating off [src]...</span>",\
"<span class='warning'>You hear welding.</span>")
if(!I.use_tool(src, user, 40, volume = I.tool_volume))
return
to_chat(user, "<span class='notice'>You weld the [mineral] plating off.</span>")
new mineral_path(loc, 2)
var/obj/structure/door_assembly/PA = new previous_assembly(loc)
transfer_assembly_vars(src, PA)
else if(glass)
if(glass)
user.visible_message("<span class='notice'>[user] welds the glass panel out of [src].</span>",\
"<span class='notice'>You start to weld the glass panel out of the [src]...</span>",\
"<span class='warning'>You hear welding.</span>")
@@ -309,8 +279,6 @@
target.created_name = source.created_name
target.state = source.state
target.anchored = source.anchored
if(previous)
target.previous_assembly = source.type
if(electronics)
target.electronics = source.electronics
source.electronics.forceMove(target)
@@ -321,9 +289,14 @@
/obj/structure/door_assembly/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
var/turf/T = get_turf(src)
var/to_spawn_type
if(mineral_type)
to_spawn_type = mineral_type
else
to_spawn_type = material_type
if(!disassembled)
material_amt = rand(2,4)
new material_type(T, material_amt)
new to_spawn_type(T, material_amt)
if(glass)
if(disassembled)
if(heat_proof_finished)
@@ -332,6 +305,4 @@
new /obj/item/stack/sheet/glass(T)
else
new /obj/item/shard(T)
if(mineral_type)
new mineral_type(T, 2)
qdel(src)