Fixes #17480; tabling not breaking glass tables

Fixes #17480.

Also catches a rare case where people would be thrown onto the tables
from afar by checking whether there are any mobs on the table with
a spawn call.

- Glass tables are now coloured by Nar'sie.
- Glass tables pregenerate and store their shatter debris.

🆑 coiax
fix: Glass tables now break when people are pushed onto them.
/🆑
This commit is contained in:
Jack Edge
2016-05-21 10:48:04 +01:00
parent 35d5c02a41
commit 8ff4486ab7
3 changed files with 42 additions and 13 deletions
+35 -10
View File
@@ -134,7 +134,7 @@
return 0
if(!G.confirm())
return 0
G.affecting.loc = src.loc
G.affecting.forceMove(src.loc)
if(istype(src, /obj/structure/table/optable))
var/obj/structure/table/optable/OT = src
G.affecting.resting = 1
@@ -263,29 +263,54 @@
buildstack = /obj/item/stack/sheet/glass
canSmoothWith = null
health = 50
var/list/debris = list()
/obj/structure/table/glass/New()
. = ..()
debris += new frame
debris += new /obj/item/weapon/shard
/obj/structure/table/glass/Destroy()
for(var/i in debris)
qdel(i)
. = ..()
/obj/structure/table/glass/Crossed(atom/movable/AM)
. = ..()
if(flags & NODECONSTRUCT)
return
if(!isliving(AM))
return
// Don't break if they're just flying past
if(AM.throwing)
return
spawn(5)
// Check again in a bit though
if(AM.loc == get_turf(src))
check_break(AM)
else
check_break(AM)
if(istype(AM, /mob/living))
var/mob/living/M = AM
if(has_gravity(M) && M.mob_size > MOB_SIZE_SMALL)
table_shatter(M)
/obj/structure/table/glass/proc/check_break(mob/living/M)
if(has_gravity(M) && M.mob_size > MOB_SIZE_SMALL)
table_shatter(M)
/obj/structure/table/glass/proc/table_shatter(mob/M)
visible_message("<span class='warning'>[src] breaks!</span>")
visible_message("<span class='warning'>[src] breaks!</span>",
"<span class='danger'>You hear breaking glass.</span>")
playsound(src.loc, "shatter", 50, 1)
new frame(src.loc)
var/obj/item/weapon/shard/S = new(src.loc)
S.throw_impact(M)
for(var/i in debris)
var/atom/movable/AM = i
AM.loc = get_turf(src)
if(istype(AM, /obj/item/weapon/shard))
AM.throw_impact(M)
M.Weaken(5)
qdel(src)
/obj/structure/table/glass/narsie_act()
color = NARSIE_WINDOW_COLOUR
for(var/obj/item/weapon/shard/S in debris)
S.color = NARSIE_WINDOW_COLOUR
/*
* Wooden tables
*/
+2 -3
View File
@@ -69,10 +69,9 @@
shatter()
/obj/structure/window/narsie_act()
var/evil_color = "#7D1919"
color = evil_color
color = NARSIE_WINDOW_COLOUR
for(var/obj/item/weapon/shard/shard in debris)
shard.color = evil_color
shard.color = NARSIE_WINDOW_COLOUR
/obj/structure/window/singularity_pull(S, current_size)
if(current_size >= STAGE_FIVE)