diff --git a/code/datums/statistics/entities/round_stats.dm b/code/datums/statistics/entities/round_stats.dm index f4b7bea10e43..7ff793336619 100644 --- a/code/datums/statistics/entities/round_stats.dm +++ b/code/datums/statistics/entities/round_stats.dm @@ -38,6 +38,9 @@ var/list/weapon_stats_list = list() // list of types /datum/entity/weapon_stats var/list/job_stats_list = list() // list of types /datum/entity/job_stats + /// A list of all player xenomorph deaths, type /datum/entity/xeno_death + var/list/xeno_deaths = list() + // nanoui data var/list/round_data = list() var/list/death_data = list() @@ -46,6 +49,7 @@ . = ..() QDEL_NULL(current_map) QDEL_LIST(death_stats_list) + QDEL_LIST(xeno_deaths) QDEL_LIST_ASSOC_VAL(castes_evolved) QDEL_LIST_ASSOC_VAL(abilities_used) QDEL_LIST_ASSOC_VAL(final_participants) @@ -365,13 +369,13 @@ var/stats = "" stats += "[SSticker.mode.round_finished]\n" stats += "Game mode: [game_mode]\n" - stats += "Map name: [current_map.name]\n" + stats += "Map name: [current_map.map_name]\n" stats += "Round time: [duration2text(round_length)]\n" stats += "End round player population: [end_round_player_population]\n" stats += "Total xenos spawned: [total_xenos_created]\n" - stats += "Total Preds spawned: [total_predators_spawned]\n" - stats += "Total Predaliens spawned: [total_predaliens]\n" + stats += "Total preds spawned: [total_predators_spawned]\n" + stats += "Total predaliens spawned: [total_predaliens]\n" stats += "Total humans spawned: [total_humans_created]\n" stats += "Xeno count during hijack: [xeno_count_during_hijack]\n" diff --git a/code/datums/statistics/entities/xeno_death.dm b/code/datums/statistics/entities/xeno_death.dm new file mode 100644 index 000000000000..e416e014182b --- /dev/null +++ b/code/datums/statistics/entities/xeno_death.dm @@ -0,0 +1,68 @@ +/datum/entity/xeno_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 hive this xeno was in + var/hive + /// What caste this xeno was + var/caste + /// What strain this xeno was, if any + var/strain + /// If this xeno was a leader or not + var/leader = FALSE + /// How many minutes the xeno had been alive for, rounded down + var/minutes_alive + /// Ckey of the player who died + var/ckey + /// How much damage this xeno took before dying + var/damage_taken + /// What killed this xeno ("m39 submachinegun") + var/killed_by + /// Round ID that this xeno died in + var/round_id + +/datum/entity/xeno_death/proc/load_data(mob/living/carbon/xenomorph/dead_xeno, datum/cause_data/death_cause) + map_name = SSmapping.configs[GROUND_MAP]?.map_name || "Unknown Map" + x = dead_xeno.x || -1 + y = dead_xeno.y || -1 + z = dead_xeno.z || -1 + death_minute = floor((world.time * 0.1) / 60) || -1 + hive = dead_xeno.hive.name || "Unknown Hive" + caste = dead_xeno.caste.caste_type || "Unknown" + strain = dead_xeno.strain?.name || "None" + leader = (dead_xeno in dead_xeno.hive.xeno_leader_list) + minutes_alive = floor(((world.time - dead_xeno.creation_time) * 0.1) / 60) || -1 + ckey = dead_xeno.ckey || dead_xeno.persistent_ckey || "" + damage_taken = dead_xeno.life_damage_taken_total || 0 + killed_by = strip_improper(death_cause.cause_name) || "Unknown" + round_id = GLOB.round_id || -1 + + SSticker?.mode?.round_stats?.xeno_deaths += src + save() + +/datum/entity_meta/xeno_death + entity_type = /datum/entity/xeno_death + table_name = "xeno_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, + "hive" = DB_FIELDTYPE_STRING_MEDIUM, + "caste" = DB_FIELDTYPE_STRING_MEDIUM, + "strain" = DB_FIELDTYPE_STRING_MEDIUM, + "leader" = DB_FIELDTYPE_INT, + "minutes_alive" = DB_FIELDTYPE_INT, + "ckey" = DB_FIELDTYPE_STRING_MEDIUM, + "damage_taken" = DB_FIELDTYPE_INT, + "killed_by" = DB_FIELDTYPE_STRING_MEDIUM, + "round_id" = DB_FIELDTYPE_INT, + ) diff --git a/code/modules/mob/living/carbon/xenomorph/Embryo.dm b/code/modules/mob/living/carbon/xenomorph/Embryo.dm index 9727e5cf623d..2c7e50043cad 100644 --- a/code/modules/mob/living/carbon/xenomorph/Embryo.dm +++ b/code/modules/mob/living/carbon/xenomorph/Embryo.dm @@ -348,7 +348,7 @@ if(!larva_embryo.ckey && larva_embryo.burrowable && loc && is_ground_level(loc.z) && (locate(/obj/structure/bed/nest) in loc) && hive.living_xeno_queen && hive.living_xeno_queen.z == loc.z) larva_embryo.visible_message(SPAN_XENODANGER("[larva_embryo] quickly burrows into the ground.")) if(GLOB.round_statistics && !larva_embryo.statistic_exempt) - GLOB.round_statistics.track_new_participant(faction, -1) // keep stats sane + GLOB.round_statistics.track_new_participant(faction, 0) // keep stats sane hive.stored_larva++ hive.hive_ui.update_burrowed_larva() qdel(larva_embryo) diff --git a/code/modules/mob/living/carbon/xenomorph/Evolution.dm b/code/modules/mob/living/carbon/xenomorph/Evolution.dm index 04f9f1f8d60e..7f5b70c53d12 100644 --- a/code/modules/mob/living/carbon/xenomorph/Evolution.dm +++ b/code/modules/mob/living/carbon/xenomorph/Evolution.dm @@ -141,6 +141,7 @@ GLOBAL_LIST_EMPTY(deevolved_ckeys) qdel(organ) //From there, the new xeno exists, hopefully var/mob/living/carbon/xenomorph/new_xeno = new M(get_turf(src), src) + new_xeno.creation_time = creation_time if(!istype(new_xeno)) //Something went horribly wrong! @@ -200,8 +201,7 @@ GLOBAL_LIST_EMPTY(deevolved_ckeys) new_xeno.client.mouse_pointer_icon = initial(new_xeno.client.mouse_pointer_icon) if(new_xeno.mind && GLOB.round_statistics) - GLOB.round_statistics.track_new_participant(new_xeno.faction, -1) //so an evolved xeno doesn't count as two. - + GLOB.round_statistics.track_new_participant(new_xeno.faction, 0) //so an evolved xeno doesn't count as two. SSround_recording.recorder.track_player(new_xeno) // We prevent de-evolved people from being tracked for the rest of the round relating to T1s in order to prevent people @@ -340,6 +340,7 @@ GLOBAL_LIST_EMPTY(deevolved_ckeys) var/level_to_switch_to = get_vision_level() var/xeno_type = GLOB.RoleAuthority.get_caste_by_text(newcaste) var/mob/living/carbon/xenomorph/new_xeno = new xeno_type(get_turf(src), src) + new_xeno.creation_time = creation_time if(!istype(new_xeno)) //Something went horribly wrong @@ -387,7 +388,7 @@ GLOBAL_LIST_EMPTY(deevolved_ckeys) new_xeno._status_traits = src._status_traits if(GLOB.round_statistics && !new_xeno.statistic_exempt) - GLOB.round_statistics.track_new_participant(faction, -1) //so an evolved xeno doesn't count as two. + GLOB.round_statistics.track_new_participant(faction, 0) //so an evolved xeno doesn't count as two. SSround_recording.recorder.stop_tracking(src) SSround_recording.recorder.track_player(new_xeno) diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index d9bce2abe394..6c5eb5ae8977 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -346,6 +346,8 @@ var/atom/movable/vis_obj/xeno_pack/backpack_icon_holder /// If TRUE, the xeno cannot slash anything var/cannot_slash = FALSE + /// The world.time when the xeno was created. Carries over between strains and evolving + var/creation_time = 0 /mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/old_xeno, hivenumber) if(old_xeno && old_xeno.hivenumber) @@ -504,6 +506,8 @@ if (hive && hive.hive_ui) hive.hive_ui.update_all_xeno_data() + creation_time = world.time + Decorate() RegisterSignal(src, COMSIG_MOB_SCREECH_ACT, PROC_REF(handle_screech_act)) diff --git a/code/modules/mob/living/carbon/xenomorph/death.dm b/code/modules/mob/living/carbon/xenomorph/death.dm index a2f739ff876a..492a159535d6 100644 --- a/code/modules/mob/living/carbon/xenomorph/death.dm +++ b/code/modules/mob/living/carbon/xenomorph/death.dm @@ -27,6 +27,9 @@ update_icons() if(!should_block_game_interaction(src)) //so xeno players don't get death messages from admin tests + var/datum/entity/xeno_death/death_log = SSentity_manager.tables[/datum/entity/xeno_death].make_new() + death_log.load_data(src, cause) + if(isqueen(src)) var/mob/living/carbon/xenomorph/queen/XQ = src playsound(loc, 'sound/voice/alien_queen_died.ogg', 75, 0) diff --git a/colonialmarines.dme b/colonialmarines.dme index 0dc5b477768c..5ff78ebca305 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -678,6 +678,7 @@ #include "code\datums\statistics\entities\round_caste_picks.dm" #include "code\datums\statistics\entities\round_stats.dm" #include "code\datums\statistics\entities\weapon_stats.dm" +#include "code\datums\statistics\entities\xeno_death.dm" #include "code\datums\statistics\entities\xeno_stats.dm" #include "code\datums\statistics\random_facts\christmas_fact.dm" #include "code\datums\statistics\random_facts\damage_fact.dm"