Plasma construction and full window fixes

- Fixed plasma window construction

- Fixed full windows from stopping players and gasses from moving above
them even with density set to 1
This commit is contained in:
Artorp
2014-08-11 01:06:27 +02:00
parent 6c5b0f7987
commit 048f5235c9
2 changed files with 72 additions and 14 deletions
+65 -11
View File
@@ -6,6 +6,8 @@
* Plasma Glass Sheets
* Reinforced Plasma Glass Sheets (AKA Holy fuck strong windows)
Todo: Create a unified construct_window(sheet, user, created_window, full_window)
*/
/*
@@ -110,6 +112,7 @@
user << "\red There is a full window in the way."
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
return 0
@@ -126,6 +129,8 @@
g_amt = 3750
m_amt = 1875
origin_tech = "materials=2"
var/created_window = /obj/structure/window/reinforced
var/full_window = /obj/structure/window/full/reinforced
/obj/item/stack/sheet/rglass/cyborg
name = "reinforced glass"
@@ -190,11 +195,8 @@
if(locate(/obj/structure/window/full) in user.loc)
user << "\red There is a window in the way."
return 1
var/obj/structure/window/W
W = new /obj/structure/window/reinforced( user.loc, 1 )
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.dir = SOUTHWEST
W.ini_dir = SOUTHWEST
W.anchored = 0
src.use(2)
@@ -349,7 +351,7 @@
var/full_window = /obj/structure/window/full/plasmabasic
/obj/item/stack/sheet/glass/plasmaglass/attack_self(mob/user as mob)
/obj/item/stack/sheet/plasmaglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/plasmaglass/attackby(obj/item/W, mob/user)
@@ -375,7 +377,7 @@
if(!user.IsAdvancedToolUser())
user << "\red You don't have the dexterity to do this!"
return 0
var/title = "Sheet-PlasmaGlass"
var/title = "Plasma-glass alloy"
title += " ([src.amount] sheet\s left)"
switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null))
if("One Direction")
@@ -417,10 +419,8 @@
if(locate(/obj/structure/window) in user.loc)
user << "\red There is a window in the way."
return 1
var/obj/structure/window/W
W = new /obj/structure/window/plasmabasic( user.loc, 0 )
W.dir = SOUTHWEST
W.ini_dir = SOUTHWEST
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
return 0
@@ -440,5 +440,59 @@
var/full_window = /obj/structure/window/full/plasmareinforced
/obj/item/stack/sheet/glass/plasmarglass/attack_self(mob/user as mob)
/obj/item/stack/sheet/plasmarglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/plasmarglass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
user << "\red You don't have the dexterity to do this!"
return 0
var/title = "Reinforced plasma-glass alloy"
title += " ([src.amount] sheet\s left)"
switch(alert(title, "Would you like full tile glass or one direction?", "One Direction", "Full Window", "Cancel", null))
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 << "\red There are too many windows in this location."
return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
user << "\red Can't let you do that."
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
var/obj/structure/window/W
W = new /obj/structure/window/plasmareinforced( user.loc, 0 )
W.dir = dir_to_set
W.ini_dir = W.dir
W.anchored = 0
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
user << "\red You need more glass to do that."
return 1
if(locate(/obj/structure/window) in user.loc)
user << "\red There is a window in the way."
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
return 0
+7 -3
View File
@@ -149,7 +149,7 @@
return
//window placing begin
else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) )
else if( istype(W,/obj/item/stack/sheet/rglass) || istype(W,/obj/item/stack/sheet/glass) || istype(W,/obj/item/stack/sheet/plasmaglass) || istype(W,/obj/item/stack/sheet/plasmarglass) )
var/dir_to_set = 1
if(loc == user.loc)
dir_to_set = user.dir
@@ -182,8 +182,12 @@
var/obj/structure/window/WD
if(istype(W,/obj/item/stack/sheet/rglass))
WD = new/obj/structure/window/reinforced(loc) //reinforced window
else
else if(istype(W,/obj/item/stack/sheet/glass))
WD = new/obj/structure/window/basic(loc) //normal window
else if(istype(W,/obj/item/stack/sheet/plasmaglass))
WD = new/obj/structure/window/plasmabasic(loc) //basic plasma window
else
WD = new/obj/structure/window/plasmareinforced(loc) //reinforced plasma window
WD.dir = dir_to_set
WD.ini_dir = dir_to_set
WD.anchored = 0
@@ -228,7 +232,7 @@
// returns 1 if shocked, 0 otherwise
/obj/structure/grille/proc/shock(mob/user as mob, prb)
if(!anchored || destroyed) // anchored/destroyed grilles are never connected
if(!anchored || destroyed) // deanchored/destroyed grilles are never connected
return 0
if(!prob(prb))
return 0