From 29df9487d494a33cee3b6ea4c5afe73180d5c7eb Mon Sep 17 00:00:00 2001 From: Ldip999 <60290575+Ldip999@users.noreply.github.com> Date: Tue, 9 Jul 2024 18:27:54 +0200 Subject: [PATCH] Tracks and rewards healing, repairing, and tanks killed in campaign (#16296) --- code/datums/personal_statistics.dm | 13 ++++++++++++- code/game/objects/obj_defense.dm | 1 + code/game/turfs/walls/walls.dm | 1 + code/modules/vehicles/armored/__armored.dm | 11 ++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/code/datums/personal_statistics.dm b/code/datums/personal_statistics.dm index e34ad294eaba7..da850b146d33f 100644 --- a/code/datums/personal_statistics.dm +++ b/code/datums/personal_statistics.dm @@ -39,7 +39,7 @@ GLOBAL_LIST_EMPTY(personal_statistics_list) var/melee_damage = 0 var/mechs_destroyed = 0 - + var/tanks_destroyed = 0 //We are watching var/friendly_fire_damage = 0 @@ -120,9 +120,12 @@ GLOBAL_LIST_EMPTY(personal_statistics_list) var/mission_objective_captured = 0 var/mission_objective_decaptured = 0 var/mission_mechs_destroyed = 0 + var/mission_tanks_destroyed = 0 var/mission_shrapnel_removed = 0 var/mission_traps_created = 0 var/mission_grenades_primed = 0 + var/mission_heals = 0 + var/mission_integrity_repaired = 0 /datum/personal_statistics/New() . = ..() @@ -309,9 +312,12 @@ GLOBAL_LIST_EMPTY(personal_statistics_list) mission_objective_captured = 0 mission_objective_decaptured = 0 mission_mechs_destroyed = 0 + mission_tanks_destroyed = 0 mission_shrapnel_removed = 0 mission_traps_created = 0 mission_grenades_primed = 0 + mission_heals = 0 + mission_integrity_repaired = 0 ///Returns the credit bonus based on stats from the current mission /datum/personal_statistics/proc/get_mission_reward() @@ -327,9 +333,12 @@ GLOBAL_LIST_EMPTY(personal_statistics_list) credit_bonus += mission_objective_captured * 20 credit_bonus += mission_objective_decaptured * 20 credit_bonus += mission_mechs_destroyed * 20 + credit_bonus += mission_tanks_destroyed * 50 credit_bonus += mission_shrapnel_removed * 3 credit_bonus += mission_traps_created * 4 credit_bonus += mission_grenades_primed * 2 + credit_bonus += mission_heals * 1 + credit_bonus += integrity_repaired * 0.1 return max(floor(credit_bonus), 0) @@ -428,6 +437,7 @@ The alternative is scattering them everywhere under their respective objects whi //If a receiving mob exists, we tally up to the user mob's stats that it performed a heal if(receiver) personal_statistics_user.heals++ + personal_statistics_user.mission_heals++ else personal_statistics_user.self_heals++ is_healing = TRUE @@ -445,6 +455,7 @@ The alternative is scattering them everywhere under their respective objects whi //If a receiving mob exists, we tally up to the user mob's stats that it performed a heal if(receiver) personal_statistics_user.heals++ + personal_statistics_user.mission_heals++ else personal_statistics_user.self_heals++ return TRUE diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 20d1b46f065f9..bde71c5b810bf 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -30,6 +30,7 @@ if(user?.client) var/datum/personal_statistics/personal_statistics = GLOB.personal_statistics_list[user.ckey] personal_statistics.integrity_repaired += repair_amount + personal_statistics.mission_integrity_repaired += repair_amount personal_statistics.times_repaired++ obj_integrity += repair_amount diff --git a/code/game/turfs/walls/walls.dm b/code/game/turfs/walls/walls.dm index 54e37281b8199..b09c176ccd57a 100644 --- a/code/game/turfs/walls/walls.dm +++ b/code/game/turfs/walls/walls.dm @@ -224,6 +224,7 @@ if(user?.client) var/datum/personal_statistics/personal_statistics = GLOB.personal_statistics_list[user.ckey] personal_statistics.integrity_repaired += repair_amount + personal_statistics.mission_integrity_repaired += repair_amount personal_statistics.times_repaired++ wall_integrity += repair_amount update_icon() diff --git a/code/modules/vehicles/armored/__armored.dm b/code/modules/vehicles/armored/__armored.dm index 2509a3cae5e61..db33498e27bde 100644 --- a/code/modules/vehicles/armored/__armored.dm +++ b/code/modules/vehicles/armored/__armored.dm @@ -154,11 +154,20 @@ if(Adjacent(entering_thing, src)) return list(get_turf(entering_thing)) -/obj/vehicle/sealed/armored/obj_destruction(damage_amount, damage_type, damage_flag) +/obj/vehicle/sealed/armored/obj_destruction(damage_amount, damage_type, damage_flag, mob/living/blame_mob) playsound(get_turf(src), SFX_EXPLOSION_LARGE, 100, TRUE) //destroy sound is normally very quiet new /obj/effect/temp_visual/explosion(get_turf(src), 7, LIGHT_COLOR_LAVA, FALSE, TRUE) for(var/mob/living/nearby_mob AS in occupants + cheap_get_living_near(src, 7)) shake_camera(nearby_mob, 4, 2) + if(istype(blame_mob) && blame_mob.ckey) + var/datum/personal_statistics/personal_statistics = GLOB.personal_statistics_list[blame_mob.ckey] + if(faction == blame_mob.faction) + personal_statistics.tanks_destroyed -- + personal_statistics.mission_tanks_destroyed -- + else + personal_statistics.tanks_destroyed ++ + personal_statistics.mission_tanks_destroyed ++ + return ..() /obj/vehicle/sealed/armored/update_icon_state()