Files
Bubberstation/code/datums/components/ranged_attacks.dm
SmArtKar 077262c0f9 Changes to crusher trophies and mining AOE, adds a new raptor-sourced trophy (#92241)
## About The Pull Request

- Rebuke effect (from god's eye and lobstrocity claw trophy) now works
on basicmobs, increasing the cooldown on their ranged attacks just like
it does for simplemobs.
- Bileworm spewlet trophy shots no longer hit your allied mobs, as
previously this would cause you to constantly hit your own
raptor/minebots/NODE drones, making it actively detrimental in some
situations. Its shots now deals brute damage instead of burn, as
otherwise its damage was reduced by 70% due to innate projectile
resistance of lavaland mobs, making it deal measely 6 damage every 10
seconds.
- MOD sphere module bombs now properly aggro lavaland mobs, as
previously they only worked on simplemobs (also fixed a direct
assignment to the blackboard in legionnaire spine code).
- They also no longer deal damage to minebots and NODE drones.
- Afterimages from the ice demon and their trophy can now be passed
through, although hostile AI would attempt to avoid doing so. This way
the trophy should no longer be an active detriment to players, and
demons themselves should be less jank to fight.

And if you're a heartless enough bastard, you can kill and butcher your
raptor to get a new raptor feather crusher trophy, which allows your
destabilizer shots to phase through your allied mobs similarly to
passthrough mods for PKA.

<img width="174" height="125" alt="Aseprite_3Olcd7oyVJ"
src="https://github.com/user-attachments/assets/99d7eebb-e36d-428b-aa48-f1261a173ca1"
/>

## Why It's Good For The Game

These changes should make vent defense more bearable, as right now its
very easy to accidentally damage and kill your own drone due to them
being hit by all AOEs in miner arsenal.
- Rebuke - should probably work on basicmobs as only remaining
simplemobs on lavaland are megafauna
- Bileworm spewlet - its a joke of a trophy at 6 damage as it has a 10
second cooldown, and it hitting your allies made vent defense much
harder than it should've been
- Sphere changes - should make bombs not kill your NODE/mining drones,
aggro helps prevent cheese.
- Afterimages - the trophy can end up bodyblocking you, this change
should make it less of a pain in the ass to use the trophy and to fight
the demons themselves.
- Raptor feather - useful for vent defense when you're using minebots or
have dismounted your raptor, right now its a pain for reasons mentioned
above

## Changelog
🆑
add: Added a raptor feather crusher trophy which makes your crusher
shots go through your allied mobs.
balance: Rebuke effect from lobster claw trophy and the eye of god now
applies to basicmob attacks
balance: Bileworm spewlet's damage is no longer reduced by 70% when
hitting lavaland fauna, and it no longer can hit allied mobs
balance: Sphere MODule bombs no longer hit NODE drones and minebots
balance: Ice demon/ice demon cube afterimages can now be walked through
by players
fix: Sphere MODule bombs now aggro basicmobs hit by their explosions
/🆑
2025-07-30 17:37:42 -04:00

117 lines
4.6 KiB
Plaintext

/**
* Configurable ranged attack for basic mobs.
*/
/datum/component/ranged_attacks
/// What kind of casing do we use to fire?
var/casing_type
/// What kind of projectile to we fire? Use only one of this or casing_type
var/projectile_type
/// Sound to play when we fire our projectile
var/projectile_sound
/// how many shots we will fire
var/burst_shots
/// intervals between shots
var/burst_intervals
/// Time to wait between shots
var/cooldown_time
/// Tracks time between shots
COOLDOWN_DECLARE(fire_cooldown)
/datum/component/ranged_attacks/Initialize(
casing_type,
projectile_type,
projectile_sound = 'sound/items/weapons/gun/pistol/shot.ogg',
burst_shots,
burst_intervals = 0.2 SECONDS,
cooldown_time = 3 SECONDS,
)
. = ..()
if(!isbasicmob(parent))
return COMPONENT_INCOMPATIBLE
src.casing_type = casing_type
src.projectile_sound = projectile_sound
src.projectile_type = projectile_type
src.cooldown_time = cooldown_time
if (casing_type && projectile_type)
CRASH("Set both casing type and projectile type in [parent]'s ranged attacks component! uhoh! stinky!")
if (!casing_type && !projectile_type)
CRASH("Set neither casing type nor projectile type in [parent]'s ranged attacks component! What are they supposed to be attacking with, air?")
if(burst_shots <= 1)
return
src.burst_shots = burst_shots
src.burst_intervals = burst_intervals
/datum/component/ranged_attacks/RegisterWithParent()
. = ..()
ADD_TRAIT(parent, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM, type)
RegisterSignal(parent, COMSIG_MOB_ATTACK_RANGED, PROC_REF(fire_ranged_attack))
RegisterSignal(parent, COMSIG_MOB_TROPHY_ACTIVATED(TROPHY_WATCHER), PROC_REF(disable_attack))
RegisterSignal(parent, COMSIG_LIVING_STATUS_APPLIED, PROC_REF(on_status_applied))
RegisterSignal(parent, COMSIG_LIVING_STATUS_REMOVED, PROC_REF(on_status_removed))
/datum/component/ranged_attacks/UnregisterFromParent()
. = ..()
UnregisterSignal(parent, list(COMSIG_MOB_ATTACK_RANGED, COMSIG_MOB_TROPHY_ACTIVATED(TROPHY_WATCHER), COMSIG_LIVING_STATUS_APPLIED, COMSIG_LIVING_STATUS_REMOVED))
REMOVE_TRAIT(parent, TRAIT_SUBTREE_REQUIRED_OPERATIONAL_DATUM, type)
/datum/component/ranged_attacks/proc/fire_ranged_attack(mob/living/basic/firer, atom/target, modifiers)
SIGNAL_HANDLER
if(!COOLDOWN_FINISHED(src, fire_cooldown))
return
if(SEND_SIGNAL(firer, COMSIG_BASICMOB_PRE_ATTACK_RANGED, target, modifiers) & COMPONENT_CANCEL_RANGED_ATTACK)
return
COOLDOWN_START(src, fire_cooldown, cooldown_time)
INVOKE_ASYNC(src, PROC_REF(async_fire_ranged_attack), firer, target, modifiers)
if(isnull(burst_shots))
return
for(var/i in 1 to (burst_shots - 1))
addtimer(CALLBACK(src, PROC_REF(async_fire_ranged_attack), firer, target, modifiers), i * burst_intervals)
/// Actually fire the damn thing
/datum/component/ranged_attacks/proc/async_fire_ranged_attack(mob/living/basic/firer, atom/target, modifiers)
firer.face_atom(target)
if(projectile_type)
firer.fire_projectile(projectile_type, target, projectile_sound)
SEND_SIGNAL(parent, COMSIG_BASICMOB_POST_ATTACK_RANGED, target, modifiers)
return
playsound(firer, projectile_sound, 100, TRUE)
var/turf/startloc = get_turf(firer)
var/obj/item/ammo_casing/casing = new casing_type(startloc)
var/target_zone
if(ismob(target))
var/mob/target_mob = target
target_zone = target_mob.get_random_valid_zone()
else
target_zone = ran_zone()
casing.fire_casing(target, firer, null, null, null, target_zone, 0, firer)
casing.update_appearance()
casing.fade_into_nothing(30 SECONDS)
SEND_SIGNAL(parent, COMSIG_BASICMOB_POST_ATTACK_RANGED, target, modifiers)
return
/// Delay the attack when hit by a watcher trophy detonation
/datum/component/ranged_attacks/proc/disable_attack(mob/source, obj/item/crusher_trophy/used_trophy, mob/living/user)
SIGNAL_HANDLER
var/stun_duration = (used_trophy.bonus_value * 0.1) SECONDS
COOLDOWN_INCREMENT(src, fire_cooldown, stun_duration)
/// Increase CD when rebuked
/datum/component/ranged_attacks/proc/on_status_applied(mob/living/source, datum/status_effect/effect)
SIGNAL_HANDLER
if (!istype(effect, /datum/status_effect/rebuked))
return
var/datum/status_effect/rebuked/rebuked = effect
if (!COOLDOWN_FINISHED(src, fire_cooldown))
COOLDOWN_INCREMENT(src, fire_cooldown, cooldown_time * (rebuked.cd_increase - 1))
cooldown_time *= rebuked.cd_increase
/// Reduce CD back when the rebuked status runs out
/datum/component/ranged_attacks/proc/on_status_removed(mob/living/source, datum/status_effect/effect)
SIGNAL_HANDLER
if (!istype(effect, /datum/status_effect/rebuked))
return
var/datum/status_effect/rebuked/rebuked = effect
cooldown_time /= rebuked.cd_increase