Files
Aurora.3/code/game/objects/structures/window.dm
Matt Atlas 99b4033ca5 Aurora 2: The 3/4thening (#17186)
* after dark

* FIXES

* breakin

* butt

* Update code/game/objects/items/devices/floor_painter.dm

Co-authored-by: Cody Brittain <cbrittain10@yahoo.com>

* Update code/game/objects/items/devices/floor_painter.dm

Co-authored-by: Cody Brittain <cbrittain10@yahoo.com>

* Update code/game/objects/structures/lattice.dm

Co-authored-by: Cody Brittain <cbrittain10@yahoo.com>

* testing 1

* a

* FUCK THIS PRESET!!!

* allah

* OTEMACHI

* tis' done

* Project Exorcism : Sneed's Snairs (Formerly Chuck's)

* Update code/game/objects/structures/stool_bed_chair_nest/chairs.dm

* Update code/game/objects/structures/stool_bed_chair_nest/chairs.dm

* Update stools.dm

* Update code/game/objects/structures/stool_bed_chair_nest/stools.dm

* Update code/game/objects/structures/stool_bed_chair_nest/stools.dm

* Update stools.dm

* Update chairs.dm

* Update code/game/objects/structures/stool_bed_chair_nest/chairs.dm

* inhand fixes

* airlocks (matt has cooked)

fuck

* my cody plays the mamba

* fuck

* fixes layering issue

* airlocks and everything else Please fucking kill me

* underlays

* unfuck blending

* finished replacing old ass shit

* your ass is geass

* conflicts die now

* public fat'wa

* progress on walls and windows

* more mapping

* baltimore accents be like

* minor progress

* monitors

* fire alarms and apc adjustments

* apcs pixel adjustments, final airlock look

* also grilles

* shuttle wall start plus shuttle windows

* starting consoles

* table outlines

* I love broke ass sprites

* fixing the stupid ass exterior walls

* light fuckery

* terminal directionals, external airlocks, table fixes, blahblahblah

* fix 1

* fix 2

* some more fixes

* fix chairs

* basic untested railings and updating colors from atteria

* bridge and some fixes

* removing some artifacts on the new walls

* breaking wood tables and adding 4 wall materials

* fix

* compile & wood fixes

* make the horizon compile again

* railings, firedoors, ATMs, intercomms and tables again

* mapping begins also some tweaks to map view of icons

* full tile steel walls

* i sure hope nothing bad happens

* airlock updates (untested)

* reverts most wall machinery

* skull

* wall coloring

* makes the tg wood chill out

* work on airlocks

* hull consistency

* cause you live forever in the lights you make

* whoops can't show that in a christian manga

* terminals should be on walls and everything's hunky dory now

also i changed the wood stuff as per atteria's suggestion

* fixing airlocks

* fixes

* window resprite, coloring adjustments

* scc hull resprite

* new grilles, frame edits, and borosilicate

* greyscale wood palette improvement

* shuttle windows

* window frame fix

* apc update

* refit and reshaded fire alarms

* mapping icon fixes

* table fixes

* map fixes, platforms and stairs

* updates cutter, new walls and terminals

* mapping fixes

* fix preview

* preview fix stone

* stairs

* initial work for the map

* railing and windowpane fuckery

* new external airlocks

* a

* fix the maps in preparation

* wall object pixel offsets

* air alarms D1

* extinguisher cabinets

* APC DESTROYED MISSION ACCOMPLISHED GOOD WORK

* deck 3: floor decals, APCs, air alarms, fire extinguisher cabinets

* deck 3: fireaxe cabinet

* /shuttle_landmark/distress/blue, move base_turf from map to obj def

* intercom presets

* formatting

* deck 1: floor decals

* deck 2: named area fix (LMAO), signs to use single quotes

* deck 2: floor decals, APCs, air alarms, fire extinguisher cabinets, fireaxe cabinets

* Platforms and stairs!

* grates and bugfixes

* Angled ship walls + grate color fix

* corrects apc anim overlay

* deck 2 and away site fixes

# Conflicts:
#	maps/sccv_horizon/sccv_horizon-2_deck_2.dmm

* deck 2 missing grate

* warning stripes

* railings and ledges

* windows and fixtures

* windoorsagain

* airlocks pt1

* windows de-seamed and transparent

* airlocks and pixel offsets

* fixes for airlocks

* more airlock fixes

* presets for ringer, request console and newscaster

* 132

* asfsaf

* kitchen tiling

* thicker freezer tile bevels

* More angled walls

* New shutters and blast doors

* directional corrections

* ops railing fixes

* updated window map things and shutters

* value changes and blast door changes

* Ledges and platforms galore (D2/D3)

* all decks: fix door dirs

* all decks: newscasters, intercoms, requests consoles, ringer consoles

* helm light blue decals to dark blue

* supermatter door dir fix

* fix directional presets (dirs/offsets): newscaster, intercom, requests console, ringer console

* firedoor changes

* deck 3: overlapping wall mountables fixes

* map changes

* airlock changes

* map tweaks

* airlock & stair icons

* various mapping modifications

* Double airlocks + fixing denied states + fixing airlocks on all levels

* Rebase

* directional terminals buttons and lights again, platform tweaks

terminal north facing sprites, atm/food terminal directionals
proper door control and lightswitch directionals (presets still need to be set up, mapping)
re-adds new light tube sprites, again
new sprites for floor lights and the other stuff that got added
adjusted platforms to be recolorable, added light and dark versions, fixed some shading

* missing ERT outfit thingy fix

* floor lights fixed

* deck 3: various small fixes

* deck 1: various small fixes

* deck 2: various small fixes

* fixes

* d2 fixes & multitile door fix

* d2 fixes, remove unused airlock files, button icon fixes, window icon fixes

* make it actually compile, oops!

* make it actually compile, pt2

* CE office camera

* pew pew pew

* pew pew pew 2

* fixes

* deck 3: buttons fixes

* deck 3: button and other fixes

* deck 3: fixes and stuff

* D1 fixes & skrell airlocks

* minor D2 tweaks

* a lot of airlock-related fixes, glass tables, paint sprayer fixes, decal fixes, changelog

* maintenance hatch sprites

* fixing double doors

* flips multi-tiles, fixes multi-tiles, adds desk windoors

* new plastic flaps

* deck 2: a few buttons

* side + middle doors

* created paths for 3-tiles doors

* apply to map the 3 tiles airlocks

* some fixes, windoor alpha

* remove this random ass potted plant

* more map fixes

* holodeck disposal pipe fix

* secure airlock sprites

no code or obj definitions yet

* vault airlock

* vault door fixes

* scc window alpha

* adjusts double door glass, firedoor open state

* adjusts construction states for doors

* remove some defunct icons and fix anims

* assembly stuff

* pharma fixes

* vault door dir

* firedoor smart generation moved to its own proc

* lift doors, d1 fixes

* firedoor smart generation: adjacent wall check

* firedoor smart generation: adjacent firedoor check

* all decks: missing firedoor and other fixes

* deck 2: weird maint stairs fix

* oops

* diona airlock fix

* the shuttle wall gigadeath

* fixes

* some fixes for leftover map item paths, and double lattices

* new diona walls

* more fixes

* and more

* deck 1: fix out of bounds keys

* deck 3: fix out of bounds keys

* runtime 3: duplicate APCs fix

* all decks: make all 3 tile wide doors glass

---------

Co-authored-by: Wezzy <wowzewow@gmail.com>
Co-authored-by: Wowzewow (Wezzy) <42310821+alsoandanswer@users.noreply.github.com>
Co-authored-by: Cody Brittain <cbrittain10@yahoo.com>
Co-authored-by: kyres1 <noodle.buster31@gmail.com>
Co-authored-by: Matt Atlas <liermattia@gmail.com>
Co-authored-by: atteria <tarkona@protonmail.com>
Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com>
Co-authored-by: DreamySkrell <107256943+DreamySkrell@users.noreply.github.com>
Co-authored-by: naut <nautilussplat@gmail.com>
Co-authored-by: naut <55491249+nauticall@users.noreply.github.com>
2023-08-30 21:18:10 +00:00

882 lines
27 KiB
Plaintext

//
// Glass
//
#define FULL_REINFORCED_WINDOW_DAMAGE_FORCE 8
#define REINFORCED_WINDOW_DAMAGE_FORCE 8
/obj/structure/window
name = "glass pane"
desc = "A glass pane."
icon = 'icons/obj/structure/window/window_panes.dmi'
icon_state = "pane"
alpha = 196
density = TRUE
w_class = ITEMSIZE_NORMAL
layer = WINDOW_PANE_LAYER
anchored = TRUE
flags = ON_BORDER
obj_flags = OBJ_FLAG_ROTATABLE|OBJ_FLAG_MOVES_UNSUPPORTED
var/hitsound = 'sound/effects/glass_hit.ogg'
var/maxhealth = 14
var/maximal_heat = T0C + 100 // Maximal heat before this window begins taking damage from fire
var/damage_per_fire_tick = 2 // Amount of damage per fire tick. Regular windows are not fireproof so they might as well break quickly.
var/health
var/ini_dir = null
var/state = 2
var/reinf = FALSE
var/basestate
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
var/full = FALSE
atmos_canpass = CANPASS_PROC
/obj/structure/window/examine(mob/user)
. = ..(user)
if(health == maxhealth)
to_chat(user, SPAN_NOTICE("It looks fully intact."))
else
var/perc = health / maxhealth
if(perc > 0.75)
to_chat(user, SPAN_NOTICE("It has a few cracks."))
else if(perc > 0.5)
to_chat(user, SPAN_WARNING("It looks slightly damaged."))
else if(perc > 0.25)
to_chat(user, SPAN_WARNING("It looks moderately damaged."))
else
to_chat(user, SPAN_DANGER("It looks heavily damaged."))
if(silicate)
if (silicate < 30)
to_chat(user, SPAN_NOTICE("It has a thin layer of silicate."))
else if (silicate < 70)
to_chat(user, SPAN_NOTICE("It is covered in silicate."))
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()
if(!full)
if(dir == SOUTH)
layer = ABOVE_MOB_LAYER
else
layer = WINDOW_PANE_LAYER
queue_smooth(src)
/obj/structure/window/proc/take_damage(var/damage = 0, var/sound_effect = 1, message = TRUE)
var/initialhealth = health
if(silicate)
damage = damage * (1 - silicate / 200)
health = max(0, health - damage)
if(health <= 0)
shatter(message)
else
if(sound_effect)
playsound(loc, 'sound/effects/glass_hit.ogg', 100, 1)
if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
if(message)
visible_message(SPAN_DANGER("[src] looks like it's about to shatter!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
if(message)
visible_message(SPAN_WARNING("[src] looks seriously damaged!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
if(message)
visible_message(SPAN_WARNING("Cracks begin to appear in [src]!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
return
/obj/structure/window/proc/apply_silicate(var/amount)
if(health < maxhealth) // Mend the damage.
health = min(health + amount * 3, maxhealth)
if(health == maxhealth)
visible_message("[src] looks fully repaired." )
else // Reinforce.
silicate = min(silicate + amount, 100)
updateSilicate()
/obj/structure/window/proc/updateSilicate()
cut_overlays()
var/image/img = image(icon, icon_state)
img.color = "#ffffff"
img.alpha = silicate * 255 / 100
add_overlay(img)
/obj/structure/window/proc/shatter(var/display_message = 1)
playsound(src, /singleton/sound_category/glass_break_sound, 70, 1)
if(display_message)
visible_message(SPAN_WARNING("\The [src] shatters!"))
if(dir == SOUTHWEST)
var/index = null
index = 0
while(index < 2)
new shardtype(loc)
if(reinf)
new /obj/item/stack/rods(loc)
index++
else
new shardtype(loc)
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
/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
var/proj_damage = Proj.get_structure_damage()
if(!proj_damage)
return
..()
take_damage(proj_damage)
return
/obj/structure/window/ex_act(severity)
switch(severity)
if(1)
qdel(src)
return
if(2)
shatter(0)
return
if(3)
if(prob(50))
shatter(0)
return
else
take_damage(rand(10,30), TRUE, FALSE)
// This and relevant verbs/procs can probably be removed since full windows are a thing now. -Gem
/obj/structure/window/proc/is_full_window()
return (dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST)
/obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(istype(mover) && mover.checkpass(PASSGLASS))
return 1
if(is_full_window())
return 0 //full tile window, you can't move into it!
if(get_dir(loc, target) & dir)
return !density
else
return 1
/obj/structure/window/CheckExit(atom/movable/O, turf/target)
if(istype(O) && O.checkpass(PASSGLASS))
return 1
if(get_dir(O.loc, target) == dir)
return 0
return 1
/obj/structure/window/hitby(AM as mob|obj, var/speed = THROWFORCE_SPEED_DIVISOR)
..()
var/tforce = 0
if(ismob(AM))
if(isliving(AM))
var/mob/living/M = AM
M.turf_collision(src, speed, /singleton/sound_category/glasscrack_sound)
return
else
visible_message(SPAN_DANGER("\The [src] was hit by \the [AM]."))
tforce = 40
else if(isobj(AM))
visible_message(SPAN_DANGER("\The [src] was hit by \the [AM]."))
var/obj/item/I = AM
tforce = I.throwforce
if(reinf)
tforce *= 0.25
if(health - tforce <= 7 && !reinf)
anchored = 0
update_nearby_icons()
step(src, get_dir(AM, src))
take_damage(tforce)
/obj/structure/window/attack_hand(var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(HAS_FLAG(user.mutations, HULK))
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
user.visible_message(SPAN_DANGER("[user] smashes through [src]!"))
user.do_attack_animation(src)
shatter()
else if (user.a_intent == I_HURT)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species.can_shred(H) || (H.is_berserk()))
attack_generic(H,25)
return
playsound(src.loc, 'sound/effects/glass_knock.ogg', 90, 1)
user.do_attack_animation(src)
user.visible_message(SPAN_DANGER("\The [user] bangs against \the [src]!"),
SPAN_DANGER("You bang against \the [src]!"),
"You hear a banging sound.")
else
playsound(src.loc, 'sound/effects/glass_knock.ogg', 60, 1)
user.visible_message("<b>[user]</b> knocks on \the [src.name].",
"You knock on \the [src.name].",
"You hear a knocking sound.")
return
/obj/structure/window/attack_generic(var/mob/user, var/damage)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(damage >= 10)
visible_message(SPAN_DANGER("[user] smashes into [src]!"))
take_damage(damage)
else
visible_message(SPAN_NOTICE("\The [user] bonks \the [src] harmlessly."))
playsound(src.loc, 'sound/effects/glass_hit.ogg', 10, 1, -2)
user.do_attack_animation(src)
return 1
/obj/structure/window/do_simple_ranged_interaction(var/mob/user)
visible_message(SPAN_NOTICE("Something knocks on \the [src]."))
playsound(loc, 'sound/effects/glass_hit.ogg', 50, 1)
return TRUE
/obj/structure/window/attackby(obj/item/W, mob/user)
if(!istype(W) || istype(W, /obj/item/flag))
return
if(istype(W, /obj/item/grab) && get_dist(src,user)<2)
var/obj/item/grab/G = W
if(istype(G.affecting,/mob/living))
grab_smash_attack(G, DAMAGE_BRUTE)
return
if(W.flags & NOBLUDGEON)
return
if(W.isscrewdriver() && user.a_intent != I_HURT)
if(reinf && state >= 1)
state = 3 - state
update_nearby_icons()
playsound(loc, W.usesound, 75, 1)
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.")))
else if(!reinf)
anchored = !anchored
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 && user.a_intent != I_HURT)
state = 1 - state
playsound(loc, W.usesound, 75, 1)
to_chat(user, (state ? SPAN_NOTICE("You have pried the window into the frame.") : SPAN_NOTICE("You have pried the window out of the frame.")))
else if(W.iswrench() && !anchored && (!state || !reinf) && user.a_intent != I_HURT)
if(!glasstype)
to_chat(user, SPAN_NOTICE("You're not sure how to dismantle \the [src] properly."))
else
visible_message(SPAN_NOTICE("[user] dismantles \the [src]."))
dismantle_window()
else
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(W.damtype == DAMAGE_BRUTE || W.damtype == DAMAGE_BURN)
if(reinf)
user.do_attack_animation(src)
if(W.force >= REINFORCED_WINDOW_DAMAGE_FORCE)
user.visible_message(SPAN_DANGER("\The [user] forcefully strikes \the [src] with \the [W]!"))
playsound(src, hitsound, W.get_clamped_volume(), 1)
hit(W.force)
else
user.visible_message(SPAN_WARNING("[user] hits \the [src] with \the [W], but it glances off, doing no damage."))
playsound(src, hitsound, W.get_clamped_volume(), 1)
else
user.do_attack_animation(src)
hit(W.force)
if(health <= 7)
anchored = 0
update_nearby_icons()
step(src, get_dir(user, src))
else
playsound(src, hitsound, 10, 1)
return
/obj/structure/window/proc/grab_smash_attack(obj/item/grab/G, var/damtype = DAMAGE_BRUTE)
var/mob/living/M = G.affecting
var/mob/living/user = G.assailant
var/state = G.state
qdel(G) //gotta delete it here because if window breaks, it won't get deleted
var/def_zone = ran_zone(BP_HEAD, 20)
switch (state)
if(1)
M.visible_message(SPAN_WARNING("[user] slams [M] against \the [src]!"))
M.apply_damage(7, damtype, def_zone, used_weapon = src)
hit(10)
if(2)
M.visible_message(SPAN_DANGER("[user] bashes [M] against \the [src]!"))
if (prob(50))
M.Weaken(1)
M.apply_damage(10, damtype, def_zone, used_weapon = src)
hit(25)
if(3)
M.visible_message(SPAN_DANGER("<big>[user] crushes [M] against \the [src]!</big>"))
M.Weaken(5)
M.apply_damage(20, damtype, def_zone, used_weapon = src)
hit(50)
/obj/structure/window/proc/hit(var/damage, var/sound_effect = 1)
if(reinf)
damage *= 0.5
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)
. = ..()
if(!full && constructed)
anchored = FALSE
if (!mapload && constructed)
state = 0
if (start_dir)
set_dir(start_dir)
health = maxhealth
ini_dir = dir
update_nearby_tiles(need_rebuild=1)
update_nearby_icons()
update_icon()
/obj/structure/window/Destroy()
density = 0
update_nearby_tiles()
var/turf/location = loc
loc = null
for(var/obj/structure/window/W in orange(location, 1))
W.update_icon()
loc = location
return ..()
/obj/structure/window/Move()
var/ini_dir = dir
update_nearby_tiles(need_rebuild=1)
..()
set_dir(ini_dir)
update_nearby_tiles(need_rebuild=1)
/obj/structure/window/proc/is_fulltile() // Checks if this window is a full-tile one.
if(dir & (dir - 1))
return 1
return 0
/obj/structure/window/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > maximal_heat)
hit(damage_per_fire_tick, 0)
..()
/********** Glass and Glass Panes **********/
/obj/structure/window/basic
name = "glass pane"
desc = "It looks thin and flimsy. A few hits with anything will shatter it."
icon_state = "window"
basestate = "window"
glasstype = /obj/item/stack/material/glass
maximal_heat = T0C + 100
damage_per_fire_tick = 2
maxhealth = 12
/obj/structure/window/basic/full
name = "glass"
icon_state = "window"
dir = 5
/obj/structure/window/reinforced
name = "reinforced glass pane"
desc = "It looks rather strong. Might take a few good hits to shatter it."
icon_state = "rwindow"
basestate = "rwindow"
maxhealth = 40
reinf = TRUE
maximal_heat = T0C + 750
damage_per_fire_tick = 2
glasstype = /obj/item/stack/material/glass/reinforced
/obj/structure/window/reinforced/full
name = "reinforced glass"
icon_state = "rwindow"
dir = 5
/obj/structure/window/reinforced/tinted
name = "reinforced tinted glass pane"
desc = "It looks rather strong and opaque. Might take a few good hits to shatter it."
icon_state = "twindow"
basestate = "twindow"
opacity = 1
/obj/structure/window/reinforced/tinted/frosted
name = "reinforced frosted glass pane"
desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window."
maxhealth = 30
/obj/structure/window/reinforced/polarized
name = "reinforced electrochromic glass pane"
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
var/id
/obj/structure/window/reinforced/polarized/proc/toggle()
if(opacity)
animate(src, color="#FFFFFF", time=5)
set_opacity(0)
else
animate(src, color="#222222", time=5)
set_opacity(1)
/obj/structure/window/reinforced/crescent/attack_hand()
return
/obj/structure/window/reinforced/crescent/attackby()
return
/obj/structure/window/reinforced/crescent/ex_act(var/severity = 2)
return
/obj/structure/window/reinforced/crescent/hitby()
return
/obj/structure/window/reinforced/crescent/take_damage()
return
/obj/structure/window/reinforced/crescent/shatter()
return
/obj/machinery/button/switch/windowtint
name = "window tint control"
desc = "A remote control switch for polarized windows."
var/range = 16
/obj/machinery/button/switch/windowtint/update_icon()
icon_state = "light[active]"
/obj/machinery/button/switch/windowtint/attack_hand(mob/user as mob)
if(..())
return TRUE
toggle_tint()
/obj/machinery/button/switch/windowtint/proc/toggle_tint()
use_power_oneoff(5)
active = !active
update_icon()
for(var/obj/structure/window/reinforced/polarized/W in range(src, range))
if(W.id == src.id || !W.id)
W.toggle()
for(var/obj/structure/window/full/reinforced/polarized/W in range(src, range))
if(W.id == src.id || !W.id)
W.toggle()
/obj/machinery/button/switch/windowtint/power_change()
..()
if(active && !powered(power_channel))
toggle_tint()
/obj/structure/window/borosilicate
name = "borosilicate glass pane"
desc = "A borosilicate alloy window. It seems to be quite strong."
color = GLASS_COLOR_PHORON
shardtype = /obj/item/material/shard/phoron
glasstype = /obj/item/stack/material/glass/phoronglass
maximal_heat = T0C + 2000
damage_per_fire_tick = 1 // This should last for 80 fire ticks if the window is not damaged at all. The idea is that borosilicate windows have something like ablative layer that protects them for a while.
maxhealth = 40
/obj/structure/window/borosilicate/reinforced
name = "reinforced borosilicate glass pane"
desc = "A borosilicate alloy window, with rods supporting it. It seems to be very strong."
color = GLASS_COLOR_PHORON_R
glasstype = /obj/item/stack/material/glass/phoronrglass
reinf = TRUE
maximal_heat = T0C + 4000
maxhealth = 80
/obj/structure/window/borosilicate/reinforced/skrell
name = "advanced borosilicate alloy window"
desc = "A window made out of a higly advanced borosilicate alloy. It seems to be extremely strong."
color = GLASS_COLOR_PHORON
maxhealth = 250
/********** Shuttle Windows **********/
/obj/structure/window/shuttle
name = "reinforced shuttle window"
desc = "It looks rather strong. Might take a few good hits to shatter it."
icon = 'icons/obj/smooth/shuttle_window.dmi'
icon_state = "shuttle_window"
basestate = "window"
flags = 0
obj_flags = null
maxhealth = 40
reinf = TRUE
basestate = "w"
dir = 5
smooth = SMOOTH_TRUE
can_be_unanchored = TRUE
layer = 2.99
/obj/structure/window/shuttle/legion
name = "reinforced cockpit window"
icon = 'icons/obj/smooth/shuttle_window_legion.dmi'
health = 160
maxhealth = 160
/obj/structure/window/shuttle/palepurple
icon = 'icons/obj/smooth/shuttle_window_palepurple.dmi'
/obj/structure/window/shuttle/skrell
name = "advanced borosilicate alloy window"
desc = "It looks extremely strong. Might take many good hits to crack it."
icon = 'icons/obj/smooth/skrell_window_purple.dmi'
health = 500
maxhealth = 500
smooth = SMOOTH_MORE | SMOOTH_DIAGONAL
canSmoothWith = list(
/turf/simulated/wall/shuttle/skrell,
/obj/structure/window/shuttle/skrell
)
/obj/structure/window/shuttle/scc_space_ship
name = "advanced borosilicate alloy window"
desc = "It looks extremely strong. Might take many good hits to crack it."
icon = 'icons/turf/smooth/scc_ship/scc_ship_windows.dmi'
icon_state = "map_window"
health = 500
maxhealth = 500
alpha = 255
smooth = SMOOTH_MORE
canSmoothWith = list(
/obj/structure/window/shuttle/scc_space_ship,
/turf/simulated/wall/shuttle/scc_space_ship
)
blend_overlay = "-wall"
attach_overlay = "attach"
can_blend_with = list(
/turf/simulated/wall/shuttle/scc_space_ship,
/obj/structure/window/shuttle/scc_space_ship
)
/obj/structure/window/shuttle/scc_space_ship/cardinal
smooth = SMOOTH_MORE
/obj/structure/window/shuttle/scc_space_ship/cardinal_smooth(adjacencies, var/list/dir_mods)
dir_mods = handle_blending(adjacencies, dir_mods)
return ..(adjacencies, dir_mods)
/obj/structure/window/shuttle/scc
icon = 'icons/obj/smooth/scc_shuttle_window.dmi'
health = 160
maxhealth = 160
/obj/structure/window/shuttle/crescent
desc = "It looks rather strong."
/obj/structure/window/shuttle/crescent/take_damage()
return
//
// Full Windows
//
/obj/structure/window/full
name = "window"
desc = "You aren't supposed to see this."
flags = 0
obj_flags = null
dir = 5
maxhealth = 28 // Two glass panes worth of health, since that's the minimum you need to break through to get to the other side.
glasstype = /obj/item/stack/material/glass
shardtype = /obj/item/material/shard
full = TRUE
layer = 2.99
base_frame = /obj/structure/window_frame
smooth = SMOOTH_MORE
canSmoothWith = list(
/turf/simulated/wall,
/turf/simulated/wall/r_wall,
/turf/unsimulated/wall/steel,
/turf/unsimulated/wall/darkshuttlewall,
/turf/unsimulated/wall/riveted,
/obj/structure/window_frame,
/obj/structure/window_frame/unanchored,
/obj/structure/window_frame/empty,
/obj/structure/window/full/reinforced,
/obj/structure/window/full/reinforced/indestructible,
/obj/structure/window/full/reinforced/polarized,
/obj/structure/window/full/reinforced/polarized/indestructible,
/obj/structure/window/full/phoron/reinforced,
/obj/structure/window/shuttle/scc_space_ship,
/turf/simulated/wall/shuttle/scc_space_ship,
/obj/machinery/door
)
blend_overlay = "wall"
attach_overlay = "attach"
can_blend_with = list(
/turf/simulated/wall,
/obj/machinery/door,
/obj/structure/window_frame
)
/obj/structure/window/full/Destroy()
var/obj/structure/window_frame/WF = locate(/obj/structure/window_frame) in get_turf(src)
if(WF)
WF.has_glass_installed = FALSE
return ..()
/obj/structure/window/full/attackby(obj/item/W, mob/user)
if(!istype(W) || istype(W, /obj/item/flag))
return
if(istype(W, /obj/item/grab) && get_dist(src,user)<2)
var/obj/item/grab/G = W
if(istype(G.affecting,/mob/living))
grab_smash_attack(G, DAMAGE_BRUTE)
return
if(W.flags & NOBLUDGEON)
return
if(W.isscrewdriver() && user.a_intent != I_HURT)
if(state == 2)
if(W.use_tool(src, user, 2 SECONDS, volume = 50))
to_chat(user, SPAN_NOTICE("You have unfastened the glass from the window frame."))
state--
update_nearby_icons()
else if(state == 1)
if(W.use_tool(src, user, 2 SECONDS, volume = 50))
to_chat(user, SPAN_NOTICE("You have fastened the glass to the window frame."))
state++
update_nearby_icons()
else if(W.iscrowbar() && user.a_intent != I_HURT)
if(state == 1)
if(W.use_tool(src, user, 2 SECONDS, volume = 50))
to_chat(user, SPAN_NOTICE("You pry the glass out of the window frame."))
state--
update_nearby_icons()
else if(state == 0)
if(W.use_tool(src, user, 2 SECONDS, volume = 50))
to_chat(user, SPAN_NOTICE("You pry the glass into the window frame."))
state++
update_nearby_icons()
else if(W.iswrench() && user.a_intent != I_HURT)
if(state == 0)
user.visible_message(SPAN_DANGER("\The [user] is dismantling \the [src]!"))
if(W.use_tool(src, user, 2 SECONDS, volume = 50))
to_chat(user, SPAN_NOTICE("You undo the safety bolts and remove the glass from \the [src]."))
dismantle_window()
else
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(W.damtype == DAMAGE_BRUTE || W.damtype == DAMAGE_BURN)
if(reinf)
user.do_attack_animation(src)
if(W.force >= FULL_REINFORCED_WINDOW_DAMAGE_FORCE)
user.visible_message(SPAN_DANGER("\The [user] forcefully strikes \the [src] with \the [W]!"))
playsound(src, hitsound, W.get_clamped_volume(), 1)
hit(W.force)
else
user.visible_message(SPAN_WARNING("[user] hits \the [src] with \the [W], but it glances off, doing no damage."))
playsound(src, hitsound, W.get_clamped_volume(), 1)
else
user.do_attack_animation(src)
hit(W.force)
else
playsound(src, hitsound, 10, 1)
return
/obj/structure/window/full/shatter(var/display_message = 1)
playsound(src, /singleton/sound_category/glass_break_sound, 70, 1)
if(display_message)
visible_message(SPAN_WARNING("\The [src] shatters!"))
if(reinf)
new /obj/item/stack/rods(loc, 4)
for(var/i = 1 to 4)
new shardtype(loc)
qdel(src)
return
/obj/structure/window/full/take_damage(var/damage = 0, var/sound_effect = 1)
var/initialhealth = health
if(silicate)
damage = damage * (1 - silicate / 200)
health = max(0, health - damage)
if(health <= 0)
shatter()
else
if(sound_effect)
playsound(loc, 'sound/effects/glass_hit.ogg', 100, 1)
if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
visible_message(SPAN_DANGER("[src] looks like it's about to shatter!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
visible_message(SPAN_WARNING("[src] looks seriously damaged!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
visible_message(SPAN_WARNING("Cracks begin to appear in [src]!"))
playsound(loc, /singleton/sound_category/glasscrack_sound, 100, 1)
return
/obj/structure/window/full/dismantle_window()
var/obj/item/stack/material/mats = new glasstype(loc)
mats.amount = 4
var/obj/structure/window_frame/WF = locate(/obj/structure/window_frame) in get_turf(src)
if(istype(WF))
WF.has_glass_installed = FALSE
WF.desc = "An empty steel window frame."
qdel(src)
update_nearby_icons()
/********** Full Windows **********/
// Reinforced Window
/obj/structure/window/full/reinforced
name = "reinforced window"
desc = "It looks rather strong. Might take a few good hits to shatter it."
icon = 'icons/obj/smooth/window/full_window.dmi'
icon_state = "window_glass"
basestate = "window_glass"
maxhealth = 80 // Two reinforced panes worth of health, since that's the minimum you need to break through to get to the other side.
reinf = TRUE
maximal_heat = T0C + 750
glasstype = /obj/item/stack/material/glass/reinforced
layer = 2.99
base_frame = /obj/structure/window_frame
smooth = SMOOTH_MORE
/obj/structure/window/full/cardinal_smooth(adjacencies, var/list/dir_mods)
dir_mods = handle_blending(adjacencies, dir_mods)
return ..(adjacencies, dir_mods)
/obj/structure/window_frame/proc/update_nearby_icons()
queue_smooth_neighbors(src)
/obj/structure/window_frame/update_icon()
queue_smooth(src)
// Indestructible Reinforced Window
/obj/structure/window/full/reinforced/indestructible/attack_hand()
return
/obj/structure/window/full/reinforced/indestructible/attackby()
return
/obj/structure/window/full/reinforced/indestructible/ex_act(var/severity = 2)
return
/obj/structure/window/full/reinforced/indestructible/hitby()
return
/obj/structure/window/full/reinforced/indestructible/take_damage()
return
/obj/structure/window/full/reinforced/indestructible/shatter()
return
// Reinforced Polarized Window
/obj/structure/window/full/reinforced/polarized
name = "reinforced electrochromic window"
desc = "Adjusts its tint with voltage. Might take a few good hits to shatter it."
var/id
/obj/structure/window/full/reinforced/polarized/proc/toggle()
if(opacity)
animate(src, color="#FFFFFF", time = 1 SECOND)
set_opacity(FALSE)
else
animate(src, color="#606060", time = 1 SECOND)
set_opacity(TRUE)
// Indestructible Reinforced Polarized Window
/obj/structure/window/full/reinforced/polarized/indestructible/attack_hand()
return
/obj/structure/window/full/reinforced/polarized/indestructible/attackby()
return
/obj/structure/window/full/reinforced/polarized/indestructible/ex_act(var/severity = 2)
return
/obj/structure/window/full/reinforced/polarized/indestructible/hitby()
return
/obj/structure/window/full/reinforced/polarized/indestructible/take_damage()
return
/obj/structure/window/full/reinforced/polarized/indestructible/shatter()
return
//Shuttle exterior window
/obj/structure/window/full/reinforced/shuttle
icon = 'icons/obj/smooth/window/shuttle_window_dark.dmi'
color = "#006eff"
icon_state = "window_glass"
basestate = "window_glass"
/obj/structure/window/full/reinforced/shuttle/red
color = "#ff0000"
/obj/structure/window/full/reinforced/shuttle/green
color = "#00ff40"
/obj/structure/window/full/reinforced/shuttle/black
color = "#150b41"
// Borosilicate Window (I.e. Phoron Window)
/obj/structure/window/full/phoron
name = "borosilicate window"
desc = "You aren't supposed to see this."
icon = 'icons/obj/smooth/window/full_window_phoron.dmi'
icon_state = "window_glass"
basestate = "window_glass"
glasstype = /obj/item/stack/material/glass/phoronglass
shardtype = /obj/item/material/shard/phoron
maxhealth = 80 // Two borosilicate glass panes worth of health, since that's the minimum you need to break through to get to the other side.
maximal_heat = T0C + 2000
damage_per_fire_tick = 1
// Reinforced Borosilicate Window (I.e. Reinforced Phoron Window)
/obj/structure/window/full/phoron/reinforced
name = "reinforced borosilicate window"
desc = "A borosilicate alloy window, with rods supporting it. It seems to be very strong."
glasstype = /obj/item/stack/material/glass/phoronrglass
maxhealth = 160 // Two reinforced borosilicate glass panes worth of health, since that's the minimum you need to break through to get to the other side.
reinf = TRUE
maximal_heat = T0C + 4000
#undef FULL_REINFORCED_WINDOW_DAMAGE_FORCE
#undef REINFORCED_WINDOW_DAMAGE_FORCE