Cremation animation + refactors and improvements (#10885)

This commit is contained in:
Wowzewow (Wezzy)
2021-02-01 10:22:15 +01:00
committed by GitHub
parent cc50f53ecf
commit 2107f3d20a
24 changed files with 242 additions and 269 deletions
+3 -3
View File
@@ -172,7 +172,7 @@
qdel(src)
else
to_chat(user, SPAN_NOTICE("You hit the metal foam but bounce off it."))
animate_shake()
shake_animation()
/obj/structure/foamedmetal/attackby(var/obj/item/I, var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
@@ -193,7 +193,7 @@
if(S.get_amount() < 4)
to_chat(user, SPAN_NOTICE("There isn't enough material here to construct a wall."))
return
var/material/M = SSmaterials.get_material_by_name(S.default_type)
if(!istype(M))
return
@@ -230,7 +230,7 @@
qdel(src)
else
to_chat(user, SPAN_NOTICE("You hit the metal foam to no effect."))
animate_shake()
shake_animation()
/obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
if(air_group)
+3 -3
View File
@@ -248,7 +248,7 @@
if ((world.time - last_shake) > 5 SECONDS)
playsound(loc, "sound/items/[pick("rip1","rip2")].ogg", 100, 1)
animate_shake()
shake_animation()
last_shake = world.time
if (!req_breakout())
@@ -274,11 +274,11 @@
return
breakout = FALSE
to_chat(escapee, "<span class='warning'>You successfully break out! Tearing the bubble's walls!</span>")
to_chat(escapee, "<span class='warning'>You successfully break out! Tearing the bubble's walls!</span>") // holy shit this is hilarious
visible_message("<span class='danger'>\the [escapee] successfully broke out of \the [src]! Tearing the bubble's walls!</span>")
playsound(loc, "sound/items/[pick("rip1","rip2")].ogg", 100, 1)
break_open()
animate_shake()
shake_animation()
desc += " <span class='danger'>It has hole in it! Maybe you shouldn't use it!</span>"
// We are out finally, the bubble is ripped. So dump everything out from it. Especially air and user.
@@ -202,7 +202,7 @@ var/list/tape_roll_applications = list()
if(user.a_intent == I_HELP)
lifted = !lifted
user.visible_message("<b>[user]</b> [lifted ? "lifts" : "drops"] the [initial(name)], [lifted ? "allowing" : "blocking"] passage.", SPAN_NOTICE("You [lifted ? "lift" : "drop"] the [initial(name)], [lifted ? "allowing" : "blocking"] passage."))
var/shake_time = animate_shake()
var/shake_time = shake_animation()
sleep(shake_time)
if(!allowed(user))
crumple(user)
@@ -239,4 +239,4 @@ var/list/tape_roll_applications = list()
qdel(P)
cur = get_step(cur,dir[i])
qdel(src)
qdel(src)
@@ -75,7 +75,7 @@
L.visible_message("<span class='danger'>[L] tears open the [src], spilling its contents everywhere!</span>", "<span class='danger'>You tear open the [src], spilling its contents everywhere!</span>")
spill()
else
animate_shake()
shake_animation()
var/toplay = pick(list('sound/effects/creatures/nibble1.ogg','sound/effects/creatures/nibble2.ogg'))
playsound(loc, toplay, 30, 1)
damage(damage)
@@ -248,7 +248,7 @@ Frequency:
else
target_closet.visible_message(SPAN_WARNING("\The [target_closet] rattles."))
to_chat(user, SPAN_NOTICE("You teleport into the target closet, bumping into the closed door."))
target_closet.animate_shake()
target_closet.shake_animation()
playsound(get_turf(src), 'sound/effects/grillehit.ogg', 100, TRUE)
/obj/item/closet_teleporter/Destroy()
+4 -5
View File
@@ -146,7 +146,7 @@
anchored = FALSE
deployed = FALSE
update_icon()
animate_shake()
shake_animation()
..()
@@ -236,7 +236,7 @@
buckle_mob(L)
playsound(src, 'sound/weapons/beartrap_shut.ogg', 100, 1)
deployed = FALSE
src.animate_shake()
src.shake_animation()
update_icon()
/obj/item/trap/animal/proc/req_breakout()
@@ -252,7 +252,7 @@
if ((world.time - last_shake) > 5 SECONDS)
playsound(loc, "sound/effects/grillehit.ogg", 100, 1)
animate_shake()
shake_animation()
last_shake = world.time
return TRUE
@@ -372,7 +372,7 @@
unbuckle_mob()
captured = null
visible_message(msg)
animate_shake()
shake_animation()
update_icon()
release_time = world.time
@@ -661,4 +661,3 @@
return
else
..()
-7
View File
@@ -218,13 +218,6 @@
/obj/proc/Created()
return
/obj/proc/animate_shake()
var/init_px = pixel_x
var/shake_dir = pick(-1, 1)
animate(src, transform = turn(matrix(), 8*shake_dir), pixel_x = init_px + 2*shake_dir, time = 1)
animate(transform = null, pixel_x = init_px, time = 6, easing = ELASTIC_EASING)
return 7 // how long it takes to do this
/obj/proc/rotate(var/mob/user, var/anchored_ignore = FALSE)
if(use_check_and_message(user))
return
@@ -376,7 +376,7 @@
return
step_towards(O, loc)
if(user != O)
user.show_viewers("<span class='danger'>[user] stuffs [O] into [src]!</span>")
user.visible_message(SPAN_DANGER("<b>[user]</b> stuffs \the [O] into \the [src]!"), SPAN_NOTICE("You stuff \the [O] into \the [src]."), range = 3)
add_fingerprint(user)
return
@@ -469,7 +469,7 @@
breakout = 1
for(var/i in 1 to time) //minutes * 6 * 5seconds * 2
playsound(loc, 'sound/effects/grillehit.ogg', 100, 1)
animate_shake()
shake_animation()
if (bar)
bar.update(i)
@@ -496,7 +496,7 @@
visible_message("<span class='danger'>\the [escapee] successfully broke out of \the [src]!</span>")
playsound(loc, 'sound/effects/grillehit.ogg', 100, 1)
break_open()
animate_shake()
shake_animation()
qdel(bar)
/obj/structure/closet/proc/break_open()
+151 -220
View File
@@ -18,7 +18,9 @@
dir = EAST
density = TRUE
anchored = TRUE
var/locked = FALSE
var/obj/structure/m_tray/connected = null
var/tray = /obj/structure/m_tray
/obj/structure/morgue/Destroy()
if(connected)
@@ -29,10 +31,21 @@
if(connected)
icon_state = "morgue0"
else
if(contents.len)
icon_state = "morgue2"
else
icon_state = "morgue1"
icon_state = "morgue1"
var/list/searching = GetAllContents(searchDepth = 3, checkClient = 0) // Search inside bodybags as well.
for(var/mob/living/M in searching)
if(iscarbon(M))
var/mob/living/carbon/C = M
if(C.status_flags & FAKEDEATH)
icon_state = "morgue2"
switch(C.stat)
if(DEAD)
icon_state = "morgue2"
if(UNCONSCIOUS)
icon_state = "morgue3"
if(CONSCIOUS)
icon_state = "morgue4"
break
return
/obj/structure/morgue/ex_act(severity)
@@ -60,7 +73,7 @@
return
/obj/structure/morgue/attack_hand(mob/user)
if(connected)
if(connected && !locked)
for(var/atom/movable/A in connected.loc)
if(!A.anchored)
A.forceMove(src)
@@ -68,29 +81,7 @@
playsound(src, 'sound/effects/roll.ogg', 5, 1)
QDEL_NULL(connected)
else
var/turf/S = get_step(src, src.dir)
if(!S)
return
else
if(S.contains_dense_objects())
to_chat(user, SPAN_WARNING("There's something in the way of \the [src]!"))
return
playsound(src, 'sound/effects/roll.ogg', 5, 1)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
connected = new /obj/structure/m_tray(src.loc)
step(src.connected, src.dir)
connected.layer = OBJ_LAYER - 0.1
var/turf/T = get_step(src, src.dir)
if(T.contents.Find(connected))
connected.connected = src
icon_state = "morgue0"
for(var/atom/movable/A in src)
A.forceMove(connected.loc)
connected.icon_state = "morguet"
connected.set_dir(src.dir)
else
QDEL_NULL(connected)
add_fingerprint(user)
relaymove(user)
update_icon()
return
@@ -101,21 +92,21 @@
/obj/structure/morgue/attackby(obj/P, mob/user)
if(P.ispen())
var/t = input(user, "What would you like the label to be?", text("[]", src.name), null) as text
var/t = input(user, "What would you like the label to be?", name) as text
if(user.get_active_hand() != P)
return
if((!in_range(src, usr) && src.loc != user))
if((!in_range(src, usr) > 1 && src.loc != user))
return
t = sanitizeSafe(t, MAX_NAME_LEN)
if(t)
name = "Morgue- '[t]'"
name = "[initial(name)] - '[t]'"
else
name = "Morgue"
name = initial(name)
add_fingerprint(user)
return
/obj/structure/morgue/relaymove(mob/user)
if(user.stat)
if(user.stat || locked)
return
var/turf/S = get_step(src, src.dir)
if(!S)
@@ -124,21 +115,21 @@
if(S.contains_dense_objects())
to_chat(user, SPAN_WARNING("There's something in the way of \the [src]!"))
return
connected = new /obj/structure/m_tray(src.loc)
step(connected, EAST)
playsound(src, 'sound/effects/roll.ogg', 5, 1)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
connected = new tray(src.loc)
step(connected, src.dir)
connected.layer = OBJ_LAYER - 0.1
var/turf/T = get_step(src, EAST)
var/turf/T = get_step(src, src.dir)
if(T.contents.Find(src.connected))
connected.connected = src
icon_state = "morgue0"
for(var/atom/movable/A in src)
A.forceMove(connected.loc)
connected.icon_state = "morguet"
else
QDEL_NULL(connected)
update_icon()
return
/*
* Morgue tray
*/
@@ -148,10 +139,10 @@
icon = 'icons/obj/stationobjs.dmi'
icon_state = "morguet"
density = TRUE
layer = 2.0
var/obj/structure/morgue/connected = null
anchored = TRUE
throwpass = TRUE
layer = TURF_LAYER
var/obj/structure/morgue/connected = null
/obj/structure/m_tray/Destroy()
if(connected?.connected == src)
@@ -180,42 +171,44 @@
return
O.forceMove(src.loc)
if(user != O)
user.visible_message("<b>[user]</b> stuffs \the [O] into \the [src]!", SPAN_NOTICE("You stuff \the [O] into \the [src]."), range = 3)
user.visible_message(SPAN_DANGER("<b>[user]</b> stuffs \the [O] into \the [src]!"), SPAN_NOTICE("You stuff \the [O] into \the [src]."), range = 3)
add_fingerprint(user)
return
/*
* Crematorium
*/
/obj/structure/crematorium
/obj/structure/morgue/crematorium
name = "crematorium"
desc = "A human incinerator. Works well on barbeque nights."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "crema1"
density = TRUE
anchored = TRUE
var/obj/structure/c_tray/connected = null
dir = SOUTH
tray = /obj/structure/m_tray/c_tray
var/cremating = FALSE
var/locked = FALSE
var/id = 1
var/_wifi_id
var/datum/wifi/receiver/button/crematorium/wifi_receiver
/obj/structure/crematorium/Initialize()
/obj/structure/morgue/crematorium/Initialize()
. = ..()
if(_wifi_id)
wifi_receiver = new(_wifi_id, src)
/obj/structure/crematorium/Destroy()
if(connected)
QDEL_NULL(connected)
/obj/structure/morgue/crematorium/Destroy()
..()
if(wifi_receiver)
QDEL_NULL(wifi_receiver)
return ..()
/obj/structure/crematorium/update_icon()
/obj/structure/morgue/crematorium/update_icon()
set_light(0)
if(cremating)
icon_state = "crema_active"
set_light(3, 1, LIGHT_COLOR_FIRE)
return
for(var/obj/machinery/button/switch/crematorium/C in range(3, src))
C.active = FALSE
C.update_icon()
if(connected)
icon_state = "crema0"
else
@@ -224,214 +217,152 @@
else
icon_state = "crema1"
/obj/structure/crematorium/ex_act(severity)
switch(severity)
if(1.0)
for(var/atom/movable/A in src)
A.forceMove(src.loc)
ex_act(severity)
qdel(src)
return
if(2.0)
if(prob(50))
for(var/atom/movable/A in src)
A.forceMove(src.loc)
ex_act(severity)
qdel(src)
return
if(3.0)
if(prob(5))
for(var/atom/movable/A in src)
A.forceMove(src.loc)
ex_act(severity)
qdel(src)
return
return
/obj/structure/crematorium/attack_hand(mob/user as mob)
/obj/structure/morgue/crematorium/attack_hand(mob/user as mob)
if(cremating)
to_chat(user, SPAN_WARNING("It's locked."))
return
if(connected && !locked)
for(var/atom/movable/A in connected.loc)
if(!A.anchored )
A.forceMove(src)
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
qdel(connected)
else if(!locked)
var/turf/S = get_step(src, src.dir)
if(!S)
return
else
if(S.contains_dense_objects())
to_chat(user, SPAN_WARNING("There's something in the way of \the [src]!"))
return
playsound(src.loc, 'sound/items/Deconstruct.ogg', 50, 1)
connected = new /obj/structure/c_tray(src.loc)
step(connected, src.dir)
connected.layer = OBJ_LAYER - 0.1
var/turf/T = get_step(src, src.dir)
if(T.contents.Find(connected))
connected.connected = src
src.icon_state = "crema0"
for(var/atom/movable/A in src)
A.forceMove(connected.loc)
connected.icon_state = "cremat"
else
qdel(src.connected)
add_fingerprint(user)
update_icon()
..()
/obj/structure/crematorium/attackby(obj/P, mob/user as mob)
if(P.ispen())
var/t = input(user, "What would you like the label to be?", "[src.name]") as text
if(user.get_active_hand() != P)
return
if((!in_range(src, usr) > 1 && src.loc != user))
return
t = sanitizeSafe(t, MAX_NAME_LEN)
if(t)
name = "Crematorium- '[t]'"
else
name = "Crematorium"
add_fingerprint(user)
return
/obj/structure/crematorium/relaymove(mob/user)
if(user.stat || locked)
return
var/turf/S = get_step(src, src.dir)
if(!S)
return
else
if(S.contains_dense_objects())
to_chat(user, SPAN_WARNING("There's something in the way of \the [src]!"))
return
connected = new /obj/structure/c_tray(src.loc)
step(connected, src.dir)
connected.layer = OBJ_LAYER - 0.1
var/turf/T = get_step(src, src.dir)
if(T.contents.Find(src.connected))
connected.connected = src
icon_state = "crema0"
for(var/atom/movable/A in src)
A.forceMove(connected.loc)
connected.icon_state = "cremat"
else
QDEL_NULL(connected)
return
/obj/structure/crematorium/proc/cremate(atom/A, mob/user)
/obj/structure/morgue/crematorium/proc/cremate(atom/A, mob/user)
if(cremating)
return
return //don't let you cremate something twice or w/e
cremating = TRUE
locked = TRUE
if(contents.len <= 0)
visible_message(SPAN_WARNING("You hear a hollow crackle coming from \the [src]."), range = 3)
else
visible_message(SPAN_WARNING("You hear a roar as \the [src] activates."))
cremating = TRUE
locked = TRUE
src.audible_message(SPAN_WARNING("You hear a hollow crackle."), 1)
flick("crema_empty", src)
set_light(3, 1, LIGHT_COLOR_FIRE)
sleep(4)
cremating = initial(cremating)
locked = initial(locked)
update_icon()
return
else
if(length(search_contents_for(/obj/item/disk/nuclear)))
to_chat(A, SPAN_WARNING("The crematorium buzzes, indicating that something important is inside the crematorium, and must be removed."))
cremating = initial(cremating)
locked = initial(locked)
update_icon()
return
src.audible_message(SPAN_WARNING("You hear a roar as \the [src] activates."), 1)
flick("crema_start", src)
update_icon()
var/desperation = 0
for(var/mob/living/M in contents)
if(M.stat < UNCONSCIOUS)
if(!iscarbon(M))
M.emote("scream")
var/list/searching = GetAllContents(searchDepth = 3, checkClient = 0)
for(var/mob/living/M in searching)
admin_attack_log(A, M, "Began cremating their victim.", "Has begun being cremated.", "began cremating")
if(iscarbon(M))
var/mob/living/carbon/C = M
for(var/I, I < 60, I++)
C.bodytemperature += 50
C.adjustFireLoss(20)
C.adjustBrainLoss(5)
if(!(C in searching)) //In case we are removed at any point.
cremating = initial(cremating)
locked = initial(locked)
update_icon()
continue
sleep(0.5 SECONDS)
if(prob(40) && (C.stat != DEAD))
desperation = rand(1,5)
switch(desperation) //This is messy. A better solution would probably be to make more sounds, but...
if(1)
playsound(src.loc, 'sound/weapons/genhit.ogg', 45, 1)
shake_animation(2)
playsound(src.loc, 'sound/weapons/genhit.ogg', 45, 1)
if(2)
playsound(src.loc, 'sound/effects/grillehit.ogg', 45, 1)
shake_animation(3)
playsound(src.loc, 'sound/effects/grillehit.ogg', 45, 1)
if(3)
playsound(src, 'sound/effects/bang.ogg', 45, 1)
if(prob(50))
playsound(src, 'sound/effects/bang.ogg', 45, 1)
shake_animation()
else
shake_animation(5)
if(4)
playsound(src, 'sound/effects/clang.ogg', 45, 1)
shake_animation(5)
if(5)
playsound(src, 'sound/weapons/smash.ogg', 50, 1)
if(prob(50))
playsound(src, 'sound/weapons/smash.ogg', 50, 1)
shake_animation(9)
else
shake_animation()
else
sleep(5)
if(M.stat == DEAD)
if(round_is_spooky())
if(prob(50))
playsound(src, 'sound/effects/ghost.ogg', 10, 5)
else
playsound(src, 'sound/effects/ghost2.ogg', 10, 5)
admin_attack_log(A, M, "Cremated their victim.", "Was cremated.", "cremated")
if(desperation)
M.audible_message("<b>[M]'s</b> screams cease, as does any movement within \the [src]. All that remains is a dull, empty silence.")
else
var/mob/living/carbon/C = M
C.emote("scream")
M.death(1)
M.ghostize()
qdel(M)
M.audible_message("\The [src] quietly shuts off. All that remains is a dull, empty silence.")
M.dust()
for(var/obj/O in contents) //obj instead of obj/item so that bodybags and ashes get destroyed. We dont want tons and tons of ash piling up
qdel(O)
var/obj/effect/decal/cleanable/ash/F = new /obj/effect/decal/cleanable/ash(src)
F.layer = OBJ_LAYER
var/obj/effect/decal/cleanable/ash/C = new /obj/effect/decal/cleanable/ash(src)
C.layer = OBJ_LAYER
sleep(30)
cremating = FALSE
locked = FALSE
cremating = initial(cremating)
locked = initial(locked)
update_icon()
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
playsound(src.loc, 'sound/effects/spray.ogg', 50, 1)
return
/*
* Crematorium tray
*/
/obj/structure/c_tray
/obj/structure/m_tray/c_tray
name = "crematorium tray"
desc = "Apply body before burning."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "cremat"
density = TRUE
anchored = TRUE
throwpass = TRUE
layer = 2.0
var/obj/structure/crematorium/connected = null
/obj/structure/c_tray/Destroy()
if(connected?.connected == src)
connected.connected = null
connected = null
return ..()
/*
* Crematorium switch
*/
/obj/structure/c_tray/attack_hand(mob/user)
if(connected)
for(var/atom/movable/A in src.loc)
if(!A.anchored)
A.forceMove(src.connected)
connected.connected = null
connected.update_icon()
add_fingerprint(user)
qdel(src)
return
return
/obj/structure/c_tray/MouseDrop_T(atom/movable/O, mob/user)
if(!istype(O, /atom/movable) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O))
return
if(!ismob(O) && !istype(O, /obj/structure/closet/body_bag))
return
if(!ismob(user) || user.stat || user.lying || user.stunned)
return
O.forceMove(src.loc)
if(user != O)
user.visible_message("<b>[user]</b> stuffs \the [O] into \the [src]!", SPAN_NOTICE("You stuff \the [O] into \the [src]."), range = 3)
return
/obj/machinery/button/crematorium
/obj/machinery/button/switch/crematorium
name = "crematorium igniter"
desc = "Burn baby burn!"
icon = 'icons/obj/power.dmi'
icon_state = "light0"
req_access = list(access_crematorium)
id = 1
var/cremate_dir // something for mappers, setting will make a crematorium in one step in this direction toggle
/obj/machinery/button/crematorium/update_icon()
return
/obj/machinery/button/crematorium/attack_hand(mob/user)
playsound(src, /decl/sound_category/switch_sound, 30)
/obj/machinery/button/switch/crematorium/attack_hand(mob/user)
..()
if(!allowed(user))
to_chat(user, SPAN_WARNING("Access denied."))
return
if(..())
return
var/list/obj/structure/crematorium/crematoriums = list()
var/list/obj/structure/morgue/crematorium/crematoriums = list()
if(!cremate_dir)
for(var/obj/structure/crematorium/C in range(3, src))
for(var/obj/structure/morgue/crematorium/C in range(3, src))
if(C.id == id)
crematoriums += C
else
var/turf/T = get_step(src, cremate_dir)
var/obj/structure/crematorium/C = locate() in T
var/obj/structure/morgue/crematorium/C = locate() in T
if(C?.id == id)
crematoriums += C
for(var/thing in crematoriums)
var/obj/structure/crematorium/C = thing
if(!C.cremating)
var/obj/structure/morgue/crematorium/C = thing
if(!C.cremating && !C.connected)
active = TRUE
update_icon()
C.cremate(user)
+1 -1
View File
@@ -173,7 +173,7 @@
user.visible_message("<span class='danger'>\The [user] hits \the [src] with \the [I] with no visible effect.</span>")
else
user.do_attack_animation(src)
animate_shake()
shake_animation()
user.visible_message("<span class='danger'>\The [user] forcefully strikes \the [src] with \the [I]!</span>")
playsound(src.loc, material.hitsound, W.get_clamped_volume(), 1)
src.health -= W.force * 1