diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 222baf65c2e..9cbe5dbabe9 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -6,6 +6,8 @@ * Plasma Glass Sheets * Reinforced Plasma Glass Sheets (AKA Holy fuck strong windows) + Todo: Create a unified construct_window(sheet, user, created_window, full_window) + */ /* @@ -98,6 +100,7 @@ W = new /obj/structure/window/basic( user.loc, 0 ) W.dir = dir_to_set W.ini_dir = W.dir + W.state = 0 W.anchored = 0 src.use(1) if("Full Window") @@ -110,6 +113,7 @@ user << "\red There is a full window in the way." return 1 var/obj/structure/window/W = new full_window( user.loc, 0 ) + W.state = 0 W.anchored = 0 src.use(2) return 0 @@ -126,6 +130,8 @@ g_amt = 3750 m_amt = 1875 origin_tech = "materials=2" + var/created_window = /obj/structure/window/reinforced + var/full_window = /obj/structure/window/full/reinforced /obj/item/stack/sheet/rglass/cyborg name = "reinforced glass" @@ -190,11 +196,8 @@ if(locate(/obj/structure/window/full) in user.loc) user << "\red There is a window in the way." return 1 - var/obj/structure/window/W - W = new /obj/structure/window/reinforced( user.loc, 1 ) + var/obj/structure/window/W = new full_window( user.loc, 0 ) W.state = 0 - W.dir = SOUTHWEST - W.ini_dir = SOUTHWEST W.anchored = 0 src.use(2) @@ -349,7 +352,7 @@ var/full_window = /obj/structure/window/full/plasmabasic -/obj/item/stack/sheet/glass/plasmaglass/attack_self(mob/user as mob) +/obj/item/stack/sheet/plasmaglass/attack_self(mob/user as mob) construct_window(user) /obj/item/stack/sheet/plasmaglass/attackby(obj/item/W, mob/user) @@ -375,7 +378,7 @@ if(!user.IsAdvancedToolUser()) user << "\red You don't have the dexterity to do this!" return 0 - var/title = "Sheet-PlasmaGlass" + var/title = "Plasma-glass alloy" title += " ([src.amount] sheet\s left)" switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null)) if("One Direction") @@ -406,6 +409,7 @@ W = new /obj/structure/window/plasmabasic( user.loc, 0 ) W.dir = dir_to_set W.ini_dir = W.dir + W.state = 0 W.anchored = 0 src.use(1) if("Full Window") @@ -417,10 +421,8 @@ if(locate(/obj/structure/window) in user.loc) user << "\red There is a window in the way." return 1 - var/obj/structure/window/W - W = new /obj/structure/window/plasmabasic( user.loc, 0 ) - W.dir = SOUTHWEST - W.ini_dir = SOUTHWEST + var/obj/structure/window/W = new full_window( user.loc, 0 ) + W.state = 0 W.anchored = 0 src.use(2) return 0 @@ -440,5 +442,60 @@ var/full_window = /obj/structure/window/full/plasmareinforced -/obj/item/stack/sheet/glass/plasmarglass/attack_self(mob/user as mob) +/obj/item/stack/sheet/plasmarglass/attack_self(mob/user as mob) construct_window(user) + +/obj/item/stack/sheet/plasmarglass/proc/construct_window(mob/user as mob) + if(!user || !src) return 0 + if(!istype(user.loc,/turf)) return 0 + if(!user.IsAdvancedToolUser()) + user << "\red You don't have the dexterity to do this!" + return 0 + var/title = "Reinforced plasma-glass alloy" + title += " ([src.amount] sheet\s left)" + 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 + //Determine the direction. It will first check in the direction the person making the window is facing, if it finds an already made window it will try looking at the next cardinal direction, etc. + var/dir_to_set = 2 + for(var/direction in list( user.dir, turn(user.dir,90), turn(user.dir,180), turn(user.dir,270) )) + var/found = 0 + for(var/obj/structure/window/WT in user.loc) + if(WT.dir == direction) + found = 1 + if(!found) + dir_to_set = direction + break + var/obj/structure/window/W + W = new /obj/structure/window/plasmareinforced( user.loc, 0 ) + W.dir = dir_to_set + W.ini_dir = W.dir + W.state = 0 + W.anchored = 0 + src.use(1) + if("Full Window") + if(!src) return 1 + if(src.loc != user) return 1 + if(src.amount < 2) + user << "\red You need more glass to do that." + return 1 + if(locate(/obj/structure/window) in user.loc) + user << "\red There is a window in the way." + return 1 + var/obj/structure/window/W = new full_window( user.loc, 0 ) + W.state = 0 + W.anchored = 0 + src.use(2) + return 0 \ No newline at end of file diff --git a/code/game/objects/structures/fullwindow.dm b/code/game/objects/structures/fullwindow.dm index fe77eaabc29..67a19dbecb5 100644 --- a/code/game/objects/structures/fullwindow.dm +++ b/code/game/objects/structures/fullwindow.dm @@ -54,6 +54,7 @@ basestate = "plasmawindow" icon_state = "plasmawindow" shardtype = /obj/item/weapon/shard/plasma + glasstype = /obj/item/stack/sheet/plasmaglass health = 120 @@ -63,6 +64,7 @@ basestate = "plasmarwindow" icon_state = "plasmarwindow" shardtype = /obj/item/weapon/shard/plasma + glasstype = /obj/item/stack/sheet/plasmaglass reinf = 1 health = 160 diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 32b3b30a8b0..0ad7fb6f7c1 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -149,7 +149,7 @@ return //window placing begin - else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) ) + else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) || istype(W,/obj/item/stack/sheet/plasmaglass) || istype(W,/obj/item/stack/sheet/plasmarglass) ) var/dir_to_set = 1 if(loc == user.loc) dir_to_set = user.dir @@ -182,8 +182,12 @@ var/obj/structure/window/WD if(istype(W,/obj/item/stack/sheet/rglass)) WD = new/obj/structure/window/reinforced(loc) //reinforced window - else + else if(istype(W,/obj/item/stack/sheet/glass)) WD = new/obj/structure/window/basic(loc) //normal window + else if(istype(W,/obj/item/stack/sheet/plasmaglass)) + WD = new/obj/structure/window/plasmabasic(loc) //basic plasma window + else + WD = new/obj/structure/window/plasmareinforced(loc) //reinforced plasma window WD.dir = dir_to_set WD.ini_dir = dir_to_set WD.anchored = 0 @@ -228,7 +232,7 @@ // returns 1 if shocked, 0 otherwise /obj/structure/grille/proc/shock(mob/user as mob, prb) - if(!anchored || destroyed) // anchored/destroyed grilles are never connected + if(!anchored || destroyed) // deanchored/destroyed grilles are never connected return 0 if(!prob(prb)) return 0 diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 029e7c506c1..9470b291de8 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -13,6 +13,8 @@ var/reinf = 0 var/basestate var/shardtype = /obj/item/weapon/shard + var/glasstype = /obj/item/stack/sheet/glass + var/disassembled = 0 var/sheets = 1 // Number of sheets needed to build this window (determines how much shit is spawned by destroy()) // var/silicate = 0 // number of units of silicate // var/icon/silicateIcon = null // the silicated icon @@ -232,6 +234,32 @@ state = 1 - state playsound(loc, 'sound/items/Crowbar.ogg', 75, 1) user << (state ? "You have pried the window into the frame." : "You have pried the window out of the frame.") + else if(istype(W, /obj/item/weapon/wrench) && !anchored && health > 7) //Disassemble deconstructed window into parts + playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1) + for(var/i=0;i=G.max_amount) + continue + G.attackby(NG, user) + + if (reinf) + var/obj/item/stack/rods/NR = new (src.loc) + for (var/obj/item/stack/rods/R in src.loc) + if(R==NR) + continue + if(R.amount>=R.max_amount) + continue + R.attackby(NR, user) + + user << "You have disassembled the window." + disassembled = 1 + density = 0 + update_nearby_tiles() + update_nearby_icons() + del(src) else if(W.damtype == BRUTE || W.damtype == BURN) hit(W.force) @@ -338,7 +366,7 @@ /obj/structure/window/Destroy() density = 0 update_nearby_tiles() - if(loc) + if(loc && !disassembled) playsound(get_turf(src), "shatter", 70, 1) update_nearby_icons() ..() @@ -391,6 +419,7 @@ basestate = "plasmawindow" icon_state = "plasmawindow" shardtype = /obj/item/weapon/shard/plasma + glasstype = /obj/item/stack/sheet/plasmaglass health = 120 /obj/structure/window/plasmabasic/New(Loc,re=0) @@ -412,6 +441,7 @@ basestate = "plasmarwindow" icon_state = "plasmarwindow" shardtype = /obj/item/weapon/shard/plasma + glasstype = /obj/item/stack/sheet/plasmaglass reinf = 1 health = 160 explosion_resistance = 4