mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-18 10:33:30 +01:00
Transitions to Full-tile Windows (#15385)
* Transitions to Full-tile Windows * tweaks * bump fix and RCD inclusion * no colors * debris refactor * even better
This commit is contained in:
@@ -160,54 +160,37 @@
|
||||
"<span class='notice'>You [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor.</span>")
|
||||
|
||||
/obj/structure/grille/proc/build_window(obj/item/stack/sheet/S, mob/user)
|
||||
var/dir_to_set = NORTH
|
||||
var/dir_to_set = SOUTHWEST
|
||||
if(!istype(S) || !user)
|
||||
return
|
||||
if(broken)
|
||||
to_chat(user, "<span class='warning'>You must repair or replace [src] first!</span>")
|
||||
return
|
||||
if(S.get_amount() < 1)
|
||||
to_chat(user, "<span class='warning'>You need at least one sheet of glass for that!</span>")
|
||||
if(S.get_amount() < 2)
|
||||
to_chat(user, "<span class='warning'>You need at least two sheets of glass for that!</span>")
|
||||
return
|
||||
if(!anchored)
|
||||
to_chat(user, "<span class='warning'>[src] needs to be fastened to the floor first!</span>")
|
||||
return
|
||||
if(!getRelativeDirection(src, user) && (user.loc != loc)) //essentially a cardinal direction adjacent or sharing same loc check
|
||||
to_chat(user, "<span class='warning'>You can't reach.</span>")
|
||||
return
|
||||
if(loc == user.loc)
|
||||
dir_to_set = user.dir
|
||||
else
|
||||
if(x == user.x)
|
||||
if(y > user.y)
|
||||
dir_to_set = SOUTH
|
||||
else
|
||||
dir_to_set = NORTH
|
||||
else if(y == user.y)
|
||||
if(x > user.x)
|
||||
dir_to_set = WEST
|
||||
else
|
||||
dir_to_set = EAST
|
||||
for(var/obj/structure/window/WINDOW in loc)
|
||||
if(WINDOW.dir == dir_to_set)
|
||||
to_chat(user, "<span class='notice'>There is already a window facing this way there.</span>")
|
||||
return
|
||||
to_chat(user, "<span class='warning'>There is already a window there!</span>")
|
||||
return
|
||||
to_chat(user, "<span class='notice'>You start placing the window...</span>")
|
||||
if(do_after(user, 20, target = src))
|
||||
if(!loc || !anchored) //Grille destroyed or unanchored while waiting
|
||||
return
|
||||
for(var/obj/structure/window/WINDOW in loc)
|
||||
if(WINDOW.dir == dir_to_set)//checking this for a 2nd time to check if a window was made while we were waiting.
|
||||
to_chat(user, "<span class='notice'>There is already a window facing this way there.</span>")
|
||||
return
|
||||
var/obj/structure/window/W = new S.created_window(get_turf(src))
|
||||
S.use(1)
|
||||
for(var/obj/structure/window/WINDOW in loc) //checking this for a 2nd time to check if a window was made while we were waiting.
|
||||
to_chat(user, "<span class='warning'>There is already a window there!</span>")
|
||||
return
|
||||
var/obj/structure/window/W = new S.full_window(drop_location())
|
||||
W.setDir(dir_to_set)
|
||||
W.ini_dir = dir_to_set
|
||||
W.anchored = FALSE
|
||||
W.state = WINDOW_OUT_OF_FRAME
|
||||
to_chat(user, "<span class='notice'>You place the [W] on [src].</span>")
|
||||
air_update_turf(TRUE)
|
||||
W.update_nearby_icons()
|
||||
W.state = WINDOW_OUT_OF_FRAME
|
||||
S.use(2)
|
||||
to_chat(user, "<span class='notice'>You place the [W] on [src].</span>")
|
||||
|
||||
|
||||
/obj/structure/grille/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
|
||||
|
||||
@@ -1,26 +1,3 @@
|
||||
GLOBAL_LIST_INIT(wcBar, pick(list("#0d8395", "#58b5c3", "#58c366", "#90d79a", "#ffffff")))
|
||||
GLOBAL_LIST_INIT(wcBrig, pick(list("#aa0808", "#7f0606", "#ff0000")))
|
||||
GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", "#8fcf44", "#ffffff")))
|
||||
|
||||
/obj/proc/color_windows(obj/W)
|
||||
var/list/wcBarAreas = list(/area/crew_quarters/bar)
|
||||
var/list/wcBrigAreas = list(/area/security, /area/shuttle/gamma)
|
||||
|
||||
var/newcolor
|
||||
var/turf/T = get_turf(W)
|
||||
if(!istype(T))
|
||||
return
|
||||
var/area/A = T.loc
|
||||
|
||||
if(is_type_in_list(A,wcBarAreas))
|
||||
newcolor = GLOB.wcBar
|
||||
else if(is_type_in_list(A,wcBrigAreas))
|
||||
newcolor = GLOB.wcBrig
|
||||
else
|
||||
newcolor = GLOB.wcCommon
|
||||
|
||||
return newcolor
|
||||
|
||||
/obj/structure/window
|
||||
name = "window"
|
||||
desc = "A window."
|
||||
@@ -43,11 +20,10 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
var/decon_speed = null
|
||||
var/fulltile = FALSE
|
||||
var/shardtype = /obj/item/shard
|
||||
var/glass_decal = /obj/effect/decal/cleanable/glass
|
||||
var/glass_type = /obj/item/stack/sheet/glass
|
||||
var/glass_amount = 1
|
||||
var/cancolor = FALSE
|
||||
var/image/crack_overlay
|
||||
var/list/debris = list()
|
||||
var/mutable_appearance/crack_overlay
|
||||
var/real_explosion_block //ignore this, just use explosion_block
|
||||
var/breaksound = "shatter"
|
||||
var/hitsound = 'sound/effects/Glasshit.ogg'
|
||||
@@ -81,30 +57,12 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
|
||||
ini_dir = dir
|
||||
|
||||
if(!color && cancolor)
|
||||
color = color_windows(src)
|
||||
|
||||
// Precreate our own debris
|
||||
|
||||
var/shards = 1
|
||||
if(fulltile)
|
||||
shards++
|
||||
setDir()
|
||||
|
||||
if(decon_speed == null && fulltile)
|
||||
decon_speed = 2 SECONDS
|
||||
|
||||
var/rods = 0
|
||||
if(reinf)
|
||||
rods++
|
||||
if(fulltile)
|
||||
rods++
|
||||
|
||||
for(var/i in 1 to shards)
|
||||
debris += new shardtype(src)
|
||||
if(rods)
|
||||
debris += new /obj/item/stack/rods(src, rods)
|
||||
|
||||
//windows only block while reinforced and fulltile, so we'll use the proc
|
||||
real_explosion_block = explosion_block
|
||||
explosion_block = EXPLOSION_BLOCK_PROC
|
||||
@@ -113,8 +71,6 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
|
||||
/obj/structure/window/narsie_act()
|
||||
color = NARSIE_WINDOW_COLOUR
|
||||
for(var/obj/item/shard/shard in debris)
|
||||
shard.color = NARSIE_WINDOW_COLOUR
|
||||
|
||||
/obj/structure/window/ratvar_act()
|
||||
if(!fulltile)
|
||||
@@ -324,6 +280,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
WELDER_ATTEMPT_REPAIR_MESSAGE
|
||||
if(I.use_tool(src, user, 40, volume = I.tool_volume))
|
||||
obj_integrity = max_integrity
|
||||
update_nearby_icons()
|
||||
WELDER_REPAIR_SUCCESS_MESSAGE
|
||||
|
||||
/obj/structure/window/proc/check_state(checked_state)
|
||||
@@ -371,13 +328,20 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
if(!disassembled)
|
||||
playsound(src, breaksound, 70, 1)
|
||||
if(!(flags & NODECONSTRUCT))
|
||||
for(var/i in debris)
|
||||
var/obj/item/I = i
|
||||
I.forceMove(loc)
|
||||
transfer_fingerprints_to(I)
|
||||
for(var/obj/item/shard/debris in spawnDebris(drop_location()))
|
||||
transfer_fingerprints_to(debris) // transfer fingerprints to shards only
|
||||
qdel(src)
|
||||
update_nearby_icons()
|
||||
|
||||
/obj/structure/window/proc/spawnDebris(location)
|
||||
. = list()
|
||||
. += new shardtype(location)
|
||||
. += new glass_decal(location)
|
||||
if(reinf)
|
||||
. += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
if(fulltile)
|
||||
. += new shardtype(location)
|
||||
|
||||
/obj/structure/window/verb/rotate()
|
||||
set name = "Rotate Window Counter-Clockwise"
|
||||
set category = "Object"
|
||||
@@ -479,14 +443,16 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
if(!fulltile)
|
||||
return
|
||||
var/ratio = obj_integrity / max_integrity
|
||||
ratio = CEILING(ratio*4, 1) * 25
|
||||
ratio = CEILING(ratio * 4, 1) * 25
|
||||
|
||||
if(smooth)
|
||||
queue_smooth(src)
|
||||
overlays -= crack_overlay
|
||||
|
||||
cut_overlay(crack_overlay)
|
||||
if(ratio > 75)
|
||||
return
|
||||
crack_overlay = image('icons/obj/structures.dmi',"damage[ratio]",-(layer+0.1))
|
||||
overlays += crack_overlay
|
||||
crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1))
|
||||
add_overlay(crack_overlay)
|
||||
|
||||
/obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
..()
|
||||
@@ -504,7 +470,6 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
desc = "It looks rather strong. Might take a few good hits to shatter it."
|
||||
icon_state = "rwindow"
|
||||
reinf = TRUE
|
||||
cancolor = TRUE
|
||||
heat_resistance = 1600
|
||||
armor = list("melee" = 50, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 25, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 100)
|
||||
rad_insulation = RAD_HEAVY_INSULATION
|
||||
@@ -576,6 +541,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
name = "plasma window"
|
||||
desc = "A window made out of a plasma-silicate alloy. It looks insanely tough to break and burn through."
|
||||
icon_state = "plasmawindow"
|
||||
glass_decal = /obj/effect/decal/cleanable/glass/plasma
|
||||
shardtype = /obj/item/shard/plasma
|
||||
glass_type = /obj/item/stack/sheet/plasmaglass
|
||||
heat_resistance = 32000
|
||||
@@ -591,6 +557,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
name = "reinforced plasma window"
|
||||
desc = "A plasma-glass alloy window, with rods supporting it. It looks hopelessly tough to break. It also looks completely fireproof, considering how basic plasma windows are insanely fireproof."
|
||||
icon_state = "plasmarwindow"
|
||||
glass_decal = /obj/effect/decal/cleanable/glass/plasma
|
||||
shardtype = /obj/item/shard/plasma
|
||||
glass_type = /obj/item/stack/sheet/plasmarglass
|
||||
reinf = TRUE
|
||||
@@ -619,7 +586,6 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
icon_state = "window"
|
||||
max_integrity = 50
|
||||
smooth = SMOOTH_TRUE
|
||||
cancolor = TRUE
|
||||
canSmoothWith = list(/obj/structure/window/full/basic, /obj/structure/window/full/reinforced, /obj/structure/window/full/reinforced/tinted, /obj/structure/window/full/plasmabasic, /obj/structure/window/full/plasmareinforced)
|
||||
|
||||
/obj/structure/window/full/plasmabasic
|
||||
@@ -627,6 +593,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
desc = "A plasma-glass alloy window. It looks insanely tough to break. It appears it's also insanely tough to burn through."
|
||||
icon = 'icons/obj/smooth_structures/plasma_window.dmi'
|
||||
icon_state = "plasmawindow"
|
||||
glass_decal = /obj/effect/decal/cleanable/glass/plasma
|
||||
shardtype = /obj/item/shard/plasma
|
||||
glass_type = /obj/item/stack/sheet/plasmaglass
|
||||
heat_resistance = 32000
|
||||
@@ -642,6 +609,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
desc = "A plasma-glass alloy window, with rods supporting it. It looks hopelessly tough to break. It also looks completely fireproof, considering how basic plasma windows are insanely fireproof."
|
||||
icon = 'icons/obj/smooth_structures/rplasma_window.dmi'
|
||||
icon_state = "rplasmawindow"
|
||||
glass_decal = /obj/effect/decal/cleanable/glass/plasma
|
||||
shardtype = /obj/item/shard/plasma
|
||||
glass_type = /obj/item/stack/sheet/plasmarglass
|
||||
smooth = SMOOTH_TRUE
|
||||
@@ -668,7 +636,6 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
rad_insulation = RAD_HEAVY_INSULATION
|
||||
explosion_block = 1
|
||||
glass_type = /obj/item/stack/sheet/rglass
|
||||
cancolor = TRUE
|
||||
|
||||
/obj/structure/window/full/reinforced/tinted
|
||||
name = "tinted window"
|
||||
@@ -681,7 +648,6 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
icon = 'icons/obj/smooth_structures/rice_window.dmi'
|
||||
icon_state = "ice_window"
|
||||
max_integrity = 150
|
||||
cancolor = FALSE
|
||||
|
||||
/obj/structure/window/full/shuttle
|
||||
name = "shuttle window"
|
||||
@@ -734,19 +700,18 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
explosion_block = 2 //fancy AND hard to destroy. the most useful combination.
|
||||
glass_type = /obj/item/stack/tile/brass
|
||||
reinf = FALSE
|
||||
cancolor = FALSE
|
||||
var/made_glow = FALSE
|
||||
|
||||
/obj/structure/window/reinforced/clockwork/Initialize(mapload, direct)
|
||||
. = ..()
|
||||
if(fulltile)
|
||||
made_glow = TRUE
|
||||
QDEL_LIST(debris)
|
||||
if(fulltile)
|
||||
new /obj/effect/temp_visual/ratvar/window(get_turf(src))
|
||||
debris += new/obj/item/stack/tile/brass(src, 2)
|
||||
else
|
||||
debris += new/obj/item/stack/tile/brass(src, 1)
|
||||
|
||||
/obj/structure/window/reinforced/clockwork/spawnDebris(location)
|
||||
. = list()
|
||||
. += new /obj/item/stack/tile/brass(location, (fulltile ? 2 : 1))
|
||||
|
||||
/obj/structure/window/reinforced/clockwork/setDir(direct)
|
||||
if(!made_glow)
|
||||
@@ -757,7 +722,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e",
|
||||
|
||||
/obj/structure/window/reinforced/clockwork/ratvar_act()
|
||||
obj_integrity = max_integrity
|
||||
update_icon()
|
||||
update_nearby_icons()
|
||||
|
||||
/obj/structure/window/reinforced/clockwork/narsie_act()
|
||||
take_damage(rand(25, 75), BRUTE)
|
||||
|
||||
Reference in New Issue
Block a user