Construction Tweaks and Fixes (#2253)

* Fixes reinforced Walls construction

when having one sheet left in the stack

* Amends Windoors

 - Assemblies are now made with two sheets of either normal or reinforced
   glass sheets, for normal and secure windoors respecting.
 - Assemblies can now be named with a pen, just like airlocks.
 - Windoor assemblies now get placed like windows, and windows take
   windoor assemblies into account when placed.
 - Decapitalises windoor assembly names.
 - Shattering windoors will make them drop exactly what they were made of
   now.
 - Prying emagged windoors will no longer make them shatter on top of
   returning to an assembly.
 - Cleans up a lot of code and gets its own update_icon() proc.

* Amends airlocks

 - Fixes airlocks occasionally not updating their icon correctly.
 - Fixes airlocks causing sparks on spawn as if they were damaged.
 - Fixes airlock not being anchored after being turned into an assembly.
 - Decapitalises airlock names.

* Windows that get unanchored by force will now correctly have the rotate verb.

* Adds changelog entry
This commit is contained in:
Hubblenaut
2016-08-02 19:39:22 +02:00
committed by Yoshax
parent 7aac528a4a
commit 044a677ab0
9 changed files with 161 additions and 90 deletions

View File

@@ -7,7 +7,7 @@
w_class = 5
var/state = 0
var/base_icon_state = ""
var/base_name = "Airlock"
var/base_name = "airlock"
var/obj/item/weapon/airlock_electronics/electronics = null
var/airlock_type = "" //the type path of the airlock once completed
var/glass_type = "/glass"
@@ -19,91 +19,91 @@
/obj/structure/door_assembly/door_assembly_com
base_icon_state = "com"
base_name = "Command Airlock"
base_name = "Command airlock"
glass_type = "/glass_command"
airlock_type = "/command"
/obj/structure/door_assembly/door_assembly_sec
base_icon_state = "sec"
base_name = "Security Airlock"
base_name = "Security airlock"
glass_type = "/glass_security"
airlock_type = "/security"
/obj/structure/door_assembly/door_assembly_eng
base_icon_state = "eng"
base_name = "Engineering Airlock"
base_name = "Engineering airlock"
glass_type = "/glass_engineering"
airlock_type = "/engineering"
/obj/structure/door_assembly/door_assembly_eat
base_icon_state = "eat"
base_name = "Engineering Atmos Airlock"
base_name = "Engineering atmos airlock"
glass_type = "/glass_engineeringatmos"
airlock_type = "/engineering"
/obj/structure/door_assembly/door_assembly_min
base_icon_state = "min"
base_name = "Mining Airlock"
base_name = "Mining airlock"
glass_type = "/glass_mining"
airlock_type = "/mining"
/obj/structure/door_assembly/door_assembly_atmo
base_icon_state = "atmo"
base_name = "Atmospherics Airlock"
base_name = "Atmospherics airlock"
glass_type = "/glass_atmos"
airlock_type = "/atmos"
/obj/structure/door_assembly/door_assembly_research
base_icon_state = "res"
base_name = "Research Airlock"
base_name = "Research airlock"
glass_type = "/glass_research"
airlock_type = "/research"
/obj/structure/door_assembly/door_assembly_science
base_icon_state = "sci"
base_name = "Science Airlock"
base_name = "Science airlock"
glass_type = "/glass_science"
airlock_type = "/science"
/obj/structure/door_assembly/door_assembly_med
base_icon_state = "med"
base_name = "Medical Airlock"
base_name = "Medical airlock"
glass_type = "/glass_medical"
airlock_type = "/medical"
/obj/structure/door_assembly/door_assembly_mai
base_icon_state = "mai"
base_name = "Maintenance Airlock"
base_name = "Maintenance airlock"
airlock_type = "/maintenance"
glass = -1
/obj/structure/door_assembly/door_assembly_ext
base_icon_state = "ext"
base_name = "External Airlock"
base_name = "External airlock"
airlock_type = "/external"
glass = -1
/obj/structure/door_assembly/door_assembly_fre
base_icon_state = "fre"
base_name = "Freezer Airlock"
base_name = "Freezer airlock"
airlock_type = "/freezer"
glass = -1
/obj/structure/door_assembly/door_assembly_hatch
base_icon_state = "hatch"
base_name = "Airtight Hatch"
base_name = "airtight hatch"
airlock_type = "/hatch"
glass = -1
/obj/structure/door_assembly/door_assembly_mhatch
base_icon_state = "mhatch"
base_name = "Maintenance Hatch"
base_name = "maintenance hatch"
airlock_type = "/maintenance_hatch"
glass = -1
/obj/structure/door_assembly/door_assembly_highsecurity // Borrowing this until WJohnston makes sprites for the assembly
base_icon_state = "highsec"
base_name = "High Security Airlock"
base_name = "high security airlock"
airlock_type = "/highsecurity"
glass = -1
@@ -221,7 +221,6 @@
W.loc = src
user << "<span class='notice'>You installed 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 )
@@ -238,7 +237,6 @@
if(!src) return
user << "<span class='notice'>You removed the airlock electronics!</span>"
src.state = 1
src.name = "Wired Airlock Assembly"
electronics.loc = src.loc
electronics = null
@@ -294,9 +292,9 @@
switch (state)
if(0)
if (anchored)
name = "Secured "
name = "secured "
if(1)
name = "Wired "
name = "wired "
if(2)
name = "Near Finished "
name += "[glass == 1 ? "Window " : ""][istext(glass) ? "[glass] Airlock" : base_name] Assembly"
name = "near finished "
name += "[glass == 1 ? "window " : ""][istext(glass) ? "[glass] airlock" : base_name] assembly ([created_name])"

View File

@@ -126,7 +126,8 @@
return ..()
/obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user)
if(S.get_amount() < 2)
var/amount_to_use = reinf_material ? 1 : 2
if(S.get_amount() < amount_to_use)
user << "<span class='notice'>There isn't enough material here to construct a wall.</span>"
return 0
@@ -143,7 +144,6 @@
user << "<span class='notice'>You begin adding the plating...</span>"
var/amount_to_use = reinf_material ? 1 : 2
if(!do_after(user,40) || !S.use(amount_to_use))
return 1 //once we've gotten this far don't call parent attackby()

View File

@@ -19,12 +19,18 @@ obj/structure/windoor_assembly
w_class = 3
var/obj/item/weapon/airlock_electronics/electronics = null
var/created_name = null
//Vars to help with the icon's name
var/facing = "l" //Does the windoor open to the left or right?
var/secure = "" //Whether or not this creates a secure windoor
var/state = "01" //How far the door assembly has progressed in terms of sprites
obj/structure/windoor_assembly/secure
name = "secure windoor assembly"
secure = "secure_"
icon_state = "l_secure_windoor_assembly01"
obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
..()
if(constructed)
@@ -65,24 +71,31 @@ obj/structure/windoor_assembly/Destroy()
/obj/structure/windoor_assembly/attackby(obj/item/W as obj, mob/user as mob)
//I really should have spread this out across more states but thin little windoors are hard to sprite.
if(istype(W, /obj/item/weapon/pen))
var/t = sanitizeSafe(input(user, "Enter the name for the windoor.", src.name, src.created_name), MAX_NAME_LEN)
if(!t) return
if(!in_range(src, usr) && src.loc != usr) return
created_name = t
return
switch(state)
if("01")
if(istype(W, /obj/item/weapon/weldingtool) && !anchored )
var/obj/item/weapon/weldingtool/WT = W
if (WT.remove_fuel(0,user))
user.visible_message("[user] dissassembles the windoor assembly.", "You start to dissassemble the windoor assembly.")
user.visible_message("[user] disassembles the windoor assembly.", "You start to disassemble the windoor assembly.")
playsound(src.loc, 'sound/items/Welder2.ogg', 50, 1)
if(do_after(user, 40))
if(!src || !WT.isOn()) return
user << "<span class='notice'>You dissasembled the windoor assembly!</span>"
new /obj/item/stack/material/glass/reinforced(get_turf(src), 5)
user << "<span class='notice'>You disassembled the windoor assembly!</span>"
if(secure)
PoolOrNew(/obj/item/stack/rods, list(get_turf(src), 4))
new /obj/item/stack/material/glass/reinforced(get_turf(src), 2)
else
new /obj/item/stack/material/glass(get_turf(src), 2)
qdel(src)
else
user << "<span class='notice'>You need more welding fuel to dissassemble the windoor assembly.</span>"
user << "<span class='notice'>You need more welding fuel to disassemble the windoor assembly.</span>"
return
//Wrenching an unsecure assembly anchors it in place. Step 4 complete
@@ -95,9 +108,9 @@ obj/structure/windoor_assembly/Destroy()
user << "<span class='notice'>You've secured the windoor assembly!</span>"
src.anchored = 1
if(src.secure)
src.name = "Secure Anchored Windoor Assembly"
src.name = "secure anchored windoor assembly"
else
src.name = "Anchored Windoor Assembly"
src.name = "anchored windoor assembly"
//Unwrenching an unsecure assembly un-anchors it. Step 4 undone
else if(istype(W, /obj/item/weapon/wrench) && anchored)
@@ -109,26 +122,9 @@ obj/structure/windoor_assembly/Destroy()
user << "<span class='notice'>You've unsecured the windoor assembly!</span>"
src.anchored = 0
if(src.secure)
src.name = "Secure Windoor Assembly"
src.name = "secure windoor assembly"
else
src.name = "Windoor Assembly"
//Adding plasteel makes the assembly a secure windoor assembly. Step 2 (optional) complete.
else if(istype(W, /obj/item/stack/rods) && !secure)
var/obj/item/stack/rods/R = W
if(R.get_amount() < 4)
user << "<span class='warning'>You need more rods to do this.</span>"
return
user << "<span class='notice'>You start to reinforce the windoor with rods.</span>"
if(do_after(user,40) && !secure)
if (R.use(4))
user << "<span class='notice'>You reinforce the windoor.</span>"
src.secure = "secure_"
if(src.anchored)
src.name = "Secure Anchored Windoor Assembly"
else
src.name = "Secure Windoor Assembly"
src.name = "windoor assembly"
//Adding cable to the assembly. Step 5 complete.
else if(istype(W, /obj/item/stack/cable_coil) && anchored)
@@ -140,9 +136,9 @@ obj/structure/windoor_assembly/Destroy()
user << "<span class='notice'>You wire the windoor!</span>"
src.state = "02"
if(src.secure)
src.name = "Secure Wired Windoor Assembly"
src.name = "secure wired windoor assembly"
else
src.name = "Wired Windoor Assembly"
src.name = "wired windoor assembly"
else
..()
@@ -160,9 +156,9 @@ obj/structure/windoor_assembly/Destroy()
new/obj/item/stack/cable_coil(get_turf(user), 1)
src.state = "01"
if(src.secure)
src.name = "Secure Anchored Windoor Assembly"
src.name = "secure anchored windoor assembly"
else
src.name = "Anchored Windoor Assembly"
src.name = "anchored windoor assembly"
//Adding airlock electronics for access. Step 6 complete.
else if(istype(W, /obj/item/weapon/airlock_electronics) && W:icon_state != "door_electronics_smoked")
@@ -175,7 +171,7 @@ obj/structure/windoor_assembly/Destroy()
user.drop_item()
W.loc = src
user << "<span class='notice'>You've installed the airlock electronics!</span>"
src.name = "Near finished Windoor Assembly"
src.name = "near finished windoor assembly"
src.electronics = W
else
W.loc = src.loc
@@ -189,9 +185,9 @@ obj/structure/windoor_assembly/Destroy()
if(!src || !src.electronics) return
user << "<span class='notice'>You've removed the airlock electronics!</span>"
if(src.secure)
src.name = "Secure Wired Windoor Assembly"
src.name = "secure wired windoor assembly"
else
src.name = "Wired Windoor Assembly"
src.name = "wired windoor assembly"
var/obj/item/weapon/airlock_electronics/ae = electronics
electronics = null
ae.loc = src.loc
@@ -222,6 +218,9 @@ obj/structure/windoor_assembly/Destroy()
windoor.base_state = "rightsecure"
windoor.set_dir(src.dir)
windoor.density = 0
windoor.name = created_name
spawn(0)
windoor.close()
if(src.electronics.one_access)
windoor.req_access = null
@@ -240,6 +239,9 @@ obj/structure/windoor_assembly/Destroy()
windoor.base_state = "right"
windoor.set_dir(src.dir)
windoor.density = 0
windoor.name = created_name
spawn(0)
windoor.close()
if(src.electronics.one_access)
windoor.req_access = null
@@ -257,8 +259,11 @@ obj/structure/windoor_assembly/Destroy()
..()
//Update to reflect changes(if applicable)
update_icon()
update_state()
/obj/structure/windoor_assembly/proc/update_state()
update_icon()
name += " ([created_name])"
//Rotates the windoor assembly clockwise
/obj/structure/windoor_assembly/verb/revrotate()

View File

@@ -161,6 +161,7 @@
if(reinf) tforce *= 0.25
if(health - tforce <= 7 && !reinf)
anchored = 0
update_verbs()
update_nearby_icons()
step(src, get_dir(AM, src))
take_damage(tforce)