From c37b255912db4f888455a4df65d42302744d4df5 Mon Sep 17 00:00:00 2001 From: Kluys Date: Mon, 17 Sep 2018 19:25:28 +0200 Subject: [PATCH 1/3] Window alt clicking utility Alt clicking a window now checks both directions for availability, a clockwise rotation takes priority but when a window is already present it will rotate the window counterclockwise instead. (prior to this it would state that the window cannot be rotated in that direction if the clockwise direction is unavailable) https://puu.sh/Bwx9X/69079c06f2.gif A gif to show the new situation I intentionally left out checking for the direction opposite to the current one as that would allow for an easy way to get into the station without being affected by fastmos. --- code/game/objects/structures/window.dm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 25c78f6e972..0e7d0e4c998 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -65,7 +65,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f else to_chat(user, "The window is unscrewed from the floor, and could be deconstructed by wrenching.") if(!anchored && !fulltile) - to_chat(user, "Alt-click to rotate it clockwise.") + to_chat(user, "Alt-click to rotate it.") /obj/structure/window/New(Loc, direct) ..() @@ -397,12 +397,25 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f return TRUE /obj/structure/window/AltClick(mob/user) - if(user.incapacitated()) - to_chat(user, "You can't do that right now!") + if(usr.stat || !usr.canmove || usr.restrained()) return - if(!Adjacent(user)) - return - revrotate() + + if(anchored) + to_chat(usr, "[src] cannot be rotated while it is fastened to the floor!") + return FALSE + + var/target_dir = turn(dir, 270) + + if(!valid_window_location(loc, target_dir)) + target_dir = turn(dir, 90) + if(!valid_window_location(loc, target_dir)) + to_chat(usr, "There is no room to rotate the [src]") + return FALSE + + setDir(target_dir) + ini_dir = dir + add_fingerprint(usr) + return TRUE /obj/structure/window/Destroy() density = FALSE From 82f112ab247de1daec927baa4094e825a31db899 Mon Sep 17 00:00:00 2001 From: Kluys Date: Mon, 17 Sep 2018 20:18:56 +0200 Subject: [PATCH 2/3] fixes --- code/game/objects/structures/window.dm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 0e7d0e4c998..4e99f56c905 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -65,7 +65,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f else to_chat(user, "The window is unscrewed from the floor, and could be deconstructed by wrenching.") if(!anchored && !fulltile) - to_chat(user, "Alt-click to rotate it.") + to_chat(user, "alt-click to rotate it.") /obj/structure/window/New(Loc, direct) ..() @@ -355,7 +355,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f set category = "Object" set src in oview(1) - if(usr.stat || !usr.canmove || usr.restrained()) + if(usr.incapacitated()) return if(anchored) @@ -378,7 +378,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f set category = "Object" set src in oview(1) - if(usr.stat || !usr.canmove || usr.restrained()) + if(usr.incapacitated()) return if(anchored) @@ -397,11 +397,17 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f return TRUE /obj/structure/window/AltClick(mob/user) - if(usr.stat || !usr.canmove || usr.restrained()) + + if(user.incapacitated()) + to_chat(user, "You can't do that right now!") + return + + if(!Adjacent(user)) + to_chat(user, "Move closer to the window!") return if(anchored) - to_chat(usr, "[src] cannot be rotated while it is fastened to the floor!") + to_chat(user, "[src] cannot be rotated while it is fastened to the floor!") return FALSE var/target_dir = turn(dir, 270) @@ -409,12 +415,12 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f if(!valid_window_location(loc, target_dir)) target_dir = turn(dir, 90) if(!valid_window_location(loc, target_dir)) - to_chat(usr, "There is no room to rotate the [src]") + to_chat(user, "There is no room to rotate the [src]") return FALSE setDir(target_dir) ini_dir = dir - add_fingerprint(usr) + add_fingerprint(user) return TRUE /obj/structure/window/Destroy() From c62b0a1a1c1766ee84e612bc4084443aa3afe8ec Mon Sep 17 00:00:00 2001 From: Kluys Date: Sat, 20 Oct 2018 18:15:14 +0200 Subject: [PATCH 3/3] Typo fixu --- code/game/objects/structures/window.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 4e99f56c905..c1e58f89848 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -65,7 +65,7 @@ var/global/wcCommon = pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8f else to_chat(user, "The window is unscrewed from the floor, and could be deconstructed by wrenching.") if(!anchored && !fulltile) - to_chat(user, "alt-click to rotate it.") + to_chat(user, "Alt-click to rotate it.") /obj/structure/window/New(Loc, direct) ..()