Files
Bubberstation/code/datums/elements/venomous.dm
SkyratBot 7bfe7215ff [MIRROR] Throwing a bee at someone injects reagents [MDB IGNORE] (#25663)
* Throwing a bee at someone injects reagents (#80354)

## About The Pull Request

Throwing a bee at someone injects that bee's reagents.
This has a larger code footprint than you might expect because venom
injection is done via an element which in turn gives a callback to a
component.
While I was touching that I also separated `COMSIG_MOVABLE_IMPACT` into
`COMSIG_MOVABLE_PRE_IMPACT` because a lot of effects trigger from
`COMSIG_MOVABLE_IMPACT` despite the fact that the throw impact can be
cancelled after the signal is sent.

I also added an inject check onto the venomous element for mob attacks,
so thick clothing can now protect you from venom injection.
I elected that Giant Spiders have big enough fangs to ignore this such
that this isn't a major balance change, as do moonicorns (that horn is
massive), Fire Sharks, and Clowns (no idea how they are applying chems
at all to be honest).

## Why It's Good For The Game

I thought about someone throwing a bee at someone like a little dart and
thought "hee hee"

## Changelog

🆑
add: If you throw a bee at someone it will hit them sting-first and
inject that bee's reagent
balance: Thick clothing can now protect you from the venom of bees,
snakes, frogs, and (small) spiders
/🆑

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com>

* Throwing a bee at someone injects reagents

---------

Co-authored-by: Jacquerel <hnevard@gmail.com>
Co-authored-by: John Willard <53777086+JohnFulpWillard@ users.noreply.github.com>
2023-12-17 10:06:35 -05:00

44 lines
1.4 KiB
Plaintext

/**
* Venomous element; which makes the attacks of the simplemob attached poison the enemy.
*
* Used for spiders, frogs, and bees!
*/
/datum/element/venomous
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
///Path of the reagent added
var/poison_type
///Details of how we inject our venom
var/injection_flags
///How much of the reagent added. if it's a list, it'll pick a range with the range being list(lower_value, upper_value)
var/list/amount_added
/datum/element/venomous/Attach(datum/target, poison_type, amount_added, injection_flags = NONE, thrown_effect = FALSE)
. = ..()
src.poison_type = poison_type
src.amount_added = amount_added
src.injection_flags = injection_flags
target.AddComponent(\
/datum/component/on_hit_effect,\
on_hit_callback = CALLBACK(src, PROC_REF(do_venom)),\
thrown_effect = thrown_effect,\
)
/datum/element/venomous/Detach(datum/target)
qdel(target.GetComponent(/datum/component/on_hit_effect))
return ..()
/datum/element/venomous/proc/do_venom(datum/element_owner, atom/venom_source, mob/living/target, hit_zone)
if(!istype(target))
return
if(target.stat == DEAD)
return
if(isliving(element_owner) && !target.try_inject(element_owner, hit_zone, injection_flags))
return
var/final_amount_added
if(islist(amount_added))
final_amount_added = rand(amount_added[1], amount_added[2])
else
final_amount_added = amount_added
target.reagents?.add_reagent(poison_type, final_amount_added)