mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-30 23:49:21 +01:00
Doors can now be broken through damage. Broken doors can be crowbarred open. High-securiry doors automatically bolt themselves when broken. Doors which are damaged, but not broken, can be repaired with sheet metal. Broken doors must be reconstructed. Spark overlays for damaged and broken doors.
Windows and doors will display messages indicating extant of damage as they are damaged (e.g. "Cracks begin to appear in [src]!") Metal rods can substitute for crowbars to force unpowered and broken doors, as well as firelocks. Window damage code cleaned up and centralized.
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
pressure_resistance = 4*ONE_ATMOSPHERE
|
||||
anchored = 1.0
|
||||
flags = ON_BORDER
|
||||
var/health = 14.0
|
||||
var/maxhealth = 14.0
|
||||
var/health
|
||||
var/ini_dir = null
|
||||
var/state = 2
|
||||
var/reinf = 0
|
||||
@@ -17,18 +18,48 @@
|
||||
// var/icon/silicateIcon = null // the silicated icon
|
||||
|
||||
|
||||
/obj/structure/window/proc/take_damage(var/damage = 0, var/sound_effect = 1)
|
||||
var/initialhealth = src.health
|
||||
src.health = max(0, src.health - damage)
|
||||
if(src.health <= 0)
|
||||
src.shatter()
|
||||
else
|
||||
if(sound_effect)
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
|
||||
if(src.health < src.maxhealth / 4 && initialhealth >= src.maxhealth / 4)
|
||||
visible_message("[src] looks like it's about to shatter!" )
|
||||
else if(src.health < src.maxhealth / 2 && initialhealth >= src.maxhealth / 2)
|
||||
visible_message("[src] looks seriously damaged!" )
|
||||
else if(src.health < src.maxhealth * 3/4 && initialhealth >= src.maxhealth * 3/4)
|
||||
visible_message("Cracks begin to appear in [src]!" )
|
||||
return
|
||||
|
||||
/obj/structure/window/proc/shatter(var/display_message = 1)
|
||||
playsound(src, "shatter", 70, 1)
|
||||
if(display_message)
|
||||
visible_message("[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)
|
||||
del(src)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
|
||||
|
||||
//Tasers and the like should not damage windows.
|
||||
if(Proj.damage_type == HALLOSS)
|
||||
return
|
||||
|
||||
health -= Proj.damage
|
||||
..()
|
||||
if(health <= 0)
|
||||
new /obj/item/weapon/shard(loc)
|
||||
new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
take_damage(Proj.damage * 4)
|
||||
return
|
||||
|
||||
|
||||
@@ -38,29 +69,20 @@
|
||||
del(src)
|
||||
return
|
||||
if(2.0)
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
shatter(0)
|
||||
return
|
||||
if(3.0)
|
||||
if(prob(50))
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
shatter(0)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/blob_act()
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
shatter()
|
||||
|
||||
|
||||
/obj/structure/window/meteorhit()
|
||||
//world << "glass at [x],[y],[z] Mhit"
|
||||
new /obj/item/weapon/shard( loc )
|
||||
if(reinf) new /obj/item/stack/rods( loc)
|
||||
del(src)
|
||||
shatter()
|
||||
|
||||
|
||||
/obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||
@@ -92,16 +114,11 @@
|
||||
var/obj/item/I = AM
|
||||
tforce = I.throwforce
|
||||
if(reinf) tforce *= 0.25
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
|
||||
health = max(0, health - tforce)
|
||||
if(health <= 7 && !reinf)
|
||||
if(health - tforce <= 7 && !reinf)
|
||||
anchored = 0
|
||||
update_nearby_icons()
|
||||
step(src, get_dir(AM, src))
|
||||
if(health <= 0)
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
take_damage(tforce)
|
||||
|
||||
/obj/structure/window/attack_tk(mob/user as mob)
|
||||
user.visible_message("<span class='notice'>Something knocks on [src].</span>")
|
||||
@@ -111,9 +128,7 @@
|
||||
if(HULK in user.mutations)
|
||||
user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!"))
|
||||
user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
shatter()
|
||||
|
||||
else if (usr.a_intent == "hurt")
|
||||
|
||||
@@ -140,15 +155,8 @@
|
||||
|
||||
|
||||
/obj/structure/window/proc/attack_generic(mob/user as mob, damage = 0) //used by attack_animal and attack_slime
|
||||
health -= damage
|
||||
if(health <= 0)
|
||||
user.visible_message("<span class='danger'>[user] smashes through [src]!</span>")
|
||||
new /obj/item/weapon/shard(loc)
|
||||
if(reinf) new /obj/item/stack/rods(loc)
|
||||
del(src)
|
||||
else //for nicer text~
|
||||
user.visible_message("<span class='danger'>[user] smashes into [src]!</span>")
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 100, 1)
|
||||
user.visible_message("<span class='danger'>[user] smashes into [src]!</span>")
|
||||
take_damage(damage)
|
||||
|
||||
/obj/structure/window/attack_animal(mob/user as mob)
|
||||
if(!isanimal(user)) return
|
||||
@@ -224,22 +232,8 @@
|
||||
|
||||
/obj/structure/window/proc/hit(var/damage, var/sound_effect = 1)
|
||||
if(reinf) damage *= 0.5
|
||||
health = max(0, health - damage)
|
||||
if(sound_effect)
|
||||
playsound(loc, 'sound/effects/Glasshit.ogg', 75, 1)
|
||||
if(health <= 0)
|
||||
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)
|
||||
del(src)
|
||||
return
|
||||
take_damage(damage)
|
||||
return
|
||||
|
||||
|
||||
/obj/structure/window/verb/rotate()
|
||||
@@ -297,6 +291,8 @@
|
||||
|
||||
// if(re) reinf = re
|
||||
|
||||
health = maxhealth
|
||||
|
||||
ini_dir = dir
|
||||
|
||||
update_nearby_tiles(need_rebuild=1)
|
||||
@@ -308,7 +304,6 @@
|
||||
/obj/structure/window/Del()
|
||||
density = 0
|
||||
update_nearby_tiles()
|
||||
playsound(src, "shatter", 70, 1)
|
||||
update_nearby_icons()
|
||||
..()
|
||||
|
||||
@@ -385,7 +380,7 @@
|
||||
basestate = "phoronwindow"
|
||||
icon_state = "phoronwindow"
|
||||
shardtype = /obj/item/weapon/shard/phoron
|
||||
health = 120
|
||||
maxhealth = 120
|
||||
|
||||
/obj/structure/window/phoronbasic/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
if(exposed_temperature > T0C + 32000)
|
||||
@@ -399,7 +394,7 @@
|
||||
icon_state = "phoronrwindow"
|
||||
shardtype = /obj/item/weapon/shard/phoron
|
||||
reinf = 1
|
||||
health = 160
|
||||
maxhealth = 160
|
||||
|
||||
/obj/structure/window/phoronreinforced/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||
return
|
||||
@@ -409,7 +404,7 @@
|
||||
desc = "It looks rather strong. Might take a few good hits to shatter it."
|
||||
icon_state = "rwindow"
|
||||
basestate = "rwindow"
|
||||
health = 40
|
||||
maxhealth = 40
|
||||
reinf = 1
|
||||
|
||||
/obj/structure/window/reinforced/tinted
|
||||
@@ -424,7 +419,7 @@
|
||||
desc = "It looks rather strong and frosted over. Looks like it might take a few less hits then a normal reinforced window."
|
||||
icon_state = "fwindow"
|
||||
basestate = "fwindow"
|
||||
health = 30
|
||||
maxhealth = 30
|
||||
|
||||
/obj/structure/window/shuttle
|
||||
name = "shuttle window"
|
||||
@@ -432,7 +427,7 @@
|
||||
icon = 'icons/obj/podwindows.dmi'
|
||||
icon_state = "window"
|
||||
basestate = "window"
|
||||
health = 40
|
||||
maxhealth = 40
|
||||
reinf = 1
|
||||
dir = 5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user