mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
[MIRROR] Fixing embedding for projectiles. [MDB IGNORE] (#23217)
* Fixing embedding for projectiles. (#77674) So, the main issue was that the variables for the embed element wouldn't set when attached to a projectile but only on items for some insignificant reason, which means it'll spawn the shrapnel yes, but won't embed it since the chance is null/zero. I read the code over and over and over with the assumption that something like this wouldn't have been done, yet it was. As for the secondary issue, because of how embedding works, the casing types of arrows and harpoon aren't spawned when hitting a non-carbon or reaching their maximum range. So, I'm re-enabling the reusable arg/var for the caseless component of harpoons and arrows, and modifying the `projectile_drop` to not drop their payload if the embedding component would already do that, so we avoid duping. * Fixing embedding for projectiles. --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
/obj/item/ammo_casing/harpoon/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/caseless)
|
||||
AddElement(/datum/element/caseless, TRUE)
|
||||
|
||||
/obj/item/ammo_casing/harpoon/update_icon_state()
|
||||
. = ..()
|
||||
|
||||
@@ -12,11 +12,13 @@
|
||||
firing_effect_type = null
|
||||
caliber = CALIBER_ARROW
|
||||
is_cased_ammo = FALSE
|
||||
///Whether the bullet type spawns another casing of the same type or not.
|
||||
var/reusable = TRUE
|
||||
|
||||
/obj/item/ammo_casing/arrow/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/envenomable_casing)
|
||||
AddElement(/datum/element/caseless)
|
||||
AddElement(/datum/element/caseless, reusable)
|
||||
|
||||
/obj/item/ammo_casing/arrow/update_icon_state()
|
||||
. = ..()
|
||||
@@ -58,7 +60,7 @@
|
||||
desc = "Here it comes, cultist scum!"
|
||||
icon_state = "holy_arrow_projectile"
|
||||
damage = 20 //still a lot but this is roundstart gear so far less
|
||||
shrapnel_type =/obj/projectile/bullet/arrow/holy
|
||||
shrapnel_type =/obj/item/ammo_casing/arrow/holy
|
||||
embedding = list(
|
||||
embed_chance = 50,
|
||||
fall_chance = 2,
|
||||
@@ -80,6 +82,7 @@
|
||||
name = "blazing star arrow"
|
||||
desc = "A holy diver seeking its target, blessed with fire. Will ignite on hit, destroying the arrow. But if you hit an already ignited target...?"
|
||||
projectile_type = /obj/projectile/bullet/arrow/blazing
|
||||
reusable = FALSE
|
||||
|
||||
/obj/projectile/bullet/arrow/blazing
|
||||
name = "blazing arrow"
|
||||
|
||||
@@ -745,9 +745,6 @@
|
||||
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_BEFORE_FIRE, src, original)
|
||||
if(firer)
|
||||
SEND_SIGNAL(firer, COMSIG_PROJECTILE_FIRER_BEFORE_FIRE, src, fired_from, original)
|
||||
//If no angle needs to resolve it from xo/yo!
|
||||
if(shrapnel_type && LAZYLEN(embedding))
|
||||
AddElement(/datum/element/embed, projectile_payload = shrapnel_type)
|
||||
if(!log_override && firer && original)
|
||||
log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]")
|
||||
//note: mecha projectile logging is handled in /obj/item/mecha_parts/mecha_equipment/weapon/action(). try to keep these messages roughly the sameish just for consistency's sake.
|
||||
@@ -1134,6 +1131,10 @@
|
||||
|
||||
return FALSE
|
||||
|
||||
///Checks if the projectile can embed into someone
|
||||
/obj/projectile/proc/can_embed_into(atom/hit)
|
||||
return embedding && shrapnel_type && iscarbon(hit) && !HAS_TRAIT(hit, TRAIT_PIERCEIMMUNE)
|
||||
|
||||
#undef MOVES_HITSCAN
|
||||
#undef MUZZLE_EFFECT_PIXEL_INCREMENT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user