Files
Bubberstation/code/modules/projectiles/projectile/bullets/_incendiary.dm
MrMelbert 93ec5a72f7 A comprehensive refactor / cleanup of bullet_hit and on_hit to cut out a single bad species / mob proc (#79024)
## About The Pull Request

- Refactored `bullet_act`. Adds `should_call_parent` and refactors
associated children to support that.
   - Fixes silicons sparking off when hit by disabler fire. 
- Desnowflakes firing range target integrity and cleans up its
bullet-hole code a bit.
- Cleans up changeling tentacle code a fair bit and fixes it not taking
off throw mode if you fail to catch something.
   - The Sleeping Carp deflection is now signalized 
- Nightmare projectile dodging is now signalized and sourced from the
Nightmare's brain rather than species
- Refactored how cardboard cutouts get knocked over to be less
snowflaked / use integrity
- Also adds projectile `on_hit` `should_call_parent` and cleans up a bit
of that, particularly their arguments.
- On hit arguments were passed wrong this entire time, it's a good thing
nothing relied on that.

## Why It's Good For The Game

This is cringe. 


1863eb2cd8/code/modules/mob/living/carbon/human/_species.dm (L1430-L1442)

Bullets should overall act more consistent across mob types and objects.

## Changelog

🆑 Melbert
fix: Silicons don't spark when shot by disablers
fix: Changelings who fail to catch something with a tencacle will have
throw mode disabled automatically
fix: Fixes occasions where you can reflect with Sleeping Carp when you
shouldn't be able to
fix: Fixes some projectiles causing like 20x less eye blur than they
should be
refactor: Refactored bullet-mob interactions
refactor: Nightmare "shadow dodge" projectile ability is now sourced
from their brain
/🆑
2023-10-18 23:08:13 -06:00

91 lines
2.7 KiB
Plaintext

/obj/projectile/bullet/incendiary
damage = 20
/// How many firestacks to apply to the target
var/fire_stacks = 4
/// If TRUE, leaves a trail of hotspots as it flies, very very chaotic
var/leaves_fire_trail = TRUE
/obj/projectile/bullet/incendiary/on_hit(atom/target, blocked = 0, pierce_hit)
. = ..()
if(iscarbon(target))
var/mob/living/carbon/M = target
M.adjust_fire_stacks(fire_stacks)
M.ignite_mob()
/obj/projectile/bullet/incendiary/Move()
. = ..()
if(!leaves_fire_trail)
return
var/turf/location = get_turf(src)
if(location)
new /obj/effect/hotspot(location)
location.hotspot_expose(700, 50, 1)
/// Incendiary bullet that more closely resembles a real flamethrower sorta deal, no visible bullet, just flames.
/obj/projectile/bullet/incendiary/fire
damage = 15
range = 6
alpha = 0
pass_flags = PASSTABLE | PASSMOB
sharpness = NONE
shrapnel_type = null
embedding = null
impact_effect_type = null
suppressed = SUPPRESSED_VERY
damage_type = BURN
armor_flag = BOMB
speed = 1.2
wound_bonus = 30
bare_wound_bonus = 30
wound_falloff_tile = -4
fire_stacks = 3
/obj/projectile/bullet/incendiary/fire/on_hit(atom/target, blocked = 0, pierce_hit)
. = ..()
var/turf/location = get_turf(target)
if(isopenturf(location))
new /obj/effect/hotspot(location)
location.hotspot_expose(700, 50, 1)
/// Used in [the backblast element][/datum/element/backblast]
/obj/projectile/bullet/incendiary/fire/backblast
ricochet_chance = 10000
ricochets_max = 4
ricochet_incidence_leeway = 0
/// Lazy attempt at knockback, any items this plume hits will be knocked back this far. Decrements with each tile passed.
var/knockback_range = 7
/// A lazylist of all the items we've already knocked back, so we don't do it again
var/list/launched_items
/// we only try to knock back the first 6 items per tile
#define BACKBLAST_MAX_ITEM_KNOCKBACK 6
/obj/projectile/bullet/incendiary/fire/backblast/Move()
. = ..()
if(knockback_range <= 0)
return
knockback_range--
var/turf/current_turf = get_turf(src)
if(!current_turf)
return
var/turf/throw_at_turf = get_turf_in_angle(Angle, current_turf, 7)
var/thrown_items = 0
for(var/iter in current_turf.contents)
if(thrown_items > BACKBLAST_MAX_ITEM_KNOCKBACK)
break
if(isitem(iter))
var/obj/item/iter_item = iter
if(iter_item.anchored || LAZYFIND(launched_items, iter_item) || iter_item.throwing)
continue
thrown_items++
iter_item.throw_at(throw_at_turf, knockback_range, knockback_range)
LAZYADD(launched_items, iter_item)
else if(isliving(iter))
var/mob/living/incineratee = iter
incineratee.take_bodypart_damage(0, damage, check_armor = TRUE, wound_bonus=wound_bonus, bare_wound_bonus=bare_wound_bonus)
incineratee.adjust_fire_stacks(fire_stacks)
#undef BACKBLAST_MAX_ITEM_KNOCKBACK