Files
Bubberstation/code/game/objects/structures/door_assembly.dm
phil235 5f835bfc26 Obj damaging system, acid damage, and fire damage refactor (WIP) (#20793)
Please refer to #20867 and #20870 for a easier view of the changes. Those two PRs show all meaningful changes (hopefully) and doesn't show the files changed with just 3 lines changed.

This PR does three things:

    It makes all children of /obj/ use the same damage system.
    Previously to make your new machine/structure be destroyable you needed to give it a var/health, and its own version of many damage related proc such as bullet_act(), take_damage(), attacked_by(), attack_animal(), attack_hulk(), ex_act(), etc... But now, all /obj/ use the same version of those procs at the /obj/ level in code/game/obj_defense.dm. All these obj share the same necessary vars: obj_integrity (health), max_integrity, integrity_failure (optional, below that health level failure happens), and the armor list var which was previously only for items, as well as the resistance_flags bitfield. When you want your new object to be destroyable, you only have to give it a value for those vars and maybe override one proc if you want a special behavior but that's it. This reorganization removes a lot of copypasta (most bullet_act() version for each obj were nearly identical). Two new elements are added to the armor list var: fire and acid armor values.
    How much damage an obj take depends on the armor value for each damage category. But some objects are INDESTRUCTIBLE and simply never take any damage no matter the type.
    The armor categories are:
    -melee(punches, item attacks, xeno/animal/hulk attacks, blob attacks, thrown weapons)
    -bullet
    -laser
    -energy (used by projectiles like ionrifle, taser, and also by EMPs)
    -bio (unused for this, only here because clothes use them when worn)
    -rad (same)
    -bomb (self-explanatory)
    -fire (for fire damage, not for heat damage though)
    -acid
    For machines and structures, when their health reaches zero the object is not just deleted but gets somewhat forcedeconstructed (the proc used is shared with the actual deconstruction system) which can drops things. To not frustrates players most of these objects drop most of the elements necessary to rebuild them (think window dropping shards). Machines drop a machine frame and all components for example (but the frame can then be itself smashed to pieces).
    For clothes, when they are damaged, they get a "damaged" overlay, which can also be seen when worn, similar to the "bloody" overlay.

    It refactors acid. See #20537.
    Some objects are ACID_PROOF and take no damage from acid, while others take varying amounts
    of damage depending on their acid armor value. Some objects are even UNACIDABLE, no acid effect can even land on them. Acid on objects can be washed off using water.

    It changes some aspect of damage from fires.
    All /obj/ can now take fire damage and be flammable, instead of just items. And instead of having just FLAMMABLE objs that become ON_FIRE as soon as some fire touch them (paper), we now have objects that are non flammable but do take damage from fire and become ashes if their health reaches zero (only for items). The damage taken varies depending on the obj's fire armor value and total health. There's also still obj and items that are FIRE_PROOF (although some might still be melted by lava if they're not LAVA_PROOF).
    When a mob is on fire, its clothes now take fire damage and can turn to ashes. Similarly, when a mob takes melee damages, its clothes gets damaged a bit and can turn to shreds. You can repair clothes with cloth that is produceable by botany's biogenerator.

    It also does many minor things:
        Clicking a structure/machine with an item on help intent never results in an attack (so you don't destroy a structure while trying to figure out which tool to use).
        I moved a lot of objects away from /obj/effect, it should only be used for visual effects, decals and stuff, not for things you can hit and destroy.
        I tweaked a bit how clothes shredding from bombs work.
        I made a machine or structure un/anchorable with the wrench, I don't remember which object...
        Since I changed the meaning of the FIRE_PROOF bitflag to actually mean fire immune, I'm buffing the slime extract that you apply on items to make them fire proof. well now they're really 100% fire proof!
        animals with environment_smash = 1 no longer one-hit destroy tables and stuff, we give them a decent obj_damage value so they can destroy most obj relatively fast depending on the animal.
        Probably a million things I forgot.

If you want to know how the damage system works all you need is the three obj vars "obj_integrity", "max_integrity", "integrity_failure", as well as the armor list var and the resistance_flags bitfield, and read the file obj_defense.dm
2016-10-10 11:14:59 +13:00

700 lines
24 KiB
Plaintext

/obj/structure/door_assembly
name = "airlock assembly"
icon = 'icons/obj/doors/airlocks/station/public.dmi'
icon_state = "construction"
var/overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
anchored = 0
density = 1
obj_integrity = 200
max_integrity = 200
var/state = 0
var/mineral = null
var/typetext = ""
var/icontext = ""
var/obj/item/weapon/electronics/airlock/electronics = null
var/airlock_type = /obj/machinery/door/airlock //the type path of the airlock once completed
var/glass_type = /obj/machinery/door/airlock/glass
var/created_name = null
var/heat_proof_finished = 0 //whether to heat-proof the finished airlock
var/material = null //icon state logic
/obj/structure/door_assembly/New()
update_icon()
/obj/structure/door_assembly/door_assembly_0
name = "airlock assembly"
airlock_type = /obj/machinery/door/airlock
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_com
name = "command airlock assembly"
icon = 'icons/obj/doors/airlocks/station/command.dmi'
typetext = "command"
icontext = "com"
glass_type = /obj/machinery/door/airlock/glass_command
airlock_type = /obj/machinery/door/airlock/command
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_com/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_sec
name = "security airlock assembly"
icon = 'icons/obj/doors/airlocks/station/security.dmi'
typetext = "security"
icontext = "sec"
glass_type = /obj/machinery/door/airlock/glass_security
airlock_type = /obj/machinery/door/airlock/security
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_sec/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_eng
name = "engineering airlock assembly"
icon = 'icons/obj/doors/airlocks/station/engineering.dmi'
typetext = "engineering"
icontext = "eng"
glass_type = /obj/machinery/door/airlock/glass_engineering
airlock_type = /obj/machinery/door/airlock/engineering
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_eng/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_min
name = "mining airlock assembly"
icon = 'icons/obj/doors/airlocks/station/mining.dmi'
typetext = "mining"
icontext = "min"
glass_type = /obj/machinery/door/airlock/glass_mining
airlock_type = /obj/machinery/door/airlock/mining
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_min/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_atmo
name = "atmospherics airlock assembly"
icon = 'icons/obj/doors/airlocks/station/atmos.dmi'
typetext = "atmos"
icontext = "atmo"
glass_type = /obj/machinery/door/airlock/glass_atmos
airlock_type = /obj/machinery/door/airlock/atmos
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_atmo/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_research
name = "research airlock assembly"
icon = 'icons/obj/doors/airlocks/station/research.dmi'
typetext = "research"
icontext = "res"
glass_type = /obj/machinery/door/airlock/glass_research
airlock_type = /obj/machinery/door/airlock/research
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_research/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_science
name = "science airlock assembly"
icon = 'icons/obj/doors/airlocks/station/science.dmi'
typetext = "science"
icontext = "sci"
glass_type = /obj/machinery/door/airlock/glass_science
airlock_type = /obj/machinery/door/airlock/science
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_science/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_med
name = "medical airlock assembly"
icon = 'icons/obj/doors/airlocks/station/medical.dmi'
typetext = "medical"
icontext = "med"
glass_type = /obj/machinery/door/airlock/glass_medical
airlock_type = /obj/machinery/door/airlock/medical
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_med/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_mai
name = "maintenance airlock assembly"
icon = 'icons/obj/doors/airlocks/station/maintenance.dmi'
typetext = "maintenance"
icontext = "mai"
glass_type = /obj/machinery/door/airlock/glass_maintenance
airlock_type = /obj/machinery/door/airlock/maintenance
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_mai/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_ext
name = "external airlock assembly"
icon = 'icons/obj/doors/airlocks/external/external.dmi'
overlays_file = 'icons/obj/doors/airlocks/external/overlays.dmi'
typetext = "external"
icontext = "ext"
glass_type = /obj/machinery/door/airlock/glass_external
airlock_type = /obj/machinery/door/airlock/external
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_ext/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_fre
name = "freezer airlock assembly"
icon = 'icons/obj/doors/airlocks/station/freezer.dmi'
typetext = "freezer"
icontext = "fre"
airlock_type = /obj/machinery/door/airlock/freezer
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_hatch
name = "airtight hatch assembly"
icon = 'icons/obj/doors/airlocks/hatch/centcom.dmi'
overlays_file = 'icons/obj/doors/airlocks/hatch/overlays.dmi'
typetext = "hatch"
icontext = "hatch"
airlock_type = /obj/machinery/door/airlock/hatch
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_mhatch
name = "maintenance hatch assembly"
icon = 'icons/obj/doors/airlocks/hatch/maintenance.dmi'
overlays_file = 'icons/obj/doors/airlocks/hatch/overlays.dmi'
typetext = "maintenance_hatch"
icontext = "mhatch"
airlock_type = /obj/machinery/door/airlock/maintenance_hatch
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_glass
name = "glass airlock assembly"
icon = 'icons/obj/doors/airlocks/station2/glass.dmi'
overlays_file = 'icons/obj/doors/airlocks/station2/overlays.dmi'
airlock_type = /obj/machinery/door/airlock/glass
anchored = 1
state = 1
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_gold
name = "gold airlock assembly"
icon = 'icons/obj/doors/airlocks/station/gold.dmi'
airlock_type = /obj/machinery/door/airlock/gold
anchored = 1
state = 1
mineral = "gold"
/obj/structure/door_assembly/door_assembly_silver
name = "silver airlock assembly"
icon = 'icons/obj/doors/airlocks/station/silver.dmi'
airlock_type = /obj/machinery/door/airlock/silver
anchored = 1
state = 1
mineral = "silver"
/obj/structure/door_assembly/door_assembly_diamond
name = "diamond airlock assembly"
icon = 'icons/obj/doors/airlocks/station/diamond.dmi'
airlock_type = /obj/machinery/door/airlock/diamond
anchored = 1
state = 1
mineral = "diamond"
/obj/structure/door_assembly/door_assembly_uranium
name = "uranium airlock assembly"
icon = 'icons/obj/doors/airlocks/station/uranium.dmi'
airlock_type = /obj/machinery/door/airlock/uranium
anchored = 1
state = 1
mineral = "uranium"
/obj/structure/door_assembly/door_assembly_plasma
name = "plasma airlock assembly"
icon = 'icons/obj/doors/airlocks/station/plasma.dmi'
airlock_type = /obj/machinery/door/airlock/plasma
anchored = 1
state = 1
mineral = "plasma"
/obj/structure/door_assembly/door_assembly_clown
name = "bananium airlock assembly"
desc = "Honk"
icon = 'icons/obj/doors/airlocks/station/bananium.dmi'
airlock_type = /obj/machinery/door/airlock/clown
anchored = 1
state = 1
mineral = "bananium"
/obj/structure/door_assembly/door_assembly_sandstone
name = "sandstone airlock assembly"
icon = 'icons/obj/doors/airlocks/station/sandstone.dmi'
airlock_type = /obj/machinery/door/airlock/sandstone
anchored = 1
state = 1
mineral = "sandstone"
/obj/structure/door_assembly/door_assembly_highsecurity // Borrowing this until WJohnston makes sprites for the assembly
name = "high security airlock assembly"
icon = 'icons/obj/doors/airlocks/highsec/highsec.dmi'
overlays_file = 'icons/obj/doors/airlocks/highsec/overlays.dmi'
typetext = "highsecurity"
icontext = "highsec"
airlock_type = /obj/machinery/door/airlock/highsecurity
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_vault
name = "vault door assembly"
icon = 'icons/obj/doors/airlocks/vault/vault.dmi'
overlays_file = 'icons/obj/doors/airlocks/vault/overlays.dmi'
typetext = "vault"
icontext = "vault"
airlock_type = /obj/machinery/door/airlock/vault
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_shuttle
name = "shuttle airlock assembly"
icon = 'icons/obj/doors/airlocks/shuttle/shuttle.dmi'
overlays_file = 'icons/obj/doors/airlocks/shuttle/overlays.dmi'
typetext = "shuttle"
icontext = "shuttle"
airlock_type = /obj/machinery/door/airlock/shuttle
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_cult
name = "cult airlock assembly"
icon = 'icons/obj/doors/airlocks/cult/runed/cult.dmi'
overlays_file = 'icons/obj/doors/airlocks/cult/runed/overlays.dmi'
typetext = "cult"
icontext = "cult"
airlock_type = /obj/machinery/door/airlock/cult
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_cult/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_cult/unruned
icon = 'icons/obj/doors/airlocks/cult/unruned/cult.dmi'
overlays_file = 'icons/obj/doors/airlocks/cult/unruned/overlays.dmi'
/obj/structure/door_assembly/door_assembly_cult/unruned/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_wood
name = "wooden airlock assembly"
icon = 'icons/obj/doors/airlocks/station/wood.dmi'
airlock_type = /obj/machinery/door/airlock/wood
anchored = 1
state = 1
mineral = "wood"
/obj/structure/door_assembly/door_assembly_viro
name = "virology airlock assembly"
icon = 'icons/obj/doors/airlocks/station/virology.dmi'
typetext = "virology"
icontext = "viro"
glass_type = /obj/machinery/door/airlock/glass_virology
airlock_type = /obj/machinery/door/airlock/virology
anchored = 1
state = 1
/obj/structure/door_assembly/door_assembly_viro/glass
mineral = "glass"
material = "glass"
/obj/structure/door_assembly/door_assembly_centcom
typetext = "centcom"
icon = 'icons/obj/doors/airlocks/centcom/centcom.dmi'
overlays_file = 'icons/obj/doors/airlocks/centcom/overlays.dmi'
icontext = "ele"
airlock_type = /obj/machinery/door/airlock/centcom
anchored = 1
state = 1
/obj/structure/door_assembly/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/weapon/pen))
var/t = stripped_input(user, "Enter the name for the door.", src.name, src.created_name,MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && src.loc != usr)
return
created_name = t
else if(istype(W, /obj/item/weapon/airlock_painter)) // |- Ricotez
//INFORMATION ABOUT ADDING A NEW AIRLOCK TO THE PAINT LIST:
//If your airlock has a regular version, add it to the list with regular versions.
//If your airlock has a glass version, add it to the list with glass versions.
//Don't forget to also set has_solid and has_glass to the proper value.
//Do NOT add your airlock to a list if it does not have a version for that list,
// or you will get broken icons.
var/obj/item/weapon/airlock_painter/WT = W
if(WT.can_use(user))
var/icontype
var/optionlist
if(mineral && mineral == "glass")
//These airlocks have a glass version.
optionlist = list("Public", "Public2", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Science", "Mining")
else
//These airlocks have a regular version.
optionlist = list("Public", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Science", "Mining", "Maintenance", "External", "High Security")
icontype = input(user, "Please select a paintjob for this airlock.") in optionlist
if((!in_range(src, usr) && src.loc != usr) || !WT.use(user))
return
var/has_solid = 0
var/has_glass = 0
switch(icontype)
if("Public")
icon = 'icons/obj/doors/airlocks/station/public.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = ""
icontext = ""
has_solid = 1
has_glass = 1
if("Public2")
icon = 'icons/obj/doors/airlocks/station2/glass.dmi'
overlays_file = 'icons/obj/doors/airlocks/station2/overlays.dmi'
typetext = ""
icontext = ""
has_solid = 1
has_glass = 1
if("Engineering")
icon = 'icons/obj/doors/airlocks/station/engineering.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "engineering"
icontext = "eng"
has_solid = 1
has_glass = 1
if("Atmospherics")
icon = 'icons/obj/doors/airlocks/station/atmos.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "atmos"
icontext = "atmo"
has_solid = 1
has_glass = 1
if("Security")
icon = 'icons/obj/doors/airlocks/station/security.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "security"
icontext = "sec"
has_solid = 1
has_glass = 1
if("Command")
icon = 'icons/obj/doors/airlocks/station/command.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "command"
icontext = "com"
has_solid = 1
has_glass = 1
if("Medical")
icon = 'icons/obj/doors/airlocks/station/medical.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "medical"
icontext = "med"
has_solid = 1
has_glass = 1
if("Research")
icon = 'icons/obj/doors/airlocks/station/research.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "research"
icontext = "res"
has_solid = 1
has_glass = 1
if("Science")
icon = 'icons/obj/doors/airlocks/station/science.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "research"
icontext = "res"
has_solid = 1
has_glass = 1
if("Mining")
icon = 'icons/obj/doors/airlocks/station/mining.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "mining"
icontext = "min"
has_solid = 1
has_glass = 1
if("Maintenance")
icon = 'icons/obj/doors/airlocks/station/maintenance.dmi'
overlays_file = 'icons/obj/doors/airlocks/station/overlays.dmi'
typetext = "maintenance"
icontext = "mai"
has_solid = 1
has_glass = 0
if("External")
icon = 'icons/obj/doors/airlocks/external/external.dmi'
overlays_file = 'icons/obj/doors/airlocks/external/overlays.dmi'
typetext = "external"
icontext = "ext"
has_solid = 1
has_glass = 0
if("High Security")
icon = 'icons/obj/doors/airlocks/highsec/highsec.dmi'
overlays_file = 'icons/obj/doors/airlocks/highsec/overlays.dmi'
typetext = "highsecurity"
icontext = "highsec"
has_solid = 1
has_glass = 0
if(has_solid)
airlock_type = text2path("/obj/machinery/door/airlock/[typetext]")
else
airlock_type = /obj/machinery/door/airlock
if(has_glass)
glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]")
else
glass_type = /obj/machinery/door/airlock/glass
if(mineral && mineral != "glass")
mineral = null //I know this is stupid, but until we change glass to a boolean it's how this code works.
user << "<span class='notice'>You change the paintjob on the airlock assembly.</span>"
else if(istype(W, /obj/item/weapon/weldingtool) && !anchored )
var/obj/item/weapon/weldingtool/WT = W
if(WT.remove_fuel(0,user))
user.visible_message("<span class='warning'>[user] disassembles the airlock assembly.</span>", \
"You start to disassemble the airlock assembly...")
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(do_after(user, 40/W.toolspeed, target = src))
if( !WT.isOn() )
return
user << "<span class='notice'>You disassemble the airlock assembly.</span>"
deconstruct(TRUE)
else if(istype(W, /obj/item/weapon/wrench))
if(!anchored )
var/door_check = 1
for(var/obj/machinery/door/D in loc)
if(!D.sub_door)
door_check = 0
break
if(door_check)
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user.visible_message("[user] secures the airlock assembly to the floor.", \
"<span class='notice'>You start to secure the airlock assembly to the floor...</span>", \
"<span class='italics'>You hear wrenching.</span>")
if(do_after(user, 40/W.toolspeed, target = src))
if( src.anchored )
return
user << "<span class='notice'>You secure the airlock assembly.</span>"
src.name = "secured airlock assembly"
src.anchored = 1
else
user << "There is another door here!"
else
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
user.visible_message("[user] unsecures the airlock assembly from the floor.", \
"<span class='notice'>You start to unsecure the airlock assembly from the floor...</span>", \
"<span class='italics'>You hear wrenching.</span>")
if(do_after(user, 40/W.toolspeed, target = src))
if(!anchored )
return
user << "<span class='notice'>You unsecure the airlock assembly.</span>"
name = "airlock assembly"
anchored = 0
else if(istype(W, /obj/item/stack/cable_coil) && state == 0 && anchored )
var/obj/item/stack/cable_coil/C = W
if (C.get_amount() < 1)
user << "<span class='warning'>You need one length of cable to wire the airlock assembly!</span>"
return
user.visible_message("[user] wires the airlock assembly.", \
"<span class='notice'>You start to wire the airlock assembly...</span>")
if(do_after(user, 40, target = src))
if(C.get_amount() < 1 || state != 0) return
C.use(1)
src.state = 1
user << "<span class='notice'>You wire the airlock assembly.</span>"
src.name = "wired airlock assembly"
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1 )
playsound(src.loc, 'sound/items/Wirecutter.ogg', 100, 1)
user.visible_message("[user] cuts the wires from the airlock assembly.", \
"<span class='notice'>You start to cut the wires from the airlock assembly...</span>")
if(do_after(user, 40/W.toolspeed, target = src))
if( src.state != 1 )
return
user << "<span class='notice'>You cut the wires from the airlock assembly.</span>"
new/obj/item/stack/cable_coil(get_turf(user), 1)
src.state = 0
src.name = "secured airlock assembly"
else if(istype(W, /obj/item/weapon/electronics/airlock) && state == 1 )
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user.visible_message("[user] installs the electronics into the airlock assembly.", \
"<span class='notice'>You start to install electronics into the airlock assembly...</span>")
if(do_after(user, 40, target = src))
if( src.state != 1 )
return
if(!user.drop_item())
return
W.loc = src
user << "<span class='notice'>You install the airlock electronics.</span>"
src.state = 2
src.name = "near finished airlock assembly"
src.electronics = W
else if(istype(W, /obj/item/weapon/crowbar) && state == 2 )
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] removes the electronics from the airlock assembly.", \
"<span class='notice'>You start to remove electronics from the airlock assembly...</span>")
if(do_after(user, 40/W.toolspeed, target = src))
if( src.state != 2 )
return
user << "<span class='notice'>You remove the airlock electronics.</span>"
src.state = 1
src.name = "wired airlock assembly"
var/obj/item/weapon/electronics/airlock/ae
if (!electronics)
ae = new/obj/item/weapon/electronics/airlock( src.loc )
else
ae = electronics
electronics = null
ae.loc = src.loc
else if(istype(W, /obj/item/stack/sheet) && !mineral)
var/obj/item/stack/sheet/G = W
if(G)
if(G.get_amount() >= 1)
if(istype(G, /obj/item/stack/sheet/rglass) || istype(G, /obj/item/stack/sheet/glass))
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [G.name] to the airlock assembly.", \
"<span class='notice'>You start to install [G.name] into the airlock assembly...</span>")
if(do_after(user, 40, target = src))
if(G.get_amount() < 1 || mineral) return
if (G.type == /obj/item/stack/sheet/rglass)
user << "<span class='notice'>You install reinforced glass windows into the airlock assembly.</span>"
heat_proof_finished = 1 //reinforced glass makes the airlock heat-proof
name = "near finished heat-proofed window airlock assembly"
else
user << "<span class='notice'>You install regular glass windows into the airlock assembly.</span>"
name = "near finished window airlock assembly"
G.use(1)
mineral = "glass"
material = "glass"
//This list contains the airlock paintjobs that have a glass version:
if(icontext in list("eng", "atmo", "sec", "com", "med", "res", "min"))
src.airlock_type = text2path("/obj/machinery/door/airlock/[typetext]")
src.glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]")
else
//This airlock is default or does not have a glass version, so we revert to the default glass airlock. |- Ricotez
airlock_type = /obj/machinery/door/airlock
glass_type = /obj/machinery/door/airlock/glass
typetext = ""
icontext = ""
else if(istype(G, /obj/item/stack/sheet/mineral))
var/M = G.sheettype
if(G.get_amount() >= 2)
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [G.name] to the airlock assembly.", \
"<span class='notice'>You start to install [G.name] into the airlock assembly...</span>")
if(do_after(user, 40, target = src))
if(G.get_amount() < 2 || mineral) return
user << "<span class='notice'>You install [M] plating into the airlock assembly.</span>"
G.use(2)
mineral = "[M]"
name = "near finished [M] airlock assembly"
airlock_type = text2path ("/obj/machinery/door/airlock/[M]")
glass_type = /obj/machinery/door/airlock/glass
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
user.visible_message("[user] finishes the airlock.", \
"<span class='notice'>You start finishing the airlock...</span>")
if(do_after(user, 40/W.toolspeed, target = src))
if(src.loc && state == 2)
user << "<span class='notice'>You finish the airlock.</span>"
var/obj/machinery/door/airlock/door
if(mineral == "glass")
door = new src.glass_type( src.loc )
else
door = new src.airlock_type( src.loc )
//door.req_access = src.req_access
door.electronics = src.electronics
door.heat_proof = src.heat_proof_finished
if(src.electronics.one_access)
door.req_one_access = src.electronics.accesses
else
door.req_access = src.electronics.accesses
if(created_name)
door.name = created_name
src.electronics.loc = door
qdel(src)
else
return ..()
update_icon()
/obj/structure/door_assembly/update_icon()
cut_overlays()
if(!material)
add_overlay(get_airlock_overlay("fill_construction", icon))
else
add_overlay(get_airlock_overlay("[material]_construction", overlays_file))
add_overlay(get_airlock_overlay("panel_c[state+1]", overlays_file))
/obj/structure/door_assembly/deconstruct(disassembled = TRUE)
if(!(flags & NODECONSTRUCT))
var/turf/T = get_turf(src)
var/metal_amt = 4
if(!disassembled)
metal_amt = rand(2,4)
new /obj/item/stack/sheet/metal(T, metal_amt)
if(mineral)
if (mineral == "glass")
if(disassembled)
if (heat_proof_finished)
new /obj/item/stack/sheet/rglass(T)
else
new /obj/item/stack/sheet/glass(T)
else
new /obj/item/weapon/shard(T)
else
var/obj/item/stack/sheet/mineral/mineral_path = text2path("/obj/item/stack/sheet/mineral/[mineral]")
new mineral_path(T, 2)
qdel(src)