mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
Merge pull request #5069 from phil235/WindoorDeconstruction
Adds windoor deconstruction & bug fixes
This commit is contained in:
@@ -4,9 +4,8 @@
|
||||
icon = 'icons/obj/doors/windoor.dmi'
|
||||
icon_state = "left"
|
||||
var/base_state = "left"
|
||||
var/health = 150.0 //If you change this, consiter changing ../door/window/brigdoor/ health at the bottom of this .dm file
|
||||
var/health = 150.0 //If you change this, consider changing ../door/window/brigdoor/ health at the bottom of this .dm file
|
||||
visible = 0.0
|
||||
use_power = 0
|
||||
flags = ON_BORDER
|
||||
opacity = 0
|
||||
var/obj/item/weapon/airlock_electronics/electronics = null
|
||||
@@ -22,7 +21,8 @@
|
||||
|
||||
/obj/machinery/door/window/Destroy()
|
||||
density = 0
|
||||
playsound(src, "shatter", 70, 1)
|
||||
if(health == 0)
|
||||
playsound(src, "shatter", 70, 1)
|
||||
..()
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
if (!ticker)
|
||||
return 0
|
||||
if(!forced)
|
||||
if(stat & NOPOWER)
|
||||
if(!hasPower())
|
||||
return 0
|
||||
if(forced < 2)
|
||||
if(emagged)
|
||||
@@ -130,7 +130,7 @@
|
||||
if (src.operating)
|
||||
return 0
|
||||
if(!forced)
|
||||
if(stat & NOPOWER)
|
||||
if(!hasPower())
|
||||
return 0
|
||||
if(forced < 2)
|
||||
if(emagged)
|
||||
@@ -252,9 +252,68 @@
|
||||
emagged = 1
|
||||
return 1
|
||||
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
if(src.density || src.operating)
|
||||
user << "<span class='warning'>You need to open the door to access the maintenance panel.</span>"
|
||||
return
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
src.p_open = !( src.p_open )
|
||||
user << "<span class='notice'>You [p_open ? "open":"close"] the maintenance panel of the [src.name].</span>"
|
||||
return
|
||||
|
||||
if(istype(I, /obj/item/weapon/crowbar))
|
||||
if(p_open && !src.density && !src.operating)
|
||||
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
|
||||
user.visible_message("<span class='warning'>[user] removes the electronics from the [src.name].</span>", \
|
||||
"You start to remove electronics from the [src.name].")
|
||||
if(do_after(user,40))
|
||||
if(src.p_open && !src.density && !src.operating && src.loc)
|
||||
var/obj/structure/windoor_assembly/WA = new /obj/structure/windoor_assembly(src.loc)
|
||||
switch(base_state)
|
||||
if("left")
|
||||
WA.facing = "l"
|
||||
if("right")
|
||||
WA.facing = "r"
|
||||
if("leftsecure")
|
||||
WA.facing = "l"
|
||||
WA.secure = 1
|
||||
if("rightsecure")
|
||||
WA.facing = "r"
|
||||
WA.secure = 1
|
||||
WA.anchored = 1
|
||||
WA.state= "02"
|
||||
WA.dir = src.dir
|
||||
WA.ini_dir = src.dir
|
||||
WA.update_icon()
|
||||
WA.created_name = src.name
|
||||
|
||||
if(emagged)
|
||||
user << "<span class='warning'>You discard the damaged electronics.</span>"
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
user << "<span class='notice'>You removed the airlock electronics!</span>"
|
||||
|
||||
var/obj/item/weapon/airlock_electronics/ae
|
||||
if(!electronics)
|
||||
ae = new/obj/item/weapon/airlock_electronics( src.loc )
|
||||
if(req_one_access)
|
||||
ae.use_one_access = 1
|
||||
ae.conf_access = src.req_one_access
|
||||
else
|
||||
ae.conf_access = src.req_access
|
||||
else
|
||||
ae = electronics
|
||||
electronics = null
|
||||
ae.loc = src.loc
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
//If windoor is unpowered, crowbar, fireaxe and armblade can force it.
|
||||
if(istype(I, /obj/item/weapon/crowbar) || istype(I, /obj/item/weapon/twohanded/fireaxe) || istype(I, /obj/item/weapon/melee/arm_blade) )
|
||||
if(stat & NOPOWER)
|
||||
if(!hasPower())
|
||||
if(src.density)
|
||||
open(2)
|
||||
else
|
||||
@@ -264,6 +323,8 @@
|
||||
//If it's a weapon, smash windoor. Unless it's an id card, agent card, ect.. then ignore it (Cards really shouldnt damage a door anyway)
|
||||
if(src.density && istype(I, /obj/item/weapon) && !istype(I, /obj/item/weapon/card) )
|
||||
user.changeNext_move(CLICK_CD_MELEE)
|
||||
if( (I.flags&NOBLUDGEON) || !I.force )
|
||||
return
|
||||
var/aforce = I.force
|
||||
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
|
||||
visible_message("<span class='danger'>\The [src] has been hit by [user] with [I].</span>")
|
||||
|
||||
@@ -219,15 +219,18 @@
|
||||
src.use(2)
|
||||
|
||||
if("Windoor")
|
||||
if(!src || src.loc != user) return 1
|
||||
|
||||
if(isturf(user.loc) && locate(/obj/structure/windoor_assembly/, user.loc))
|
||||
user << "<span class='warning'>There is already a windoor assembly in that location.</span>"
|
||||
if(!src || src.loc != user || !isturf(user.loc))
|
||||
return 1
|
||||
|
||||
if(isturf(user.loc) && locate(/obj/machinery/door/window/, user.loc))
|
||||
user << "<span class='warning'>There is already a windoor in that location.</span>"
|
||||
return 1
|
||||
for(var/obj/structure/windoor_assembly/WA in user.loc)
|
||||
if(WA.dir == user.dir)
|
||||
user << "<span class='warning'>There is already a windoor assembly in that location.</span>"
|
||||
return 1
|
||||
|
||||
for(var/obj/machinery/door/window/W in user.loc)
|
||||
if(W.dir == user.dir)
|
||||
user << "<span class='warning'>There is already a windoor in that location.</span>"
|
||||
return 1
|
||||
|
||||
if(src.get_amount() < 5)
|
||||
user << "<span class='warning'>You need more glass to do that.</span>"
|
||||
|
||||
@@ -20,11 +20,12 @@ obj/structure/windoor_assembly
|
||||
|
||||
var/ini_dir
|
||||
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
|
||||
var/secure = 0 //Whether or not this creates a secure windoor
|
||||
var/state = "01" //How far the door assembly has progressed
|
||||
|
||||
obj/structure/windoor_assembly/New(dir=NORTH)
|
||||
..()
|
||||
@@ -42,7 +43,7 @@ obj/structure/windoor_assembly/Destroy()
|
||||
move_update_air(T)
|
||||
|
||||
/obj/structure/windoor_assembly/update_icon()
|
||||
icon_state = "[facing]_[secure]windoor_assembly[state]"
|
||||
icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]"
|
||||
|
||||
/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
if(istype(mover) && mover.checkpass(PASSGLASS))
|
||||
@@ -93,11 +94,20 @@ obj/structure/windoor_assembly/Destroy()
|
||||
|
||||
//Wrenching an unsecure assembly anchors it in place. Step 4 complete
|
||||
if(istype(W, /obj/item/weapon/wrench) && !anchored)
|
||||
for(var/obj/machinery/door/window/WD in src.loc)
|
||||
if(WD.dir == src.dir)
|
||||
user << "<span class='warning'>There is already a windoor in that location.</span>"
|
||||
return
|
||||
playsound(src.loc, 'sound/items/Ratchet.ogg', 100, 1)
|
||||
user.visible_message("[user] secures the windoor assembly to the floor.", "You start to secure the windoor assembly to the floor.")
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
if(!src || src.anchored)
|
||||
return
|
||||
for(var/obj/machinery/door/window/WD in src.loc)
|
||||
if(WD.dir == src.dir)
|
||||
user << "<span class='warning'>There is already a windoor in that location.</span>"
|
||||
return
|
||||
user << "<span class='notice'>You've secured the windoor assembly!</span>"
|
||||
src.anchored = 1
|
||||
if(src.secure)
|
||||
@@ -111,7 +121,8 @@ obj/structure/windoor_assembly/Destroy()
|
||||
user.visible_message("[user] unsecures the windoor assembly to the floor.", "You start to unsecure the windoor assembly to the floor.")
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
if(!src || !src.anchored)
|
||||
return
|
||||
user << "<span class='notice'>You've unsecured the windoor assembly!</span>"
|
||||
src.anchored = 0
|
||||
if(src.secure)
|
||||
@@ -128,11 +139,12 @@ obj/structure/windoor_assembly/Destroy()
|
||||
user << "<span class='notice'>You start to reinforce the windoor with plasteel.</span>"
|
||||
|
||||
if(do_after(user,40))
|
||||
if(!src) return
|
||||
if(!src || secure)
|
||||
return
|
||||
|
||||
P.use(2)
|
||||
user << "<span class='notice'>You reinforce the windoor.</span>"
|
||||
src.secure = "secure_"
|
||||
src.secure = 1
|
||||
if(src.anchored)
|
||||
src.name = "secure anchored windoor assembly"
|
||||
else
|
||||
@@ -143,7 +155,8 @@ obj/structure/windoor_assembly/Destroy()
|
||||
user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
if(!src || !src.anchored || src.state != "01")
|
||||
return
|
||||
var/obj/item/stack/cable_coil/CC = W
|
||||
CC.use(1)
|
||||
user << "<span class='notice'>You wire the windoor!</span>"
|
||||
@@ -163,26 +176,28 @@ obj/structure/windoor_assembly/Destroy()
|
||||
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
if(!src || src.state != "02")
|
||||
return
|
||||
|
||||
user << "<span class='notice'>You cut the windoor wires!</span>"
|
||||
new/obj/item/stack/cable_coil(get_turf(user), 1)
|
||||
src.state = "01"
|
||||
if(src.secure)
|
||||
src.name = "secure wired windoor assembly"
|
||||
src.name = "secure anchored windoor assembly"
|
||||
else
|
||||
src.name = "wired windoor assembly"
|
||||
src.name = "anchored windoor assembly"
|
||||
|
||||
//Adding airlock electronics for access. Step 6 complete.
|
||||
else if(istype(W, /obj/item/weapon/airlock_electronics))
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)
|
||||
user.visible_message("[user] installs the electronics into the airlock assembly.", "You start to install electronics into the airlock assembly.")
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
if(!src || src.electronics)
|
||||
W.loc = src.loc
|
||||
return
|
||||
user << "<span class='notice'>You've installed the airlock electronics!</span>"
|
||||
src.name = "near finished windoor assembly"
|
||||
src.electronics = W
|
||||
@@ -198,16 +213,24 @@ obj/structure/windoor_assembly/Destroy()
|
||||
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to uninstall electronics from the airlock assembly.")
|
||||
|
||||
if(do_after(user, 40))
|
||||
if(!src) return
|
||||
if(!src || !electronics)
|
||||
return
|
||||
user << "<span class='notice'>You've removed the airlock electronics!</span>"
|
||||
src.name = "wired windoor assembly"
|
||||
var/obj/item/weapon/airlock_electronics/ae
|
||||
if (!electronics) //This shouldnt happen, but if it does, lets not crash and runtime.
|
||||
ae = new/obj/item/weapon/airlock_electronics( src.loc )
|
||||
else
|
||||
ae = electronics
|
||||
electronics = null
|
||||
ae.loc = src.loc
|
||||
ae = electronics
|
||||
electronics = null
|
||||
ae.loc = src.loc
|
||||
|
||||
else if(istype(W, /obj/item/weapon/pen))
|
||||
var/t = copytext(stripped_input(user, "Enter the name for the door.", src.name, src.created_name),1,MAX_NAME_LEN)
|
||||
if(!t)
|
||||
return
|
||||
if(!in_range(src, usr) && src.loc != usr)
|
||||
return
|
||||
created_name = t
|
||||
return
|
||||
|
||||
|
||||
|
||||
//Crowbar to complete the assembly, Step 7 complete.
|
||||
@@ -221,44 +244,51 @@ obj/structure/windoor_assembly/Destroy()
|
||||
|
||||
if(do_after(user, 40))
|
||||
|
||||
if(!src) return
|
||||
if(src.loc && src.electronics)
|
||||
|
||||
density = 1 //Shouldn't matter but just incase
|
||||
user << "<span class='notice'>You finish the windoor!</span>"
|
||||
|
||||
if(secure)
|
||||
var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(src.loc)
|
||||
if(src.facing == "l")
|
||||
windoor.icon_state = "leftsecureopen"
|
||||
windoor.base_state = "leftsecure"
|
||||
else
|
||||
windoor.icon_state = "rightsecureopen"
|
||||
windoor.base_state = "rightsecure"
|
||||
windoor.dir = src.dir
|
||||
windoor.density = 0
|
||||
|
||||
if(src.electronics.use_one_access)
|
||||
windoor.req_one_access = src.electronics.conf_access
|
||||
else
|
||||
windoor.req_access = src.electronics.conf_access
|
||||
windoor.electronics = src.electronics
|
||||
src.electronics.loc = windoor
|
||||
if(created_name)
|
||||
windoor.name = created_name
|
||||
windoor.close()
|
||||
|
||||
density = 1 //Shouldn't matter but just incase
|
||||
user << "<span class='notice'>You finish the windoor!</span>"
|
||||
|
||||
if(secure)
|
||||
var/obj/machinery/door/window/brigdoor/windoor = new /obj/machinery/door/window/brigdoor(src.loc)
|
||||
if(src.facing == "l")
|
||||
windoor.icon_state = "leftsecureopen"
|
||||
windoor.base_state = "leftsecure"
|
||||
else
|
||||
windoor.icon_state = "rightsecureopen"
|
||||
windoor.base_state = "rightsecure"
|
||||
windoor.dir = src.dir
|
||||
windoor.density = 0
|
||||
var/obj/machinery/door/window/windoor = new /obj/machinery/door/window(src.loc)
|
||||
if(src.facing == "l")
|
||||
windoor.icon_state = "leftopen"
|
||||
windoor.base_state = "left"
|
||||
else
|
||||
windoor.icon_state = "rightopen"
|
||||
windoor.base_state = "right"
|
||||
windoor.dir = src.dir
|
||||
windoor.density = 0
|
||||
|
||||
if(src.electronics.use_one_access)
|
||||
windoor.req_one_access = src.electronics.conf_access
|
||||
else
|
||||
windoor.req_access = src.electronics.conf_access
|
||||
windoor.electronics = src.electronics
|
||||
src.electronics.loc = windoor
|
||||
windoor.close()
|
||||
else
|
||||
var/obj/machinery/door/window/windoor = new /obj/machinery/door/window(src.loc)
|
||||
if(src.facing == "l")
|
||||
windoor.icon_state = "leftopen"
|
||||
windoor.base_state = "left"
|
||||
else
|
||||
windoor.icon_state = "rightopen"
|
||||
windoor.base_state = "right"
|
||||
windoor.dir = src.dir
|
||||
windoor.density = 0
|
||||
windoor.electronics = src.electronics
|
||||
src.electronics.loc = windoor
|
||||
if(created_name)
|
||||
windoor.name = created_name
|
||||
windoor.close()
|
||||
|
||||
windoor.req_access = src.electronics.conf_access
|
||||
windoor.electronics = src.electronics
|
||||
src.electronics.loc = windoor
|
||||
windoor.close()
|
||||
|
||||
qdel(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user