From 9018195366199f96315f2b6f222a25917a50640d Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Thu, 28 Sep 2017 02:31:52 -0400 Subject: [PATCH 1/3] Windows Update Your computer will restart in- No, not that kind of Windows Update! Updates windows code (and not delete sys32) to be better in various regards Full windows now have double the health of their directional counterparts. You spend twice the glass, you get twice the integrity! You can now build one directional OR full windows on grilles, as well as select the direction of the one directional window you are building on the grille! - This is largely quality of life, saves some time on the actual repairing / building of windows. :cl: tweak: Full windows are now 100% stronger than before, so you don't have to pick strength over security. tweak: Full windows now take longer to deconstruct so they offer slightly better security against break-ins. Toolspeed does apply. rscadd: Full and directional windows can be built on grilles now, and you can even pick the direction! Technically both a tweak and an addition... /:cl: --- .../game/objects/items/stacks/sheets/glass.dm | 16 +-- .../objects/items/stacks/sheets/sheets.dm | 2 + code/game/objects/structures/fullwindow.dm | 10 +- code/game/objects/structures/grille.dm | 127 ++++++++++-------- code/game/objects/structures/window.dm | 123 ++++++++++------- 5 files changed, 165 insertions(+), 113 deletions(-) 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 48b2268d8cc..216862df917 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/plasmareinforced @@ -55,7 +55,7 @@ shardtype = /obj/item/weapon/shard/plasma glasstype = /obj/item/stack/sheet/plasmaglass reinf = 1 - health = 160 + health = 320 /obj/structure/window/full/reinforced @@ -63,7 +63,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 @@ -78,7 +78,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" @@ -86,7 +86,7 @@ icon = 'icons/obj/podwindows.dmi' icon_state = "window" basestate = "window" - health = 160 + health = 320 reinf = 1 /obj/structure/window/full/shuttle/New() 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 126dd6e3a38..7ca8209c8ea 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -108,7 +108,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f return 1 -/obj/structure/window/hitby(atom/movable/AM) +/obj/structure/window/hitby(atom/movable/AM) ..() var/tforce = 0 if(ismob(AM)) @@ -125,7 +125,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f update_nearby_icons() step(src, get_dir(AM, src)) if(health <= 0) - destroy() + destroy() /obj/structure/window/attack_hand(mob/user as mob) @@ -180,7 +180,8 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f /obj/structure/window/attackby(obj/item/weapon/W as obj, mob/living/user as mob, params) - if(!istype(W)) return//I really wish I did not need this + if(!istype(W)) + return//I really wish I did not need this if(istype(W, /obj/item/weapon/grab) && get_dist(src,user)<2) var/obj/item/weapon/grab/G = W if(istype(G.affecting,/mob/living)) @@ -210,66 +211,98 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f hit(75) return - if(W.flags & NOBLUDGEON) return + if(W.flags & NOBLUDGEON) + return - if(istype(W, /obj/item/weapon/screwdriver)) - if(reinf && state >= 1) - state = 3 - state - playsound(loc, W.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) - anchored = !anchored + if(handle_decon(W, user, is_fulltile())) + return + + if(W.damtype == BRUTE || W.damtype == BURN) + user.changeNext_move(CLICK_CD_MELEE) + hit(W.force) + if(health <= 7) + anchored = 0 update_nearby_icons() - playsound(loc, W.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, W.usesound, 75, 1) - to_chat(user, (anchored ? "You have fastened the window to the floor." : "You have unfastened the window.")) - else if(istype(W, /obj/item/weapon/crowbar) && reinf && state <= 1) - state = 1 - state + step(src, get_dir(user, src)) + else + playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1) + ..() + return + +/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, (anchored ? "You have fastened the frame to the floor." : "You have 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, (state == 1 ? "You have unfastened the window from the frame." : "You have 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() + to_chat(user, (anchored ? "You have fastened the window to the floor." : "You have unfastened the window.")) + 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 to_chat(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, W.usesound, 50, 1) + 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) + 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(W.damtype == BRUTE || W.damtype == BURN) - user.changeNext_move(CLICK_CD_MELEE) - hit(W.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(..()) From 6a941a85266ca147b9c5031623482fb49bf4b2e2 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Sat, 4 Nov 2017 18:13:39 -0400 Subject: [PATCH 2/3] Message and spacing tweaks --- code/game/objects/structures/window.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 04dd3803ea8..cfee76dc749 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -238,14 +238,14 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f if(!do_after(user, 20 * W.toolspeed, target = src)) return 1 anchored = !anchored - to_chat(user, (anchored ? "You have fastened the frame to the floor." : "You have unfastened the frame from the floor.")) + 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, (state == 1 ? "You have unfastened the window from the frame." : "You have fastened the window to the frame.")) + 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.") @@ -253,7 +253,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f return 1 anchored = !anchored update_nearby_icons() - to_chat(user, (anchored ? "You have fastened the window to the floor." : "You have unfastened the window.")) + to_chat(user, "You have [anchored ? "fastened the window to" : "unfastened the window from"] the floor.") return 1 //crowbar if(iscrowbar(W)) @@ -265,7 +265,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f if(!do_after(user, 20 * W.toolspeed, target = src)) return 1 state = 1 - state - to_chat(user, (state ? "You have pried the window into the frame." : "You have pried the window out of the frame.")) + to_chat(user, "You have pried the window [state ? "into" : "out of"] the frame.") return 1 //wrench if(iswrench(W)) @@ -276,10 +276,10 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f to_chat(user, "You begin to disassemble [src]...") if(!do_after(user, 20 * W.toolspeed, target = src)) return 1 - for(var/i=0;i= S.max_amount) continue @@ -288,7 +288,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f if(reinf) var/obj/item/stack/rods/NR = new (get_turf(src)) for(var/obj/item/stack/rods/R in loc) - if(R==NR) + if(R == NR) continue if(R.amount >= R.max_amount) continue From 49c65da656ff9377853209e571a082227282ff85 Mon Sep 17 00:00:00 2001 From: FalseIncarnate Date: Tue, 7 Nov 2017 21:20:09 -0500 Subject: [PATCH 3/3] Shuttle window health reduction --- code/game/objects/structures/fullwindow.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/structures/fullwindow.dm b/code/game/objects/structures/fullwindow.dm index 216862df917..0ac428a6282 100644 --- a/code/game/objects/structures/fullwindow.dm +++ b/code/game/objects/structures/fullwindow.dm @@ -86,7 +86,7 @@ icon = 'icons/obj/podwindows.dmi' icon_state = "window" basestate = "window" - health = 320 + health = 160 reinf = 1 /obj/structure/window/full/shuttle/New()