Skip to content

Commit

Permalink
TGS Test Merge (#8294)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Jan 31, 2025
2 parents 71f540b + 1b40968 commit 9fdcc1d
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 1 deletion.
81 changes: 81 additions & 0 deletions code/datums/statistics/entities/marine_death.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/datum/entity/marine_death
/// What map this death happened on
var/map_name
/// X coord of the death
var/x
/// Y coord of the death
var/y
/// Z coord of the death
var/z
/// What minute this death happened at, rounded down
var/death_minute
/// What role this marine was
var/role
/// How many minutes the marine had been alive for, rounded down
var/minutes_alive
/// Ckey of the player who died
var/ckey
/// How much damage this marine
var/damage_taken
/// What killed this marine ("Ravager")
var/killed_by
/// Round ID that this marine died in
var/round_id
/// The primary weapon (as best we can find) of the marine
var/primary_weapon
/// The armor the marine was wearing on death
var/armor
/// How many kills this marine got
var/kill_count
/// What squad this player belongs to, if any
var/squad

/datum/entity/marine_death/proc/load_data(mob/living/carbon/human/dead_marine, datum/cause_data/death_cause)
map_name = SSmapping.configs[GROUND_MAP]?.map_name || "Unknown Map"
x = dead_marine.x || -1
y = dead_marine.y || -1
z = dead_marine.z || -1
death_minute = floor((world.time * 0.1) / 60)
role = dead_marine.job
ckey = dead_marine.ckey || dead_marine.persistent_ckey || ""
damage_taken = dead_marine.life_damage_taken_total || 0
killed_by = strip_improper(death_cause?.cause_name) || "Unknown"
round_id = GLOB.round_id || -1
kill_count = dead_marine.life_kills_total || 0
if(isgun(dead_marine.s_store))
primary_weapon = strip_improper(dead_marine.s_store::name)
else if(isgun(dead_marine.back))
primary_weapon = strip_improper(dead_marine.back::name)
else
var/obj/item/weapon/gun/found_gun = locate(/obj/item/weapon/gun) in dead_marine.contents
if(found_gun)
primary_weapon = strip_improper(found_gun::name)

if(istype(dead_marine.wear_suit, /obj/item/clothing/suit))
armor = strip_improper(dead_marine.wear_suit::name)

if(dead_marine.assigned_squad)
squad = dead_marine.assigned_squad.name

SSticker?.mode?.round_stats?.marine_deaths += src
save()

/datum/entity_meta/marine_death
entity_type = /datum/entity/marine_death
table_name = "marine_deaths"
field_types = list(
"map_name" = DB_FIELDTYPE_STRING_MEDIUM,
"x" = DB_FIELDTYPE_INT,
"y" = DB_FIELDTYPE_INT,
"z" = DB_FIELDTYPE_INT,
"death_minute" = DB_FIELDTYPE_INT,
"role" = DB_FIELDTYPE_STRING_MEDIUM,
"ckey" = DB_FIELDTYPE_STRING_MEDIUM,
"damage_taken" = DB_FIELDTYPE_INT,
"killed_by" = DB_FIELDTYPE_STRING_MEDIUM,
"round_id" = DB_FIELDTYPE_INT,
"primary_weapon" = DB_FIELDTYPE_STRING_MEDIUM,
"armor" = DB_FIELDTYPE_STRING_MEDIUM,
"kill_count" = DB_FIELDTYPE_INT,
"squad" = DB_FIELDTYPE_STRING_SMALL,
)
4 changes: 4 additions & 0 deletions code/datums/statistics/entities/round_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
/// A list of all player xenomorph deaths, type /datum/entity/xeno_death
var/list/xeno_deaths = list()

/// A list of all marine deaths, type /datum/entity/marine_death
var/list/marine_deaths = list()

// nanoui data
var/list/round_data = list()
var/list/death_data = list()
Expand All @@ -50,6 +53,7 @@
QDEL_NULL(current_map)
QDEL_LIST(death_stats_list)
QDEL_LIST(xeno_deaths)
QDEL_LIST(marine_deaths)
QDEL_LIST_ASSOC_VAL(castes_evolved)
QDEL_LIST_ASSOC_VAL(abilities_used)
QDEL_LIST_ASSOC_VAL(final_participants)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/statistics/entities/xeno_death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
x = dead_xeno.x || -1
y = dead_xeno.y || -1
z = dead_xeno.z || -1
death_minute = floor((world.time * 0.1) / 60) || -1
death_minute = floor((world.time * 0.1) / 60)
hive = dead_xeno.hive.name || "Unknown Hive"
caste = dead_xeno.caste.caste_type || "Unknown"
strain = dead_xeno.strain?.name || "None"
Expand Down
4 changes: 4 additions & 0 deletions code/modules/mob/living/carbon/human/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@

give_action(src, /datum/action/ghost)

if(!should_block_game_interaction(src) && istype(SSticker.mode, /datum/game_mode/colonialmarines) && !(datum_flags & DF_VAR_EDITED) && ckey)
var/datum/entity/marine_death/death_entry = DB_ENTITY(/datum/entity/marine_death)
death_entry.load_data(src, cause)

if(!gibbed && species.death_sound)
playsound(loc, species.death_sound, 50, 1)

Expand Down
1 change: 1 addition & 0 deletions colonialmarines.dme
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@
#include "code\datums\statistics\entities\human_stats.dm"
#include "code\datums\statistics\entities\job_stats.dm"
#include "code\datums\statistics\entities\map_stats.dm"
#include "code\datums\statistics\entities\marine_death.dm"
#include "code\datums\statistics\entities\medal_stats.dm"
#include "code\datums\statistics\entities\panel_stats.dm"
#include "code\datums\statistics\entities\player_entity.dm"
Expand Down

0 comments on commit 9fdcc1d

Please sign in to comment.