diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm index 3d28fdd8116..bedfaf2fa03 100644 --- a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_x_act.dm @@ -14,7 +14,7 @@ #define COMSIG_ATOM_EMP_ACT "atom_emp_act" ///from base of atom/fire_act(): (exposed_temperature, exposed_volume) #define COMSIG_ATOM_FIRE_ACT "atom_fire_act" -///from base of atom/bullet_act(): (/obj/projectile, def_zone) +///from base of atom/bullet_act(): (/obj/proj, def_zone, piercing_hit, blocked) #define COMSIG_ATOM_PRE_BULLET_ACT "pre_atom_bullet_act" /// All this does is prevent default bullet on_hit from being called, [BULLET_ACT_HIT] being return is implied #define COMPONENT_BULLET_ACTED (1<<0) @@ -22,7 +22,7 @@ #define COMPONENT_BULLET_BLOCKED (1<<1) /// Forces bullet act to return [BULLET_ACT_FORCE_PIERCE], takes priority over above #define COMPONENT_BULLET_PIERCED (1<<2) -///from base of atom/bullet_act(): (/obj/projectile, def_zone) +///from base of atom/bullet_act(): (/obj/proj, def_zone, piercing_hit, blocked) #define COMSIG_ATOM_BULLET_ACT "atom_bullet_act" ///from base of atom/CheckParts(): (list/parts_list, datum/crafting_recipe/R) #define COMSIG_ATOM_CHECKPARTS "atom_checkparts" diff --git a/code/game/atom/atom_act.dm b/code/game/atom/atom_act.dm index 8565d790612..54f023eb86b 100644 --- a/code/game/atom/atom_act.dm +++ b/code/game/atom/atom_act.dm @@ -76,17 +76,32 @@ return protection // Pass the protection value collected here upwards /** - * React to a hit by a projectile object + * Wrapper for bullet_act used for atom-specific calculations, i.e. armor * * @params * * hitting_projectile - projectile * * def_zone - zone hit * * piercing_hit - is this hit piercing or normal? */ -/atom/proc/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE) + +/atom/proc/projectile_hit(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE, blocked = null) + if (isnull(blocked)) + blocked = check_projectile_armor(def_zone, hitting_projectile) + return bullet_act(hitting_projectile, def_zone, piercing_hit, blocked) + +/** + * React to a hit by a projectile object + * + * @params + * * hitting_projectile - projectile + * * def_zone - zone hit + * * piercing_hit - is this hit piercing or normal? + * * blocked - total armor value to apply to this hit + */ +/atom/proc/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE, blocked = 0) SHOULD_CALL_PARENT(TRUE) - var/sigreturn = SEND_SIGNAL(src, COMSIG_ATOM_PRE_BULLET_ACT, hitting_projectile, def_zone) + var/sigreturn = SEND_SIGNAL(src, COMSIG_ATOM_PRE_BULLET_ACT, hitting_projectile, def_zone, piercing_hit, blocked) if(sigreturn & COMPONENT_BULLET_PIERCED) return BULLET_ACT_FORCE_PIERCE if(sigreturn & COMPONENT_BULLET_BLOCKED) @@ -94,7 +109,7 @@ if(sigreturn & COMPONENT_BULLET_ACTED) return BULLET_ACT_HIT - SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, hitting_projectile, def_zone) + SEND_SIGNAL(src, COMSIG_ATOM_BULLET_ACT, hitting_projectile, def_zone, piercing_hit, blocked) if(QDELETED(hitting_projectile)) // Signal deleted it? return BULLET_ACT_BLOCK @@ -102,7 +117,7 @@ target = src, // This armor check only matters for the visuals and messages in on_hit(), it's not actually used to reduce damage since // only living mobs use armor to reduce damage, but on_hit() is going to need the value no matter what is shot. - blocked = check_projectile_armor(def_zone, hitting_projectile), + blocked = blocked, pierce_hit = piercing_hit, ) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index e6eb41c42e6..c8a3e10b8e9 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -293,7 +293,7 @@ mutate() return BULLET_ACT_HIT if(istype(proj, /obj/projectile/energy/flora/yield)) - return myseed.bullet_act(proj) + return myseed.projectile_hit(proj) if(istype(proj, /obj/projectile/energy/flora/evolution)) if(myseed) if(LAZYLEN(myseed.mutatelist)) diff --git a/code/modules/lost_crew/damages/projectile.dm b/code/modules/lost_crew/damages/projectile.dm index 121304ac9b5..64541cf1eaf 100644 --- a/code/modules/lost_crew/damages/projectile.dm +++ b/code/modules/lost_crew/damages/projectile.dm @@ -13,7 +13,7 @@ var/hits = ((max_hits - min_hits) * severity + min_hits) for(var/i in 1 to hits) - body.bullet_act(projectile, def_zone = pick(GLOB.all_body_zones), piercing_hit = TRUE) + body.projectile_hit(projectile, def_zone = pick(GLOB.all_body_zones), piercing_hit = TRUE) /datum/corpse_damage/cause_of_death/projectile/laser projectile = /obj/projectile/beam/laser diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 36c9182d32b..1a5e4b60ecc 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -60,7 +60,7 @@ playsound(src, held_item.block_sound, BLOCK_SOUND_VOLUME, TRUE) // Find a turf near or on the original location to bounce to if(!isturf(loc)) //Open canopy mech (ripley) check. if we're inside something and still got hit - return loc.bullet_act(bullet, def_zone, piercing_hit) + return loc.projectile_hit(bullet, def_zone, piercing_hit) bullet.reflect(src) return BULLET_ACT_FORCE_PIERCE // complete projectile permutation diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 71dc34b986f..230d0d9ab1c 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -91,12 +91,11 @@ /mob/living/proc/is_ears_covered() return null -/mob/living/bullet_act(obj/projectile/proj, def_zone, piercing_hit = FALSE) +/mob/living/bullet_act(obj/projectile/proj, def_zone, piercing_hit = FALSE, blocked = 0) . = ..() if (. != BULLET_ACT_HIT) return . - var/blocked = check_projectile_armor(def_zone, proj, is_silent = TRUE) if(blocked >= 100) if(proj.is_hostile_projectile()) apply_projectile_effects(proj, def_zone, blocked) diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 2d81fb6c3b5..763335d6728 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -187,6 +187,6 @@ // "Burn" damage is equally strong against internal components and exterior casing // "Brute" damage mostly damages the casing. /obj/machinery/modular_computer/bullet_act(obj/projectile/proj) - return cpu?.bullet_act(proj) || ..() + return cpu?.projectile_hit(proj) || ..() #undef CPU_INTERACTABLE diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index f5c62e1d059..c4c5d42164c 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -533,7 +533,7 @@ pierces += 1 // Targets should handle their impact logic on our own and if they decide that we hit them, they call our on_hit - var/result = target.bullet_act(src, def_zone, mode == PROJECTILE_PIERCE_HIT) + var/result = target.projectile_hit(src, def_zone, mode == PROJECTILE_PIERCE_HIT) if (result != BULLET_ACT_FORCE_PIERCE && max_pierces && pierces >= max_pierces) return PROJECTILE_IMPACT_SUCCESSFUL diff --git a/code/modules/surgery/organs/internal/eyes/_eyes.dm b/code/modules/surgery/organs/internal/eyes/_eyes.dm index fd6beabcb0d..0f7e229b24c 100644 --- a/code/modules/surgery/organs/internal/eyes/_eyes.dm +++ b/code/modules/surgery/organs/internal/eyes/_eyes.dm @@ -107,14 +107,13 @@ organ_owner.update_sight() UnregisterSignal(organ_owner, COMSIG_ATOM_BULLET_ACT) -/obj/item/organ/eyes/proc/on_bullet_act(mob/living/carbon/source, obj/projectile/proj, def_zone) +/obj/item/organ/eyes/proc/on_bullet_act(mob/living/carbon/source, obj/projectile/proj, def_zone, piercing_hit, blocked) SIGNAL_HANDLER // Once-a-dozen-rounds level of rare if (def_zone != BODY_ZONE_HEAD || !prob(proj.damage * 0.1) || !(proj.damage_type == BRUTE || proj.damage_type == BURN)) return - var/blocked = source.check_projectile_armor(def_zone, proj, is_silent = TRUE) if (blocked && source.is_eyes_covered()) if (!proj.armour_penetration || prob(blocked - proj.armour_penetration)) return diff --git a/code/modules/vehicles/atv.dm b/code/modules/vehicles/atv.dm index 6a472ccc31c..3840bfe0cd2 100644 --- a/code/modules/vehicles/atv.dm +++ b/code/modules/vehicles/atv.dm @@ -116,7 +116,7 @@ if(prob(50) || !LAZYLEN(buckled_mobs)) return ..() for(var/mob/buckled_mob as anything in buckled_mobs) - return buckled_mob.bullet_act(proj) + return buckled_mob.projectile_hit(proj) return ..() /obj/vehicle/ridden/atv/atom_destruction() diff --git a/code/modules/vehicles/mecha/combat/durand.dm b/code/modules/vehicles/mecha/combat/durand.dm index da1f7122dd1..1497c4c615d 100644 --- a/code/modules/vehicles/mecha/combat/durand.dm +++ b/code/modules/vehicles/mecha/combat/durand.dm @@ -84,7 +84,7 @@ //Redirects projectiles to the shield if defense_check decides they should be blocked and returns true. /obj/vehicle/sealed/mecha/durand/bullet_act(obj/projectile/source, def_zone, mode) if(defense_check(source.loc) && shield) - return shield.bullet_act(source, def_zone, mode) + return shield.projectile_hit(source, def_zone, mode) return ..() diff --git a/code/modules/vehicles/mecha/mecha_defense.dm b/code/modules/vehicles/mecha/mecha_defense.dm index f0fdc3997a3..d7f52915a4b 100644 --- a/code/modules/vehicles/mecha/mecha_defense.dm +++ b/code/modules/vehicles/mecha/mecha_defense.dm @@ -121,7 +121,7 @@ && !(mecha_flags & SILICON_PILOT) \ && (def_zone == BODY_ZONE_HEAD || def_zone == BODY_ZONE_CHEST)) var/mob/living/hitmob = pick(occupants) - return hitmob.bullet_act(hitting_projectile, def_zone, piercing_hit) //If the sides are open, the occupant can be hit + return hitmob.projectile_hit(hitting_projectile, def_zone, piercing_hit) //If the sides are open, the occupant can be hit . = ..() diff --git a/code/modules/vehicles/secway.dm b/code/modules/vehicles/secway.dm index 341167630af..6042210d01c 100644 --- a/code/modules/vehicles/secway.dm +++ b/code/modules/vehicles/secway.dm @@ -101,5 +101,5 @@ if(!buckled_mobs || prob(40)) return ..() for(var/mob/rider as anything in buckled_mobs) - return rider.bullet_act(proj) + return rider.projectile_hit(proj) return ..()