Files
Bubberstation/code/datums/elements/tiny_mob_hunter.dm
Jacquerel 1cdc327a8f Station Trait: Spider Infestation (#73893)
## About The Pull Request

Hate having your cables eaten by mice? Nanotrasen have heard your
complaints and settled on a natural, _organic_, and eco-friendly
solution.

When this station trait is active, roundstart and event mouse spawns
have a chance to instead be replaced with duct spiders (both will exist,
it doesn't remove mice).
Duct spiders are largely harmless to humans, actively hunt other
maintenance creatures (such as mice), and have only one _tiny_ downside.

![image](https://user-images.githubusercontent.com/7483112/224345781-2627be98-67f2-4cab-ac40-c6c9b35ea909.png)

These mobs can also sometimes be spawned by a minor scrubber clog event.

As a side note, all spider basic mobs with AI (except Araneus) will now
try to automatically fill a small area around them with webs.

Also I made it so that mobs will ignore their random_walking behaviour
if they're engaged in a `do_after`, just in case.

## Why It's Good For The Game

Adds a little bit of variety to things which can slightly annoy you in
maintenance.
Spiders will automatically make places they live in look like spiders
live there.

## Changelog

🆑
add: A station trait which sometimes populates maintenance with small
spiders. You can wear them as a hat if you wanted to have a spider on
your head for some reason.
add: Spider mobs will automatically start webbing up their environment.
/🆑
2023-03-12 18:53:38 -06:00

32 lines
1.1 KiB
Plaintext

/// Deals bonus brute damage to smaller mobs
/datum/element/tiny_mob_hunter
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// Will apply bonus to mobs this size or smaller
var/target_size
/// Additional damage to apply
var/bonus_damage
/datum/element/tiny_mob_hunter/Attach(datum/target, target_size = MOB_SIZE_TINY, bonus_damage = 10)
. = ..()
if(!isanimal_or_basicmob(target)) // No post-attack signal for carbons, you can add one if you really want to put this on one
return ELEMENT_INCOMPATIBLE
src.target_size = target_size
src.bonus_damage = bonus_damage
RegisterSignal(target, COMSIG_HOSTILE_POST_ATTACKINGTARGET, PROC_REF(on_attacked_target))
/datum/element/tiny_mob_hunter/Detach(datum/target)
UnregisterSignal(target, COMSIG_HOSTILE_POST_ATTACKINGTARGET)
return ..()
/// Applies a bonus following the attack
/datum/element/tiny_mob_hunter/proc/on_attacked_target(mob/living/hunter, atom/target)
SIGNAL_HANDLER
if (!isliving(target))
return
var/mob/living/prey = target
if (prey.mob_size > target_size)
return
prey.apply_damage(bonus_damage, BRUTE, hunter.zone_selected)