Skip to content

Commit

Permalink
Tracks and rewards healing, repairing, and tanks killed in campaign (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldip999 committed Jul 9, 2024
1 parent f5606c1 commit 29df948
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion code/datums/personal_statistics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
. = ..()
Expand Down Expand Up @@ -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()
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/obj_defense.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions code/game/turfs/walls/walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 10 additions & 1 deletion code/modules/vehicles/armored/__armored.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 29df948

Please sign in to comment.