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

@@ -14,9 +14,7 @@
name = "glass"
singular_name = "glass sheet"
icon_state = "sheet-glass"
var/created_window = /obj/structure/window/basic
var/is_reinforced = 0
var/list/construction_options = list("One Direction", "Full Window")
default_type = "glass"
/obj/item/stack/material/glass/attack_self(mob/user as mob)
@@ -52,75 +50,7 @@
if (!G && replace)
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"
icon_state = "sheet-rglass"
default_type = "reinforced glass"
created_window = /obj/structure/window/reinforced
is_reinforced = 1
construction_options = list("One Direction", "Full Window", "Windoor")
/*
* Phoron Glass sheets
@@ -142,7 +70,6 @@
name = "phoron glass"
singular_name = "phoron glass sheet"
icon_state = "sheet-phoronglass"
created_window = /obj/structure/window/phoronbasic
default_type = "phoron glass"
/obj/item/stack/material/glass/phoronglass/attackby(obj/item/W, mob/user)
@@ -170,5 +97,4 @@
singular_name = "reinforced phoron glass sheet"
icon_state = "sheet-phoronrglass"
default_type = "reinforced phoron glass"
created_window = /obj/structure/window/phoronreinforced
is_reinforced = 1