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 20:09:04 -05:00
committed by mwerezak
parent 57110b4059
commit ab2b4608e0
19 changed files with 121 additions and 196 deletions
+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."