mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-21 04:48:18 +01:00
Adds new full windows (#12434)
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
/obj/structure/window_frame
|
||||
name = "window frame"
|
||||
desc = "An empty window frame."
|
||||
icon = 'icons/obj/smooth/full_window.dmi'
|
||||
icon_state = "window_frame"
|
||||
build_amt = 4
|
||||
anchored = FALSE
|
||||
|
||||
/obj/structure/window_frame/anchored
|
||||
anchored = TRUE
|
||||
|
||||
/obj/structure/window_frame/attackby(obj/item/W, mob/user)
|
||||
if((W.isscrewdriver()) && (istype(loc, /turf/simulated) || anchored))
|
||||
playsound(src, W.usesound, 80, 1)
|
||||
anchored = !anchored
|
||||
user.visible_message("<span class='notice'>[user] [anchored ? "fastens" : "unfastens"] \the [src].</span>", \
|
||||
"<span class='notice'>You have [anchored ? "fastened the grille to" : "unfastened the grill from"] the floor.</span>")
|
||||
return
|
||||
|
||||
else if(W.iswelder())
|
||||
var/obj/item/weldingtool/WT = W
|
||||
if(!WT.isOn())
|
||||
to_chat(user, SPAN_WARNING("\The [WT] isn't turned on."))
|
||||
return
|
||||
if(WT.remove_fuel(0, user))
|
||||
to_chat(user, SPAN_NOTICE("You use \the [WT] to remove \the [src]."))
|
||||
playsound(src, WT.usesound, 80, 1)
|
||||
new /obj/item/stack/material/steel(get_turf(src),rand(1,3))
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
else if(istype(W, /obj/item/stack/material) && W.get_material_name() == MATERIAL_GLASS_REINFORCED && anchored)
|
||||
var/obj/item/stack/material/G = W
|
||||
if(G.use(4))
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
to_chat(user, SPAN_WARNING ("You place the glass on the window frame."))
|
||||
new /obj/structure/window/full(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
to_chat(user, SPAN_WARNING ("You need at least four sheets of reinforced glass to finished the window."))
|
||||
|
||||
else if(istype(W, /obj/item/stack/material) && W.get_material_name() == MATERIAL_GLASS_REINFORCED_PHORON && anchored)
|
||||
var/obj/item/stack/material/G = W
|
||||
if(G.use(4))
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
to_chat(user, SPAN_WARNING ("You place the glass on the window frame."))
|
||||
new /obj/structure/window/full/phoron(get_turf(src))
|
||||
qdel(src)
|
||||
return
|
||||
else
|
||||
to_chat(user, SPAN_WARNING ("You need at least four sheets of reinforced borosilicate glass to finished the window."))
|
||||
@@ -10,6 +10,7 @@
|
||||
anchored = TRUE
|
||||
flags = CONDUCT
|
||||
explosion_resistance = 1
|
||||
layer = 2.98
|
||||
var/health = 10
|
||||
var/destroyed = 0
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
var/shardtype = /obj/item/material/shard
|
||||
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/base_frame = null
|
||||
|
||||
atmos_canpass = CANPASS_PROC
|
||||
|
||||
@@ -45,6 +46,12 @@
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("There is a thick layer of silicate covering it."))
|
||||
|
||||
/obj/structure/window/proc/update_nearby_icons()
|
||||
queue_smooth_neighbors(src)
|
||||
|
||||
/obj/structure/window/update_icon()
|
||||
queue_smooth(src)
|
||||
|
||||
/obj/structure/window/proc/take_damage(var/damage = 0, var/sound_effect = 1)
|
||||
var/initialhealth = health
|
||||
|
||||
@@ -102,6 +109,14 @@
|
||||
new shardtype(loc) //todo pooling?
|
||||
if(reinf)
|
||||
new /obj/item/stack/rods(loc)
|
||||
|
||||
if(base_frame)
|
||||
if(prob(50))
|
||||
var/obj/F = new base_frame(loc)
|
||||
F.anchored = anchored
|
||||
else
|
||||
new /obj/item/material/shard/shrapnel(loc)
|
||||
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
@@ -233,6 +248,7 @@
|
||||
to_chat(user, (state == 1 ? SPAN_NOTICE("You have unfastened the window from the frame.") : SPAN_NOTICE("You have fastened the window to the frame.")))
|
||||
else if(reinf && state == 0)
|
||||
anchored = !anchored
|
||||
update_icon()
|
||||
update_nearby_icons()
|
||||
playsound(loc, W.usesound, 75, 1)
|
||||
to_chat(user, (anchored ? SPAN_NOTICE("You have fastened the frame to the floor.") : SPAN_NOTICE("You have unfastened the frame from the floor.")))
|
||||
@@ -241,6 +257,8 @@
|
||||
update_nearby_icons()
|
||||
playsound(loc, W.usesound, 75, 1)
|
||||
to_chat(user, (anchored ? SPAN_NOTICE("You have fastened the window to the floor.") : SPAN_NOTICE("You have unfastened the window.")))
|
||||
update_icon()
|
||||
update_nearby_icons()
|
||||
else if(W.iscrowbar() && reinf && state <= 1)
|
||||
state = 1 - state
|
||||
playsound(loc, W.usesound, 75, 1)
|
||||
@@ -250,12 +268,7 @@
|
||||
to_chat(user, SPAN_NOTICE("You're not sure how to dismantle \the [src] properly."))
|
||||
else
|
||||
visible_message(SPAN_NOTICE("[user] dismantles \the [src]."))
|
||||
if(dir == SOUTHWEST)
|
||||
var/obj/item/stack/material/mats = new glasstype(loc)
|
||||
mats.amount = is_fulltile() ? 4 : 2
|
||||
else
|
||||
new glasstype(loc)
|
||||
qdel(src)
|
||||
dismantle_window()
|
||||
else
|
||||
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
||||
if(W.damtype == BRUTE || W.damtype == BURN)
|
||||
@@ -300,6 +313,14 @@
|
||||
take_damage(damage)
|
||||
return
|
||||
|
||||
/obj/structure/window/proc/dismantle_window()
|
||||
if(dir == SOUTHWEST)
|
||||
var/obj/item/stack/material/mats = new glasstype(loc)
|
||||
mats.amount = is_fulltile() ? 4 : 2
|
||||
else
|
||||
new glasstype(loc)
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/window/Initialize(mapload, start_dir = null, constructed=0)
|
||||
. = ..()
|
||||
|
||||
@@ -342,33 +363,6 @@
|
||||
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!
|
||||
/obj/structure/window/proc/update_nearby_icons()
|
||||
update_icon()
|
||||
for(var/obj/structure/window/W in orange(src, 1))
|
||||
W.update_icon()
|
||||
|
||||
//merges adjacent full-tile windows into one (blatant ripoff from game/smoothwall.dm)
|
||||
/obj/structure/window/update_icon()
|
||||
//A little cludge here, since I don't know how it will work with slim windows. Most likely VERY wrong.
|
||||
//this way it will only update full-tile ones
|
||||
cut_overlays()
|
||||
if(!is_fulltile())
|
||||
icon_state = "[basestate]"
|
||||
return
|
||||
var/list/dirs = list()
|
||||
if(anchored)
|
||||
for(var/obj/structure/window/W in orange(src,1))
|
||||
if(W.anchored && W.density && W.type == src.type && W.is_fulltile()) //Only counts anchored, not-destroyed fill-tile windows.
|
||||
dirs += get_dir(src, W)
|
||||
|
||||
var/list/connections = dirs_to_corner_states(dirs)
|
||||
|
||||
icon_state = ""
|
||||
for(var/i = 1 to 4)
|
||||
var/image/I = image(icon, "[basestate][connections[i]]", dir = 1<<(i-1))
|
||||
add_overlay(I)
|
||||
|
||||
/obj/structure/window/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
if(exposed_temperature > maximal_heat)
|
||||
hit(damage_per_fire_tick, 0)
|
||||
@@ -499,12 +493,6 @@
|
||||
/obj/structure/window/shuttle/crescent/take_damage()
|
||||
return
|
||||
|
||||
/obj/structure/window/shuttle/update_nearby_icons()
|
||||
queue_smooth_neighbors(src)
|
||||
|
||||
/obj/structure/window/update_icon()
|
||||
queue_smooth(src)
|
||||
|
||||
/obj/structure/window/reinforced/polarized
|
||||
name = "electrochromic window"
|
||||
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
|
||||
@@ -566,3 +554,59 @@
|
||||
|
||||
/obj/machinery/button/switch/windowtint/update_icon()
|
||||
icon_state = "light[active]"
|
||||
|
||||
/obj/structure/window/full
|
||||
name = "reinforced window"
|
||||
desc = "It looks rather strong. Might take a few good hits to shatter it."
|
||||
icon = 'icons/obj/smooth/full_window.dmi'
|
||||
icon_state = "window_glass"
|
||||
basestate = "window_glass"
|
||||
maxhealth = 40
|
||||
reinf = TRUE
|
||||
maximal_heat = T0C + 750
|
||||
dir = 5
|
||||
smooth = SMOOTH_TRUE
|
||||
damage_per_fire_tick = 2.0
|
||||
can_be_unanchored = TRUE
|
||||
glasstype = /obj/item/stack/material/glass/reinforced
|
||||
layer = 2.99
|
||||
base_frame = /obj/structure/window_frame
|
||||
|
||||
/obj/structure/window/full/dismantle_window()
|
||||
var/obj/item/stack/material/mats = new glasstype(loc)
|
||||
mats.amount = 4
|
||||
var/obj/structure/window_frame/F = new/obj/structure/window_frame (get_turf(src))
|
||||
F.anchored = anchored
|
||||
qdel(src)
|
||||
|
||||
/obj/structure/window/full/phoron
|
||||
name = "reinforced borosilicate window"
|
||||
desc = "A borosilicate alloy window, with rods supporting it. It seems to be very strong."
|
||||
icon = 'icons/obj/smooth/phoron_full_window.dmi'
|
||||
icon_state = "window_glass"
|
||||
basestate = "window_glass"
|
||||
shardtype = /obj/item/material/shard/phoron
|
||||
glasstype = /obj/item/stack/material/glass/phoronrglass
|
||||
maximal_heat = T0C + 4000
|
||||
damage_per_fire_tick = 1.0
|
||||
maxhealth = 80.0
|
||||
layer = 2.99
|
||||
base_frame = /obj/structure/window_frame
|
||||
|
||||
/obj/structure/window/reinforced/polarized/full
|
||||
name = "reinforced electrochromic window"
|
||||
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
|
||||
icon = 'icons/obj/smooth/full_window.dmi'
|
||||
icon_state = "window_glass"
|
||||
basestate = "window_glass"
|
||||
dir = 5
|
||||
smooth = SMOOTH_TRUE
|
||||
layer = 2.99
|
||||
base_frame = /obj/structure/window_frame
|
||||
|
||||
/obj/structure/window/reinforced/polarized/full/dismantle_window()
|
||||
var/obj/item/stack/material/mats = new glasstype(loc)
|
||||
mats.amount = 4
|
||||
var/obj/structure/window_frame/F = new/obj/structure/window_frame (get_turf(src))
|
||||
F.anchored = anchored
|
||||
qdel(src)
|
||||
|
||||
Reference in New Issue
Block a user