added defines for window construction states and full window diagonal dir

added a proc to check for valid window location, added var/fulltile to windows instead of using a proc
added clockwork windoors and windows to brass recipes
added titanium glass and plastitanium glass, made glass types use recipes like other stacks, you can smelt the new glasses in the ORM
removed force from RCD and added NOBLUDGEON flag, fixing a bug where you couldn't deconstruct airlocks with an RCD
slight nerf to wielded fireaxe, does high damage to windows and grilles instead of insta-deleting them
deleted fullwindow.dm and moved windows to window.dm
added some feedback to placing glass on grilles
examining windoor assembly shows you can rotate it, examining windows show deconstruction hints and rotation
added cracks to windows, you can repair windows using a welding tool on help intent, slight buff to window health
added var/cancolor to windows and blacklists some windows from being auto-colored, window shards also get colored on narsie_act()
full windows now use icon smoothing system, windows now use the obj_integrity damage system
added is_glass_sheet() helper
This commit is contained in:
uraniummeltdown
2018-04-10 23:16:23 +05:00
parent 49e49591a1
commit 75bded82cf
40 changed files with 812 additions and 844 deletions
+74 -297
View File
@@ -13,6 +13,15 @@
/*
* Glass sheets
*/
GLOBAL_LIST_INIT(glass_recipes, list ( \
new/datum/stack_recipe/window("directional window", /obj/structure/window/basic, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe/window("fulltile window", /obj/structure/window/full/basic, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe("fishbowl", /obj/machinery/fishtank/bowl, 1, time = 0), \
new/datum/stack_recipe("fish tank", /obj/machinery/fishtank/tank, 3, time = 0, on_floor = TRUE), \
new/datum/stack_recipe("wall aquariam", /obj/machinery/fishtank/wall, 4, time = 0, on_floor = TRUE) \
))
/obj/item/stack/sheet/glass
name = "glass"
desc = "HOLY SHEET! That is a lot of glass."
@@ -30,8 +39,9 @@
/obj/item/stack/sheet/glass/cyborg
materials = list()
/obj/item/stack/sheet/glass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/glass/New(loc, amount)
recipes = GLOB.glass_recipes
..()
/obj/item/stack/sheet/glass/attackby(obj/item/W, mob/user, params)
..()
@@ -59,94 +69,18 @@
else
return ..()
/obj/item/stack/sheet/glass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
to_chat(user, "<span class='danger'>You don't have the dexterity to do this!</span>")
return 0
var/title = "Sheet-Glass"
title += " ([src.amount] sheet\s left)"
switch(input(title, "What would you like to construct?") in list("One Direction Window", "Full Window", "Fishbowl", "Fish Tank", "Wall Aquarium", "Cancel"))
if("One Direction Window")
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)
to_chat(user, "<span class='danger'>There are too many windows in this location.</span>")
return 1
directions-=win.dir
if(win.is_fulltile())
to_chat(user, "<span class='danger'>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
var/obj/structure/window/W
W = new /obj/structure/window/basic( user.loc, 0 )
W.dir = dir_to_set
W.ini_dir = W.dir
W.state = 0
W.anchored = 0
W.air_update_turf(1)
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
if(locate(/obj/structure/window/full) in user.loc)
to_chat(user, "<span class='danger'>There is a full window in the way.</span>")
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
W.air_update_turf(1)
src.use(2)
if("Fishbowl")
if(!src) return 1
if(src.loc != user) return 1
var/obj/machinery/fishtank/F = new /obj/machinery/fishtank/bowl(user.loc, 0)
F.air_update_turf(1)
src.use(1)
if("Fish Tank")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 3)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
var/obj/machinery/fishtank/F = new /obj/machinery/fishtank/tank(user.loc, 0)
F.air_update_turf(1)
src.use(3)
if("Wall Aquarium")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 4)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
var/obj/machinery/fishtank/F = new /obj/machinery/fishtank/wall(user.loc, 0)
F.air_update_turf(1)
src.use(4)
return 0
/*
* Reinforced glass sheets
*/
GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
new/datum/stack_recipe/window("windoor frame", /obj/structure/windoor_assembly, 5, time = 0, on_floor = TRUE, window_checks = TRUE), \
null, \
new/datum/stack_recipe/window("directional reinforced window", /obj/structure/window/reinforced, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe/window("fulltile reinforced window", /obj/structure/window/full/reinforced, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
))
/obj/item/stack/sheet/rglass
name = "reinforced glass"
desc = "Glass which seems to have rods or something stuck in them."
@@ -161,105 +95,14 @@
/obj/item/stack/sheet/rglass/cyborg
materials = list()
/obj/item/stack/sheet/rglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/rglass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
to_chat(user, "<span class='danger'>You don't have the dexterity to do this!</span>")
return 0
var/title = "Sheet Reinf. Glass"
title += " ([src.amount] sheet\s left)"
switch(input(title, "Would you like full tile glass a one direction glass pane or a windoor?") in list("One Direction", "Full Window", "Windoor", "Cancel"))
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)
to_chat(user, "<span class='danger'>There are too many windows in this location.</span>")
return 1
directions-=win.dir
if(win.is_fulltile())
to_chat(user, "<span class='danger'>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
var/obj/structure/window/W
W = new /obj/structure/window/reinforced( user.loc, 1 )
W.state = 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)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
if(locate(/obj/structure/window/full) in user.loc)
to_chat(user, "<span class='danger'>There is a window in the way.</span>")
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
if("Windoor")
if(!src || src.loc != user) return 1
if(isturf(user.loc) && locate(/obj/structure/windoor_assembly/, user.loc))
to_chat(user, "<span class='danger'>There is already a windoor assembly in that location.</span>")
return 1
if(isturf(user.loc) && locate(/obj/machinery/door/window/, user.loc))
to_chat(user, "<span class='danger'>There is already a windoor in that location.</span>")
return 1
if(src.amount < 5)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
var/obj/structure/windoor_assembly/WD
WD = new /obj/structure/windoor_assembly(user.loc)
WD.state = "01"
WD.anchored = 0
src.use(5)
switch(user.dir)
if(SOUTH)
WD.dir = SOUTH
WD.ini_dir = SOUTH
if(EAST)
WD.dir = EAST
WD.ini_dir = EAST
if(WEST)
WD.dir = WEST
WD.ini_dir = WEST
else//If the user is facing northeast. northwest, southeast, southwest or north, default to north
WD.dir = NORTH
WD.ini_dir = NORTH
else
return 1
return 0
/obj/item/stack/sheet/rglass/New(loc, amount)
recipes = GLOB.reinforced_glass_recipes
..()
GLOBAL_LIST_INIT(pglass_recipes, list ( \
new/datum/stack_recipe/window("directional window", /obj/structure/window/plasmabasic, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe/window("fulltile window", /obj/structure/window/full/plasmabasic, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
))
/obj/item/stack/sheet/plasmaglass
name = "plasma glass"
@@ -271,8 +114,9 @@
created_window = /obj/structure/window/plasmabasic
full_window = /obj/structure/window/full/plasmabasic
/obj/item/stack/sheet/plasmaglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/plasmaglass/New(loc, amount)
recipes = GLOB.pglass_recipes
..()
/obj/item/stack/sheet/plasmaglass/attackby(obj/item/W, mob/user, params)
..()
@@ -291,64 +135,15 @@
else
return ..()
/obj/item/stack/sheet/plasmaglass/proc/construct_window(mob/user as mob)
if(!user || !src) return 0
if(!istype(user.loc,/turf)) return 0
if(!user.IsAdvancedToolUser())
to_chat(user, "<span class='danger'> You don't have the dexterity to do this!")
return 0
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")
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)
to_chat(user, "<span class='danger'>There are too many windows in this location.</span>")
return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
to_chat(user, "<span class='danger'>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
var/obj/structure/window/W
W = new /obj/structure/window/plasmabasic( user.loc, 0 )
W.dir = dir_to_set
W.ini_dir = W.dir
W.state = 0
W.anchored = 0
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
if(locate(/obj/structure/window) in user.loc)
to_chat(user, "<span class='danger'>There is a window in the way.</span>")
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
return 0
/*
* Reinforced plasma glass sheets
*/
GLOBAL_LIST_INIT(prglass_recipes, list ( \
new/datum/stack_recipe/window("directional reinforced window", /obj/structure/window/plasmareinforced, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe/window("fulltile reinforced window", /obj/structure/window/full/plasmareinforced, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
))
/obj/item/stack/sheet/plasmarglass
name = "reinforced plasma glass"
desc = "Plasma glass which seems to have rods or something stuck in them."
@@ -360,60 +155,42 @@
full_window = /obj/structure/window/full/plasmareinforced
armor = list("melee" = 20, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0)
/obj/item/stack/sheet/plasmarglass/attack_self(mob/user as mob)
construct_window(user)
/obj/item/stack/sheet/plasmarglass/New(loc, amount)
recipes = GLOB.prglass_recipes
..()
/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())
to_chat(user, "<span class='danger'>You don't have the dexterity to do this!</span>")
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)
to_chat(user, "<span class='danger'>There are too many windows in this location.</span>")
return 1
directions-=win.dir
if(!(win.ini_dir in cardinal))
to_chat(user, "<span class='danger'>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
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.state = 0
W.anchored = 0
src.use(1)
if("Full Window")
if(!src) return 1
if(src.loc != user) return 1
if(src.amount < 2)
to_chat(user, "<span class='danger'>You need more glass to do that.</span>")
return 1
if(locate(/obj/structure/window) in user.loc)
to_chat(user, "<span class='danger'>There is a window in the way.</span>")
return 1
var/obj/structure/window/W = new full_window( user.loc, 0 )
W.state = 0
W.anchored = 0
src.use(2)
return 0
GLOBAL_LIST_INIT(titaniumglass_recipes, list(
new/datum/stack_recipe/window("shuttle window", /obj/structure/window/full/shuttle, 2, time = 0, on_floor = TRUE, window_checks = TRUE)
))
/obj/item/stack/sheet/titaniumglass
name = "titanium glass"
desc = "A glass sheet made out of a titanium-silicate alloy."
singular_name = "titanium glass sheet"
icon_state = "sheet-titaniumglass"
item_state = "sheet-titaniumglass"
materials = list(MAT_TITANIUM=MINERAL_MATERIAL_AMOUNT, MAT_GLASS=MINERAL_MATERIAL_AMOUNT)
merge_type = /obj/item/stack/sheet/titaniumglass
full_window = /obj/structure/window/full/shuttle
/obj/item/stack/sheet/titaniumglass/New(loc, amount)
recipes = GLOB.titaniumglass_recipes
..()
GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
new/datum/stack_recipe/window("plastitanium window", /obj/structure/window/plastitanium, 2, time = 0, on_floor = TRUE, window_checks = TRUE)
))
/obj/item/stack/sheet/plastitaniumglass
name = "plastitanium glass"
desc = "A glass sheet made out of a plasma-titanium-silicate alloy."
singular_name = "plastitanium glass sheet"
icon_state = "sheet-plastitaniumglass"
item_state = "sheet-plastitaniumglass"
materials = list(MAT_TITANIUM=MINERAL_MATERIAL_AMOUNT, MAT_PLASMA=MINERAL_MATERIAL_AMOUNT, MAT_GLASS=MINERAL_MATERIAL_AMOUNT)
merge_type = /obj/item/stack/sheet/plastitaniumglass
full_window = /obj/structure/window/plastitanium
/obj/item/stack/sheet/plastitaniumglass/New(loc, amount)
recipes = GLOB.plastitaniumglass_recipes
..()
@@ -318,7 +318,11 @@ var/global/list/datum/stack_recipe/cult = list ( \
/*
* Brass
*/
var/global/list/datum/stack_recipe/brass_recipes = list ( \
var/global/list/datum/stack_recipe/brass_recipes = list (\
new/datum/stack_recipe/window("brass windoor", /obj/machinery/door/window/clockwork, 2, time = 30, on_floor = TRUE, window_checks = TRUE), \
null,
new/datum/stack_recipe/window("directional brass window", /obj/structure/window/reinforced/clockwork, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe/window("fulltile brass window", /obj/structure/window/reinforced/clockwork/fulltile, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
new/datum/stack_recipe("brass table frame", /obj/structure/table_frame/brass, 1, time = 5, one_per_turf = TRUE, on_floor = TRUE), \
)
+5 -1
View File
@@ -149,6 +149,10 @@
to_chat(usr, "<span class='warning'>You haven't got enough [src] to build \the [R.title]!</span>")
return 0
if(R.window_checks && !valid_window_location(usr.loc, usr.dir))
to_chat(usr, "<span class='warning'>The [R.title] won't fit here!</span>")
return FALSE
if(R.one_per_turf && (locate(R.result_type) in creation_loc))
to_chat(usr, "<span class='warning'>There is another [R.title] here!</span>")
return 0
@@ -166,7 +170,7 @@
return
var/atom/O = new R.result_type(creation_loc)
O.dir = usr.dir
O.setDir(usr.dir)
if(R.max_res_amount > 1)
var/obj/item/stack/new_item = O
new_item.amount = R.res_amount * multiplier
+14 -1
View File
@@ -11,8 +11,9 @@
var/time = 0
var/one_per_turf = 0
var/on_floor = 0
var/window_checks = FALSE
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0)
/datum/stack_recipe/New(title, result_type, req_amount = 1, res_amount = 1, max_res_amount = 1, time = 0, one_per_turf = 0, on_floor = 0, window_checks = FALSE)
src.title = title
src.result_type = result_type
src.req_amount = req_amount
@@ -21,6 +22,7 @@
src.time = time
src.one_per_turf = one_per_turf
src.on_floor = on_floor
src.window_checks = window_checks
/datum/stack_recipe/proc/post_build(var/obj/item/stack/S, var/obj/result)
return
@@ -40,6 +42,17 @@
R.update_icon()
..()
/datum/stack_recipe/window
/datum/stack_recipe/window/post_build(obj/item/stack/S, obj/result)
if(istype(result, /obj/structure/windoor_assembly))
var/obj/structure/windoor_assembly/W = result
W.ini_dir = W.dir
else if(istype(result, /obj/structure/window))
var/obj/structure/window/W = result
W.ini_dir = W.dir
W.anchored = FALSE
W.state = WINDOW_OUT_OF_FRAME
/*
* Recipe list datum
*/
+4 -12
View File
@@ -9,10 +9,10 @@ RCD
icon_state = "rcd"
opacity = 0
density = 0
anchored = 0.0
flags = CONDUCT
force = 10.0
throwforce = 10.0
anchored = 0
flags = CONDUCT | NOBLUDGEON
force = 0
throwforce = 10
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_NORMAL
@@ -296,8 +296,6 @@ RCD
var/turf/T1 = get_turf(A)
QDEL_NULL(A)
for(var/obj/structure/window/W in T1.contents)
W.disassembled = 1
W.density = 0
qdel(W)
for(var/cdir in cardinal)
var/turf/T2 = get_step(T1, cdir)
@@ -307,8 +305,6 @@ RCD
continue
for(var/obj/structure/window/W in T2.contents)
if(W.dir == turn(cdir, 180))
W.disassembled = 1
W.density = 0
qdel(W)
var/obj/structure/window/reinforced/W = new(T2)
W.dir = turn(cdir, 180)
@@ -331,16 +327,12 @@ RCD
activate()
new /obj/structure/grille(A)
for(var/obj/structure/window/W in contents)
W.disassembled = 1 // Prevent that annoying glass breaking sound
W.density = 0
qdel(W)
for(var/cdir in cardinal)
var/turf/T = get_step(A, cdir)
if(locate(/obj/structure/grille) in T.contents)
for(var/obj/structure/window/W in T.contents)
if(W.dir == turn(cdir, 180))
W.disassembled = 1
W.density = 0
qdel(W)
else // Build a window!
var/obj/structure/window/reinforced/W = new(A)
+10 -10
View File
@@ -176,16 +176,16 @@
icon_state = "fireaxe[wielded]"
return
/obj/item/twohanded/fireaxe/afterattack(atom/A as mob|obj|turf|area, mob/user as mob, proximity)
if(!proximity) return
..()
if(A && wielded && (istype(A,/obj/structure/window) || istype(A,/obj/structure/grille))) //destroys windows and grilles in one hit
if(istype(A,/obj/structure/window))
/obj/item/twohanded/fireaxe/afterattack(atom/A, mob/user, proximity)
if(!proximity)
return
if(wielded)
if(istype(A, /obj/structure/window))
var/obj/structure/window/W = A
W.destroy()
else
qdel(A)
W.take_damage(200, BRUTE, "melee", 0)
else if(istype(A, /obj/structure/grille))
var/obj/structure/grille/G = A
G.take_damage(40, BRUTE, "melee", 0)
/*
* Double-Bladed Energy Swords - Cheridan
@@ -751,7 +751,7 @@
if(A && wielded && (istype(A, /obj/structure/window) || istype(A, /obj/structure/grille)))
if(istype(A, /obj/structure/window))
var/obj/structure/window/W = A
W.destroy()
W.deconstruct(FALSE)
if(prob(4))
charged++
user.visible_message("<span class='notice'>The axe starts to emit an electric buzz!</span>")