From f7abfcd7e378f2bf1f28141d1cc69c5a3617b79b Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 9 Nov 2023 15:12:57 +0100 Subject: [PATCH 1/4] remove useless line since it was assign to the same value in their parent object. --- code/datums/ammo/bullet/pistol.dm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/code/datums/ammo/bullet/pistol.dm b/code/datums/ammo/bullet/pistol.dm index 8be63b0a15af..76f14f74e70b 100644 --- a/code/datums/ammo/bullet/pistol.dm +++ b/code/datums/ammo/bullet/pistol.dm @@ -97,7 +97,6 @@ // Used by M1911, Deagle and KT-42 /datum/ammo/bullet/pistol/heavy name = "heavy pistol bullet" - headshot_state = HEADSHOT_OVERLAY_MEDIUM accuracy = -HIT_ACCURACY_TIER_3 accuracy_var_low = PROJECTILE_VARIANCE_TIER_6 damage = 55 @@ -167,8 +166,6 @@ /datum/ammo/bullet/pistol/highpower name = "high-powered pistol bullet" - headshot_state = HEADSHOT_OVERLAY_MEDIUM - accuracy = HIT_ACCURACY_TIER_3 damage = 36 penetration = ARMOR_PENETRATION_TIER_5 @@ -177,7 +174,6 @@ // Used by VP78 and Auto 9 /datum/ammo/bullet/pistol/squash name = "squash-head pistol bullet" - headshot_state = HEADSHOT_OVERLAY_MEDIUM debilitate = list(0,0,0,0,0,0,0,2) accuracy = HIT_ACCURACY_TIER_4 From 38a3c00c5184432d2dd176ce2f73364421fd2bea Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 9 Nov 2023 15:15:17 +0100 Subject: [PATCH 2/4] added / to make it a proper comment of the variable --- code/datums/ammo/ammo.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/ammo/ammo.dm b/code/datums/ammo/ammo.dm index a858c6b1f5a7..ec0b33fc3509 100644 --- a/code/datums/ammo/ammo.dm +++ b/code/datums/ammo/ammo.dm @@ -1,6 +1,6 @@ /datum/ammo var/name = "generic bullet" - //Icon state when a human is permanently killed with it by execution/suicide. + /// Icon state when a human is permanently killed with it by execution/suicide. var/headshot_state = null var/icon = 'icons/obj/items/weapons/projectiles.dmi' var/icon_state = "bullet" From 9dd2e3c7d2293d689e54746d7151a03428454188 Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 9 Nov 2023 15:19:23 +0100 Subject: [PATCH 3/4] clean a bit code of revolver.dm and remove a line that was already set in is parent object --- code/datums/ammo/bullet/revolver.dm | 7 ------- 1 file changed, 7 deletions(-) diff --git a/code/datums/ammo/bullet/revolver.dm b/code/datums/ammo/bullet/revolver.dm index 633bf3e2f7ff..9c18eeb591d4 100644 --- a/code/datums/ammo/bullet/revolver.dm +++ b/code/datums/ammo/bullet/revolver.dm @@ -7,7 +7,6 @@ /datum/ammo/bullet/revolver name = "revolver bullet" headshot_state = HEADSHOT_OVERLAY_MEDIUM - damage = 55 penetration = ARMOR_PENETRATION_TIER_1 accuracy = HIT_ACCURACY_TIER_1 @@ -74,7 +73,6 @@ /datum/ammo/bullet/revolver/upp name = "heavy revolver bullet" - headshot_state = HEADSHOT_OVERLAY_MEDIUM penetration = ARMOR_PENETRATION_TIER_4 damage = 70 @@ -102,7 +100,6 @@ /datum/ammo/bullet/revolver/upp/shrapnel_bits name = "small shrapnel" icon_state = "shrapnelshot_bit" - max_range = 6 damage = 30 penetration = ARMOR_PENETRATION_TIER_4 @@ -113,22 +110,18 @@ /datum/ammo/bullet/revolver/small name = "small revolver bullet" headshot_state = HEADSHOT_OVERLAY_LIGHT - damage = 45 - penetration = ARMOR_PENETRATION_TIER_3 /datum/ammo/bullet/revolver/small/hollowpoint name = "small hollowpoint revolver bullet" headshot_state = HEADSHOT_OVERLAY_MEDIUM - damage = 75 // way too strong because it's hard to make a good balance between HP and normal with this system, but the damage falloff is really strong penetration = 0 damage_falloff = DAMAGE_FALLOFF_TIER_6 /datum/ammo/bullet/revolver/mateba name = ".454 heavy revolver bullet" - damage = 60 damage_var_low = PROJECTILE_VARIANCE_TIER_8 damage_var_high = PROJECTILE_VARIANCE_TIER_6 From 4ac67cd2019213f95b7bc2c849a4f44a9356546d Mon Sep 17 00:00:00 2001 From: Julien Date: Thu, 9 Nov 2023 15:34:32 +0100 Subject: [PATCH 4/4] trying to up one level of object to allow more weapon to do BE --- code/datums/ammo/ammo.dm | 60 +++++++++++++++++++++++++++++++ code/datums/ammo/bullet/bullet.dm | 59 ------------------------------ 2 files changed, 60 insertions(+), 59 deletions(-) diff --git a/code/datums/ammo/ammo.dm b/code/datums/ammo/ammo.dm index ec0b33fc3509..aed85505a2e8 100644 --- a/code/datums/ammo/ammo.dm +++ b/code/datums/ammo/ammo.dm @@ -244,3 +244,63 @@ var/datum/reagent/R = new flamer_reagent_type() new /obj/flamer_fire(T, cause_data, R) + +//battle execution code. +// handle battlefield execution check if BE can be executed +/datum/ammo/proc/handle_battlefield_execution(datum/ammo/firing_ammo, mob/living/hit_mob, obj/projectile/firing_projectile, mob/living/user, obj/item/weapon/gun/fired_from) + SIGNAL_HANDLER + + if(!user || hit_mob == user || user.zone_selected != "head" || user.a_intent != INTENT_HARM || !ishuman_strict(hit_mob)) + return + + if(!skillcheck(user, SKILL_EXECUTION, SKILL_EXECUTION_TRAINED)) + to_chat(user, SPAN_DANGER("You don't know how to execute someone correctly.")) + return + + var/mob/living/carbon/human/execution_target = hit_mob + + if(execution_target.status_flags & PERMANENTLY_DEAD) + to_chat(user, SPAN_DANGER("[execution_target] has already been executed!")) + return + + INVOKE_ASYNC(src, PROC_REF(attempt_battlefield_execution), src, execution_target, firing_projectile, user, fired_from) + + return COMPONENT_CANCEL_AMMO_POINT_BLANK + +/datum/ammo/proc/attempt_battlefield_execution(datum/ammo/firing_ammo, mob/living/carbon/human/execution_target, obj/projectile/firing_projectile, mob/living/user, obj/item/weapon/gun/fired_from) + user.affected_message(execution_target, + SPAN_HIGHDANGER("You aim \the [fired_from] at [execution_target]'s head!"), + SPAN_HIGHDANGER("[user] aims \the [fired_from] directly at your head!"), + SPAN_DANGER("[user] aims \the [fired_from] at [execution_target]'s head!")) + + user.next_move += 1.1 SECONDS //PB has no click delay; readding it here to prevent people accidentally queuing up multiple executions. + + if(!do_after(user, 1 SECONDS, INTERRUPT_ALL, BUSY_ICON_HOSTILE) || !user.Adjacent(execution_target)) + fired_from.delete_bullet(firing_projectile, TRUE) + return + + if(!(fired_from.flags_gun_features & GUN_SILENCED)) + playsound(user, fired_from.fire_sound, fired_from.firesound_volume, FALSE) + else + playsound(user, fired_from.fire_sound, 25, FALSE) + + shake_camera(user, 1, 2) + + execution_target.apply_damage(damage * 3, BRUTE, "head", no_limb_loss = TRUE, permanent_kill = TRUE) //Apply gobs of damage and make sure they can't be revived later... + execution_target.apply_damage(200, OXY) //...fill out the rest of their health bar with oxyloss... + execution_target.death(create_cause_data("execution", user)) //...make certain they're properly dead... + shake_camera(execution_target, 3, 4) + execution_target.update_headshot_overlay(headshot_state) //...and add a gory headshot overlay. + + execution_target.visible_message(SPAN_HIGHDANGER(uppertext("[execution_target] WAS EXECUTED!")), \ + SPAN_HIGHDANGER("You WERE EXECUTED!")) + + user.count_niche_stat(STATISTICS_NICHE_EXECUTION, 1, firing_projectile.weapon_cause_data?.cause_name) + + var/area/execution_area = get_area(execution_target) + + msg_admin_attack(FONT_SIZE_HUGE("[key_name(usr)] has battlefield executed [key_name(execution_target)] in [get_area(usr)] ([usr.loc.x],[usr.loc.y],[usr.loc.z])."), usr.loc.x, usr.loc.y, usr.loc.z) + log_attack("[key_name(usr)] battlefield executed [key_name(execution_target)] at [execution_area.name].") + + if(flags_ammo_behavior & AMMO_EXPLOSIVE) + execution_target.gib() diff --git a/code/datums/ammo/bullet/bullet.dm b/code/datums/ammo/bullet/bullet.dm index dadb644201df..8795e8d91759 100644 --- a/code/datums/ammo/bullet/bullet.dm +++ b/code/datums/ammo/bullet/bullet.dm @@ -20,62 +20,3 @@ shrapnel_chance = SHRAPNEL_CHANCE_TIER_1 shrapnel_type = /obj/item/shard/shrapnel shell_speed = AMMO_SPEED_TIER_4 - -/datum/ammo/bullet/proc/handle_battlefield_execution(datum/ammo/firing_ammo, mob/living/hit_mob, obj/projectile/firing_projectile, mob/living/user, obj/item/weapon/gun/fired_from) - SIGNAL_HANDLER - - if(!user || hit_mob == user || user.zone_selected != "head" || user.a_intent != INTENT_HARM || !ishuman_strict(hit_mob)) - return - - if(!skillcheck(user, SKILL_EXECUTION, SKILL_EXECUTION_TRAINED)) - to_chat(user, SPAN_DANGER("You don't know how to execute someone correctly.")) - return - - var/mob/living/carbon/human/execution_target = hit_mob - - if(execution_target.status_flags & PERMANENTLY_DEAD) - to_chat(user, SPAN_DANGER("[execution_target] has already been executed!")) - return - - INVOKE_ASYNC(src, PROC_REF(attempt_battlefield_execution), src, execution_target, firing_projectile, user, fired_from) - - return COMPONENT_CANCEL_AMMO_POINT_BLANK - -/datum/ammo/bullet/proc/attempt_battlefield_execution(datum/ammo/firing_ammo, mob/living/carbon/human/execution_target, obj/projectile/firing_projectile, mob/living/user, obj/item/weapon/gun/fired_from) - user.affected_message(execution_target, - SPAN_HIGHDANGER("You aim \the [fired_from] at [execution_target]'s head!"), - SPAN_HIGHDANGER("[user] aims \the [fired_from] directly at your head!"), - SPAN_DANGER("[user] aims \the [fired_from] at [execution_target]'s head!")) - - user.next_move += 1.1 SECONDS //PB has no click delay; readding it here to prevent people accidentally queuing up multiple executions. - - if(!do_after(user, 1 SECONDS, INTERRUPT_ALL, BUSY_ICON_HOSTILE) || !user.Adjacent(execution_target)) - fired_from.delete_bullet(firing_projectile, TRUE) - return - - if(!(fired_from.flags_gun_features & GUN_SILENCED)) - playsound(user, fired_from.fire_sound, fired_from.firesound_volume, FALSE) - else - playsound(user, fired_from.fire_sound, 25, FALSE) - - shake_camera(user, 1, 2) - - execution_target.apply_damage(damage * 3, BRUTE, "head", no_limb_loss = TRUE, permanent_kill = TRUE) //Apply gobs of damage and make sure they can't be revived later... - execution_target.apply_damage(200, OXY) //...fill out the rest of their health bar with oxyloss... - execution_target.death(create_cause_data("execution", user)) //...make certain they're properly dead... - shake_camera(execution_target, 3, 4) - execution_target.update_headshot_overlay(headshot_state) //...and add a gory headshot overlay. - - execution_target.visible_message(SPAN_HIGHDANGER(uppertext("[execution_target] WAS EXECUTED!")), \ - SPAN_HIGHDANGER("You WERE EXECUTED!")) - - user.count_niche_stat(STATISTICS_NICHE_EXECUTION, 1, firing_projectile.weapon_cause_data?.cause_name) - - var/area/execution_area = get_area(execution_target) - - msg_admin_attack(FONT_SIZE_HUGE("[key_name(usr)] has battlefield executed [key_name(execution_target)] in [get_area(usr)] ([usr.loc.x],[usr.loc.y],[usr.loc.z])."), usr.loc.x, usr.loc.y, usr.loc.z) - log_attack("[key_name(usr)] battlefield executed [key_name(execution_target)] at [execution_area.name].") - - if(flags_ammo_behavior & AMMO_EXPLOSIVE) - execution_target.gib() -