diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 38d426766a0..2a78511d2c7 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -20,8 +20,8 @@ icon_state = "sheet-glass" materials = list(MAT_GLASS=MINERAL_MATERIAL_AMOUNT) origin_tech = "materials=1" - var/created_window = /obj/structure/window/basic - var/full_window = /obj/structure/window/full/basic + created_window = /obj/structure/window/basic + full_window = /obj/structure/window/full/basic merge_type = /obj/item/stack/sheet/glass /obj/item/stack/sheet/glass/fifty @@ -154,8 +154,8 @@ icon_state = "sheet-rglass" materials = list(MAT_METAL=MINERAL_MATERIAL_AMOUNT/2, MAT_GLASS=MINERAL_MATERIAL_AMOUNT) origin_tech = "materials=2" - var/created_window = /obj/structure/window/reinforced - var/full_window = /obj/structure/window/full/reinforced + created_window = /obj/structure/window/reinforced + full_window = /obj/structure/window/full/reinforced merge_type = /obj/item/stack/sheet/rglass /obj/item/stack/sheet/rglass/cyborg @@ -268,8 +268,8 @@ icon_state = "sheet-plasmaglass" materials = list(MAT_GLASS=MINERAL_MATERIAL_AMOUNT*2) origin_tech = "plasmatech=2;materials=2" - var/created_window = /obj/structure/window/plasmabasic - var/full_window = /obj/structure/window/full/plasmabasic + created_window = /obj/structure/window/plasmabasic + full_window = /obj/structure/window/full/plasmabasic /obj/item/stack/sheet/plasmaglass/attack_self(mob/user as mob) @@ -357,8 +357,8 @@ icon_state = "sheet-plasmarglass" materials = list(MAT_METAL=MINERAL_MATERIAL_AMOUNT/2, MAT_GLASS=MINERAL_MATERIAL_AMOUNT*2) origin_tech = "plasmatech=2;materials=2" - var/created_window = /obj/structure/window/plasmareinforced - var/full_window = /obj/structure/window/full/plasmareinforced + created_window = /obj/structure/window/plasmareinforced + full_window = /obj/structure/window/full/plasmareinforced /obj/item/stack/sheet/plasmarglass/attack_self(mob/user as mob) diff --git a/code/game/objects/items/stacks/sheets/sheets.dm b/code/game/objects/items/stacks/sheets/sheets.dm index 3a92d0f7662..460a70cb069 100644 --- a/code/game/objects/items/stacks/sheets/sheets.dm +++ b/code/game/objects/items/stacks/sheets/sheets.dm @@ -9,6 +9,8 @@ attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "smashed") var/perunit = MINERAL_MATERIAL_AMOUNT var/sheettype = null //this is used for girders in the creation of walls/false walls + var/created_window = null //apparently glass sheets don't share a base type for glass specifically, so each had to define these vars individually + var/full_window = null //moving the var declaration to here so this can be checked cleaner until someone is willing to make them share a base type properly usesound = 'sound/items/Deconstruct.ogg' toolspeed = 1 diff --git a/code/game/objects/structures/fullwindow.dm b/code/game/objects/structures/fullwindow.dm index b0c1f2c512c..f9e8adbf9aa 100644 --- a/code/game/objects/structures/fullwindow.dm +++ b/code/game/objects/structures/fullwindow.dm @@ -44,7 +44,7 @@ icon_state = "plasmawindow" shardtype = /obj/item/weapon/shard/plasma glasstype = /obj/item/stack/sheet/plasmaglass - health = 120 + health = 240 /obj/structure/window/full/plasmabasic/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) if(exposed_temperature > T0C + 32000) @@ -59,7 +59,7 @@ shardtype = /obj/item/weapon/shard/plasma glasstype = /obj/item/stack/sheet/plasmaglass reinf = 1 - health = 160 + health = 320 /obj/structure/window/full/plasmareinforced/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) return @@ -69,7 +69,7 @@ desc = "It looks rather strong. Might take a few good hits to shatter it." icon_state = "rwindow" basestate = "rwindow" - health = 40 + health = 80 reinf = 1 /obj/structure/window/full/reinforced/tinted @@ -84,7 +84,7 @@ desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window." icon_state = "fwindow" basestate = "fwindow" - health = 30 + health = 60 /obj/structure/window/full/shuttle name = "shuttle window" diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index c1b4984c158..aab8d550040 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -159,65 +159,82 @@ //window placing begin 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)) - if(!broken) - var/obj/item/stack/ST = W - if (ST.get_amount() < 1) - to_chat(user, "You need at least one sheet of glass for that!") - return - var/dir_to_set = NORTH - if(!anchored) - to_chat(user, "[src] needs to be fastened to the floor first!") - return - if(loc == user.loc) - dir_to_set = user.dir - else - if((x == user.x) || (y == user.y)) //Only supposed to work for cardinal directions. - if(x == user.x) - if(y > user.y) - dir_to_set = SOUTH - else - dir_to_set = NORTH - else if(y == user.y) - if(x > user.x) - dir_to_set = WEST - else - dir_to_set = EAST - else - to_chat(user, "You can't reach.") - return //Only works for cardinal direcitons, diagonals aren't supposed to work like this. - for(var/obj/structure/window/WINDOW in loc) - if(WINDOW.dir == dir_to_set) - to_chat(user, "There is already a window facing this way there.") - return - to_chat(user, "You start placing the window...") - if(do_after(user, 20 * W.toolspeed, target = src)) - if(!loc || !anchored) //Grille destroyed or unanchored while waiting - return - for(var/obj/structure/window/WINDOW in loc) - if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting. - to_chat(user, "There is already a window facing this way there.") - return - var/obj/structure/window/WD - if(istype(W,/obj/item/stack/sheet/rglass)) - WD = new/obj/structure/window/reinforced(loc) //reinforced window - 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.setDir(dir_to_set) - WD.ini_dir = dir_to_set - WD.anchored = 0 - WD.state = 0 - ST.use(1) - to_chat(user, "You place the [WD] on [src].") - WD.update_icon() - return + build_window(W, user) + return //window placing end + else if(istype(W, /obj/item/weapon/shard) || !shock(user, 70)) return attacked_by(W, user) +/obj/structure/grille/proc/build_window(obj/item/stack/sheet/S, mob/user) + if(!istype(S) || !user) + return + if(broken) + to_chat(user, "You must repair or replace [src] first!") + return + if(S.get_amount() < 1) + to_chat(user, "You need at least one sheet of glass for that!") + return + if(!anchored) + to_chat(user, "[src] needs to be fastened to the floor first!") + return + if(!getRelativeDirection(src, user) && (user.loc != loc)) //essentially a cardinal direction adjacent or sharing same loc check + to_chat(user, "You can't reach.") + return + if(/obj/structure/window/full in loc) //check for a full window already present (blocks the whole tile) + to_chat(user, "There is already a full window there.") + return + var/selection = alert(user, "What type of window would you like to place?", "Window Construction", "One Direction", "Full", "Cancel") + if(selection == "Cancel") + return + if(selection == "Full") + if(S.get_amount() < 2) + to_chat(user, "You need at least two sheets of glass for that!") + return + if(do_after(user, 20, target = src)) //glass doesn't have a toolspeed, so no multiplier + if(broken || !anchored || !src) //make sure the grille is still intact, anchored, and exists! + return + if(S.get_amount() < 2) //make sure we still have enough for this! + return + if(!getRelativeDirection(src, user) && (user.loc != loc)) //make sure we can still do this from our location + return + var/obj/structure/window/W = new S.full_window(get_turf(src)) + S.use(2) + W.anchored = 0 + W.state = 0 + to_chat(user, "You place [W] on [src].") + W.update_icon() + return + if(selection == "One Direction") + var/dir_selection = input("Which direction will this window face?", "Direction") as null|anything in list("north", "east", "south", "west") + if(!dir_selection) + return + var/temp_dir = text2dir(dir_selection) + for(var/obj/structure/window/W in loc) + if(istype(W, /obj/structure/window/full)) //double checking in case a full window was created while selecting direction + to_chat(user, "There is already a full window there.") + return + if(W.dir == temp_dir) //to avoid building a window on top of an existing window + to_chat(user, "There is already a window facing this direction there.") + return + if(do_after(user, 20, target = src)) + if(broken || !anchored || !src) //make sure the grille is still intact, anchored, and exists! + return + if(S.get_amount() < 1) //make sure we still have enough fir this! + to_chat(user, "You need at least one sheet of glass for that!") + return + if(!getRelativeDirection(src, user) && (user.loc != loc)) //make sure we can still do this from our location + return + var/obj/structure/window/W = new S.created_window(get_turf(src)) + S.use(1) + W.setDir(temp_dir) + W.ini_dir = temp_dir + W.anchored = 0 + W.state = 0 + to_chat(user, "You place [W] on [src].") + W.update_icon() + return + /obj/structure/grille/proc/attacked_by(obj/item/I, mob/living/user) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 3946f6613da..cfee76dc749 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -180,7 +180,8 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f /obj/structure/window/attackby(obj/item/I as obj, mob/living/user as mob, params) - if(!istype(I)) return//I really wish I did not need this + if(!istype(I)) + return//I really wish I did not need this if(istype(I, /obj/item/weapon/grab) && get_dist(src,user)<2) var/obj/item/weapon/grab/G = I if(istype(G.affecting,/mob/living)) @@ -209,67 +210,97 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f M.apply_damage(30) hit(75) return + if(I.flags & NOBLUDGEON) + return - if(I.flags & NOBLUDGEON) return + if(handle_decon(I, user, is_fulltile())) + return - if(istype(I, /obj/item/weapon/screwdriver)) - if(reinf && state >= 1) - state = 3 - state - playsound(loc, I.usesound, 75, 1) - to_chat(user, (state == 1 ? "You have unfastened the window from the frame." : "You have fastened the window to the frame.")) - else if(reinf && state == 0) + if(I.damtype == BRUTE || I.damtype == BURN) + user.changeNext_move(CLICK_CD_MELEE) + hit(I.force) + if(health <= 7) + anchored = 0 + update_nearby_icons() + step(src, get_dir(user, src)) + else + playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) + ..() + +/obj/structure/window/proc/handle_decon(obj/item/weapon/W, mob/user, var/takes_time = FALSE) + //screwdriver + if(isscrewdriver(W)) + playsound(loc, W.usesound, 75, 1) + if(reinf) + if(state == 0) + if(takes_time) + to_chat(user, "You begin to [anchored ? "unfasten the frame from" : "fasten the frame to"] the floor.") + if(!do_after(user, 20 * W.toolspeed, target = src)) + return 1 + anchored = !anchored + to_chat(user, "You have [anchored? "fastened the frame to" : "unfastened the frame from"] the floor.") + if(state >= 1) + if(takes_time) + to_chat(user, "You begin to [(state == 1) ? "fasten the window to" : "unfasten the window from"] the frame.") + if(!do_after(user, 20 * W.toolspeed, target = src)) + return 1 + state = 3 - state + to_chat(user, "You have [(state == 1) ? "unfastened the window from" : "fastened the window to"] the frame.") + else + if(takes_time) + to_chat(user, "You begin to [anchored ? "unfasten the frame from" : "fasten the frame to"] the floor.") + if(!do_after(user, 20 * W.toolspeed, target = src)) + return 1 anchored = !anchored update_nearby_icons() - playsound(loc, I.usesound, 75, 1) - to_chat(user, (anchored ? "You have fastened the frame to the floor." : "You have unfastened the frame from the floor.")) - else if(!reinf) - anchored = !anchored - update_nearby_icons() - playsound(loc, I.usesound, 75, 1) - to_chat(user, (anchored ? "You have fastened the window to the floor." : "You have unfastened the window.")) - else if(istype(I, /obj/item/weapon/crowbar) && reinf && state <= 1) + to_chat(user, "You have [anchored ? "fastened the window to" : "unfastened the window from"] the floor.") + return 1 + //crowbar + if(iscrowbar(W)) + if(!reinf || state > 1) + return 0 + playsound(loc, W.usesound, 75, 1) + if(takes_time) + to_chat(user, "You begin to pry the window [state ? "out of" : "in to"] the frame.") + if(!do_after(user, 20 * W.toolspeed, target = src)) + return 1 state = 1 - state - playsound(loc, I.usesound, 75, 1) - to_chat(user, (state ? "You have pried the window into the frame." : "You have pried the window out of the frame.")) - else if(istype(I, /obj/item/weapon/wrench) && !anchored && health > 7) //Disassemble deconstructed window into parts - playsound(src.loc, I.usesound, 50, 1) - for(var/i=0;iYou have pried the window [state ? "into" : "out of"] the frame.") + return 1 + //wrench + if(iswrench(W)) + if(anchored) + return 0 + playsound(loc, W.usesound, 50, 1) + if(takes_time) + to_chat(user, "You begin to disassemble [src]...") + if(!do_after(user, 20 * W.toolspeed, target = src)) + return 1 + for(var/i=0; i=G.max_amount) + if(S.amount >= S.max_amount) continue - G.attackby(NG, user, params) + S.attackby(NS, 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) + var/obj/item/stack/rods/NR = new (get_turf(src)) + for(var/obj/item/stack/rods/R in loc) + if(R == NR) continue - if(R.amount>=R.max_amount) + if(R.amount >= R.max_amount) continue - R.attackby(NR, user, params) + R.attackby(NR, user) - to_chat(user, "You have disassembled the window.") + to_chat(user, "You have disassembled [src].") disassembled = 1 density = 0 air_update_turf(1) update_nearby_icons() qdel(src) - else - if(I.damtype == BRUTE || I.damtype == BURN) - user.changeNext_move(CLICK_CD_MELEE) - hit(I.force) - if(health <= 7) - anchored = 0 - update_nearby_icons() - step(src, get_dir(user, src)) - else - playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) - ..() - return - + return 1 /obj/structure/window/mech_melee_attack(obj/mecha/M) if(..())