Files
Bubberstation/code/datums/elements/caseless.dm
SmArtKar 7f15e11993 Adds a new syringe gun mode and improves foam darts. (#89510)
## About The Pull Request

This PR implements multiple new features:

Foam darts now can stick to people as long as their cap isn't removed.
Riot foam darts have a chance to jostle when you move with one stuck
inside of you, dealing a bit of stamina damage from the weight stuck to
your limbs.

Syringe guns received a second "low power" mode, toggleable with in-hand
right click. In this mode, syringes fired will embed into their target
and slowly leak their reagents instead of instantly delivering them.
Thankfully, they can be plucked out pretty quickly.

You can also insert syringes into uncapped (screwdriver-ed) foam darts
(similarly to pens) to achieve the same result, allowing you to get a
bootleg low-efficiency syringe gun.

Additionally, I fixed/cleaned up some embedding issues/code which I
found while coding this.

## Why It's Good For The Game

This allows players to explore new funny interactions between items and
chems, as we don't have a reliable slow release mechanism aside from IV
drips currently. And foam darts embedding it just (mostly) harmless
fluff, if someone figures out a way to cause havoc with it then I'll be
very proud of them (someone totally will).

## Changelog
🆑
add: Foam darts now stick to people when they have their cap on, riot
foam darts also can passively deal a bit of stamina damage when you move
with one.
add: Syringes can be inserted into foam darts, making them embed and
slowly leak their reagents into their victim.
add: Syringe guns can be toggled (with right click) between high power
and low power modes, former being their normal functionality and latter
making syringes embed and slowly leak their contents.
fix: Fixed projectiles sometimes not embedding when they should've
code: Cleaned embedding code up
/🆑
2025-03-01 22:52:19 +11:00

37 lines
1.5 KiB
Plaintext

/**
* An element that deletes the casing when fired and, if reusable is true, adds the projectile_drop element to the bullet.
* Just make sure to not add components or elements that also use COMSIG_FIRE_CASING after this one.
* Not compatible with pellets (how the eff would that work in a senible way tho?).
*/
/datum/element/caseless
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
var/reusable = FALSE
/datum/element/caseless/Attach(datum/target, reusable = FALSE)
. = ..()
if(!isammocasing(target))
return ELEMENT_INCOMPATIBLE
src.reusable = reusable
if (reusable)
RegisterSignal(target, COMSIG_CASING_READY_PROJECTILE, PROC_REF(on_ready_projectile))
RegisterSignal(target, COMSIG_FIRE_CASING, PROC_REF(on_fired_casing))
/datum/element/caseless/proc/on_ready_projectile(obj/item/ammo_casing/shell, atom/target, mob/living/user, quiet, zone_override, atom/fired_from)
SIGNAL_HANDLER
var/obj/projectile/proj = shell.loaded_projectile
if(isnull(proj))
return
if(!ispath(proj.shrapnel_type))
proj.shrapnel_type = shell.type
proj.AddElement(/datum/element/projectile_drop, shell.type)
/datum/element/caseless/proc/on_fired_casing(obj/item/ammo_casing/shell, atom/target, mob/living/user, fired_from, randomspread, spread, zone_override, params, distro, obj/projectile/proj)
SIGNAL_HANDLER
if(isgun(fired_from))
var/obj/item/gun/shot_from = fired_from
if(shot_from.chambered == shell)
shot_from.chambered = null //Nuke it. Nuke it now.
QDEL_NULL(shell)