diff --git a/baystation12.dme b/baystation12.dme
index 44b0fe2c807..31e5a7abce5 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -648,6 +648,7 @@
#include "code\game\objects\washing_machine.dm"
#include "code\game\objects\watercloset.dm"
#include "code\game\objects\weapons.dm"
+#include "code\game\objects\windoor_assembly.dm"
#include "code\game\objects\window.dm"
#include "code\game\objects\alien\acid.dm"
#include "code\game\objects\alien\defines.dm"
diff --git a/code/game/machinery/doors/airlock_electronics.dm b/code/game/machinery/doors/airlock_electronics.dm
index 34379e9a6a3..525bfd43897 100644
--- a/code/game/machinery/doors/airlock_electronics.dm
+++ b/code/game/machinery/doors/airlock_electronics.dm
@@ -1,4 +1,4 @@
-//This file was auto-corrected by findeclaration.exe on 29/05/2012 15:03:04
+//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
/obj/item/weapon/airlock_electronics
name = "Airlock Electronics"
@@ -58,15 +58,12 @@
Topic(href, href_list)
..()
- if (usr.stat || usr.restrained())
+ if (usr.stat || usr.restrained() || !ishuman(usr))
return
if (href_list["close"])
usr << browse(null, "window=airlock")
return
- if (!ishuman(usr))
- return
-
if (href_list["login"])
var/obj/item/I = usr.equipped()
if (istype(I, /obj/item/device/pda))
diff --git a/code/game/objects/door_assembly.dm b/code/game/objects/door_assembly.dm
index f316fcc0e8c..4c9e9c7207c 100644
--- a/code/game/objects/door_assembly.dm
+++ b/code/game/objects/door_assembly.dm
@@ -184,7 +184,9 @@ obj/structure/door_assembly
W:welding = 2
user.visible_message("[user] dissassembles the airlock assembly.", "You start to dissassemble the airlock assembly.")
playsound(src.loc, 'Welder2.ogg', 50, 1)
+
if(do_after(user, 40))
+ if(!src) return
user << "\blue You dissasembled the airlock assembly!"
new /obj/item/stack/sheet/metal(get_turf(src), 4)
if(src.glass==1)
@@ -194,52 +196,55 @@ obj/structure/door_assembly
else
user << "\blue You need more welding fuel to dissassemble the airlock assembly."
return
+
else if(istype(W, /obj/item/weapon/wrench) && !anchored )
playsound(src.loc, 'Ratchet.ogg', 100, 1)
- var/turf/T = get_turf(user)
user.visible_message("[user] secures the airlock assembly to the floor.", "You start to secure the airlock assembly to the floor.")
- sleep(40)
- if(get_turf(user) == T)
+
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You secured the airlock assembly!"
src.name = "Secured Airlock Assembly"
src.anchored = 1
+
else if(istype(W, /obj/item/weapon/wrench) && anchored )
playsound(src.loc, 'Ratchet.ogg', 100, 1)
- var/turf/T = get_turf(user)
user.visible_message("[user] unsecures the airlock assembly from the floor.", "You start to unsecure the airlock assembly from the floor.")
- sleep(40)
- if(get_turf(user) == T)
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You unsecured the airlock assembly!"
src.name = "Airlock Assembly"
src.anchored = 0
+
else if(istype(W, /obj/item/weapon/cable_coil) && state == 0 && anchored )
var/obj/item/weapon/cable_coil/coil = W
- var/turf/T = get_turf(user)
user.visible_message("[user] wires the airlock assembly.", "You start to wire the airlock assembly.")
- sleep(40)
- if(get_turf(user) == T)
+ if(do_after(user, 40))
+ if(!src) return
coil.use(1)
src.state = 1
user << "\blue You wire the Airlock!"
src.name = "Wired Airlock Assembly"
+
else if(istype(W, /obj/item/weapon/wirecutters) && state == 1 )
playsound(src.loc, 'Wirecutter.ogg', 100, 1)
- var/turf/T = get_turf(user)
user.visible_message("[user] cuts the wires from the airlock assembly.", "You start to cut the wires from airlock assembly.")
- sleep(40)
- if(get_turf(user) == T)
+
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You cut the airlock wires.!"
- new/obj/item/weapon/cable_coil(T, 1)
+ new/obj/item/weapon/cable_coil(get_turf(user), 1)
src.state = 0
src.name = "Secured Airlock Assembly"
+
else if(istype(W, /obj/item/weapon/airlock_electronics) && state == 1 )
playsound(src.loc, 'Screwdriver.ogg', 100, 1)
- var/turf/T = get_turf(user)
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
- sleep(40)
- if(get_turf(user) == T)
+
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You installed the airlock electronics!"
var/obj/item/weapon/airlock_electronics/E = W
@@ -263,12 +268,13 @@ obj/structure/door_assembly
W.loc = src.loc
//del(W)
+
else if(istype(W, /obj/item/weapon/crowbar) && state == 2 )
playsound(src.loc, 'Crowbar.ogg', 100, 1)
- var/turf/T = get_turf(user)
user.visible_message("[user] removes the electronics from the airlock assembly.", "You start to install electronics into the airlock assembly.")
- sleep(40)
- if(get_turf(user) == T)
+
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You removed the airlock electronics!"
src.state = 1
src.name = "Wired Airlock Assembly"
@@ -279,6 +285,7 @@ obj/structure/door_assembly
ae = electronics
electronics = null
ae.loc = src.loc
+
else if(istype(W, /obj/item/stack/sheet/rglass) && glass == 0 && ispath(glass_type))
playsound(src.loc, 'Crowbar.ogg', 100, 1)
user.visible_message("[user] adds reinforced glass windows to the airlock assembly.", "You start to install reinforced glass windows into the airlock assembly.")
@@ -293,10 +300,10 @@ obj/structure/door_assembly
src.airlock_type = glass_type
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
playsound(src.loc, 'Screwdriver.ogg', 100, 1)
- var/turf/T = get_turf(user)
user << "\blue Now finishing the airlock."
- sleep(40)
- if(get_turf(user) == T)
+
+ if(do_after(user, 40))
+ if(!src) return
user << "\blue You finish the airlock!"
var/obj/machinery/door/airlock/door
if(glass)
diff --git a/code/game/objects/stacks/glass.dm b/code/game/objects/stacks/glass.dm
index f70c1e50b57..a11beacd82f 100644
--- a/code/game/objects/stacks/glass.dm
+++ b/code/game/objects/stacks/glass.dm
@@ -17,8 +17,8 @@ SHARDS
var/obj/item/weapon/cable_coil/CC = W
if(CC.amount < 5)
user << "\b There is not enough wire in this coil. You need 5 lengths."
- CC.amount -= 5
- amount -= 1
+ CC.use(5)
+ src.use(1)
user << "\blue You attach wire to the [name]."
new/obj/item/stack/light_w(user.loc)
if(CC.amount <= 0)
@@ -50,37 +50,39 @@ SHARDS
return 0
var/title = "Sheet-Glass"
title += " ([src.amount] sheet\s left)"
- switch(alert(title, "Would you like full tile glass or one direction?", "one direct", "full (2 sheets)", "cancel", null))
- if("one direct")
+ switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null))
+ if("One Direction")
if(!src) return 1
if(src.loc != user) return 1
+
var/list/directions = new/list(cardinal)
+ var/i = 0
for (var/obj/structure/window/win in user.loc)
+ i++
+ if(i >= 4)
+ user << "\red There are too many windows in this location."
+ return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
user << "\red Can't let you do that."
return 1
- var/dir_to_set = 2
- //yes, this could probably be done better but hey... it works...
+
+ var/dir_to_set = NORTH
for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 4
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 1
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 8
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 2
+ if (WT.dir == SOUTH)
+ dir_to_set = EAST
+ if (WT.dir == WEST)
+ dir_to_set = SOUTH
+ if (WT.dir == NORTH)
+ dir_to_set = WEST
+
var/obj/structure/window/W
W = new /obj/structure/window/basic( user.loc, 0 )
W.dir = dir_to_set
W.ini_dir = W.dir
W.anchored = 0
src.use(1)
- if("full (2 sheets)")
+ if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
@@ -111,30 +113,32 @@ SHARDS
return 0
var/title = "Sheet Reinf. Glass"
title += " ([src.amount] sheet\s left)"
- switch(alert(title, "Would you like full tile glass or one direction?", "one direct", "full (2 sheets)", "cancel", null))
- if("one direct")
+ switch(input(title, "Would you like full tile glass a one direction glass pane or a windoor?") in list("One Direction", "Full Window", "Windoor", "Cancel"))
+ if("One Direction")
if(!src) return 1
if(src.loc != user) return 1
var/list/directions = new/list(cardinal)
+ var/i = 0
for (var/obj/structure/window/win in user.loc)
+ i++
+ if(i >= 4)
+ user << "\red There are too many windows in this location."
+ return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
user << "\red Can't let you do that."
return 1
- var/dir_to_set = 2
- //yes, this could probably be done better but hey... it works...
+ var/dir_to_set = NORTH
for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 4
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 1
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 8
- for(var/obj/structure/window/WT in user.loc)
- if (WT.dir == dir_to_set)
- dir_to_set = 2
+ if (WT.dir == SOUTH)
+ dir_to_set = EAST
+ if (WT.dir == WEST)
+ dir_to_set = SOUTH
+ if (WT.dir == NORTH)
+ dir_to_set = WEST
+ /*else
+ dir_to_set stays NORTH*/
+
var/obj/structure/window/W
W = new /obj/structure/window/reinforced( user.loc, 1 )
W.state = 0
@@ -142,7 +146,8 @@ SHARDS
W.ini_dir = W.dir
W.anchored = 0
src.use(1)
- if("full (2 sheets)")
+
+ if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
@@ -158,6 +163,44 @@ SHARDS
W.ini_dir = SOUTHWEST
W.anchored = 0
src.use(2)
+
+ if("Windoor")
+ if(!src || src.loc != user) return 1
+
+ if(isturf(user.loc) && locate(/obj/structure/windoor_assembly/, user.loc))
+ user << "\red There is already a windoor assembly in that location."
+ return 1
+
+ if(isturf(user.loc) && locate(/obj/machinery/door/window/, user.loc))
+ user << "\red There is already a windoor in that location."
+ return 1
+
+ if(src.amount < 5)
+ user << "\red You need more glass to do that."
+ return 1
+
+ var/obj/structure/windoor_assembly/WD
+ WD = new /obj/structure/windoor_assembly(user.loc)
+ WD.state = "01"
+ WD.anchored = 0
+ src.use(5)
+ switch(user.dir)
+ if(SOUTH)
+ WD.dir = SOUTH
+ WD.ini_dir = SOUTH
+ if(EAST)
+ WD.dir = EAST
+ WD.ini_dir = EAST
+ if(WEST)
+ WD.dir = WEST
+ WD.ini_dir = WEST
+ else//If the user is facing northeast. northwest, southeast, southwest or north, default to north
+ WD.dir = NORTH
+ WD.ini_dir = NORTH
+ else
+ return 1
+
+
return 0
// SHARDS
diff --git a/code/game/objects/windoor_assembly.dm b/code/game/objects/windoor_assembly.dm
new file mode 100644
index 00000000000..2734c06d2c3
--- /dev/null
+++ b/code/game/objects/windoor_assembly.dm
@@ -0,0 +1,297 @@
+/* Windoor (window door) assembly -Nodrak
+ * Step 1: Create a windoor out of rglass
+ * Step 2: Add r-glass to the assembly to make a secure windoor (Optional)
+ * Step 3: Rotate or Flip the assembly to face and open the way you want
+ * Step 4: Wrench the assembly in place
+ * Step 5: Add cables to the assembly
+ * Step 6: Set access for the door.
+ * Step 7: Screwdriver the door to complete
+ */
+
+
+obj/structure/windoor_assembly
+ icon = 'windoor.dmi'
+
+ name = "Windoor Assembly"
+ icon_state = "l_windoor_assembly01"
+ anchored = 0
+ density = 0
+ dir = NORTH
+
+ var/ini_dir
+ var/list/conf_access = null //configuring access, step 6
+
+ //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/New(dir=NORTH)
+ ..()
+ src.ini_dir = src.dir
+ update_nearby_tiles(need_rebuild=1)
+
+obj/structure/windoor_assembly/Del()
+ density = 0
+ update_nearby_tiles()
+ ..()
+
+/obj/structure/windoor_assembly/update_icon()
+ icon_state = "[facing]_[secure]windoor_assembly[state]"
+
+/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
+ if(istype(mover) && mover.pass_flags & PASSGLASS)
+ return 1
+ if(get_dir(loc, target) == dir) //Make sure looking at appropriate border
+ if(air_group) return 0
+ return !density
+ else
+ return 1
+
+/obj/structure/windoor_assembly/CheckExit(atom/movable/mover as mob|obj, turf/target as turf)
+ if(istype(mover) && mover.pass_flags & PASSGLASS)
+ return 1
+ if(get_dir(loc, target) == dir)
+ return !density
+ else
+ return 1
+
+
+/obj/structure/windoor_assembly/attackby(obj/item/W as obj, mob/user as mob)
+ switch(state)
+ if("01")
+ //Wrenching an unsecure assembly anchors it in place. Step 4 complete
+ if(istype(W, /obj/item/weapon/wrench) && !anchored)
+ playsound(src.loc, '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
+ user << "\blue You've secured the windoor assembly!"
+ src.anchored = 1
+ if(src.secure)
+ src.name = "Secure Anchored Windoor Assembly"
+ else
+ src.name = "Anchored Windoor Assembly"
+
+ //Unwrenching an unsecure assembly un-anchors it. Step 4 undone
+ else if(istype(W, /obj/item/weapon/wrench) && anchored)
+ playsound(src.loc, 'Ratchet.ogg', 100, 1)
+ 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
+ user << "\blue You've unsecured the windoor assembly!"
+ src.anchored = 0
+ if(src.secure)
+ src.name = "Secure Windoor Assembly"
+ else
+ src.name = "Windoor Assembly"
+
+ //Adding r-glass 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.amount < 4)
+ user << "\red You need more rods to do this."
+ return
+ user << "\blue You start to reinforce the windoor with rods."
+
+ if(do_after(user,40))
+ if(!src) return
+
+ R.use(4)
+ user << "\blue You reinforce the windoor."
+ src.secure = "secure_"
+ if(src.anchored)
+ src.name = "Secure Anchored Windoor Assembly"
+ else
+ src.name = "Secure Windoor Assembly"
+
+ //Adding cable to the assembly. Step 5 complete.
+ else if(istype(W, /obj/item/weapon/cable_coil) && anchored)
+ user.visible_message("[user] wires the windoor assembly.", "You start to wire the windoor assembly.")
+
+ if(do_after(user, 40))
+ if(!src) return
+ var/obj/item/weapon/cable_coil/CC = W
+ CC.use(1)
+ user << "\blue You wire the windoor!"
+ src.state = "02"
+ if(src.secure)
+ src.name = "Secure Wired Windoor Assembly"
+ else
+ src.name = "Wired Windoor Assembly"
+ else
+ ..()
+
+ if("02")
+
+ //Removing wire from the assembly. Step 5 undone.
+ if(istype(W, /obj/item/weapon/wirecutters))
+ playsound(src.loc, 'Wirecutter.ogg', 100, 1)
+ 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
+
+ user << "\blue You cut the windoor wires.!"
+ new/obj/item/weapon/cable_coil(get_turf(user), 1)
+ src.state = "01"
+ if(src.secure)
+ src.name = "Secure Wired Windoor Assembly"
+ else
+ src.name = "Wired Windoor Assembly"
+
+ //Screwdrivering the wires in place (setting door access). Step 6 in progress.
+ else if(istype(W, /obj/item/weapon/screwdriver))
+ playsound(src.loc, 'Screwdriver.ogg', 100, 1)
+ user.visible_message("[user] adjusts the access wires of the windoor assembly.", "You start to adjust the access wires of the windoor assembly.")
+ configure_access()
+
+
+ //Crowbar to complete the assembly, Step 7 complete.
+ if(istype(W, /obj/item/weapon/crowbar))
+ usr << browse(null, "window=windoor_access")
+ playsound(src.loc, 'Crowbar.ogg', 100, 1)
+ user.visible_message("[user] pries the windoor into the frame.", "You start prying the windoor into the frame.")
+
+ if(do_after(user, 40))
+
+ if(!src) return
+
+ density = 1 //Shouldn't matter but just incase
+ user << "\blue You finish the windoor!"
+
+ 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.req_access = src.conf_access
+
+ 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.req_access = src.conf_access
+
+ del(src)
+
+
+ else
+ ..()
+
+ //Update to reflect changes(if applicable)
+ update_icon()
+
+//Adjust the access of the door and pass it to Topic
+/obj/structure/windoor_assembly/proc/configure_access()
+ if(!src || !usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
+ return
+
+ var/t1 = "Access control
\n"
+
+ if(!conf_access)
+ t1 += "All
"
+ else
+ t1 += "All
"
+
+ t1 += "
"
+
+ var/list/accesses = get_all_accesses()
+ for (var/acc in accesses)
+ var/aname = get_access_desc(acc)
+
+ if (!conf_access || !conf_access.len || !(acc in conf_access))
+ t1 += "[aname]
"
+ else
+ t1 += "[aname]
"
+
+ t1 += text("