Merge pull request #5747 from Neerti/fulltile_window_improvements

Makes fulltile windows seperate from dir
This commit is contained in:
Anewbe
2018-12-04 13:36:18 -06:00
committed by VirgoBot
parent 4579aed0ed
commit 2572f3a145
5 changed files with 21 additions and 93 deletions

View File

@@ -121,7 +121,7 @@
// Special handling of windows, which are dense but block only from some directions // Special handling of windows, which are dense but block only from some directions
if(istype(A, /obj/structure/window)) if(istype(A, /obj/structure/window))
var/obj/structure/window/W = A var/obj/structure/window/W = A
if (!W.is_full_window() && !(turn(src.last_move, 180) & A.dir)) if (!W.is_fulltile() && !(turn(src.last_move, 180) & A.dir))
continue continue
// Same thing for (closed) windoors, which have the same problem // Same thing for (closed) windoors, which have the same problem
else if(istype(A, /obj/machinery/door/window) && !(turn(src.last_move, 180) & A.dir)) else if(istype(A, /obj/machinery/door/window) && !(turn(src.last_move, 180) & A.dir))

View File

@@ -14,9 +14,7 @@
name = "glass" name = "glass"
singular_name = "glass sheet" singular_name = "glass sheet"
icon_state = "sheet-glass" icon_state = "sheet-glass"
var/created_window = /obj/structure/window/basic
var/is_reinforced = 0 var/is_reinforced = 0
var/list/construction_options = list("One Direction", "Full Window")
default_type = "glass" default_type = "glass"
/obj/item/stack/material/glass/attack_self(mob/user as mob) /obj/item/stack/material/glass/attack_self(mob/user as mob)
@@ -52,75 +50,7 @@
if (!G && replace) if (!G && replace)
user.put_in_hands(RG) user.put_in_hands(RG)
/obj/item/stack/material/glass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
return 0
var/title = "Sheet-[name]"
title += " ([src.get_amount()] sheet\s left)"
switch(input(title, "What would you like to construct?") as null|anything in construction_options)
if("One Direction")
if(!src) return 1
if(src.loc != user) return 1
var/list/directions = new/list(cardinal)
var/i = 0
for (var/obj/structure/window/win in user.loc)
i++
if(i >= 4)
user << "<span class='warning'>There are too many windows in this location.</span>"
return 1
directions-=win.dir
if(!(win.dir in cardinal))
user << "<span class='warning'>Can't let you do that.</span>"
return 1
//Determine the direction. It will first check in the direction the person making the window is facing, if it finds an already made window it will try looking at the next cardinal direction, etc.
var/dir_to_set = 2
for(var/direction in list( user.dir, turn(user.dir,90), turn(user.dir,180), turn(user.dir,270) ))
var/found = 0
for(var/obj/structure/window/WT in user.loc)
if(WT.dir == direction)
found = 1
if(!found)
dir_to_set = direction
break
new created_window( user.loc, dir_to_set, 1 )
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.get_amount() < 4)
user << "<span class='warning'>You need more glass to do that.</span>"
return 1
if(locate(/obj/structure/window) in user.loc)
user << "<span class='warning'>There is a window in the way.</span>"
return 1
new created_window( user.loc, SOUTHWEST, 1 )
src.use(4)
if("Windoor")
if(!is_reinforced) return 1
if(!src || src.loc != user) return 1
if(isturf(user.loc) && locate(/obj/structure/windoor_assembly/, user.loc))
user << "<span class='warning'>There is already a windoor assembly in that location.</span>"
return 1
if(isturf(user.loc) && locate(/obj/machinery/door/window/, user.loc))
user << "<span class='warning'>There is already a windoor in that location.</span>"
return 1
if(src.get_amount() < 5)
user << "<span class='warning'>You need more glass to do that.</span>"
return 1
new /obj/structure/windoor_assembly(user.loc, user.dir, 1)
src.use(5)
return 0
/* /*
@@ -131,9 +61,7 @@
singular_name = "reinforced glass sheet" singular_name = "reinforced glass sheet"
icon_state = "sheet-rglass" icon_state = "sheet-rglass"
default_type = "reinforced glass" default_type = "reinforced glass"
created_window = /obj/structure/window/reinforced
is_reinforced = 1 is_reinforced = 1
construction_options = list("One Direction", "Full Window", "Windoor")
/* /*
* Phoron Glass sheets * Phoron Glass sheets
@@ -142,7 +70,6 @@
name = "phoron glass" name = "phoron glass"
singular_name = "phoron glass sheet" singular_name = "phoron glass sheet"
icon_state = "sheet-phoronglass" icon_state = "sheet-phoronglass"
created_window = /obj/structure/window/phoronbasic
default_type = "phoron glass" default_type = "phoron glass"
/obj/item/stack/material/glass/phoronglass/attackby(obj/item/W, mob/user) /obj/item/stack/material/glass/phoronglass/attackby(obj/item/W, mob/user)
@@ -170,5 +97,4 @@
singular_name = "reinforced phoron glass sheet" singular_name = "reinforced phoron glass sheet"
icon_state = "sheet-phoronrglass" icon_state = "sheet-phoronrglass"
default_type = "reinforced phoron glass" default_type = "reinforced phoron glass"
created_window = /obj/structure/window/phoronreinforced
is_reinforced = 1 is_reinforced = 1

View File

@@ -21,6 +21,7 @@
var/shardtype = /obj/item/weapon/material/shard var/shardtype = /obj/item/weapon/material/shard
var/glasstype = null // Set this in subtypes. Null is assumed strange or otherwise impossible to dismantle, such as for shuttle glass. var/glasstype = null // Set this in subtypes. Null is assumed strange or otherwise impossible to dismantle, such as for shuttle glass.
var/silicate = 0 // number of units of silicate var/silicate = 0 // number of units of silicate
var/fulltile = FALSE // Set to true on full-tile variants.
/obj/structure/window/examine(mob/user) /obj/structure/window/examine(mob/user)
. = ..(user) . = ..(user)
@@ -128,16 +129,10 @@
/obj/structure/window/blob_act() /obj/structure/window/blob_act()
take_damage(50) take_damage(50)
//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) /obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(istype(mover) && mover.checkpass(PASSGLASS)) if(istype(mover) && mover.checkpass(PASSGLASS))
return 1 return 1
if(is_full_window()) if(is_fulltile())
return 0 //full tile window, you can't move into it! return 0 //full tile window, you can't move into it!
if(get_dir(loc, target) & dir) if(get_dir(loc, target) & dir)
return !density return !density
@@ -388,8 +383,6 @@
anchored = 0 anchored = 0
state = 0 state = 0
update_verbs() update_verbs()
if(is_fulltile())
maxhealth *= 2
health = maxhealth health = maxhealth
@@ -416,9 +409,7 @@
//checks if this window is full-tile one //checks if this window is full-tile one
/obj/structure/window/proc/is_fulltile() /obj/structure/window/proc/is_fulltile()
if(dir & (dir - 1)) return fulltile
return 1
return 0
//This proc is used to update the icons of nearby windows. It should not be confused with update_nearby_tiles(), which is an atmos proc! //This proc is used to update the icons of nearby windows. It should not be confused with update_nearby_tiles(), which is an atmos proc!
/obj/structure/window/proc/update_nearby_icons() /obj/structure/window/proc/update_nearby_icons()
@@ -484,6 +475,10 @@
maxhealth = 12.0 maxhealth = 12.0
force_threshold = 3 force_threshold = 3
/obj/structure/window/basic/full
maxhealth = 24
fulltile = TRUE
/obj/structure/window/phoronbasic /obj/structure/window/phoronbasic
name = "phoron window" name = "phoron window"
desc = "A borosilicate alloy window. It seems to be quite strong." desc = "A borosilicate alloy window. It seems to be quite strong."
@@ -497,8 +492,8 @@
force_threshold = 5 force_threshold = 5
/obj/structure/window/phoronbasic/full /obj/structure/window/phoronbasic/full
dir = SOUTHWEST
maxhealth = 80 maxhealth = 80
fulltile = TRUE
/obj/structure/window/phoronreinforced /obj/structure/window/phoronreinforced
name = "reinforced borosilicate window" name = "reinforced borosilicate window"
@@ -514,8 +509,8 @@
force_threshold = 10 force_threshold = 10
/obj/structure/window/phoronreinforced/full /obj/structure/window/phoronreinforced/full
dir = SOUTHWEST
maxhealth = 160 maxhealth = 160
fulltile = TRUE
/obj/structure/window/reinforced /obj/structure/window/reinforced
name = "reinforced window" name = "reinforced window"
@@ -530,9 +525,9 @@
force_threshold = 6 force_threshold = 6
/obj/structure/window/reinforced/full /obj/structure/window/reinforced/full
dir = SOUTHWEST
icon_state = "fwindow" icon_state = "fwindow"
maxhealth = 80 maxhealth = 80
fulltile = TRUE
/obj/structure/window/reinforced/tinted /obj/structure/window/reinforced/tinted
name = "tinted window" name = "tinted window"
@@ -567,9 +562,9 @@
var/id var/id
/obj/structure/window/reinforced/polarized/full /obj/structure/window/reinforced/polarized/full
dir = SOUTHWEST
icon_state = "fwindow" icon_state = "fwindow"
maxhealth = 80 maxhealth = 80
fulltile = TRUE
/obj/structure/window/reinforced/polarized/attackby(obj/item/W as obj, mob/user as mob) /obj/structure/window/reinforced/polarized/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/device/multitool) && !anchored) // Only allow programming if unanchored! if(istype(W, /obj/item/device/multitool) && !anchored) // Only allow programming if unanchored!

View File

@@ -113,6 +113,7 @@ var/list/name_to_material
// Placeholder vars for the time being, todo properly integrate windows/light tiles/rods. // Placeholder vars for the time being, todo properly integrate windows/light tiles/rods.
var/created_window var/created_window
var/created_fulltile_window
var/rod_product var/rod_product
var/wire_product var/wire_product
var/list/window_options = list() var/list/window_options = list()
@@ -485,11 +486,12 @@ var/list/name_to_material
destruction_desc = "shatters" destruction_desc = "shatters"
window_options = list("One Direction" = 1, "Full Window" = 4, "Windoor" = 2) window_options = list("One Direction" = 1, "Full Window" = 4, "Windoor" = 2)
created_window = /obj/structure/window/basic created_window = /obj/structure/window/basic
created_fulltile_window = /obj/structure/window/basic/full
rod_product = /obj/item/stack/material/glass/reinforced rod_product = /obj/item/stack/material/glass/reinforced
/material/glass/build_windows(var/mob/living/user, var/obj/item/stack/used_stack) /material/glass/build_windows(var/mob/living/user, var/obj/item/stack/used_stack)
if(!user || !used_stack || !created_window || !window_options.len) if(!user || !used_stack || !created_window || !created_fulltile_window || !window_options.len)
return 0 return 0
if(!user.IsAdvancedToolUser()) if(!user.IsAdvancedToolUser())
@@ -544,6 +546,8 @@ var/list/name_to_material
if(choice == "Windoor") if(choice == "Windoor")
if(is_reinforced()) if(is_reinforced())
build_path = /obj/structure/windoor_assembly/secure build_path = /obj/structure/windoor_assembly/secure
else if(choice == "Full Window")
build_path = created_fulltile_window
else else
build_path = created_window build_path = created_window
@@ -575,6 +579,7 @@ var/list/name_to_material
composite_material = list(DEFAULT_WALL_MATERIAL = SHEET_MATERIAL_AMOUNT / 2, "glass" = SHEET_MATERIAL_AMOUNT) composite_material = list(DEFAULT_WALL_MATERIAL = SHEET_MATERIAL_AMOUNT / 2, "glass" = SHEET_MATERIAL_AMOUNT)
window_options = list("One Direction" = 1, "Full Window" = 4, "Windoor" = 2) window_options = list("One Direction" = 1, "Full Window" = 4, "Windoor" = 2)
created_window = /obj/structure/window/reinforced created_window = /obj/structure/window/reinforced
created_fulltile_window = /obj/structure/window/reinforced/full
wire_product = null wire_product = null
rod_product = null rod_product = null
@@ -588,6 +593,7 @@ var/list/name_to_material
stack_origin_tech = list(TECH_MATERIAL = 4) stack_origin_tech = list(TECH_MATERIAL = 4)
window_options = list("One Direction" = 1, "Full Window" = 4) window_options = list("One Direction" = 1, "Full Window" = 4)
created_window = /obj/structure/window/phoronbasic created_window = /obj/structure/window/phoronbasic
created_fulltile_window = /obj/structure/window/phoronbasic/full
wire_product = null wire_product = null
rod_product = /obj/item/stack/material/glass/phoronrglass rod_product = /obj/item/stack/material/glass/phoronrglass
@@ -599,6 +605,7 @@ var/list/name_to_material
composite_material = list() //todo composite_material = list() //todo
window_options = list("One Direction" = 1, "Full Window" = 4) window_options = list("One Direction" = 1, "Full Window" = 4)
created_window = /obj/structure/window/phoronreinforced created_window = /obj/structure/window/phoronreinforced
created_fulltile_window = /obj/structure/window/phoronreinforced/full
hardness = 40 hardness = 40
weight = 30 weight = 30
stack_origin_tech = list(TECH_MATERIAL = 2) stack_origin_tech = list(TECH_MATERIAL = 2)

View File

@@ -832,7 +832,7 @@ default behaviour is:
if (pulling) if (pulling)
if (istype(pulling, /obj/structure/window)) if (istype(pulling, /obj/structure/window))
var/obj/structure/window/W = pulling var/obj/structure/window/W = pulling
if(W.is_full_window()) if(W.is_fulltile())
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T))) for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
stop_pulling() stop_pulling()
if (pulling) if (pulling)