mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 03:02:38 +00:00
## About The Pull Request This PR elementises two kinds of spider behaviour in preparation for making them into Basic Mobs, which in turn will solve a bug with Araneus. This will probably conflict with my other PR but I'll deal with it. The Nurse Spider and Flesh Spider healing abilities which were similar but not _quite_ the same now share the same component. Also Lightgeists because they also did this. I'll be honest I think Flesh Spider would be better off with the "Regenerator" component instead but that would be a balance change so I can't do that right now. The Tarantula "slower when not on webs" passive is also now an element. This will make my third PR (to be opened when these two are merged) easier. Also I noticed we were using the same colour for spawning a particle in a few places so I moved that hash into the colours define file. ALSO while making this the linter identified that a shitload of procs were passing `required_bodytype` to `heal_overall_damage` as if it was `stamina` which probably caused some bugs. Don't know which though! https://user-images.githubusercontent.com/7483112/217679050-b728ee98-3ba1-4663-bb6b-75295d5f9a6a.mp4 ## Why It's Good For The Game Reduces amount of duplicated code, making it easier to maintain. Elements can be reused for other things later, like the infuser? ## Changelog 🆑 refactor: Spider healing abilities have been refactored to reuse the same code rather than reimplement it across two different mobs, it should work the same as it used to. This is also used by Lightgeists. fix: Mob biotype on `heal_overall_damage` should be applied more consistently. This might mean that some things which were previously healing prosthetic limbs have stopped doing that. /🆑
33 lines
998 B
Plaintext
33 lines
998 B
Plaintext
/**
|
|
* # Web Walker element
|
|
*
|
|
* A mob with this element will move more slowly when it's not stood on a webbed turf.
|
|
*/
|
|
/datum/element/web_walker
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
/// Move speed modifier to apply when not stood on webs
|
|
var/datum/movespeed_modifier/off_web_slowdown
|
|
|
|
/datum/element/web_walker/Attach(datum/target, datum/movespeed_modifier/off_web_slowdown)
|
|
. = ..()
|
|
if (!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
src.off_web_slowdown = off_web_slowdown
|
|
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
|
|
|
/datum/element/web_walker/Detach(datum/source)
|
|
. = ..()
|
|
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
|
|
|
|
/// When we move, check if we're still on a web
|
|
/datum/element/web_walker/proc/on_moved(mob/living/source)
|
|
SIGNAL_HANDLER
|
|
|
|
var/obj/structure/spider/stickyweb/web = locate() in get_turf(source)
|
|
if (web)
|
|
source.remove_movespeed_modifier(off_web_slowdown)
|
|
else
|
|
source.add_movespeed_modifier(off_web_slowdown)
|