Fixes #6702 and cleanup

Makes reinforced glass a subtype of glass, cleans up window creation copypasta.
Cleaned up window initialization leaking outside of the window constructor.
Removes unnecessary init_dir var from windows.
This commit is contained in:
mwerezak
2014-11-12 16:03:23 -05:00
committed by mwerezak
parent 57110b4059
commit ab2b4608e0
19 changed files with 121 additions and 196 deletions
@@ -159,7 +159,7 @@ obj/structure/door_assembly
if(do_after(user, 40))
if(!src || !WT.isOn()) return
user << "\blue You welded the glass panel out!"
new /obj/item/stack/sheet/rglass(src.loc)
new /obj/item/stack/sheet/glass/reinforced(src.loc)
glass = 0
else if(!anchored)
user.visible_message("[user] dissassembles the airlock assembly.", "You start to dissassemble the airlock assembly.")
@@ -239,7 +239,7 @@ obj/structure/door_assembly
var/obj/item/stack/sheet/S = W
if (S)
if (S.get_amount() >= 1)
if(istype(S, /obj/item/stack/sheet/rglass))
if(istype(S, /obj/item/stack/sheet/glass/reinforced))
playsound(src.loc, 'sound/items/Crowbar.ogg', 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40) && !glass)
@@ -303,4 +303,4 @@ obj/structure/door_assembly
name = "Wired "
if(2)
name = "Near Finished "
name += "[glass == 1 ? "Window " : ""][istext(glass) ? "[glass] Airlock" : base_name] Assembly"
name += "[glass == 1 ? "Window " : ""][istext(glass) ? "[glass] Airlock" : base_name] Assembly"
+5 -11
View File
@@ -123,8 +123,8 @@
return
//window placing begin
else if(istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/ST = W
else if(istype(W,/obj/item/stack/sheet/glass))
var/obj/item/stack/sheet/glass/ST = W
var/dir_to_set = 1
if(loc == user.loc)
dir_to_set = user.dir
@@ -153,16 +153,10 @@
if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting.
user << "<span class='notice'>There is already a window facing this way there.</span>"
return
var/wtype = ST.created_window
if (ST.use(1))
var/obj/structure/window/WD
if(istype(W, /obj/item/stack/sheet/rglass))
WD = new/obj/structure/window/reinforced(loc) //reinforced window
else
WD = new/obj/structure/window/basic(loc) //normal window
WD.dir = dir_to_set
WD.ini_dir = dir_to_set
WD.anchored = 0
WD.state = 0
var/obj/structure/window/WD = new wtype(loc, dir_to_set, 1)
user << "<span class='notice'>You place the [WD] on [src].</span>"
WD.update_icon()
return
@@ -18,7 +18,6 @@ obj/structure/windoor_assembly
density = 0
dir = NORTH
var/ini_dir
var/obj/item/weapon/airlock_electronics/electronics = null
//Vars to help with the icon's name
@@ -26,9 +25,17 @@ obj/structure/windoor_assembly
var/secure = "" //Whether or not this creates a secure windoor
var/state = "01" //How far the door assembly has progressed in terms of sprites
obj/structure/windoor_assembly/New(dir=NORTH)
obj/structure/windoor_assembly/New(Loc, start_dir=NORTH, constructed=0)
..()
src.ini_dir = src.dir
if(constructed)
state = "01"
anchored = 0
switch(start_dir)
if(NORTH, SOUTH, EAST, WEST)
dir = start_dir
else //If the user is facing northeast. northwest, southeast, southwest or north, default to north
dir = NORTH
update_nearby_tiles(need_rebuild=1)
obj/structure/windoor_assembly/Del()
@@ -70,7 +77,7 @@ obj/structure/windoor_assembly/Del()
if(do_after(user, 40))
if(!src || !WT.isOn()) return
user << "\blue You dissasembled the windoor assembly!"
new /obj/item/stack/sheet/rglass(get_turf(src), 5)
new /obj/item/stack/sheet/glass/reinforced(get_turf(src), 5)
if(secure)
new /obj/item/stack/rods(get_turf(src), 4)
del(src)
@@ -270,7 +277,6 @@ obj/structure/windoor_assembly/Del()
if(src.state != "01")
update_nearby_tiles(need_rebuild=1)
src.ini_dir = src.dir
update_icon()
return
+21 -11
View File
@@ -8,7 +8,6 @@
anchored = 1.0
flags = ON_BORDER
var/health = 14.0
var/ini_dir = null
var/state = 2
var/reinf = 0
var/basestate
@@ -16,7 +15,6 @@
// var/silicate = 0 // number of units of silicate
// var/icon/silicateIcon = null // the silicated icon
/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
//Tasers and the like should not damage windows.
@@ -62,11 +60,16 @@
if(reinf) new /obj/item/stack/rods( loc)
del(src)
//TODO: Make full windows a separate type of window.
//Once a full window, it will always be a full window, so there's no point
//having the same type for both.
/obj/structure/window/proc/is_full_window()
return (dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST)
/obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(istype(mover) && mover.checkpass(PASSGLASS))
return 1
if(dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST)
if(is_full_window())
return 0 //full tile window, you can't move into it!
if(get_dir(loc, target) == dir)
return !density
@@ -255,7 +258,6 @@
dir = turn(dir, 90)
// updateSilicate()
update_nearby_tiles(need_rebuild=1)
ini_dir = dir
return
@@ -272,7 +274,6 @@
dir = turn(dir, 270)
// updateSilicate()
update_nearby_tiles(need_rebuild=1)
ini_dir = dir
return
@@ -292,18 +293,19 @@
*/
/obj/structure/window/New(Loc,re=0)
/obj/structure/window/New(Loc, start_dir=null, constructed=0)
..()
// if(re) reinf = re
ini_dir = dir
//player-constructed windows
if (constructed)
anchored = 0
if (start_dir)
dir = start_dir
update_nearby_tiles(need_rebuild=1)
update_nearby_icons()
return
/obj/structure/window/Del()
density = 0
@@ -314,6 +316,7 @@
/obj/structure/window/Move()
var/ini_dir = dir
update_nearby_tiles(need_rebuild=1)
..()
dir = ini_dir
@@ -412,6 +415,13 @@
health = 40
reinf = 1
/obj/structure/window/New(Loc, constructed=0)
..()
//player-constructed windows
if (constructed)
state = 0
/obj/structure/window/reinforced/tinted
name = "tinted window"
desc = "It looks rather strong and opaque. Might take a few good hits to shatter it."