From 64bcc1c0f0d0bba5da308b3987d99e2396eb4851 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Sat, 11 Feb 2012 00:04:21 +0000 Subject: [PATCH] - Moved three (well two, one was doubled for some reason) screen/attackby() procs to appear AFTER the screen object is defined. They were in a random file instead of where the objects are. If you double-click and 'screen' object in the object browser it now takes you to the definition instead of some random file. - Clicking a grille with a glass or r-glass sheet in your hand, when the grille is in one of your cardinal directions (North, south, east or west) will make you start building a window. It takes 2s to build the window, which spawns unfastened (same as when you create one.) This should make fixing damaged grille-window combinations easier. If you are standing on a grille and click it with a glass / r-glass sheet in your hand, the window will face the direction you're currently facing. Screenshot: http://www.kamletos.si/placing%20windows%20on%20grilles.PNG git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3081 316c924e-a436-60f5-8080-3fe189b3f50e --- code/game/objects/grille.dm | 43 ++++++++++++++++++++++ code/game/objects/items.dm | 5 --- code/game/objects/secstorage/secstorage.dm | 4 -- code/game/objects/storage/storage.dm | 4 -- code/game/objects/window.dm | 2 + code/modules/mob/screen.dm | 9 +++++ 6 files changed, 54 insertions(+), 13 deletions(-) diff --git a/code/game/objects/grille.dm b/code/game/objects/grille.dm index 23a05cf7be3..b584f5ec996 100644 --- a/code/game/objects/grille.dm +++ b/code/game/objects/grille.dm @@ -117,6 +117,49 @@ for(var/mob/O in oviewers()) O << text("\red [user] [src.anchored ? "fastens" : "unfastens"] the grille.") return + else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) ) + var/dir_to_set = 1 + if(src.loc == usr.loc) + dir_to_set = usr.dir + else + if( ( src.x == usr.x ) || (src.y == usr.y) ) //Only supposed to work for cardinal directions. + if( src.x == usr.x ) + if( src.y > usr.y ) + dir_to_set = 2 + else + dir_to_set = 1 + else if( src.y == usr.y ) + if( src.x > usr.x ) + dir_to_set = 8 + else + dir_to_set = 4 + else + usr << "\red You can't reach there.." + return //Only works for cardinal direcitons, diagonals aren't supposed to work like this. + for(var/obj/structure/window/WINDOW in src.loc) + if(WINDOW.dir == dir_to_set) + usr << "\red There is already a window facing this way there." + return + usr << "\blue You start placing the window" + if(do_after(user,20)) + if(!src) return //Grille destroyed while waiting + for(var/obj/structure/window/WINDOW in src.loc) + if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting. + usr << "\red 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(src.loc,1) //reinforced window + else + WD = new/obj/structure/window(src.loc,0) //normal window + WD.dir = dir_to_set + WD.ini_dir = dir_to_set + WD.anchored = 0 + WD.state = 0 + var/obj/item/stack/ST = W + ST.use(1) + usr << "\blue You place the [WD] on the [src]" + return else if(istype(W, /obj/item/weapon/shard)) src.health -= W.force * 0.1 else if(!shock(user, 70)) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index fe6ef849c78..f0fc48238e2 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -255,11 +255,6 @@ del(src) return -/obj/screen/close/DblClick() - if (src.master) - src.master:close(usr) - return - //What the fuck is this code /mob/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/game/objects/secstorage/secstorage.dm b/code/game/objects/secstorage/secstorage.dm index a9b3b976adc..09d6f7c2ff9 100644 --- a/code/game/objects/secstorage/secstorage.dm +++ b/code/game/objects/secstorage/secstorage.dm @@ -255,7 +255,3 @@ src.orient_objs(7, 8, 10, 7) return return - -/obj/screen/storage/attackby(W, mob/user as mob) - src.master.attackby(W, user) - return diff --git a/code/game/objects/storage/storage.dm b/code/game/objects/storage/storage.dm index 5ee6d07df77..d40972ec5fd 100644 --- a/code/game/objects/storage/storage.dm +++ b/code/game/objects/storage/storage.dm @@ -241,10 +241,6 @@ O.emp_act(severity) ..() -/obj/screen/storage/attackby(W, mob/user as mob) - src.master.attackby(W, user) - return - // BubbleWrap - A box can be folded up to make card /obj/item/weapon/storage/attack_self(mob/user as mob) if ( contents.len ) diff --git a/code/game/objects/window.dm b/code/game/objects/window.dm index 6a33b30ef52..3db18f5e3ec 100644 --- a/code/game/objects/window.dm +++ b/code/game/objects/window.dm @@ -297,6 +297,8 @@ health = 40 if(opacity) icon_state = "twindow" + else + icon_state = "window" update_nearby_tiles(need_rebuild=1) diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index a4aa521c515..1cfc64c6dcd 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -10,6 +10,11 @@ name = "close" master = null +/obj/screen/close/DblClick() + if (src.master) + src.master:close(usr) + return + /obj/screen/grab name = "grab" master = null @@ -18,6 +23,10 @@ name = "storage" master = null +/obj/screen/storage/attackby(W, mob/user as mob) + src.master.attackby(W, user) + return + /obj/screen/zone_sel name = "Damage Zone" icon = 'zone_sel.dmi'