Files
Bubberstation/code/datums/elements/temporary_atom.dm
SkyratBot 71a25960db [MIRROR] Basic mobs won't shoot walls / Basic mobs won't leave permanent bullet casings [MDB IGNORE] (#18719)
* Basic mobs won't shoot walls / Basic mobs won't leave permanent bullet casings (#72494)

## About The Pull Request

Basic mobs using the generic ranged attack behaviour will now not
attempt to shoot a target which they can no longer see.
If they can still see you through a window that's fine because shooting
in your direction will probably break the window eventually, but a mob
knowing you're on the other side of a wall and pointlessly firing at it
isn't useful.

Additionally, adds a component to bullet casings fired by basic mobs
which deletes them after 30 seconds.

https://user-images.githubusercontent.com/7483112/211012442-027455c7-2846-426e-89fb-c8c89d891e4f.mp4

Here's a demonstration but sped up so they vanish after 5 seconds
instead.

## Why It's Good For The Game

![image](https://user-images.githubusercontent.com/7483112/210862278-f58111d9-917b-43c4-8fa0-b58c02ae8ab5.png)
We're not actually sure that's where these 75,000 bullet casings came
from (it's probably related to that pAI down there) but it's one way it
could happen.

Players with limited ammo leaving persistent bullet casings should
rarely be a problem, mobs have infinite ammo and so should not be able
to generate infinite debris. Having them just sort of disappear after 30
seconds is... less than immersive, but I feel like it's better than the
alternative.
You can attach the element to other things to thanos snap them if you
want.

## Changelog

🆑
fix: Syndicate mobs will no longer attempt to shoot you through walls,
building up massive piles of empty bullet casings in the process.
qol: Bullet casings from "weapons" fired by certain mobs will clean
themselves up after 30 seconds.
/🆑

* Basic mobs won't shoot walls / Basic mobs won't leave permanent bullet casings

Co-authored-by: Jacquerel <hnevard@gmail.com>
2023-01-14 12:25:53 -08:00

15 lines
654 B
Plaintext

/// Deletes the atom with a little fading out animation after a specified time
/datum/element/temporary_atom
/datum/element/temporary_atom/Attach(datum/target, life_time = 5 SECONDS, fade_time = 3 SECONDS)
. = ..()
if (!isatom(target))
return ELEMENT_INCOMPATIBLE
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), target), life_time, TIMER_DELETE_ME)
if (life_time > fade_time && fade_time > 0)
addtimer(CALLBACK(src, PROC_REF(fade_out), target, fade_time), life_time - fade_time, TIMER_DELETE_ME)
/datum/element/temporary_atom/proc/fade_out(atom/target,fade_time)
animate(target, alpha = 0, time = fade_time, flags = ANIMATION_PARALLEL)