[MIRROR] Turns blood walking into an element [MDB IGNORE] (#11047)

* Turns blood walking into an element (#64162)

Refactoring things to elements/components is better in general, and I thought this was a perfect thing to turn into one.

* Turns blood walking into an element

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-01-27 04:03:38 +00:00
committed by GitHub
co-authored by John Willard
parent a58893115f
commit e14b57e62b
4 changed files with 55 additions and 9 deletions
+50
View File
@@ -0,0 +1,50 @@
///Blood walk, a bespoke element that causes you to make blood wherever you walk.
/datum/element/blood_walk
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
id_arg_index = 2
///A unique blood type we might want to spread
var/blood_type
///The sound that plays when we spread blood.
var/sound_played
///How loud will the sound be, if there is one.
var/sound_volume
///The chance of spawning blood whenever walking
var/blood_spawn_chance
/datum/element/blood_walk/Attach(
datum/target,
blood_type = /obj/effect/decal/cleanable/blood,
sound_played,
sound_volume = 80,
blood_spawn_chance = 100,
)
. = ..()
if(!ismovable(target))
return ELEMENT_INCOMPATIBLE
src.blood_type = blood_type
src.sound_played = sound_played
src.sound_volume = sound_volume
src.blood_spawn_chance = blood_spawn_chance
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/spread_blood)
/datum/element/blood_walk/Detach(datum/target)
. = ..()
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
///Spawns blood (if possible) under the source, and plays a sound effect (if any)
/datum/element/blood_walk/proc/spread_blood(datum/source)
SIGNAL_HANDLER
var/atom/movable/movable_source = source
var/turf/current_turf = movable_source.loc
if(!isturf(current_turf))
return
if(!prob(blood_spawn_chance))
return
new blood_type(current_turf)
if(!isnull(sound_played))
playsound(movable_source, sound_played, sound_volume, TRUE, 2, TRUE)
@@ -673,10 +673,9 @@
web_speed = 0.7
menu_description = "Self-sufficient spider variant capable of healing themselves and producing webbbing fast, but has less health and damage. Toxin injection of 10u per bite."
/mob/living/simple_animal/hostile/giant_spider/hunter/flesh/Moved(atom/oldloc, dir)
/mob/living/simple_animal/hostile/giant_spider/hunter/flesh/Initialize(mapload)
. = ..()
if(prob(5))
new /obj/effect/decal/cleanable/blood/bubblegum(loc)
AddElement(/datum/element/blood_walk, /obj/effect/decal/cleanable/blood/bubblegum, blood_spawn_chance = 5)
/mob/living/simple_animal/hostile/giant_spider/hunter/flesh/AttackingTarget()
if(is_busy)
@@ -99,6 +99,8 @@ Difficulty: Hard
hallucination_charge_surround.spawn_blood = TRUE
RegisterSignal(src, COMSIG_BLOOD_WARP, .proc/blood_enrage)
RegisterSignal(src, COMSIG_FINISHED_CHARGE, .proc/after_charge)
if(spawn_blood)
AddElement(/datum/element/blood_walk, /obj/effect/decal/cleanable/blood/bubblegum, 'sound/effects/meteorimpact.ogg', 200)
/mob/living/simple_animal/hostile/megafauna/bubblegum/Destroy()
QDEL_NULL(triple_charge)
@@ -305,12 +307,6 @@ Difficulty: Hard
update_approach()
. = ..()
/mob/living/simple_animal/hostile/megafauna/bubblegum/Moved(atom/OldLoc, Dir, Forced = FALSE)
. = ..()
if(spawn_blood)
new /obj/effect/decal/cleanable/blood/bubblegum(src.loc)
playsound(src, 'sound/effects/meteorimpact.ogg', 200, TRUE, 2, TRUE)
/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination
name = "bubblegum's hallucination"
desc = "Is that really just a hallucination?"
+1
View File
@@ -927,6 +927,7 @@
#include "code\datums\elements\basic_body_temp_sensitive.dm"
#include "code\datums\elements\beauty.dm"
#include "code\datums\elements\bed_tucking.dm"
#include "code\datums\elements\blood_walk.dm"
#include "code\datums\elements\bsa_blocker.dm"
#include "code\datums\elements\chemical_transfer.dm"
#include "code\datums\elements\chewable.dm"