From fb3e0d3a35abb396dfbd52a75bd1e39cef240a05 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 15:45:46 +0500 Subject: [PATCH 01/69] b1 --- code/__DEFINES/misc.dm | 51 -- code/__DEFINES/statistic.dm | 89 ++ code/__DEFINES/stats.dm | 14 - code/__DEFINES/subsystems.dm | 9 +- code/_globalvars/global_lists.dm | 2 + code/controllers/subsystem/influxstats.dm | 3 +- code/controllers/subsystem/perf_logging.dm | 29 +- code/controllers/subsystem/playtime.dm | 37 +- code/datums/ammo/bullet/bullet.dm | 2 +- code/datums/components/disk_reader.dm | 2 +- code/datums/elements/suturing.dm | 1 + code/datums/entities/player.dm | 9 + code/datums/entities/player_times.dm | 2 +- code/datums/medal_awards.dm | 16 +- code/datums/mind.dm | 20 - .../datums/statistics/entities/caste_stats.dm | 24 - .../datums/statistics/entities/death_stats.dm | 127 ++- .../datums/statistics/entities/human_stats.dm | 415 --------- code/datums/statistics/entities/job_stats.dm | 8 - code/datums/statistics/entities/map_stats.dm | 26 +- .../datums/statistics/entities/medal_stats.dm | 103 +-- .../datums/statistics/entities/panel_stats.dm | 834 +++--------------- .../statistics/entities/player_entity.dm | 268 +++++- .../datums/statistics/entities/player_save.dm | 330 ------- .../statistics/entities/player_stats.dm | 464 ++++++---- .../datums/statistics/entities/round_stats.dm | 346 +++----- .../statistics/entities/weapon_stats.dm | 49 - code/datums/statistics/entities/xeno_stats.dm | 171 ---- code/game/gamemodes/cm_initialize.dm | 5 +- .../colonialmarines/colonialmarines.dm | 85 +- .../gamemodes/colonialmarines/huntergames.dm | 3 - .../colonialmarines/whiskey_outpost.dm | 89 +- .../gamemodes/colonialmarines/xenovsxeno.dm | 43 +- code/game/gamemodes/game_mode.dm | 83 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/machinery/doors/runed_sandstone.dm | 2 +- code/game/machinery/fusion_engine.dm | 1 + .../objects/items/devices/defibrillator.dm | 1 + .../items/explosives/grenades/grenade.dm | 2 +- code/game/objects/items/fulton.dm | 2 +- code/game/objects/items/handcuffs.dm | 2 +- code/game/objects/items/legcuffs.dm | 2 +- .../objects/items/reagent_containers/pill.dm | 2 +- code/game/objects/items/stacks/cable_coil.dm | 1 + code/game/objects/items/stacks/medical.dm | 2 + code/game/objects/items/weapons/blades.dm | 4 +- .../objects/structures/barricade/barricade.dm | 4 +- .../structures/barricade/deployable.dm | 2 +- .../objects/structures/barricade/metal.dm | 4 +- code/game/objects/structures/window.dm | 19 +- code/game/supplyshuttle.dm | 2 +- code/game/turfs/walls/walls.dm | 2 +- code/modules/client/client_defines.dm | 2 - code/modules/cm_marines/overwatch.dm | 4 +- code/modules/cm_tech/implements/ammo_kits.dm | 2 + code/modules/cm_tech/implements/engi_czsp.dm | 1 + code/modules/cm_tech/implements/implants.dm | 16 + .../desert_dam/motion_sensor/sensortower.dm | 1 + code/modules/mob/emote.dm | 2 + code/modules/mob/living/carbon/carbon.dm | 2 +- .../living/carbon/human/human_attackhand.dm | 2 +- .../xenomorph/abilities/general_powers.dm | 1 + .../carbon/xenomorph/abilities/xeno_action.dm | 7 +- .../carbon/xenomorph/castes/Facehugger.dm | 5 +- .../mob/living/simple_animal/friendly/cat.dm | 2 +- .../living/simple_animal/friendly/corgi.dm | 2 +- .../simple_animal/friendly/farm_animals.dm | 4 +- code/modules/objectives/data_retrieval.dm | 2 +- code/modules/power/apc.dm | 2 +- .../chemistry_machinery/reagent_analyzer.dm | 2 +- .../shuttle/shuttles/crashable/lifeboats.dm | 1 + code/modules/shuttles/shuttle_console.dm | 4 +- code/modules/surgery/amputation.dm | 4 +- code/modules/surgery/bones.dm | 2 +- code/modules/surgery/brainrepair.dm | 2 +- code/modules/surgery/chestburster.dm | 2 +- code/modules/surgery/eye.dm | 2 +- code/modules/surgery/implant.dm | 6 +- code/modules/surgery/internal_bleeding.dm | 2 +- code/modules/surgery/organs_internal.dm | 6 +- .../surgery/robotic_organs_internal.dm | 2 +- colonialmarines.dme | 8 +- tgui/packages/tgui/interfaces/Playtime.tsx | 138 ++- 83 files changed, 1444 insertions(+), 2609 deletions(-) create mode 100644 code/__DEFINES/statistic.dm delete mode 100644 code/__DEFINES/stats.dm delete mode 100644 code/datums/statistics/entities/caste_stats.dm delete mode 100644 code/datums/statistics/entities/human_stats.dm delete mode 100644 code/datums/statistics/entities/job_stats.dm delete mode 100644 code/datums/statistics/entities/player_save.dm delete mode 100644 code/datums/statistics/entities/weapon_stats.dm delete mode 100644 code/datums/statistics/entities/xeno_stats.dm diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index cf6d6c64d9a9..4f1bbe998e47 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -185,60 +185,9 @@ #define EMERGENCY_PLATE_OD_WARNING 1 #define EMERGENCY_PLATE_ADJUSTED_WARNING 2 - // RESEARCH UPGRADES DEFINES END -// Statistics defines -#define STATISTIC_XENO "xeno" -#define STATISTIC_HUMAN "human" - -#define STATISTICS_DEATH_LIST_LEN 10 - -#define STATISTICS_NICHE_EXECUTION "Executions Made" -#define STATISTICS_NICHE_MEDALS "Medals Received" -#define STATISTICS_NICHE_MEDALS_GIVE "Medals Given" -#define STATISTICS_NICHE_SHOCK "Times Shocked" -#define STATISTICS_NICHE_GRENADES "Grenades Thrown" -#define STATISTICS_NICHE_FLIGHT "Flights Piloted" -#define STATISTICS_NICHE_HANDCUFF "Handcuffs Applied" -#define STATISTICS_NICHE_PILLS "Pills Fed" -#define STATISTICS_NICHE_DISCHARGE "Accidental Discharges" -#define STATISTICS_NICHE_FULTON "Fultons Deployed" -#define STATISTICS_NICHE_DISK "Disks Decrypted" -#define STATISTICS_NICHE_UPLOAD "Data Uploaded" -#define STATISTICS_NICHE_CHEMS "Chemicals Discovered" -#define STATISTICS_NICHE_CRATES "Supplies Airdropped" -#define STATISTICS_NICHE_OB "Bombardments Fired" - -#define STATISTICS_NICHE_CADES "Barricades Built" -#define STATISTICS_NICHE_UPGRADE_CADES "Barricades Upgraded" -#define STATISTICS_NICHE_REPAIR_CADES "Barricades Repaired" -#define STATISTICS_NICHE_REPAIR_GENERATOR "Generators Repaired" -#define STATISTICS_NICHE_REPAIR_APC "APCs Repaired" -#define STATISTICS_NICHE_DEFENSES_BUILT "Defenses Built" - -#define STATISTICS_NICHE_CORGI "Corgis Murdered" -#define STATISTICS_NICHE_CAT "Cats Murdered" -#define STATISTICS_NICHE_COW "Cows Murdered" -#define STATISTICS_NICHE_CHICKEN "Chickens Murdered" - -#define STATISTICS_NICHE_SURGERY_BONES "Bones Mended" -#define STATISTICS_NICHE_SURGERY_IB "Internal Bleedings Stopped" -#define STATISTICS_NICHE_SURGERY_BRAIN "Brains Mended" -#define STATISTICS_NICHE_SURGERY_EYE "Eyes Mended" -#define STATISTICS_NICHE_SURGERY_LARVA "Larvae Removed" -#define STATISTICS_NICHE_SURGERY_SHRAPNEL "Shrapnel Removed" -#define STATISTICS_NICHE_SURGERY_AMPUTATE "Limbs Amputated" -#define STATISTICS_NICHE_SURGERY_ORGAN_REPAIR "Organs Repaired" -#define STATISTICS_NICHE_SURGERY_ORGAN_ATTACH "Organs Implanted" -#define STATISTICS_NICHE_SURGERY_ORGAN_REMOVE "Organs Harvested" - -#define STATISTICS_NICHE_DESTRUCTION_WALLS "Walls Destroyed" -#define STATISTICS_NICHE_DESTRUCTION_DOORS "Doors Destroyed" -#define STATISTICS_NICHE_DESTRUCTION_WINDOWS "Windows Destroyed" - //Multiplier for turning points into cash -#define DEFCON_TO_MONEY_MULTIPLIER 10000 #define SUPPLY_TO_MONEY_MUPLTIPLIER 100 //Force the config directory to be something other than "config" diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm new file mode 100644 index 000000000000..3351e9119fe6 --- /dev/null +++ b/code/__DEFINES/statistic.dm @@ -0,0 +1,89 @@ +#define get_client_stat(client, stat) (client.player_data ? LAZYACCESS(client.player_data.stats, stat) ? client.player_data.stats[stat].stat_number : 0 : 0) + +#define FACEHUG_TIER_1 5 +#define FACEHUG_TIER_2 25 +#define FACEHUG_TIER_3 100 +#define FACEHUG_TIER_4 1000 + +// Statistics defines +#define STATISTIC_TYPE_MISC "Misc" +#define STATISTIC_TYPE_CASTE "Caste" +#define STATISTIC_TYPE_CASTE_ABILITIES "Caste Abilities" +#define STATISTIC_TYPE_JOB "Role" +#define STATISTIC_TYPE_WEAPON "Weapon" + +#define STATISTICS_DEATH_LIST_LEN 20 + +#define STATISTICS_FF_SHOT_HIT "FF Shot Hit" +#define STATISTICS_SHOT_HIT "Shot Hit" +#define STATISTICS_SHOT "Shot" +#define STATISTICS_DAMAGE "Damage" +#define STATISTICS_FF_DAMAGE "FF Damage" +#define STATISTICS_HEALED_DAMAGE "Healed Damage" +#define STATISTICS_SCREAM "Scream" +#define STATISTICS_HIT "Hit" +#define STATISTICS_FF_HIT "FF Hit" +#define STATISTICS_SLASH "Slash" +#define STATISTICS_REVIVE "Revive" +#define STATISTICS_REVIVED "Revived" +#define STATISTICS_STEPS_WALKED "Steps" +#define STATISTICS_KILL "Kill" +#define STATISTICS_DEATH "Death" +#define STATISTICS_KILL_FF "Kill FF" +#define STATISTICS_DEATH_FF "Death FF" +#define STATISTICS_ROUNDS_PLAYED "Rounds Played" + +#define STATISTICS_ABILITES "Abilites" +#define STATISTICS_FACEHUGGE "Facehugge" +#define STATISTIC_XENO_STRUCTURES_BUILD "Builded" + +#define STATISTICS_EXECUTION "Executions Made" +#define STATISTICS_MEDALS "Medals Received" +#define STATISTICS_MEDALS_GIVE "Medals Given" +#define STATISTICS_SHOCK "Times Shocked" +#define STATISTICS_GRENADES "Grenades Thrown" +#define STATISTICS_FLIGHT "Flights Piloted" +#define STATISTICS_HANDCUFF "Handcuffs Applied" +#define STATISTICS_PILLS "Pills Fed" +#define STATISTICS_DISCHARGE "Accidental Discharges" +#define STATISTICS_FULTON "Fultons Deployed" +#define STATISTICS_DISK "Disks Decrypted" +#define STATISTICS_UPLOAD "Data Uploaded" +#define STATISTICS_CHEMS "Chemicals Discovered" +#define STATISTICS_CRATES "Supplies Airdropped" +#define STATISTICS_OB "Bombardments Fired" +#define STATISTICS_AMMO_CONVERTED "Ammo Converted" +#define STATISTICS_IMPLANTS_IMPLANTED "Implants Implanted" +#define STATISTICS_REVIVED_BY_IMPLANT "Revive Implant Saved Lifes" +#define STATISTICS_SD_ACTIVATION "SD Activated" // OOD +#define STATISTICS_SACRIFICE "Sacrificed" // OOD +#define STATISTICS_ESCAPE "Escaped" + +#define STATISTICS_CADES "Barricades Built" +#define STATISTICS_UPGRADE_CADES "Barricades Upgraded" +#define STATISTICS_REPAIR_CADES "Barricades Repaired" +#define STATISTICS_REPAIR_GENERATOR "Generators Repaired" +#define STATISTICS_UPGRADE_TURRETS "Defenses Upgraded" +#define STATISTICS_REPAIR_APC "APCs Repaired" +#define STATISTICS_DEFENSES_BUILT "Defenses Built" + +#define STATISTICS_CORGI "Corgis Murdered" +#define STATISTICS_CAT "Cats Murdered" +#define STATISTICS_COW "Cows Murdered" +#define STATISTICS_CHICKEN "Chickens Murdered" + +#define STATISTICS_SURGERY_BONES "Bones Mended" +#define STATISTICS_SURGERY_IB "Internal Bleedings Stopped" +#define STATISTICS_SURGERY_BRAIN "Brains Mended" +#define STATISTICS_SURGERY_EYE "Eyes Mended" +#define STATISTICS_SURGERY_LARVA "Larvae Removed" +#define STATISTICS_SURGERY_NECRO "Necro Limbs Fixed" +#define STATISTICS_SURGERY_SHRAPNEL "Shrapnel Removed" +#define STATISTICS_SURGERY_AMPUTATE "Limbs Amputated" +#define STATISTICS_SURGERY_ORGAN_REPAIR "Organs Repaired" +#define STATISTICS_SURGERY_ORGAN_ATTACH "Organs Implanted" +#define STATISTICS_SURGERY_ORGAN_REMOVE "Organs Harvested" + +#define STATISTICS_DESTRUCTION_WALLS "Walls Destroyed" +#define STATISTICS_DESTRUCTION_DOORS "Doors Destroyed" +#define STATISTICS_DESTRUCTION_WINDOWS "Windows Destroyed" diff --git a/code/__DEFINES/stats.dm b/code/__DEFINES/stats.dm deleted file mode 100644 index 1810d01e1d93..000000000000 --- a/code/__DEFINES/stats.dm +++ /dev/null @@ -1,14 +0,0 @@ -#define get_client_stat(client, stat) (client.player_data ? LAZYACCESS(client.player_data.stats, stat) ? client.player_data.stats[stat].stat_number : 0 : 0) - -// Stat IDs -#define PLAYER_STAT_FACEHUGS "facehugs" - -#define FACEHUG_TIER_1 5 -#define FACEHUG_TIER_2 25 -#define FACEHUG_TIER_3 100 -#define FACEHUG_TIER_4 1000 - -// Stat Categories -#define STAT_CATEGORY_MARINE "marine" -#define STAT_CATEGORY_XENO "xeno" -#define STAT_CATEGORY_YAUTJA "yautja" diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 88496c79d630..4e8c18ce42f6 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -114,6 +114,12 @@ #define SS_INIT_TOPIC 83 #define SS_INIT_LOBBYART 82 #define SS_INIT_INFLUXDRIVER 28 +// Do not break this braket +#define SS_INIT_DATABASE 27.9 +#define SS_INIT_ENTITYMANAGER 27.8 +#define SS_INIT_PREF_LOGGING 27.7 +#define SS_INIT_PLAYTIME 27.6 +// Do not break this braket #define SS_INIT_GARBAGE 24 #define SS_INIT_EVENTS 23.5 #define SS_INIT_HIJACK 22.6 @@ -144,9 +150,6 @@ #define SS_INIT_ASSETS -20 #define SS_INIT_TICKER -21 #define SS_INIT_VOTE -23 -#define SS_INIT_DATABASE -27 -#define SS_INIT_ENTITYMANAGER -28 -#define SS_INIT_PLAYTIME -29 #define SS_INIT_STICKY -30 #define SS_INIT_PREDSHIPS -31 #define SS_INIT_OBJECTIVES -32 diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index c6957eefd22c..b6b8f0c16c9c 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -56,6 +56,8 @@ GLOBAL_LIST_EMPTY(cached_maps) GLOB.minimap_icons = base64_icons +GLOBAL_DATUM(round_statistics, /datum/entity/statistic_round) +GLOBAL_LIST_EMPTY_TYPED(player_entities, /datum/player_entity) // Xeno stuff // // Resin constructions parameters diff --git a/code/controllers/subsystem/influxstats.dm b/code/controllers/subsystem/influxstats.dm index 066c94cc2593..0362a689704b 100644 --- a/code/controllers/subsystem/influxstats.dm +++ b/code/controllers/subsystem/influxstats.dm @@ -59,13 +59,14 @@ SUBSYSTEM_DEF(influxstats) SSinfluxdriver.enqueue_stats("burst_larva", list("hive" = hive.reporting_id), list("count" = burst_larvas)) /datum/controller/subsystem/influxstats/proc/run_round_statistics() - var/datum/entity/statistic/round/stats = SSticker?.mode?.round_stats + var/datum/entity/statistic_round/stats = GLOB.round_statistics if(!stats) return // Sadge SSinfluxdriver.enqueue_stats_crude("chestbursts", stats.total_larva_burst) SSinfluxdriver.enqueue_stats_crude("hugged", stats.total_huggers_applied) SSinfluxdriver.enqueue_stats_crude("friendlyfire", stats.total_friendly_fire_instances) + SSinfluxdriver.enqueue_stats_crude("friendlykills", stats.total_friendly_kills) var/list/participants = flatten_entity_list(stats.participants) if(length(participants)) diff --git a/code/controllers/subsystem/perf_logging.dm b/code/controllers/subsystem/perf_logging.dm index 4a3066b758ba..cf530bdd4cdf 100644 --- a/code/controllers/subsystem/perf_logging.dm +++ b/code/controllers/subsystem/perf_logging.dm @@ -1,7 +1,10 @@ +#define WAIT_SSPERFLOGGING_READY while(!SSperf_logging.round) {stoplag();} + SUBSYSTEM_DEF(perf_logging) name = "Perf Logging" wait = 60 SECONDS - flags = SS_NO_INIT | SS_KEEP_TIMING + init_order = SS_INIT_PREF_LOGGING + flags = SS_KEEP_TIMING priority = SS_PRIORITY_PERFLOGGING var/datum/entity/mc_round/round var/list/datum/entity/mc_controller/controller_assoc = list() @@ -9,14 +12,11 @@ SUBSYSTEM_DEF(perf_logging) var/ord = 0 // Amount of measurements var/tcost = 0 // Total cost for current tick +/datum/controller/subsystem/perf_logging/Initialize(timeofday) + start_logging() + return SS_INIT_SUCCESS + /datum/controller/subsystem/perf_logging/fire(resumed = FALSE) - if(SSticker?.current_state < GAME_STATE_PLAYING) - return // Not started yet - if(!SSentity_manager?.ready) - return // DB not ready - if(!round) // Init - start_logging() - return if(!resumed) ord++ tcost = 0 @@ -26,8 +26,8 @@ SUBSYSTEM_DEF(perf_logging) if(SS?.cost > 0.1) currentrun += SS - while(length(currentrun)) - var/datum/controller/subsystem/SS = currentrun[length(currentrun)] + while(currentrun.len) + var/datum/controller/subsystem/SS = currentrun[currentrun.len] currentrun.len-- var/datum/entity/mc_controller/C = controller_assoc[SS.type] new_record(SS, C) @@ -39,15 +39,18 @@ SUBSYSTEM_DEF(perf_logging) /// Setup to begin performance logging when game starts /datum/controller/subsystem/perf_logging/proc/start_logging() SHOULD_NOT_SLEEP(TRUE) - var/datum/map_config/ground = SSmapping.configs[GROUND_MAP] - if(!ground) return + var/datum/map_config/ground = SSmapping.configs?[GROUND_MAP] + if(!ground) + return ord = 0 round = SSentity_manager.round round.map_name = ground.map_name + round.save() var/datum/entity/mc_controller/C for(var/datum/controller/subsystem/SS in Master.subsystems) C = SSentity_manager.select_by_key(/datum/entity/mc_controller, "[SS.type]") - if(!C) continue + if(!C) + continue C.wait_time = SS.wait C.save() controller_assoc[SS.type] = C diff --git a/code/controllers/subsystem/playtime.dm b/code/controllers/subsystem/playtime.dm index 6813c4fabd78..cc470c5f00b2 100644 --- a/code/controllers/subsystem/playtime.dm +++ b/code/controllers/subsystem/playtime.dm @@ -1,11 +1,46 @@ SUBSYSTEM_DEF(playtime) name = "Playtime" wait = 1 MINUTES + init_order = SS_INIT_PLAYTIME priority = SS_PRIORITY_PLAYTIME - flags = SS_NO_INIT | SS_KEEP_TIMING + flags = SS_KEEP_TIMING + var/list/best_playtimes = list() var/list/currentrun = list() +/datum/controller/subsystem/playtime/Initialize() + get_best_playtimes() + return SS_INIT_SUCCESS + +/datum/controller/subsystem/playtime/proc/get_best_playtimes() + set waitfor = FALSE + set background = TRUE + + WAIT_DB_READY + + var/list/datum/view_record/playtime/PTs = DB_VIEW(/datum/view_record/playtime) + var/list/real_best_playtimes = list() + for(var/datum/view_record/playtime/PT as anything in PTs) + CHECK_TICK + if(!(PT.role_id in real_best_playtimes)) + real_best_playtimes[PT.role_id] = list(PT.total_minutes, PT) + continue + if(real_best_playtimes[PT.role_id][1] > PT.total_minutes) + continue + real_best_playtimes[PT.role_id] = list(PT.total_minutes, PT) + + for(var/role_name in real_best_playtimes) + CHECK_TICK + var/list/info_list = real_best_playtimes[role_name] + var/datum/view_record/playtime/PT = info_list[2] + if(!PT) + continue + var/datum/view_record/players/player = SAFEPICK(DB_VIEW(/datum/view_record/players, DB_COMP("id", DB_EQUALS, PT.player_id))) + if(!player) + stack_trace("[PT.player_id] not found for [PT.role_id] (tell a dev, db fucked up).") + continue + best_playtimes += list(list("ckey" = player.ckey) + PT.get_nanoui_data()) + /datum/controller/subsystem/playtime/fire(resumed = FALSE) if (!resumed) src.currentrun = GLOB.clients.Copy() diff --git a/code/datums/ammo/bullet/bullet.dm b/code/datums/ammo/bullet/bullet.dm index dadb644201df..733b7fa3fda5 100644 --- a/code/datums/ammo/bullet/bullet.dm +++ b/code/datums/ammo/bullet/bullet.dm @@ -69,7 +69,7 @@ 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) + user.count_statistic_stat(STATISTICS_EXECUTION) var/area/execution_area = get_area(execution_target) diff --git a/code/datums/components/disk_reader.dm b/code/datums/components/disk_reader.dm index 6292519893e9..b8971f2e11a2 100644 --- a/code/datums/components/disk_reader.dm +++ b/code/datums/components/disk_reader.dm @@ -61,7 +61,7 @@ inserter.drop_inv_item_to_loc(potential_disk, parent) disk = potential_disk to_chat(inserter, SPAN_NOTICE("You insert [potential_disk] and enter the decryption key.")) - inserter.count_niche_stat(STATISTICS_NICHE_DISK) + inserter.count_statistic_stat(STATISTICS_DISK) /datum/component/disk_reader/proc/on_disk_complete(datum/source) SIGNAL_HANDLER diff --git a/code/datums/elements/suturing.dm b/code/datums/elements/suturing.dm index eee65b0ba7df..114886b94d50 100644 --- a/code/datums/elements/suturing.dm +++ b/code/datums/elements/suturing.dm @@ -276,6 +276,7 @@ maximum_heal = total amount of each damage type that can be healed - IE TRUE/TRU W.salved |= WOUND_SUTURED target_limb.heal_damage(brute_to_heal, burn_to_heal) + healing.track_heal_damage(initial(suturing_item.name), healed, brute_to_heal + burn_to_heal) if(!suture_brute && !suture_burn) return SUTURED_FULLY diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm index fbdcc11e1037..3d8b58eebed7 100644 --- a/code/datums/entities/player.dm +++ b/code/datums/entities/player.dm @@ -52,6 +52,7 @@ var/list/datum/entity/player_job_ban/job_bans var/list/datum/entity/player_time/playtimes var/list/datum/entity/player_stat/stats + var/datum/entity/player_entity/player_entity = null var/list/playtime_data // For the NanoUI menu var/client/owning_client @@ -428,6 +429,14 @@ BSQL_PROTECT_DATUM(/datum/entity/player) if(whitelist in GLOB.bitfields["whitelist_status"]) whitelist_flags |= GLOB.bitfields["whitelist_status"]["[whitelist]"] + setup_statistics() + +/datum/entity/player/proc/setup_statistics() + if(!player_entity) + player_entity = setup_player_entity(ckey) + player_entity.player = src + player_entity.setup_entity() + /datum/entity/player/proc/on_read_notes(list/datum/entity/player_note/_notes) notes_loaded = TRUE if(notes) diff --git a/code/datums/entities/player_times.dm b/code/datums/entities/player_times.dm index 4fc28ba2fa5e..b8343b657b72 100644 --- a/code/datums/entities/player_times.dm +++ b/code/datums/entities/player_times.dm @@ -78,7 +78,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player_time) /datum/entity/player/ui_data(mob/user) if(!LAZYACCESS(playtime_data, "loaded")) load_timestat_data() - return playtime_data + return list("playtime" = playtime_data, "playtimeglob" = SSplaytime.best_playtimes) /datum/entity/player/ui_state(mob/user) return GLOB.always_state diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 15152a8179a4..1d008ec6b821 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -74,7 +74,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME if(!as_admin && mob == usr) // Giver: Increment their medals given stat giver_mob = mob - mob.count_niche_stat(STATISTICS_NICHE_MEDALS_GIVE) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data.id) if(found_other) break found_other = TRUE @@ -153,7 +153,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME // Recipient: Add the medal to the player's stats if(recipient_ckey) - var/datum/entity/player_entity/recipient_player = setup_player_entity(recipient_ckey) + var/datum/player_entity/recipient_player = setup_player_entity(recipient_ckey) if(recipient_player) recipient_player.track_medal_earned(medal_type, recipient_mob, recipient_rank, citation, usr) @@ -246,9 +246,9 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME // Recipient: Add the medal to the player's stats if(recipient_ckey) - var/datum/entity/player_entity/recipient_player = setup_player_entity(recipient_ckey) + var/datum/player_entity/recipient_player = setup_player_entity(recipient_ckey) if(recipient_player) - recipient_player.track_medal_earned(medal_type, recipient_mob, recipient_rank, citation, giving_mob) + recipient_player.track_medal_earned(medal_type, recipient_mob, recipient_rank, citation, usr) // Inform staff of success message_admins("[key_name_admin(giving_mob)] awarded a [medal_type] to [chosen_recipient] for: \'[citation]\'.") @@ -342,7 +342,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, if(mob == usr) // Giver: Increment their medals given stat giver_mob = mob - mob.count_niche_stat(STATISTICS_NICHE_MEDALS_GIVE) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data.id) break // Create the recipient_award @@ -376,7 +376,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Recipient: Add the medal to the player's stats if(recipient_ckey) - var/datum/entity/player_entity/recipient_player = setup_player_entity(recipient_ckey) + var/datum/player_entity/recipient_player = setup_player_entity(recipient_ckey) if(recipient_player) recipient_player.track_medal_earned(medal_type, recipient_mob, recipient_caste, citation, usr) @@ -446,11 +446,11 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Remove giver's stat if(giver_mob) - giver_mob.count_niche_stat(STATISTICS_NICHE_MEDALS_GIVE, -1) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, -1, giver_mob.client.player_data.id) // Remove stats for recipient (this has a weakref to the mob, but theres a possibility of recipient.statistic_exempt) if(recipient_mob) - var/datum/entity/player_entity/recipient_player = setup_player_entity(recipient_mob.persistent_ckey) + var/datum/player_entity/recipient_player = setup_player_entity(recipient_mob.persistent_ckey) if(recipient_player) recipient_player.untrack_medal_earned(medal_type, recipient_mob, citation) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 945f4d0a5351..3e3e8cc140fe 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -23,7 +23,6 @@ /datum/mind/New(key, ckey) src.key = key src.ckey = ckey - player_entity = setup_player_entity(ckey) objective_memory = new() objective_interface = new() research_objective_interface = new() @@ -36,7 +35,6 @@ current = null original = null ghost_mob = null - player_entity = null return ..() /datum/mind/proc/transfer_to(mob/living/new_character, force = FALSE) @@ -76,7 +74,6 @@ if(ui.allowed_user_stat == -1) ui.close() continue - player_entity = setup_player_entity(ckey) SEND_SIGNAL(src, COMSIG_MIND_TRANSFERRED, old_current) SEND_SIGNAL(new_character, COMSIG_MOB_NEW_MIND, current.client) @@ -109,23 +106,6 @@ for(var/obj/item/W in current) current.drop_inv_item_on_ground(W) -/datum/mind/proc/setup_human_stats() - if(!player_entity) - player_entity = setup_player_entity(ckey) - if(!player_entity) - return - return player_entity.setup_human_stats() - -/datum/mind/proc/setup_xeno_stats() - if(!player_entity) - player_entity = setup_player_entity(ckey) - if(!player_entity) - return - return player_entity.setup_xeno_stats() - -/datum/mind/proc/wipe_entity() - player_entity = null - //Initialisation procs /mob/proc/mind_initialize() if(mind) mind.key = key diff --git a/code/datums/statistics/entities/caste_stats.dm b/code/datums/statistics/entities/caste_stats.dm deleted file mode 100644 index 6bfc18d124b7..000000000000 --- a/code/datums/statistics/entities/caste_stats.dm +++ /dev/null @@ -1,24 +0,0 @@ -/datum/entity/player_stats/caste - var/name = null - var/total_hits = 0 - var/list/abilities_used = list() // types of /datum/entity/statistic, "tail sweep" = 10, "screech" = 2 - -/datum/entity/player_stats/caste/Destroy(force) - . = ..() - QDEL_LIST_ASSOC_VAL(abilities_used) - -/datum/entity/player_stats/caste/proc/setup_ability(ability) - if(!ability) - return - var/ability_key = strip_improper(ability) - if(abilities_used["[ability_key]"]) - return abilities_used["[ability_key]"] - var/datum/entity/statistic/S = new() - S.name = ability_key - S.value = 0 - abilities_used["[ability_key]"] = S - return S - -/datum/entity/player_stats/caste/proc/track_personal_abilities_used(ability, amount = 1) - var/datum/entity/statistic/S = setup_ability(ability) - S.value += amount diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 18751ba604a1..71c2ac67601e 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -1,4 +1,4 @@ -/datum/entity/statistic/death +/datum/entity/statistic_death var/player_id var/round_id @@ -7,8 +7,6 @@ var/mob_name var/area_name - var/is_xeno - var/cause_name var/cause_player_id var/cause_role_name @@ -30,9 +28,11 @@ var/y var/z +BSQL_PROTECT_DATUM(/datum/entity/statistic_death) + /datum/entity_meta/statistic_death - entity_type = /datum/entity/statistic/death - table_name = "log_player_statistic_death" + entity_type = /datum/entity/statistic_death + table_name = "player_statistic_death" field_types = list( "player_id" = DB_FIELDTYPE_BIGINT, "round_id" = DB_FIELDTYPE_BIGINT, @@ -61,8 +61,69 @@ "x" = DB_FIELDTYPE_INT, "y" = DB_FIELDTYPE_INT, - "z" = DB_FIELDTYPE_INT + "z" = DB_FIELDTYPE_INT, + ) + +/datum/view_record/statistic_death + var/player_id + var/round_id + + var/role_name + var/faction_name + var/mob_name + var/area_name + + var/cause_name + var/cause_player_id + var/cause_role_name + var/cause_faction_name + + var/total_steps = 0 + var/total_kills = 0 + var/time_of_death + var/total_time_alive + + var/total_brute = 0 + var/total_burn = 0 + var/total_oxy = 0 + var/total_tox = 0 + + var/x + var/y + var/z + +/datum/entity_view_meta/statistic_death_ordered + root_record_type = /datum/entity/statistic_death + destination_entity = /datum/view_record/statistic_death + fields = list( + "player_id", + "round_id", + + "role_name", + "faction_name", + "mob_name", + "area_name", + + "cause_name", + "cause_player_id", + "cause_role_name", + "cause_faction_name", + + "total_steps", + "total_kills", + "time_of_death", + "total_time_alive", + + "total_brute", + "total_burn", + "total_oxy", + "total_tox", + + "x", + "y", + "z", ) + order_by = list("round_id" = DB_ORDER_BY_DESC) /mob/proc/track_mob_death(datum/cause_data/cause_data, turf/death_loc) if(cause_data && !istype(cause_data)) @@ -74,6 +135,7 @@ log_message += "[cause_data.cause_name]" else log_message += "unknown causes" + var/mob/cause_mob = cause_data?.resolve_mob() if(cause_mob) log_message += " from [key_name(cause_data.resolve_mob())]" @@ -87,19 +149,17 @@ var/area/area = get_area(death_loc) handle_observer_message(cause_data, cause_mob, death_loc, area) - // Perform logging above before get_player_from_key to avoid delays - var/datum/entity/statistic/death/new_death = DB_ENTITY(/datum/entity/statistic/death) + var/datum/entity/statistic_death/new_death = DB_ENTITY(/datum/entity/statistic_death) var/datum/entity/player/player_entity = get_player_from_key(mind.ckey) if(player_entity) new_death.player_id = player_entity.id - if(SSperf_logging) - new_death.round_id = SSperf_logging.round.id + new_death.round_id = SSperf_logging.round?.id new_death.role_name = get_role_name() new_death.mob_name = real_name - new_death.faction_name = faction - new_death.is_xeno = FALSE + new_death.faction_name = faction?.name + new_death.area_name = area.name new_death.cause_name = cause_data?.cause_name @@ -133,32 +193,33 @@ new_death.total_damage_taken = life_damage_taken_total new_death.total_revives_done = life_revives_total - if(GLOB.round_statistics) - GLOB.round_statistics.track_death(new_death) + var/ff_type = new_death.cause_faction_name == new_death.faction_name ? 1 : 0 + if(SSticker.mode.round_statistics) + SSticker.mode.round_statistics.track_dead_participant(new_death.faction_name) + if(ff_type) + SSticker.mode.round_statistics.total_friendly_kills++ + + if(isxeno(cause_mob)) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_CASTE, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) + else if(ishuman(cause_mob)) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_JOB, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) + if(new_death.cause_role_name) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) + + if(isxeno(src)) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) + else if(ishuman(src)) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) + if(new_death.cause_name) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) + + if(SSticker.mode && SSticker.mode.round_statistics) + SSticker.mode.round_statistics.death_stats_list += new_death new_death.save() new_death.detach() return new_death -/mob/living/carbon/human/track_mob_death(datum/cause_data/cause_data, turf/death_loc) - . = ..() - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(human_stats && human_stats.death_list) - human_stats.death_list.Insert(1, .) - -/mob/living/carbon/xenomorph/track_mob_death(datum/cause_data/cause_data, turf/death_loc) - var/datum/entity/statistic/death/new_death = ..() - if(!new_death) - return - new_death.is_xeno = TRUE // this was placed beneath the if below, which meant gibbing as a xeno wouldn't track properly in stats - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(xeno_stats && xeno_stats.death_list) - xeno_stats.death_list.Insert(1, new_death) - /mob/proc/handle_observer_message(datum/cause_data/cause_data, mob/cause_mob, turf/death_loc, area/death_area) var/observer_message = "[real_name] has died" if(cause_data && cause_data.cause_name) diff --git a/code/datums/statistics/entities/human_stats.dm b/code/datums/statistics/entities/human_stats.dm deleted file mode 100644 index 20d5a284becd..000000000000 --- a/code/datums/statistics/entities/human_stats.dm +++ /dev/null @@ -1,415 +0,0 @@ -/datum/entity/player_stats/human - var/total_friendly_fire = 0 - var/total_revives = 0 - var/total_lives_saved = 0 - var/total_shots = 0 - var/total_shots_hit = 0 - var/total_screams = 0 - var/list/weapon_stats_list = list() //! indexed list of types /datum/entity/weapon_stats - var/list/job_stats_list = list() //! indexed list of types /datum/entity/job_stats - var/datum/entity/weapon_stats/top_weapon //! reference to /datum/entity/weapon_stats (like tac-shotty) - var/list/datum/entity/statistic/medal/medal_list = list() //! list of all medals earned - -/datum/entity/player_stats/human/Destroy(force) - . = ..() - QDEL_LIST_ASSOC_VAL(weapon_stats_list) - QDEL_LIST_ASSOC_VAL(job_stats_list) - QDEL_NULL(top_weapon) - QDEL_LIST(medal_list) - -/datum/entity/player_stats/human/get_playtime(type) - if(!type) - return ..() - if(type == "Squad Roles") - var/total_squad_time = 0 - for(var/squad_type in GLOB.job_squad_roles) - var/datum/entity/player_stats/job/squad_stat = job_stats_list["[squad_type]"] - if(!squad_stat) // Have not played the squad role yet - continue - total_squad_time += squad_stat.get_playtime() - return total_squad_time - else if(type == "CIC Roles") - var/total_command_time = 0 - for(var/command_type in GLOB.job_command_roles) - var/datum/entity/player_stats/job/command_stat = job_stats_list["[command_type]"] - if(!command_stat) // Have not played the command role yet - continue - total_command_time += command_stat.get_playtime() - return total_command_time - else if(!job_stats_list["[type]"]) // Have not played the role yet - return 0 - var/datum/entity/player_stats/job/S = job_stats_list["[type]"] - return S.get_playtime() - -//****************** -//Stat Procs - setup -//****************** - -/datum/entity/player_stats/human/proc/setup_job_stats(job, noteworthy = TRUE) - if(!job) - return - var/job_key = strip_improper(job) - if(job_stats_list["[job_key]"]) - var/datum/entity/player_stats/job/S = job_stats_list["[job_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/player_stats/job/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = player - new_stat.name = job_key - job_stats_list["[job_key]"] = new_stat - return new_stat - -/datum/entity/player_stats/human/proc/setup_weapon_stats(weapon, noteworthy = TRUE) - if(!weapon) - return - var/weapon_key = strip_improper(weapon) - if(weapon_stats_list["[weapon_key]"]) - var/datum/entity/weapon_stats/S = weapon_stats_list["[weapon_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/weapon_stats/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = src - new_stat.name = weapon_key - weapon_stats_list["[weapon_key]"] = new_stat - return new_stat - -//****************** -//Stat Procs - death -//****************** - -/mob/living/carbon/human/track_death_calculations() - if(statistic_exempt || statistic_tracked || !mind || !mind.player_entity) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - var/job_actual = get_actual_job_name(src) - if(!human_stats.round_played) - human_stats.total_rounds_played++ - human_stats.round_played = TRUE - human_stats.total_playtime += life_time_total - human_stats.track_job_playtime(job_actual, life_time_total) - human_stats.recalculate_top_weapon() - human_stats.recalculate_nemesis() - ..() - -/datum/entity/player_stats/human/recalculate_nemesis() - for(var/job_statistic in job_stats_list) - var/datum/entity/player_stats/job/job_entity = job_stats_list[job_statistic] - job_entity.recalculate_nemesis() - ..() - -/datum/entity/player_stats/human/proc/recalculate_top_weapon() - for(var/statistics in weapon_stats_list) - var/datum/entity/weapon_stats/stat_entity = weapon_stats_list[statistics] - if(!top_weapon) - top_weapon = stat_entity - continue - if(stat_entity.total_kills > top_weapon.total_kills) - top_weapon = stat_entity - -/datum/entity/player_stats/human/proc/track_job_playtime(job, time = 0) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(!S) - return - if(!S.round_played) - S.total_rounds_played++ - S.round_played = TRUE - S.total_playtime += time - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_playtime += time - -/datum/entity/player_stats/human/count_personal_death(job) - var/datum/entity/player_stats/job/S = setup_job_stats(job) - S.total_deaths++ - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_deaths++ - -//****************** -//Stat Procs - kills -//****************** - -/datum/entity/player_stats/human/count_personal_human_kill(job_name, cause, job) - var/datum/entity/player_stats/job/S = setup_job_stats(job) - S.count_human_kill(job_name, cause) - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.count_human_kill(job_name, cause) - if(cause) - var/datum/entity/weapon_stats/W = setup_weapon_stats(cause) - W.count_human_kill(job_name) - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(cause) - R.count_human_kill(job_name) - -/datum/entity/player_stats/human/count_personal_xeno_kill(caste_type, cause, job) - var/datum/entity/player_stats/job/S = setup_job_stats(job) - S.count_xeno_kill(caste_type, cause) - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.count_xeno_kill(caste_type, cause) - if(cause) - var/datum/entity/weapon_stats/W = setup_weapon_stats(cause) - W.count_xeno_kill(caste_type) - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(cause) - R.count_xeno_kill(caste_type) - -/datum/entity/player_stats/human/count_human_kill(job_name, cause, job) - if(!job_name) - return - if(cause) - var/datum/entity/weapon_stats/W = setup_weapon_stats(cause) - W.total_kills++ - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(cause) - R.total_kills++ - recalculate_top_weapon() - ..() - -/datum/entity/player_stats/human/count_xeno_kill(job_name, cause, caste) - if(!job_name) - return - if(cause) - var/datum/entity/weapon_stats/W = setup_weapon_stats(cause) - W.total_kills++ - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(cause) - R.total_kills++ - recalculate_top_weapon() - ..() - -//***************** -//Mob Procs - minor -//***************** - -/datum/entity/player_stats/human/count_personal_niche_stat(niche_name, amount = 1, job) - var/datum/entity/player_stats/job/S = setup_job_stats(job) - S.count_niche_stat(niche_name, amount) - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.count_niche_stat(niche_name, amount) - -/datum/entity/player_stats/human/count_niche_stat(niche_name, amount = 1, job, weapon) - if(!niche_name) - return - if(weapon) - var/datum/entity/weapon_stats/W = setup_weapon_stats(weapon) - W.count_niche_stat(niche_name, amount) - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(weapon) - R.count_niche_stat(niche_name, amount) - recalculate_top_weapon() - ..() - -/datum/entity/player_stats/human/count_personal_steps_walked(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job, FALSE) - S.steps_walked += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job, FALSE) - R.steps_walked += amount - -/mob/living/carbon/human/track_steps_walked(amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.steps_walked += amount - var/job_actual = get_actual_job_name(src) - if(job_actual) - human_stats.count_personal_steps_walked(job_actual, amount) - -/datum/entity/player_stats/human/proc/count_weapon_hit(weapon, amount = 1) - if(!weapon) - return - var/datum/entity/weapon_stats/S = setup_weapon_stats(weapon) - if(isnull(S.total_hits)) - S.total_hits = 0 - S.total_hits += amount - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(weapon) - R.total_hits +=amount - -/mob/proc/track_hit(weapon, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.count_weapon_hit(weapon, amount) - -/datum/entity/player_stats/human/proc/count_weapon_shot(weapon, amount = 1) - if(!weapon) - return - var/datum/entity/weapon_stats/S = setup_weapon_stats(weapon) - if(isnull(S.total_shots)) - S.total_shots = 0 - S.total_shots += amount - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(weapon) - R.total_shots +=amount - -/datum/entity/player_stats/human/proc/count_personal_shot(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_shots)) - S.total_shots = 0 - S.total_shots += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_shots += amount - -/mob/proc/track_shot(weapon, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.total_shots += amount - human_stats.count_weapon_shot(weapon, amount) - human_stats.count_personal_shot(job, amount) - -/datum/entity/player_stats/human/proc/count_weapon_shot_hit(weapon, amount = 1) - if(!weapon) - return - var/datum/entity/weapon_stats/S = setup_weapon_stats(weapon) - if(isnull(S.total_shots_hit)) - S.total_shots_hit = 0 - S.total_shots_hit += amount - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(weapon) - R.total_shots_hit += amount - -/datum/entity/player_stats/human/proc/count_personal_shot_hit(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_shots_hit)) - S.total_shots_hit = 0 - S.total_shots_hit += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_shots_hit += amount - -/mob/proc/track_shot_hit(weapon, shot_mob, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.total_shots_hit += amount - human_stats.count_weapon_shot_hit(weapon, amount) - human_stats.count_personal_shot_hit(job, amount) - if(GLOB.round_statistics) - GLOB.round_statistics.total_projectiles_hit += amount - if(shot_mob) - if(ishuman(shot_mob)) - GLOB.round_statistics.total_projectiles_hit_human += amount - else if(isxeno(shot_mob)) - GLOB.round_statistics.total_projectiles_hit_xeno += amount - -/datum/entity/player_stats/human/proc/count_weapon_friendly_fire(weapon, amount = 1) - if(!weapon) - return - var/datum/entity/weapon_stats/S = setup_weapon_stats(weapon) - if(isnull(S.total_friendly_fire)) - S.total_friendly_fire = 0 - S.total_friendly_fire += amount - if(GLOB.round_statistics) - var/datum/entity/weapon_stats/R = GLOB.round_statistics.setup_weapon_stats(weapon) - R.total_friendly_fire += amount - -/datum/entity/player_stats/human/proc/count_personal_friendly_fire(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_friendly_fire)) - S.total_friendly_fire = 0 - S.total_friendly_fire += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_friendly_fire += amount - -/mob/proc/track_friendly_fire(weapon, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.total_friendly_fire++ - human_stats.count_weapon_friendly_fire(weapon, amount) - human_stats.count_personal_friendly_fire(job, amount) - -/datum/entity/player_stats/human/proc/count_personal_revive(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_revives)) - S.total_revives = 0 - S.total_revives += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_revives += amount - -/mob/proc/track_revive(job, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.total_revives += amount - human_stats.count_personal_revive(job, amount) - -/datum/entity/player_stats/human/proc/count_personal_life_saved(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_lives_saved)) - S.total_lives_saved = 0 - S.total_lives_saved += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_lives_saved += amount - -/mob/proc/track_life_saved(job, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - human_stats.total_lives_saved += amount - human_stats.count_personal_life_saved(job, amount) - -/datum/entity/player_stats/human/proc/count_personal_scream(job, amount = 1) - if(!job) - return - var/datum/entity/player_stats/job/S = setup_job_stats(job) - if(isnull(S.total_screams)) - S.total_screams = 0 - S.total_screams += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/job/R = GLOB.round_statistics.setup_job_stats(job) - R.total_screams += amount - -/mob/proc/track_scream(job, amount = 1) - if(statistic_exempt || !client || !ishuman(src) || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - if(isnull(human_stats)) - return - if(isnull(human_stats.total_screams)) - human_stats.total_screams = 0 - human_stats.total_screams++ - human_stats.count_personal_scream(job, amount) diff --git a/code/datums/statistics/entities/job_stats.dm b/code/datums/statistics/entities/job_stats.dm deleted file mode 100644 index 199c2adb3160..000000000000 --- a/code/datums/statistics/entities/job_stats.dm +++ /dev/null @@ -1,8 +0,0 @@ -/datum/entity/player_stats/job - var/name - var/total_friendly_fire - var/total_revives - var/total_lives_saved - var/total_shots - var/total_shots_hit - var/total_screams diff --git a/code/datums/statistics/entities/map_stats.dm b/code/datums/statistics/entities/map_stats.dm index ec3ebb79b448..ac46cb41a2fa 100644 --- a/code/datums/statistics/entities/map_stats.dm +++ b/code/datums/statistics/entities/map_stats.dm @@ -1,15 +1,12 @@ -/datum/entity/statistic/map +/datum/entity/statistic_map var/map_name var/total_rounds = 0 var/total_hijacks = 0 - var/total_marine_victories = 0 - var/total_marine_majors = 0 - var/total_xeno_victories = 0 - var/total_xeno_majors = 0 - var/total_draws = 0 + var/total_victories + var/list/victories /datum/entity_meta/statistic_map - entity_type = /datum/entity/statistic/map + entity_type = /datum/entity/statistic_map table_name = "maps" key_field = "map_name" field_types = list( @@ -17,10 +14,15 @@ "total_rounds" = DB_FIELDTYPE_BIGINT, "total_hijacks" = DB_FIELDTYPE_BIGINT, - "total_marine_victories" = DB_FIELDTYPE_BIGINT, - "total_marine_majors" = DB_FIELDTYPE_BIGINT, - "total_xeno_victories" = DB_FIELDTYPE_BIGINT, - "total_xeno_majors" = DB_FIELDTYPE_BIGINT, - "total_draws" = DB_FIELDTYPE_BIGINT + "total_victories" = DB_FIELDTYPE_STRING_MAX, ) +/datum/entity_meta/statistic_map/map(datum/entity/statistic_map/map_entity, list/values) + ..() + if(values["total_victories"]) + map_entity.victories = json_decode(values["total_victories"]) + +/datum/entity_meta/statistic_map/unmap(datum/entity/statistic_map/map_entity) + . = ..() + if(length(map_entity.victories)) + .["total_victories"] = json_encode(map_entity.victories) diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index c5684e3cd9a4..bff81c5d6b26 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -1,32 +1,31 @@ /datum/entity/statistic/medal - var/player_id var/round_id - var/medal_type var/recipient_name var/recipient_role var/citation - var/giver_name var/giver_player_id +BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) + /datum/entity_meta/statistic_medal - entity_type = /datum/entity/statistic/medal - table_name = "log_player_statistic_medal" - field_types = list( - "player_id" = DB_FIELDTYPE_BIGINT, - "round_id" = DB_FIELDTYPE_BIGINT, - - "medal_type" = DB_FIELDTYPE_STRING_LARGE, - "recipient_name" = DB_FIELDTYPE_STRING_LARGE, - "recipient_role" = DB_FIELDTYPE_STRING_LARGE, - "citation" = DB_FIELDTYPE_STRING_MAX, - - "giver_name" = DB_FIELDTYPE_STRING_LARGE, - "giver_player_id" = DB_FIELDTYPE_BIGINT - ) - -/datum/view_record/medal_view + entity_type = /datum/entity/statistic/medal + table_name = "player_statistic_medal" + field_types = list( + "player_id" = DB_FIELDTYPE_BIGINT, + "round_id" = DB_FIELDTYPE_BIGINT, + + "medal_type" = DB_FIELDTYPE_STRING_LARGE, + "recipient_name" = DB_FIELDTYPE_STRING_LARGE, + "recipient_role" = DB_FIELDTYPE_STRING_LARGE, + "citation" = DB_FIELDTYPE_STRING_MAX, + + "giver_name" = DB_FIELDTYPE_STRING_LARGE, + "giver_player_id" = DB_FIELDTYPE_BIGINT, + ) + +/datum/view_record/statistic_medal var/player_id var/round_id var/medal_type @@ -37,9 +36,9 @@ var/giver_player_id var/id -/datum/entity_view_meta/medal_view +/datum/entity_view_meta/statistic_medal_ordered root_record_type = /datum/entity/statistic/medal - destination_entity = /datum/view_record/medal_view + destination_entity = /datum/view_record/statistic_medal fields = list( "player_id", "round_id", @@ -50,18 +49,19 @@ "giver_name", "giver_player_id", "id", - ) + ) -/datum/entity/player_entity/proc/track_medal_earned(new_medal_type, mob/new_recipient, new_recipient_role, new_citation, mob/giver) + +/datum/player_entity/proc/track_medal_earned(new_medal_type, mob/new_recipient, new_recipient_role, new_citation, mob/giver) if(!new_medal_type || !new_recipient || new_recipient.statistic_exempt || !new_recipient_role || !new_citation || !giver) return var/datum/entity/statistic/medal/new_medal = DB_ENTITY(/datum/entity/statistic/medal) - var/datum/entity/player/player_entity = get_player_from_key(new_recipient.persistent_ckey) + var/datum/entity/player/player_entity = get_player_from_key(new_recipient.ckey) if(player_entity) new_medal.player_id = player_entity.id - new_medal.round_id = SSperf_logging.round.id + new_medal.round_id = SSperf_logging.round?.id new_medal.medal_type = new_medal_type new_medal.recipient_name = new_recipient.real_name new_medal.recipient_role = new_recipient_role @@ -73,56 +73,23 @@ if(giver_player) new_medal.giver_player_id = giver_player.id + track_statistic_earned(new_recipient.faction.faction_name, STATISTICS_MEDALS, 1, new_recipient.client.player_data.id) + medals += new_medal new_medal.save() new_medal.detach() - if (isxeno(new_recipient)) - var/datum/entity/player_stats/xeno/xeno_stats = setup_xeno_stats() - xeno_stats.count_niche_stat(STATISTICS_NICHE_MEDALS, 1, new_recipient_role) - xeno_stats.medal_list.Insert(1, new_medal) - else - var/datum/entity/player_stats/human/human_stats = setup_human_stats() - human_stats.count_niche_stat(STATISTICS_NICHE_MEDALS, 1, new_recipient_role) - human_stats.medal_list.Insert(1, new_medal) - -/datum/entity/player_entity/proc/untrack_medal_earned(medal_type, mob/recipient, citation) +/datum/player_entity/proc/untrack_medal_earned(medal_type, mob/recipient, citation) if(!medal_type || !recipient || recipient.statistic_exempt || !citation) return FALSE if(!check_rights(R_MOD)) return FALSE - // Remove the stats for the job/caste, individual, and the stat's list of medals - var/round_id = SSperf_logging.round.id - if (isxeno(recipient)) - // Xeno jellies - var/mob/living/carbon/xenomorph/xeno = recipient - var/caste = xeno.caste_type - var/datum/entity/player_stats/xeno/xeno_stats = setup_xeno_stats() - xeno_stats.count_niche_stat(STATISTICS_NICHE_MEDALS, -1, caste) - - for(var/datum/entity/statistic/medal/medal as anything in xeno_stats.medal_list) - if(medal.round_id == round_id && medal.recipient_name == recipient.real_name && medal.medal_type == medal_type && medal.citation == citation) - xeno_stats.medal_list.Remove(medal) - medal.delete() - break - else - // Marine medals - var/rank - var/weak_ref_recipient = WEAKREF(recipient) - for(var/list/marine_manifest_list in list(GLOB.data_core.general)) - for(var/datum/data/record/record in marine_manifest_list) - if(record.fields["ref"] == weak_ref_recipient) - rank = record.fields["rank"] - break - var/datum/entity/player_stats/human/human_stats = setup_human_stats() - human_stats.count_niche_stat(STATISTICS_NICHE_MEDALS, -1, rank) - - for(var/datum/entity/statistic/medal/medal as anything in human_stats.medal_list) - if(medal.round_id == round_id && medal.recipient_name == recipient.real_name && medal.medal_type == medal_type && medal.citation == citation) - human_stats.medal_list.Remove(medal) - medal.delete() - break - + var/round_id = SSperf_logging.round?.id + track_statistic_earned(recipient.faction.faction_name, STATISTICS_MEDALS, -1, recipient.client.player_data.id) + for(var/datum/entity/statistic/medal/new_medal as anything in medals) + if(new_medal.round_id == round_id && new_medal.recipient_name == recipient.real_name && new_medal.medal_type == medal_type && new_medal.citation == citation) + medals -= new_medal + new_medal.delete() + break return TRUE - diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index c62925673622..a1b51f31d93a 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -1,739 +1,197 @@ -//******************************************************* -//*******************STAT PANEL************************** -//******************************************************* - - -/datum/entity/player_entity/proc/show_statistics(mob/user, datum/entity/statistic/round/viewing_round = GLOB.round_statistics, update_data = FALSE) - if(update_data) - update_panel_data(GLOB.round_statistics) - ui_interact(user) - -/datum/entity/player_entity/proc/ui_interact(mob/user, ui_key = "statistics", datum/nanoui/ui, force_open = 1) - data["menu"] = menu - data["subMenu"] = subMenu - data["dataMenu"] = dataMenu - - ui = SSnano.nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) - - if(!ui) - ui = new(user, src, ui_key, "cm_stat_panel.tmpl", "Statistics", 450, 700, null, -1) - ui.set_initial_data(data) - ui.open() - -/datum/entity/player_entity/Topic(href, href_list) - var/mob/user = usr - user.set_interaction(src) - - if(href_list["menu"]) - menu = href_list["menu"] - if(href_list["subMenu"]) - subMenu = href_list["subMenu"] - if(href_list["dataMenu"]) - dataMenu = href_list["dataMenu"] - - SSnano.nanomanager.update_uis(src) - -/datum/entity/player_entity/proc/check_eye() - return - -//******************************************************* -//*******************KILL PANEL************************** -//******************************************************* - - -/datum/entity/statistic/round/proc/show_kill_feed(mob/user) - tgui_interact(user) - -/datum/entity/statistic/round/tgui_interact(mob/user, datum/tgui/ui) +/datum/player_entity/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "KillPanel", "Killfeed") + ui = new(user, src, "Statistic", "Statistic") ui.open() - ui.set_autoupdate(FALSE) + ui.set_autoupdate(TRUE) -/datum/entity/statistic/round/ui_state(mob/user) +/datum/player_entity/ui_state(mob/user) return GLOB.always_state -/datum/entity/statistic/round/ui_data(mob/user) +/datum/player_entity/ui_data(mob/user, datum/entity/statistic_round/viewing_round = SSticker?.mode?.round_statistics ) var/list/data = list() - - data["death_data"] = death_data - - return data - -/datum/entity/statistic/round/proc/check_eye() - return - -//******************************************************* -//*******************PLAYER DATA************************* -//******************************************************* - -/datum/entity/player_entity/proc/update_panel_data(datum/entity/statistic/round/viewing_round = GLOB.round_statistics) - data["current_time"] = worldtime2text() - + data["data_tabs"] = list() if(viewing_round) - viewing_round.update_panel_data() - data["round"] = viewing_round.round_data["round"] + data["round"] = viewing_round.update_panel_data() + data["data_tabs"] += "Round" - if(player_stats["human"]) - var/datum/entity/player_stats/human/H = player_stats["human"] - var/list/humans_killed = list() - var/list/xenos_killed = list() + if(length(medals)) var/list/medal_list = list() - var/list/death_list = list() - var/list/weapon_stats_list = list() - var/list/job_stats_list = list() - var/list/niche_stats_list = list() - var/list/top_weapon = null - var/list/human_nemesis = null - - if(H.nemesis) - human_nemesis = list("name" = H.nemesis.name, "value" = H.nemesis.value) - - if(H.top_weapon) - top_weapon = list( - "name" = sanitize(H.top_weapon.name), - "total_kills" = H.top_weapon.total_kills, - "total_hits" = H.top_weapon.total_hits, - "total_shots" = H.top_weapon.total_shots, - "total_shots_hit" = H.top_weapon.total_shots_hit, - "total_friendly_fire" = H.top_weapon.total_friendly_fire - ) - - for(var/iteration in H.humans_killed) - var/datum/entity/statistic/S = H.humans_killed[iteration] - humans_killed += list(list("name" = S.name, "value" = S.value)) - - for(var/iteration in H.xenos_killed) - var/datum/entity/statistic/S = H.xenos_killed[iteration] - xenos_killed += list(list("name" = S.name, "value" = S.value)) - - for(var/iteration in H.niche_stats) - var/datum/entity/statistic/S = H.niche_stats[iteration] - niche_stats_list += list(list("name" = S.name, "value" = S.value)) - - for(var/datum/entity/statistic/medal/S in H.medal_list) + for(var/datum/entity/statistic/medal/medal as anything in medals) medal_list += list(list( - "medal_type" = sanitize(S.medal_type), - "recipient" = sanitize(S.recipient_name), - "recipient_job" = sanitize(S.recipient_role), - "citation" = sanitize(S.citation), - "giver" = sanitize(S.giver_name) - )) - - for(var/datum/entity/statistic/death/S in H.death_list) - var/list/damage_list = list() - if(S.total_brute) - damage_list += list(list("name" = "brute", "value" = S.total_brute)) - if(S.total_burn) - damage_list += list(list("name" = "burn", "value" = S.total_burn)) - if(S.total_oxy) - damage_list += list(list("name" = "oxy", "value" = S.total_oxy)) - if(S.total_tox) - damage_list += list(list("name" = "tox", "value" = S.total_tox)) - death_list += list(list( - "mob_name" = sanitize(S.mob_name), - "job_name" = S.role_name, - "area_name" = sanitize_area(S.area_name), - "cause_name" = sanitize(S.cause_name), - "total_kills" = S.total_kills, - "total_damage" = damage_list, - "time_of_death" = duration2text(S.time_of_death), - "total_time_alive" = duration2text(S.total_time_alive), - "total_damage_taken" = S.total_damage_taken, - "x" = S.x, - "y" = S.y, - "z" = S.z - )) - - for(var/iteration in H.weapon_stats_list) - var/datum/entity/weapon_stats/S = H.weapon_stats_list[iteration] - if(!S.display_stat) - continue - var/list/weapon_humans_killed = list() - var/list/weapon_xenos_killed = list() - var/list/weapon_niche_stats_list = list() - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - weapon_humans_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - weapon_xenos_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - weapon_niche_stats_list += list(list("name" = D.name, "value" = D.value)) - - weapon_stats_list += list(list( - "name" = sanitize(S.name), - "total_kills" = S.total_kills, - "total_hits" = S.total_hits, - "total_shots" = S.total_shots, - "total_shots_hit" = S.total_shots_hit, - "total_friendly_fire" = S.total_friendly_fire, - "humans_killed" = weapon_humans_killed, - "xenos_killed" = weapon_xenos_killed, - "niche_stats" = weapon_niche_stats_list + "round_id" = "[medal.round_id]", + "medal_type" = medal.medal_type, + "recipient" = sanitize(medal.recipient_name), + "recipient_job" = medal.recipient_role, + "citation" = sanitize(medal.citation), + "giver" = sanitize(medal.giver_name), )) - for(var/iteration in H.job_stats_list) - var/datum/entity/player_stats/job/S = H.job_stats_list[iteration] - if(!S.display_stat) - continue - var/list/job_humans_killed = list() - var/list/job_xenos_killed = list() - var/list/job_death_list = list() - var/list/job_niche_stats_list = list() - var/list/job_nemesis = null - - if(S.nemesis) - job_nemesis = list("name" = S.nemesis.name, "value" = S.nemesis.value) - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - job_humans_killed += list(list("name" = D.name, "value" = D.value)) + data["medals"] = medal_list + data["data_tabs"] += "Medals" - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - job_xenos_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - job_niche_stats_list += list(list("name" = D.name, "value" = D.value)) - - for(var/datum/entity/statistic/death/DS in S.death_list) - var/list/damage_list = list() - if(DS.total_brute) - damage_list += list(list("name" = "brute", "value" = DS.total_brute)) - if(DS.total_burn) - damage_list += list(list("name" = "burn", "value" = DS.total_burn)) - if(DS.total_oxy) - damage_list += list(list("name" = "oxy", "value" = DS.total_oxy)) - if(DS.total_tox) - damage_list += list(list("name" = "tox", "value" = DS.total_tox)) - death_list += list(list( - "mob_name" = sanitize(DS.mob_name), - "job_name" = DS.role_name, - "area_name" = sanitize_area(DS.area_name), - "cause_name" = sanitize(DS.cause_name), - "total_kills" = DS.total_kills, - "total_damage" = damage_list, - "time_of_death" = duration2text(DS.time_of_death), - "total_time_alive" = duration2text(DS.total_time_alive), - "total_damage_taken" = DS.total_damage_taken, - "x" = DS.x, - "y" = DS.y, - "z" = DS.z - )) - - job_stats_list += list(list( - "name" = S.name, - "total_kills" = S.total_kills, - "total_deaths" = S.total_deaths, - "total_playtime" = duration2text(S.total_playtime), - "total_rounds_played" = S.total_rounds_played, - "steps_walked" = S.steps_walked, - "total_friendly_fire" = S.total_friendly_fire, - "total_revives" = S.total_revives, - "total_lives_saved" = S.total_lives_saved, - "total_shots" = S.total_shots, - "total_shots_hit" = S.total_shots_hit, - "total_screams" = S.total_screams, - "nemesis" = job_nemesis, - "humans_killed" = job_humans_killed, - "xenos_killed" = job_xenos_killed, - "job_death_list" = job_death_list, - "niche_stats" = job_niche_stats_list - )) - - data["human"] = list( - "total_kills" = H.total_kills, - "total_deaths" = H.total_deaths, - "total_playtime" = duration2text(H.total_playtime), - "total_rounds_played" = H.total_rounds_played, - "steps_walked" = H.steps_walked, - "total_friendly_fire" = H.total_friendly_fire, - "total_revives" = H.total_revives, - "total_lives_saved" = H.total_lives_saved, - "total_shots" = H.total_shots, - "total_shots_hit" = H.total_shots_hit, - "total_screams" = H.total_screams, - "nemesis" = human_nemesis, - "humans_killed" = humans_killed, - "xenos_killed" = xenos_killed, - "medal_list" = medal_list, - "death_list" = death_list, - "weapon_stats_list" = weapon_stats_list, - "job_stats_list" = job_stats_list, - "niche_stats" = niche_stats_list, - "top_weapon" = top_weapon - ) - - if(player_stats["xeno"]) - var/datum/entity/player_stats/xeno/H = player_stats["xeno"] - var/list/humans_killed = list() - var/list/xenos_killed = list() - var/list/medal_list = list() + data["factions"] = list() + for(var/faction_to_get in statistics) + var/datum/statistic_groups/group = statistics[faction_to_get] + var/list/nemesis = list() var/list/death_list = list() - var/list/caste_stats_list = list() - var/list/niche_stats_list = list() - var/list/top_caste = null - var/list/xeno_nemesis = null + var/list/top_statistics = list() + var/list/total_statistics = list() + var/list/statistics_list_tabs = list() + var/list/statistics_list = list() + if(group.nemesis) + nemesis = list("name" = group.nemesis.nemesis_name, "value" = group.nemesis.value) - if(H.nemesis) - xeno_nemesis = list("name" = H.nemesis.name, "value" = H.nemesis.value) + for(var/datum/entity/statistic_death/statistic_death as anything in group.statistic_deaths) + if(length(death_list) >= STATISTICS_DEATH_LIST_LEN) + break - if(H.top_caste) - top_caste = list( - "name" = H.top_caste.name, - "total_kills" = H.top_caste.total_kills, - "total_deaths" = H.top_caste.total_deaths, - "total_playtime" = duration2text(H.top_caste.total_playtime), - "total_rounds_played" = H.top_caste.total_rounds_played, - ) - - for(var/iteration in H.humans_killed) - var/datum/entity/statistic/S = H.humans_killed[iteration] - humans_killed += list(list("name" = S.name, "value" = S.value)) + var/list/damage_list = list() + if(statistic_death.total_brute) + damage_list += list(list("name" = "brute", "value" = statistic_death.total_brute)) - for(var/iteration in H.xenos_killed) - var/datum/entity/statistic/S = H.xenos_killed[iteration] - xenos_killed += list(list("name" = S.name, "value" = S.value)) + if(statistic_death.total_burn) + damage_list += list(list("name" = "burn", "value" = statistic_death.total_burn)) - for(var/iteration in H.niche_stats) - var/datum/entity/statistic/S = H.niche_stats[iteration] - niche_stats_list += list(list("name" = S.name, "value" = S.value)) + if(statistic_death.total_oxy) + damage_list += list(list("name" = "oxy", "value" = statistic_death.total_oxy)) - for(var/datum/entity/statistic/medal/S in H.medal_list) - medal_list += list(list( - "medal_type" = sanitize(S.medal_type), - "recipient" = sanitize(S.recipient_name), - "recipient_job" = sanitize(S.recipient_role), - "citation" = sanitize(S.citation), - "giver" = sanitize(S.giver_name) - )) + if(statistic_death.total_tox) + damage_list += list(list("name" = "tox", "value" = statistic_death.total_tox)) - for(var/datum/entity/statistic/death/S in H.death_list) - var/list/damage_list = list() - if(S.total_brute) - damage_list += list(list("name" = "brute", "value" = S.total_brute)) - if(S.total_burn) - damage_list += list(list("name" = "burn", "value" = S.total_burn)) - if(S.total_oxy) - damage_list += list(list("name" = "oxy", "value" = S.total_oxy)) - if(S.total_tox) - damage_list += list(list("name" = "tox", "value" = S.total_tox)) death_list += list(list( - "mob_name" = sanitize(S.mob_name), - "job_name" = S.role_name, - "area_name" = sanitize_area(S.area_name), - "cause_name" = sanitize(S.cause_name), - "total_kills" = S.total_kills, + "mob_name" = sanitize(statistic_death.mob_name), + "job_name" = statistic_death.role_name, + "area_name" = sanitize_area(statistic_death.area_name), + "cause_name" = sanitize(statistic_death.cause_name), + "total_kills" = statistic_death.total_kills, "total_damage" = damage_list, - "time_of_death" = duration2text(S.time_of_death), - "total_time_alive" = duration2text(S.total_time_alive), - "total_damage_taken" = S.total_damage_taken, - "x" = S.x, - "y" = S.y, - "z" = S.z + "time_of_death" = statistic_death.time_of_death, + "total_time_alive" = statistic_death.total_time_alive, + "total_damage_taken" = statistic_death.total_damage_taken, + "x" = statistic_death.x, + "y" = statistic_death.y, + "z" = statistic_death.z, )) - for(var/iteration in H.caste_stats_list) - var/datum/entity/player_stats/caste/S = H.caste_stats_list[iteration] - if(!S.display_stat) - continue - var/list/caste_abilities_used = list() - var/list/caste_humans_killed = list() - var/list/caste_xenos_killed = list() - var/list/caste_death_list = list() - var/list/caste_niche_stats_list = list() - var/list/caste_nemesis = null - - if(S.nemesis) - caste_nemesis = list("name" = S.nemesis.name, "value" = S.nemesis.value) - - for(var/sub_iteration in S.abilities_used) - var/datum/entity/statistic/D = S.abilities_used[sub_iteration] - caste_abilities_used += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - caste_humans_killed += list(list("name" = D.name, "value" = D.value)) + for(var/group_subtype in group.statistic_info) + var/list/statistic_info = list() + var/datum/player_statistic/player_statistic = group.statistic_info[group_subtype] + if(player_statistic.statistic_name == STATISTIC_TYPE_CASTE || player_statistic.statistic_name == STATISTIC_TYPE_JOB) + total_statistics += list(list("name" = player_statistic.statistic_name, "value" = "TOTAL")) + for(var/subtype in player_statistic.total) + total_statistics += list(list("name" = subtype, "value" = player_statistic.total[subtype])) + + if(player_statistic.top_statistic) + var/list/top_statistic_list = list() + var/datum/player_statistic_detail/detail_statistic = player_statistic.top_statistic + for(var/datum/entity/statistic/top_statistic_entity as anything in detail_statistic.statistics) + top_statistic_list += list(list("name" = top_statistic_entity.statistic_name, "value" = top_statistic_entity.value)) + + top_statistics += list(list( + "name" = detail_statistic.detail_name, + "statistics" = top_statistic_list, + )) - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - caste_xenos_killed += list(list("name" = D.name, "value" = D.value)) + for(var/statistic_subtype in player_statistic.statistics) + var/datum/player_statistic_detail/detail_statistic = player_statistic.statistics[statistic_subtype] + var/list/subtype_statistics = list() + var/list/subtype_top_statistics = list() + for(var/datum/entity/statistic/statistic as anything in detail_statistic.statistics) + subtype_statistics += list(list("name" = statistic.statistic_name, "value" = statistic.value)) - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - caste_niche_stats_list += list(list("name" = D.name, "value" = D.value)) + for(var/datum/entity/statistic/statistic as anything in detail_statistic.top_values_statistics) + subtype_top_statistics += list(list("name" = statistic.statistic_name, "value" = statistic.value)) - for(var/datum/entity/statistic/death/DS in S.death_list) - var/list/damage_list = list() - if(DS.total_brute) - damage_list += list(list("name" = "brute", "value" = DS.total_brute)) - if(DS.total_burn) - damage_list += list(list("name" = "burn", "value" = DS.total_burn)) - if(DS.total_oxy) - damage_list += list(list("name" = "oxy", "value" = DS.total_oxy)) - if(DS.total_tox) - damage_list += list(list("name" = "tox", "value" = DS.total_tox)) - death_list += list(list( - "mob_name" = sanitize(DS.mob_name), - "job_name" = DS.role_name, - "area_name" = sanitize_area(DS.area_name), - "cause_name" = sanitize(DS.cause_name), - "total_kills" = DS.total_kills, - "total_damage" = damage_list, - "time_of_death" = duration2text(DS.time_of_death), - "total_time_alive" = duration2text(DS.total_time_alive), - "total_damage_taken" = DS.total_damage_taken, - "x" = DS.x, - "y" = DS.y, - "z" = DS.z + statistic_info += list(list( + "name" = detail_statistic.detail_name, + "statistics" = subtype_statistics, + "top_statistics" = subtype_top_statistics, )) - caste_stats_list += list(list( - "name" = S.name, - "total_kills" = S.total_kills, - "total_hits" = S.total_hits, - "total_deaths" = S.total_deaths, - "total_playtime" = duration2text(S.total_playtime), - "total_rounds_played" = S.total_rounds_played, - "steps_walked" = S.steps_walked, - "nemesis" = caste_nemesis, - "humans_killed" = caste_humans_killed, - "xenos_killed" = caste_xenos_killed, - "death_list" = caste_death_list, - "abilities_used" = caste_abilities_used, - "niche_stats" = caste_niche_stats_list + statistics_list_tabs += player_statistic.statistic_name + statistics_list += list(list( + "name" = player_statistic.statistic_name, + "value" = statistic_info, )) - data["xeno"] = list( - "total_kills" = H.total_kills, - "total_deaths" = H.total_deaths, - "total_playtime" = duration2text(H.total_playtime), - "total_rounds_played" = H.total_rounds_played, - "steps_walked" = H.steps_walked, - "total_hits" = H.total_hits, - "nemesis" = xeno_nemesis, - "humans_killed" = humans_killed, - "xenos_killed" = xenos_killed, - "medal_list" = medal_list, - "death_list" = death_list, - "caste_stats_list" = caste_stats_list, - "niche_stats" = niche_stats_list, - "top_caste" = top_caste - ) - -//******************************************************* -//*******************ROUND DATA************************** -//******************************************************* + if(length(total_statistics)) + data["data_tabs"] += group.group_name + data["factions"][group.group_name] = list( + "name" = group.group_name, + "nemesis" = nemesis, + "death_list" = death_list, + "statistics" = total_statistics, + "top_statistics" = top_statistics, + "statistics_list" = statistics_list, + ) + return data -/datum/entity/statistic/round/proc/update_panel_data() +/datum/entity/statistic_round/proc/update_panel_data() var/map_name if(current_map) - map_name = current_map.name + map_name = current_map.map_name - var/list/participants_list = list() - var/list/hijack_participants_list = list() - var/list/final_participants_list = list() + var/list/participants_list = null + var/list/hijack_participants_list = null + var/list/final_participants_list = null var/list/total_deaths_list = list() var/list/new_death_stats_list = list() - var/list/new_weapon_stats_list = list() - var/list/new_job_stats_list = list() - var/list/new_caste_stats_list = list() - for(var/iteration in participants) - var/datum/entity/statistic/S = participants[iteration] - participants_list += list(list("name" = S.name, "value" = S.value)) + if(length(participants)) + participants_list = list() + for(var/stat_name in participants) + participants_list += list(list("name" = stat_name, "value" = participants[stat_name])) - for(var/iteration in hijack_participants) - var/datum/entity/statistic/S = hijack_participants[iteration] - hijack_participants_list += list(list("name" = S.name, "value" = S.value)) + if(length(hijack_participants)) + hijack_participants_list = list() + for(var/stat_name in hijack_participants) + hijack_participants_list += list(list("name" = stat_name, "value" = hijack_participants[stat_name])) - for(var/iteration in final_participants) - var/datum/entity/statistic/S = final_participants[iteration] - final_participants_list += list(list("name" = S.name, "value" = S.value)) + if(length(final_participants)) + final_participants_list = list() + for(var/stat_name in final_participants) + final_participants_list += list(list("name" = stat_name, "value" = final_participants[stat_name])) - for(var/iteration in total_deaths) - var/datum/entity/statistic/S = total_deaths[iteration] - total_deaths_list += list(list("name" = S.name, "value" = S.value)) + total_deaths_list = length(total_deaths) - for(var/datum/entity/statistic/death/S in death_stats_list) - if(length(new_death_stats_list) >= STATISTICS_DEATH_LIST_LEN) + for(var/datum/entity/statistic_death/statistic_death as anything in death_stats_list) + if(new_death_stats_list.len >= STATISTICS_DEATH_LIST_LEN) break var/list/damage_list = list() - if(S.total_brute) - damage_list += list(list("name" = "brute", "value" = S.total_brute)) - if(S.total_burn) - damage_list += list(list("name" = "burn", "value" = S.total_burn)) - if(S.total_oxy) - damage_list += list(list("name" = "oxy", "value" = S.total_oxy)) - if(S.total_tox) - damage_list += list(list("name" = "tox", "value" = S.total_tox)) - - var/new_time_of_death - if(S.time_of_death) - new_time_of_death = duration2text(S.time_of_death) - var/new_total_time_alive - if(S.total_time_alive) - new_total_time_alive = duration2text(S.total_time_alive) - - var/death = list(list( - "mob_name" = sanitize(S.mob_name), - "job_name" = S.role_name, - "area_name" = sanitize_area(S.area_name), - "cause_name" = sanitize(S.cause_name), - "total_kills" = S.total_kills, + if(statistic_death.total_brute) + damage_list += list(list("name" = "brute", "value" = statistic_death.total_brute)) + if(statistic_death.total_burn) + damage_list += list(list("name" = "burn", "value" = statistic_death.total_burn)) + if(statistic_death.total_oxy) + damage_list += list(list("name" = "oxy", "value" = statistic_death.total_oxy)) + if(statistic_death.total_tox) + damage_list += list(list("name" = "tox", "value" = statistic_death.total_tox)) + + new_death_stats_list += list(list( + "mob_name" = sanitize(statistic_death.mob_name), + "job_name" = statistic_death.role_name, + "area_name" = sanitize_area(statistic_death.area_name), + "cause_name" = sanitize(statistic_death.cause_name), + "total_kills" = statistic_death.total_kills, "total_damage" = damage_list, - "time_of_death" = new_time_of_death, - "total_time_alive" = new_total_time_alive, - "total_damage_taken" = S.total_damage_taken, - "x" = S.x, - "y" = S.y, - "z" = S.z - )) - if(length(new_death_stats_list) < STATISTICS_DEATH_LIST_LEN) - new_death_stats_list += death - - for(var/iteration in weapon_stats_list) - var/datum/entity/weapon_stats/S = weapon_stats_list[iteration] - if(!S.display_stat) - continue - var/list/weapon_humans_killed = list() - var/list/weapon_xenos_killed = list() - var/list/weapon_niche_stats_list = list() - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - if(!D) - continue - weapon_humans_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - if(!D) - continue - weapon_xenos_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - if(!D) - continue - weapon_niche_stats_list += list(list("name" = D.name, "value" = D.value)) - - new_weapon_stats_list += list(list( - "name" = sanitize(S.name), - "total_kills" = S.total_kills, - "total_hits" = S.total_hits, - "total_shots" = S.total_shots, - "total_shots_hit" = S.total_shots_hit, - "total_friendly_fire" = S.total_friendly_fire, - "humans_killed" = weapon_humans_killed, - "xenos_killed" = weapon_xenos_killed, - "niche_stats" = weapon_niche_stats_list + "time_of_death" = duration2text(statistic_death.time_of_death), + "total_time_alive" = duration2text(statistic_death.total_time_alive), + "total_damage_taken" = statistic_death.total_damage_taken, + "x" = statistic_death.x, + "y" = statistic_death.y, + "z" = statistic_death.z, )) - for(var/iteration in job_stats_list) - var/datum/entity/player_stats/job/S = job_stats_list[iteration] - if(!S.display_stat) - continue - var/list/job_humans_killed = list() - var/list/job_xenos_killed = list() - var/list/job_death_list = list() - var/list/job_niche_stats_list = list() - var/list/job_nemesis = null - - if(S.nemesis) - job_nemesis = list("name" = S.nemesis.name, "value" = S.nemesis.value) - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - if(!D) - continue - job_humans_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - if(!D) - continue - job_xenos_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - if(!D) - continue - job_niche_stats_list += list(list("name" = D.name, "value" = D.value)) - - for(var/datum/entity/statistic/death/DS in S.death_list) - var/list/damage_list = list() - if(DS.total_brute) - damage_list += list(list("name" = "brute", "value" = DS.total_brute)) - if(DS.total_burn) - damage_list += list(list("name" = "burn", "value" = DS.total_burn)) - if(DS.total_oxy) - damage_list += list(list("name" = "oxy", "value" = DS.total_oxy)) - if(DS.total_tox) - damage_list += list(list("name" = "tox", "value" = DS.total_tox)) - - var/new_time_of_death - if(DS.time_of_death) - new_time_of_death = duration2text(DS.time_of_death) - var/new_total_time_alive - if(DS.total_time_alive) - new_total_time_alive = duration2text(DS.total_time_alive) - - job_death_list += list(list( - "mob_name" = sanitize(DS.mob_name), - "job_name" = DS.role_name, - "area_name" = sanitize_area(DS.area_name), - "cause_name" = sanitize(DS.cause_name), - "total_kills" = DS.total_kills, - "total_damage" = damage_list, - "time_of_death" = new_time_of_death, - "total_time_alive" = new_total_time_alive, - "total_damage_taken" = DS.total_damage_taken, - "x" = DS.x, - "y" = DS.y, - "z" = DS.z - )) - - new_job_stats_list += list(list( - "name" = S.name, - "total_kills" = S.total_kills, - "total_deaths" = S.total_deaths, - "total_playtime" = duration2text(S.total_playtime), - "total_rounds_played" = S.total_rounds_played, - "steps_walked" = S.steps_walked, - "total_friendly_fire" = S.total_friendly_fire, - "total_revives" = S.total_revives, - "total_lives_saved" = S.total_lives_saved, - "total_shots" = S.total_shots, - "total_shots_hit" = S.total_shots_hit, - "total_screams" = S.total_screams, - "nemesis" = job_nemesis, - "humans_killed" = job_humans_killed, - "xenos_killed" = job_xenos_killed, - "job_death_list" = job_death_list, - "niche_stats" = job_niche_stats_list - )) - - for(var/iteration in caste_stats_list) - var/datum/entity/player_stats/caste/S = caste_stats_list[iteration] - if(!S.display_stat) - continue - var/list/caste_abilities_used = list() - var/list/caste_humans_killed = list() - var/list/caste_xenos_killed = list() - var/list/caste_death_list = list() - var/list/caste_niche_stats_list = list() - var/list/caste_nemesis = null - - if(S.nemesis) - caste_nemesis = list("name" = S.nemesis.name, "value" = S.nemesis.value) - - for(var/sub_iteration in S.abilities_used) - var/datum/entity/statistic/D = S.abilities_used[sub_iteration] - if(!D) - continue - caste_abilities_used += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.humans_killed) - var/datum/entity/statistic/D = S.humans_killed[sub_iteration] - if(!D) - continue - caste_humans_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.xenos_killed) - var/datum/entity/statistic/D = S.xenos_killed[sub_iteration] - if(!D) - continue - caste_xenos_killed += list(list("name" = D.name, "value" = D.value)) - - for(var/sub_iteration in S.niche_stats) - var/datum/entity/statistic/D = S.niche_stats[sub_iteration] - if(!D) - continue - caste_niche_stats_list += list(list("name" = D.name, "value" = D.value)) - - for(var/datum/entity/statistic/death/DS in S.death_list) - var/list/damage_list = list() - if(DS.total_brute) - damage_list += list(list("name" = "brute", "value" = DS.total_brute)) - if(DS.total_burn) - damage_list += list(list("name" = "burn", "value" = DS.total_burn)) - if(DS.total_oxy) - damage_list += list(list("name" = "oxy", "value" = DS.total_oxy)) - if(DS.total_tox) - damage_list += list(list("name" = "tox", "value" = DS.total_tox)) - - var/new_time_of_death - if(DS.time_of_death) - new_time_of_death = duration2text(DS.time_of_death) - var/new_total_time_alive - if(DS.total_time_alive) - new_total_time_alive = duration2text(DS.total_time_alive) - - caste_death_list += list(list( - "mob_name" = sanitize(DS.mob_name), - "job_name" = DS.role_name, - "area_name" = sanitize_area(DS.area_name), - "cause_name" = sanitize(DS.cause_name), - "total_kills" = DS.total_kills, - "total_damage" = damage_list, - "time_of_death" = new_time_of_death, - "total_time_alive" = new_total_time_alive, - "total_damage_taken" = DS.total_damage_taken, - "x" = DS.x, - "y" = DS.y, - "z" = DS.z - )) - - new_caste_stats_list += list(list( - "name" = S.name, - "total_kills" = S.total_kills, - "total_hits" = S.total_hits, - "total_deaths" = S.total_deaths, - "total_playtime" = duration2text(S.total_playtime), - "total_rounds_played" = S.total_rounds_played, - "steps_walked" = S.steps_walked, - "nemesis" = caste_nemesis, - "humans_killed" = caste_humans_killed, - "xenos_killed" = caste_xenos_killed, - "death_list" = caste_death_list, - "abilities_used" = caste_abilities_used, - "niche_stats" = caste_niche_stats_list - )) - - var/new_time_start - if(real_time_start) - new_time_start = time2text(real_time_start) - - var/new_round_length - if(round_length) - new_round_length = duration2text(round_length) - - var/new_hijack_time - if(round_hijack_time) - new_hijack_time = time2text(round_hijack_time) - - var/new_time_end - if(real_time_end) - new_time_end = time2text(real_time_end) - - death_data["death_stats_list"] = new_death_stats_list - round_data["round"] = list( - "name" = name, + return list( + "name" = round_name, "game_mode" = game_mode, "map_name" = map_name, "round_result" = round_result, - "real_time_start" = new_time_start, - "real_time_end" = new_time_end, - "round_length" = new_round_length, - "round_hijack_time" = new_hijack_time, + "real_time_start" = real_time_start, + "real_time_end" = real_time_end, + "round_length" = round_length, + "round_hijack_time" = round_hijack_time, "end_round_player_population" = end_round_player_population, "total_projectiles_fired" = total_projectiles_fired, "total_projectiles_hit" = total_projectiles_hit, @@ -741,14 +199,12 @@ "total_projectiles_hit_xeno" = total_projectiles_hit_xeno, "total_slashes" = total_slashes, "total_friendly_fire_instances" = total_friendly_fire_instances, + "total_friendly_kills" = total_friendly_kills, "total_huggers_applied" = total_huggers_applied, "total_larva_burst" = total_larva_burst, "participants" = participants_list, "hijack_participants" = hijack_participants_list, "final_participants" = final_participants_list, "total_deaths" = total_deaths_list, - "death_stats_list" = new_death_stats_list, - "weapon_stats_list" = new_weapon_stats_list, - "job_stats_list" = new_job_stats_list, - "caste_stats_list" = new_caste_stats_list + "death_list" = new_death_stats_list, ) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index f0b3d37ede7e..8d48e30085f5 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -1,47 +1,225 @@ -#define PREFFILE_VERSION_MIN 3 -#define PREFFILE_VERSION_MAX 3 + +///////////////////////////////////////////////////////////////////////////////////// +//Statistic entity /datum/entity/statistic - var/name = null - var/value = null - -/datum/entity/player_entity - var/name - var/ckey // "cakey" - var/list/player_stats = list() //! Indeed list of /datum/entity/player_stats - var/list/death_stats = list() //! Indexed list of /datum/entity/statistic/death - var/menu = 0 - var/subMenu = 0 - var/dataMenu = 0 - var/data[0] - var/path - var/savefile_version - var/save_loaded = FALSE - -/datum/entity/player_entity/Destroy(force) - QDEL_LIST_ASSOC_VAL(player_stats) - QDEL_LIST_ASSOC_VAL(death_stats) - return ..() - -/datum/entity/player_entity/proc/get_playtime(branch, type) - var/playtime = 0 - if(player_stats["[branch]"]) - var/datum/entity/player_stats/branch_stat = player_stats["[branch]"] - playtime += branch_stat.get_playtime(type) - return playtime - -/datum/entity/player_entity/proc/setup_human_stats() - if(player_stats["human"] && !isnull(player_stats["human"])) - return player_stats["human"] - var/datum/entity/player_stats/human/new_stat = new() - new_stat.player = src - player_stats["human"] = new_stat - return new_stat - -/datum/entity/player_entity/proc/setup_xeno_stats() - if(player_stats["xeno"] && !isnull(player_stats["xeno"])) - return player_stats["xeno"] - var/datum/entity/player_stats/xeno/new_stat = new() - new_stat.player = src - player_stats["xeno"] = new_stat - return new_stat + var/player_id + var/faction + var/statistic_type + var/general_name + var/statistic_name + var/value + +/datum/entity_meta/statistic + entity_type = /datum/entity/statistic + table_name = "player_statistic" + field_types = list( + "player_id" = DB_FIELDTYPE_BIGINT, + "faction" = DB_FIELDTYPE_STRING_LARGE, + "statistic_type" = DB_FIELDTYPE_STRING_LARGE, + "general_name" = DB_FIELDTYPE_STRING_LARGE, + "statistic_name" = DB_FIELDTYPE_STRING_LARGE, + "value" = DB_FIELDTYPE_INT, + ) + +/proc/track_statistic_earned(faction, statistic_type, general_name, statistic_name, value, player_id) + if(!player_id || !faction || !statistic_type || !general_name || !statistic_name) + return + + DB_FILTER(/datum/entity/statistic, DB_AND( + DB_COMP("player_id", DB_EQUALS, player_id), + DB_COMP("faction", DB_EQUALS, faction), + DB_COMP("statistic_type", DB_EQUALS, statistic_type), + DB_COMP("general_name", DB_EQUALS, general_name), + DB_COMP("statistic_name", DB_EQUALS, statistic_name)), + CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(track_statistic_earned_callback), faction, statistic_type, general_name, statistic_name, value, player_id)) + +/proc/track_statistic_earned_callback(faction, statistic_type, general_name, statistic_name, value, player_id, list/datum/entity/statistic/statistics) + if(!length(statistics)) + var/datum/entity/statistic/statistic = DB_ENTITY(/datum/entity/statistic) + statistic.faction = faction + statistic.statistic_type = statistic_type + statistic.general_name = general_name + statistic.statistic_name = statistic_name + statistic.value = value + statistic.player_id = player_id + statistic.save() + else + var/datum/entity/statistic/real_stat = statistics[statistics.len] + statistics.len-- + for(var/datum/entity/statistic/clone as anything in statistics) + if(clone.value < real_stat.value) + clone.delete() + log_runtime("found duplicated table [faction], [statistic_type], [general_name], [statistic_name]") // Check for bug persist + else + real_stat.delete() + real_stat = clone + + real_stat.value += value + real_stat.save() + +///////////////////////////////////////////////////////////////////////////////////// +//Statistic groups + +/datum/statistic_groups + var/group_name = "" + var/group_parameter = "" + var/datum/player_entity/player = null + + var/datum/player_statistic_nemesis/nemesis = new() + var/list/statistic_deaths = list() + var/list/statistic_info = list() + var/list/statistic_all = list() + +/datum/statistic_groups/proc/load_statistic_deaths(list/datum/entity/statistic_death/statistics) + nemesis.nemesis_name = "" + nemesis.value = 0 + statistic_deaths = list() + var/list/causes = list() + for(var/datum/entity/statistic_death/statistic as anything in statistics) + statistic_deaths += statistic + if(!statistic.cause_name) + continue + causes[statistic.cause_name]++ + if(causes[statistic.cause_name] > nemesis.value) + nemesis.nemesis_name = statistic.cause_name + nemesis.value = causes[statistic.cause_name] + +/datum/statistic_groups/proc/load_statistic(list/datum/entity/statistic/statistics) + statistic_all = list() + for(var/datum/entity/statistic/statistic as anything in statistics) + if(!statistic_all[statistic.statistic_type]) + statistic_all[statistic.statistic_type] = list() + + if(!statistic_all[statistic.statistic_type][statistic.general_name]) + statistic_all[statistic.statistic_type][statistic.general_name] = list() + + statistic.sync() + statistic_all[statistic.statistic_type][statistic.general_name] += statistic + recalculate_statistic() + +/datum/statistic_groups/proc/recalculate_statistic() + for(var/subtype in statistic_all) + var/datum/player_statistic/statistic = statistic_info[subtype] + if(!statistic) + statistic = new() + statistic.statistic_name = subtype + statistic.player = player + statistic.owner = src + statistic_info[subtype] = statistic + statistic.statistic_all = statistic_all[subtype] + statistic.load_statistic() + +///////////////////////////////////////////////////////////////////////////////////// +//Player detail statistic + +/datum/player_statistic + var/statistic_name + var/datum/player_entity/player = null + var/datum/statistic_groups/owner = null + + var/datum/player_statistic_detail/top_statistic = list() + var/list/statistics = list() + + var/list/statistic_all = list() + var/list/total = list() + +/datum/player_statistic/proc/load_statistic() + for(var/subtype in statistic_all) + var/datum/player_statistic_detail/statistic = statistics[subtype] + if(!statistic) + statistic = new() + statistic.detail_name = subtype + statistic.player = player + statistic.owner = src + statistics[subtype] = statistic + statistic.statistics = statistic_all[subtype] + recalculate_statistic() + +/datum/player_statistic/proc/recalculate_statistic() + var/list/potential_top_statistic = list("", 0) + for(var/subtype in statistics) + var/datum/player_statistic_detail/detail_statistic = statistics[subtype] + detail_statistic.top_values_statistics = list() + for(var/datum/entity/statistic/potential_statistic as anything in detail_statistic.statistics) + var/top = TRUE + for(var/datum/entity/statistic/statistic as anything in statistic_all[potential_statistic.general_name] - potential_statistic) + if(potential_statistic.value <= statistic.value) + top = FALSE + break + if(top) + detail_statistic.top_values_statistics += potential_statistic + if(potential_top_statistic[2] < length(detail_statistic.top_values_statistics)) + potential_top_statistic = list(detail_statistic, length(detail_statistic.top_values_statistics)) + top_statistic = potential_top_statistic[1] + + for(var/subtype in statistic_all) + for(var/datum/entity/statistic/statistic as anything in statistic_all[subtype]) + if(total[statistic.statistic_name]) + total[statistic.statistic_name] += statistic.value + else + total[statistic.statistic_name] = statistic.value + +/datum/player_statistic_detail + var/detail_name + var/datum/player_entity/player = null + var/datum/player_statistic/owner = null + + var/list/top_values_statistics = list() + var/list/statistics = list() + +/datum/player_statistic_nemesis + var/nemesis_name + var/value + +///////////////////////////////////////////////////////////////////////////////////// +//Player Entity + +/datum/player_entity + var/entity_name + var/ckey + var/datum/entity/player/player = null + var/list/datum/entity/statistic/medal/medals = list() + var/list/statistics = list() + +/datum/player_entity/proc/get_statistic(faction, statistic_type, general_name, statistic_name) + var/datum/statistic_groups/match_statistic = statistics[faction] + if(!match_statistic) + return FALSE + + var/datum/entity/statistic/statistic = match_statistic.statistic_info[statistic_type][general_name][statistic_name] + if(!statistic) + return FALSE + return statistic.value + +/datum/player_entity/proc/setup_entity() + set waitfor = FALSE + WAIT_DB_READY + if(player) + for(var/faction_to_get in FACTION_LIST_ALL) + var/datum/statistic_groups/new_group = statistics[faction_to_get] + if(!new_group) + new_group = new() + new_group.group_name = GLOB.faction_datum[faction_to_get].name + new_group.group_parameter = faction_to_get + new_group.player = src + statistics[faction_to_get] = new_group + + DB_FILTER(/datum/entity/statistic_death, DB_AND( + DB_COMP("player_id", DB_EQUALS, player.id), + DB_COMP("faction_name", DB_EQUALS, new_group.group_name)), + CALLBACK(new_group, TYPE_PROC_REF(/datum/statistic_groups, load_statistic_deaths))) + + DB_FILTER(/datum/entity/statistic, DB_AND( + DB_COMP("player_id", DB_EQUALS, player.id), + DB_COMP("faction", DB_EQUALS, faction_to_get)), + CALLBACK(new_group, TYPE_PROC_REF(/datum/statistic_groups, load_statistic))) + + DB_FILTER(/datum/entity/statistic/medal, DB_COMP("player_id", DB_EQUALS, player.id), CALLBACK(src, TYPE_PROC_REF(/datum/player_entity, statistic_load_medals))) + +/datum/player_entity/proc/statistic_load_medals(list/datum/entity/statistic/medal/statistics) + for(var/datum/entity/statistic/medal/statistic as anything in statistics) + if(statistic in medals) + continue + + medals += statistic diff --git a/code/datums/statistics/entities/player_save.dm b/code/datums/statistics/entities/player_save.dm deleted file mode 100644 index 05507bfcc4b4..000000000000 --- a/code/datums/statistics/entities/player_save.dm +++ /dev/null @@ -1,330 +0,0 @@ - -/datum/entity/player_entity/proc/setup_save(key) - if(key && !IsGuestKey(key)) - load_path(lowertext(key)) - load_statistics() - savefile_version = PREFFILE_VERSION_MAX - -/datum/entity/player_entity/proc/load_path(ckey,filename="statistics.sav") - if(!ckey) - return - path = "data/player_saves/[copytext(ckey,1,2)]/[ckey]/[filename]" - savefile_version = PREFFILE_VERSION_MAX - -/datum/entity/player_entity/proc/save_statistics() - if(!path || !save_loaded) - log_debug("STATISTICS: stats failed to save for [ckey] in [path] (save_loaded: [save_loaded])") - return FALSE - var/savefile/S = new /savefile(path) - if(!S) - return FALSE - S.cd = "/" - - update_panel_data() - - S["version"] << savefile_version - S["xeno"] << data["xeno"] - S["human"] << data["human"] - - return TRUE - -/datum/entity/player_entity/proc/load_statistics() - if(!path || !fexists(path)) - save_loaded = TRUE - return FALSE - var/savefile/S = new /savefile(path) - if(!S) - log_debug("STATISTICS: fexists but load failed for [ckey] in [path]") - return FALSE - S.cd = "/" - - if(S["version"] < PREFFILE_VERSION_MIN) - return FALSE - - S["version"] >> savefile_version - - var/list/human_save = list() - var/list/xeno_save = list() - - S["human"] >> human_save - S["xeno"] >> xeno_save - - if(human_save) - setup_human_stats() - var/datum/entity/player_stats/human/human_stats = player_stats["human"] - human_stats.total_kills = human_save["total_kills"] - human_stats.total_deaths = human_save["total_deaths"] - human_stats.total_playtime = text2duration(human_save["total_playtime"]) - human_stats.total_rounds_played = human_save["total_rounds_played"] - human_stats.steps_walked = human_save["steps_walked"] - - human_stats.total_friendly_fire = human_save["total_friendly_fire"] - human_stats.total_revives = human_save["total_revives"] - human_stats.total_lives_saved = human_save["total_lives_saved"] - human_stats.total_shots = human_save["total_shots"] - human_stats.total_shots_hit = human_save["total_shots_hit"] - human_stats.total_screams = human_save["total_screams"] - - if(human_save["nemesis"]) - var/save_nemesis = human_save["nemesis"] - var/datum/entity/statistic/new_nemesis = new() - new_nemesis.name = save_nemesis["name"] - new_nemesis.value = save_nemesis["value"] - human_stats.nemesis = new_nemesis - - if(human_save["humans_killed"]) - var/save_humans_killed = human_save["humans_killed"] - var/list/new_humans_killed_list = new() - for(var/save_kill in save_humans_killed) - var/datum/entity/statistic/new_human_killed = new() - new_human_killed.name = save_kill["name"] - new_human_killed.value = save_kill["value"] - new_humans_killed_list["[new_human_killed.name]"] = new_human_killed - human_stats.humans_killed = new_humans_killed_list - - if(human_save["xenos_killed"]) - var/save_xeno_killed = human_save["xenos_killed"] - var/list/new_xenos_killed_list = new() - for(var/save_kill in save_xeno_killed) - var/datum/entity/statistic/new_xeno_killed = new() - new_xeno_killed.name = save_kill["name"] - new_xeno_killed.value = save_kill["value"] - new_xenos_killed_list["[new_xeno_killed.name]"] = new_xeno_killed - human_stats.xenos_killed = new_xenos_killed_list - - if(human_save["niche_stats"]) - var/save_niche_stats = human_save["niche_stats"] - var/list/new_niche_stat_list = new() - for(var/save_niche in save_niche_stats) - var/datum/entity/statistic/new_niche_stat = new() - new_niche_stat.name = save_niche["name"] - new_niche_stat.value = save_niche["value"] - new_niche_stat_list["[new_niche_stat.name]"] = new_niche_stat - human_stats.niche_stats = new_niche_stat_list - - if(human_save["weapon_stats_list"]) - var/save_weapon_list = human_save["weapon_stats_list"] - var/list/new_weapon_list = new() - for(var/save_weapon in save_weapon_list) - var/datum/entity/weapon_stats/new_weapon = new() - new_weapon.player = src - new_weapon.name = save_weapon["name"] - new_weapon.total_kills = save_weapon["total_kills"] - new_weapon.total_hits = save_weapon["total_hits"] - new_weapon.total_shots = save_weapon["total_shots"] - new_weapon.total_shots_hit = save_weapon["total_shots_hit"] - new_weapon.total_friendly_fire = save_weapon["total_friendly_fire"] - - if(save_weapon["humans_killed"]) - var/save_humans_killed = save_weapon["humans_killed"] - var/list/new_humans_killed_list = new() - for(var/save_kill in save_humans_killed) - var/datum/entity/statistic/new_human_killed = new() - new_human_killed.name = save_kill["name"] - new_human_killed.value = save_kill["value"] - new_humans_killed_list["[new_human_killed.name]"] = new_human_killed - new_weapon.humans_killed = new_humans_killed_list - - if(save_weapon["xenos_killed"]) - var/save_xeno_killed = save_weapon["xenos_killed"] - var/list/new_xenos_killed_list = new() - for(var/save_kill in save_xeno_killed) - var/datum/entity/statistic/new_xeno_killed = new() - new_xeno_killed.name = save_kill["name"] - new_xeno_killed.value = save_kill["value"] - new_xenos_killed_list["[new_xeno_killed.name]"] = new_xeno_killed - new_weapon.xenos_killed = new_xenos_killed_list - - if(save_weapon["niche_stats"]) - var/save_niche_stats = save_weapon["niche_stats"] - var/list/new_niche_stat_list = new() - for(var/save_niche in save_niche_stats) - var/datum/entity/statistic/new_niche_stat = new() - new_niche_stat.name = save_niche["name"] - new_niche_stat.value = save_niche["value"] - new_niche_stat_list["[new_niche_stat.name]"] = new_niche_stat - new_weapon.niche_stats = new_niche_stat_list - - new_weapon_list["[new_weapon.name]"] = new_weapon - human_stats.weapon_stats_list = new_weapon_list - - if(human_save["job_stats_list"]) - var/save_job_list = human_save["job_stats_list"] - var/list/new_job_list = new() - for(var/save_job in save_job_list) - var/datum/entity/player_stats/job/new_job = new() - new_job.total_kills = save_job["total_kills"] - new_job.total_deaths = save_job["total_deaths"] - new_job.total_playtime = text2duration(save_job["total_playtime"]) - new_job.total_rounds_played = save_job["total_rounds_played"] - new_job.steps_walked = save_job["steps_walked"] - - new_job.name = save_job["name"] - new_job.total_friendly_fire = save_job["total_friendly_fire"] - new_job.total_revives = save_job["total_revives"] - new_job.total_lives_saved = save_job["total_lives_saved"] - new_job.total_shots = save_job["total_shots"] - new_job.total_shots_hit = save_job["total_shots_hit"] - new_job.total_screams = save_job["total_screams"] - - if(save_job["nemesis"]) - var/save_nemesis = save_job["nemesis"] - var/datum/entity/statistic/new_nemesis = new() - new_nemesis.name = save_nemesis["name"] - new_nemesis.value = save_nemesis["value"] - new_job.nemesis = new_nemesis - - if(save_job["humans_killed"]) - var/save_humans_killed = save_job["humans_killed"] - var/list/new_humans_killed_list = new() - for(var/save_kill in save_humans_killed) - var/datum/entity/statistic/new_human_killed = new() - new_human_killed.name = save_kill["name"] - new_human_killed.value = save_kill["value"] - new_humans_killed_list["[new_human_killed.name]"] = new_human_killed - new_job.humans_killed = new_humans_killed_list - - if(save_job["xenos_killed"]) - var/save_xeno_killed = save_job["xenos_killed"] - var/list/new_xenos_killed_list = new() - for(var/save_kill in save_xeno_killed) - var/datum/entity/statistic/new_xeno_killed = new() - new_xeno_killed.name = save_kill["name"] - new_xeno_killed.value = save_kill["value"] - new_xenos_killed_list["[new_xeno_killed.name]"] = new_xeno_killed - new_job.xenos_killed = new_xenos_killed_list - - if(save_job["niche_stats"]) - var/save_niche_stats = save_job["niche_stats"] - var/list/new_niche_stat_list = new() - for(var/save_niche in save_niche_stats) - var/datum/entity/statistic/new_niche_stat = new() - new_niche_stat.name = save_niche["name"] - new_niche_stat.value = save_niche["value"] - new_niche_stat_list["[new_niche_stat.name]"] = new_niche_stat - new_job.niche_stats = new_niche_stat_list - - new_job_list["[new_job.name]"] = new_job - human_stats.job_stats_list = new_job_list - - human_stats.recalculate_nemesis() - human_stats.recalculate_top_weapon() - - if(xeno_save) - setup_xeno_stats() - var/datum/entity/player_stats/xeno/xeno_stats = player_stats["xeno"] - xeno_stats.total_kills = xeno_save["total_kills"] - xeno_stats.total_deaths = xeno_save["total_deaths"] - xeno_stats.total_playtime = text2duration(xeno_save["total_playtime"]) - xeno_stats.total_rounds_played = xeno_save["total_rounds_played"] - xeno_stats.steps_walked = xeno_save["steps_walked"] - - xeno_stats.total_hits = xeno_save["total_hits"] - - if(xeno_save["nemesis"]) - var/save_nemesis = xeno_save["nemesis"] - var/datum/entity/statistic/new_nemesis = new() - new_nemesis.name = save_nemesis["name"] - new_nemesis.value = save_nemesis["value"] - xeno_stats.nemesis = new_nemesis - - if(xeno_save["humans_killed"]) - var/save_humans_killed = xeno_save["humans_killed"] - var/list/new_humans_killed_list = new() - for(var/save_kill in save_humans_killed) - var/datum/entity/statistic/new_human_killed = new() - new_human_killed.name = save_kill["name"] - new_human_killed.value = save_kill["value"] - new_humans_killed_list["[new_human_killed.name]"] = new_human_killed - xeno_stats.humans_killed = new_humans_killed_list - - if(xeno_save["xenos_killed"]) - var/save_xeno_killed = xeno_save["xenos_killed"] - var/list/new_xenos_killed_list = new() - for(var/save_kill in save_xeno_killed) - var/datum/entity/statistic/new_xeno_killed = new() - new_xeno_killed.name = save_kill["name"] - new_xeno_killed.value = save_kill["value"] - new_xenos_killed_list["[new_xeno_killed.name]"] = new_xeno_killed - xeno_stats.xenos_killed = new_xenos_killed_list - - if(xeno_save["niche_stats"]) - var/save_niche_stats = xeno_save["niche_stats"] - var/list/new_niche_stat_list = new() - for(var/save_niche in save_niche_stats) - var/datum/entity/statistic/new_niche_stat = new() - new_niche_stat.name = save_niche["name"] - new_niche_stat.value = save_niche["value"] - new_niche_stat_list["[new_niche_stat.name]"] = new_niche_stat - xeno_stats.niche_stats = new_niche_stat_list - - if(xeno_save["caste_stats_list"]) - var/save_caste_list = xeno_save["caste_stats_list"] - var/list/new_caste_list = new() - for(var/save_caste in save_caste_list) - var/datum/entity/player_stats/caste/new_caste = new() - new_caste.total_kills = save_caste["total_kills"] - new_caste.total_deaths = save_caste["total_deaths"] - new_caste.total_playtime = text2duration(save_caste["total_playtime"]) - new_caste.total_rounds_played = save_caste["total_rounds_played"] - new_caste.steps_walked = save_caste["steps_walked"] - - new_caste.name = save_caste["name"] - new_caste.total_hits = save_caste["total_hits"] - - if(save_caste["nemesis"]) - var/save_nemesis = save_caste["nemesis"] - var/datum/entity/statistic/new_nemesis = new() - new_nemesis.name = save_nemesis["name"] - new_nemesis.value = save_nemesis["value"] - new_caste.nemesis = new_nemesis - - if(save_caste["abilities_used"]) - var/save_abilities_used = save_caste["abilities_used"] - var/list/new_abilities_used_list = new() - for(var/save_ability in save_abilities_used) - var/datum/entity/statistic/new_ability_used = new() - new_ability_used.name = save_ability["name"] - new_ability_used.value = save_ability["value"] - new_abilities_used_list["[new_ability_used.name]"] = new_ability_used - new_caste.abilities_used = new_abilities_used_list - - if(save_caste["humans_killed"]) - var/save_humans_killed = save_caste["humans_killed"] - var/list/new_humans_killed_list = new() - for(var/save_kill in save_humans_killed) - var/datum/entity/statistic/new_human_killed = new() - new_human_killed.name = save_kill["name"] - new_human_killed.value = save_kill["value"] - new_humans_killed_list["[new_human_killed.name]"] = new_human_killed - new_caste.humans_killed = new_humans_killed_list - - if(save_caste["xenos_killed"]) - var/save_xeno_killed = save_caste["xenos_killed"] - var/list/new_xenos_killed_list = new() - for(var/save_kill in save_xeno_killed) - var/datum/entity/statistic/new_xeno_killed = new() - new_xeno_killed.name = save_kill["name"] - new_xeno_killed.value = save_kill["value"] - new_xenos_killed_list["[new_xeno_killed.name]"] = new_xeno_killed - new_caste.xenos_killed = new_xenos_killed_list - - if(save_caste["niche_stats"]) - var/save_niche_stats = save_caste["niche_stats"] - var/list/new_niche_stat_list = new() - for(var/save_niche in save_niche_stats) - var/datum/entity/statistic/new_niche_stat = new() - new_niche_stat.name = save_niche["name"] - new_niche_stat.value = save_niche["value"] - new_niche_stat_list["[new_niche_stat.name]"] = new_niche_stat - new_caste.niche_stats = new_niche_stat_list - - new_caste_list["[new_caste.name]"] = new_caste - xeno_stats.caste_stats_list = new_caste_list - - xeno_stats.recalculate_nemesis() - xeno_stats.recalculate_top_caste() - - save_loaded = TRUE - update_panel_data() - return TRUE diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index a8444c1a5894..2fc32087ef83 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -1,173 +1,329 @@ -/datum/entity/player_stats - var/datum/entity/player_entity/player = null // "mattatlas" - var/total_kills = 0 - var/total_deaths = 0 - var/total_playtime = 0 - var/total_rounds_played = 0 - var/steps_walked = 0 - var/round_played = FALSE - var/datum/entity/statistic/nemesis // "runner" = 3 - var/list/niche_stats = list() // list of type /datum/entity/statistic, "Total Executions" = number - var/list/humans_killed = list() // list of type /datum/entity/statistic, "jobname2" = number - var/list/xenos_killed = list() // list of type /datum/entity/statistic, "caste" = number - var/list/death_list = list() // list of type /datum/entity/death_stats - var/display_stat = TRUE - -/datum/entity/player_stats/Destroy(force) - QDEL_NULL(nemesis) - QDEL_LIST_ASSOC_VAL(niche_stats) - QDEL_LIST_ASSOC_VAL(humans_killed) - QDEL_LIST_ASSOC_VAL(xenos_killed) - QDEL_LIST_ASSOC_VAL(death_list) - return ..() - -/datum/entity/player_stats/proc/get_playtime() - return total_playtime - -/datum/entity/player_stats/proc/count_personal_human_kill(job_name, cause, job) - return - -/datum/entity/player_stats/proc/count_personal_xeno_kill(job_name, cause, job) - return - -/datum/entity/player_stats/proc/count_human_kill(job_name, cause, job) - if(!job_name) - return - if(!humans_killed["[job_name]"]) - var/datum/entity/statistic/N = new() - N.name = job_name - humans_killed["[job_name]"] = N - var/datum/entity/statistic/S = humans_killed["[job_name]"] - S.value++ - if(job) - count_personal_human_kill(job_name, cause, job) - total_kills++ - -/datum/entity/player_stats/proc/count_xeno_kill(caste, cause, job) - if(!caste) - return - if(!xenos_killed["[caste]"]) - var/datum/entity/statistic/N = new() - N.name = caste - xenos_killed["[caste]"] = N - var/datum/entity/statistic/S = xenos_killed["[caste]"] - S.value++ - if(job) - count_personal_xeno_kill(caste, cause, job) - total_kills++ - -//***************** -//Mob Procs - death -//***************** - -/datum/entity/player_stats/proc/recalculate_nemesis() - var/list/causes = list() - for(var/datum/entity/statistic/death/stat_entity in death_list) - if(!stat_entity.cause_name) - continue - causes["[stat_entity.cause_name]"]++ - if(!nemesis) - nemesis = new() - nemesis.name = stat_entity.cause_name - nemesis.value = 1 - continue - if(causes["[stat_entity.cause_name]"] > nemesis.value) - nemesis.name = stat_entity.cause_name - nemesis.value = causes["[stat_entity.cause_name]"] - -/datum/entity/player_stats/proc/count_personal_death(job) - return +// TODO: Some day do custom count effect on stats updated, so don't copy this is procs and also do it flexible like right now (I don't wanna change it, because on next merge upstream in this is rep it will fuck up all calls on that and fixing more flexible shit will be harder) +// Also, make it wait and count like every +-30 minutes, so our DB not fuck up in INF!, funny... + +///////////////////////////////////////////////////////////////////////////////////// +//Mob /mob/proc/track_death_calculations() - if(statistic_exempt || statistic_tracked) - return - if(GLOB.round_statistics) - GLOB.round_statistics.recalculate_nemesis() - if(mind && mind.player_entity) - mind.player_entity.update_panel_data(GLOB.round_statistics) + if(statistic_exempt || statistic_tracked || !client || !client.player_data || !faction) + return FALSE + client.player_data.setup_statistics() statistic_tracked = TRUE + return TRUE + +/mob/proc/count_statistic_stat(statistic_name, amount = 1, weapon) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_steps_walked() + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + if(SSticker.mode.round_statistics) + SSticker.mode.round_statistics.total_projectiles_hit += amount + if(shot_mob) + if(ishuman(shot_mob)) + SSticker.mode.round_statistics.total_projectiles_hit_human += amount + else if(isxeno(shot_mob)) + SSticker.mode.round_statistics.total_projectiles_hit_xeno += amount + return TRUE -//***************** -//Mob Procs - kills -//***************** +/mob/proc/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE -/mob/proc/count_human_kill(job_name, cause) - return +/mob/proc/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE -/mob/proc/count_xeno_kill(killed_caste, cause) - return +/mob/proc/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE -/mob/proc/count_niche_stat(niche_name, amount = 1) - return +/mob/proc/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + if(SSticker.mode.round_statistics) + SSticker.mode.round_statistics.total_friendly_fire_instances += amount + return TRUE +/mob/proc/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +/mob/proc/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + if(SSticker.mode.round_statistics) + SSticker.mode.round_statistics.total_slashes += amount + return TRUE + +/mob/proc/track_ability_usage(ability, caste, amount = 1) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + +///////////////////////////////////////////////////////////////////////////////////// //Human -/mob/living/carbon/human/count_human_kill(job_name, cause) - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - var/job_actual = get_actual_job_name(src) - human_stats.count_human_kill(job_name, cause, job_actual) -/mob/living/carbon/human/count_xeno_kill(killed_caste, cause) - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - var/job_actual = get_actual_job_name(src) - human_stats.count_xeno_kill(killed_caste, cause, job_actual) -/mob/living/carbon/human/count_niche_stat(niche_name, amount = 1, weapon_name) - if(statistic_exempt || !mind) - return - var/job_actual = get_actual_job_name(src) - var/datum/entity/player_stats/human/human_stats = mind.setup_human_stats() - human_stats.count_niche_stat(niche_name, amount, job_actual, weapon_name) +/mob/living/carbon/human/track_death_calculations() + . = ..() + if(!.) + return FALSE -//Xeno -/mob/living/carbon/xenomorph/count_human_kill(job_name, cause) - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - xeno_stats.count_human_kill(job_name, cause, caste_type) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data.id) -/mob/living/carbon/xenomorph/count_xeno_kill(killed_caste, cause) - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - xeno_stats.count_xeno_kill(killed_caste, cause, caste_type) +/mob/living/carbon/human/count_statistic_stat(statistic_name, amount = 1, weapon) + . = ..() + if(!.) + return FALSE -/mob/living/carbon/xenomorph/count_niche_stat(niche_name, amount = 1) - if(statistic_exempt || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - xeno_stats.count_niche_stat(niche_name, amount, caste_type) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) + . = ..() + if(!.) + return FALSE -//***************** -//Mob Procs - minor -//***************** + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) -/datum/entity/player_stats/proc/count_personal_niche_stat(niche_name, amount = 1, job) - return +/mob/living/carbon/human/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) + . = ..() + if(!.) + return FALSE -/datum/entity/player_stats/proc/count_niche_stat(niche_name, amount = 1, job) - if(!niche_name) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/human/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + +///////////////////////////////////////////////////////////////////////////////////// +//Xenomorph + +/mob/living/carbon/xenomorph/track_death_calculations() + . = ..() + if(!. || !faction) return - if(!niche_stats["[niche_name]"]) - var/datum/entity/statistic/N = new() - N.name = niche_name - niche_stats["[niche_name]"] = N - var/datum/entity/statistic/S = niche_stats["[niche_name]"] - S.value += amount - if(job) - count_personal_niche_stat(niche_name, amount, job) - -/datum/entity/player_stats/proc/count_personal_steps_walked(job) - return -/mob/proc/track_steps_walked() - return + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data.id) + +/mob/living/carbon/xenomorph/count_statistic_stat(statistic_name, amount = 1, weapon) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, statistic_name, amount, client.player_data.id) + +/mob/living/carbon/xenomorph/track_ability_usage(ability, caste, amount = 1) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste, ability, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, STATISTICS_ABILITES, amount, client.player_data.id) diff --git a/code/datums/statistics/entities/round_stats.dm b/code/datums/statistics/entities/round_stats.dm index 79493ca87ef0..195a89cfc3c8 100644 --- a/code/datums/statistics/entities/round_stats.dm +++ b/code/datums/statistics/entities/round_stats.dm @@ -1,4 +1,4 @@ -/datum/entity/statistic/round +/datum/entity/statistic_round var/round_id var/round_name @@ -20,40 +20,25 @@ var/total_projectiles_hit_human = 0 var/total_projectiles_hit_xeno = 0 var/total_friendly_fire_instances = 0 + var/total_friendly_kills = 0 var/total_slashes = 0 // untracked data - var/datum/entity/statistic/map/current_map // reference to current map - var/list/datum/entity/statistic/death/death_stats_list = list() + var/datum/entity/statistic_map/current_map = null // reference to current map + var/list/datum/entity/statistic_death/death_stats_list = list() var/list/abilities_used = list() // types of /datum/entity/statistic, "tail sweep" = 10, "screech" = 2 - var/list/participants = list() // types of /datum/entity/statistic, "[human.faction]" = 10, "xeno" = 2 - var/list/final_participants = list() // types of /datum/entity/statistic, "[human.faction]" = 0, "xeno" = 45 - var/list/hijack_participants = list() // types of /datum/entity/statistic, "[human.faction]" = 0, "xeno" = 45 - var/list/total_deaths = list() // types of /datum/entity/statistic, "[human.faction]" = 0, "xeno" = 45 + var/list/participants = list() // types of /datum/entity/statistic, "[mob.faction]" = 10 + var/list/final_participants = list() // types of /datum/entity/statistic, "[mob.faction]" = 0 + var/list/hijack_participants = list() // types of /datum/entity/statistic, "[mob.faction]" = 0 + var/list/total_deaths = list() // types of /datum/entity/statistic, "[mob.faction]" = 0 var/list/caste_stats_list = list() // list of types /datum/entity/player_stats/caste 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 - // nanoui data - var/list/round_data = list() - var/list/death_data = list() - -/datum/entity/statistic/round/Destroy(force) - . = ..() - QDEL_NULL(current_map) - QDEL_LIST(death_stats_list) - QDEL_LIST_ASSOC_VAL(abilities_used) - QDEL_LIST_ASSOC_VAL(final_participants) - QDEL_LIST_ASSOC_VAL(hijack_participants) - QDEL_LIST_ASSOC_VAL(total_deaths) - QDEL_LIST_ASSOC_VAL(caste_stats_list) - QDEL_LIST_ASSOC_VAL(weapon_stats_list) - QDEL_LIST_ASSOC_VAL(job_stats_list) - /datum/entity_meta/statistic_round - entity_type = /datum/entity/statistic/round + entity_type = /datum/entity/statistic_round table_name = "rounds" key_field = "round_id" field_types = list( @@ -77,290 +62,162 @@ "total_projectiles_hit_human" = DB_FIELDTYPE_INT, "total_projectiles_hit_xeno" = DB_FIELDTYPE_INT, "total_friendly_fire_instances" = DB_FIELDTYPE_INT, - "total_slashes" = DB_FIELDTYPE_INT + "total_friendly_kills" = DB_FIELDTYPE_INT, + "total_slashes" = DB_FIELDTYPE_INT, ) /datum/game_mode/proc/setup_round_stats() - if(!round_stats) - var/datum/entity/mc_round/mc_round = SSentity_manager.select(/datum/entity/mc_round) + set waitfor = FALSE + + WAIT_SSPERFLOGGING_READY + + if(!GLOB.round_statistics) var/operation_name operation_name = "[pick(GLOB.operation_titles)]" operation_name += " [pick(GLOB.operation_prefixes)]" operation_name += "-[pick(GLOB.operation_postfixes)]" - // Round stats - round_stats = DB_ENTITY(/datum/entity/statistic/round) - round_stats.round_name = operation_name - round_stats.round_id = mc_round.id - round_stats.map_name = SSmapping.configs[GROUND_MAP].map_name - round_stats.game_mode = name - round_stats.real_time_start = world.realtime - round_stats.save() - - // Setup the global reference - GLOB.round_statistics = round_stats - - // Map stats - var/datum/entity/statistic/map/new_map = DB_EKEY(/datum/entity/statistic/map, SSmapping.configs[GROUND_MAP].map_name) - new_map.total_rounds++ - new_map.save() - - // Connect map to round - round_stats.current_map = new_map - -/datum/entity/statistic/round/proc/setup_job_stats(job, noteworthy = TRUE) - if(!job) - return - var/job_key = strip_improper(job) - if(job_stats_list["[job_key]"]) - var/datum/entity/player_stats/job/S = job_stats_list["[job_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/player_stats/job/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = src - new_stat.name = job_key - new_stat.total_rounds_played++ - job_stats_list["[job_key]"] = new_stat - return new_stat - -/datum/entity/statistic/round/proc/setup_weapon_stats(weapon, noteworthy = TRUE) - if(!weapon) - return - var/weapon_key = strip_improper(weapon) - if(weapon_stats_list["[weapon_key]"]) - var/datum/entity/weapon_stats/S = weapon_stats_list["[weapon_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/weapon_stats/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = src - new_stat.name = weapon_key - weapon_stats_list["[weapon_key]"] = new_stat - return new_stat - -/datum/entity/statistic/round/proc/setup_caste_stats(caste, noteworthy = TRUE) - if(!caste) - return - var/caste_key = strip_improper(caste) - if(caste_stats_list["[caste_key]"]) - var/datum/entity/player_stats/caste/S = caste_stats_list["[caste_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/player_stats/caste/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = src - new_stat.name = caste_key - new_stat.total_rounds_played++ - caste_stats_list["[caste_key]"] = new_stat - return new_stat - -/datum/entity/statistic/round/proc/setup_ability(ability) - if(!ability) - return - var/ability_key = strip_improper(ability) - if(abilities_used["[ability_key]"]) - return abilities_used["[ability_key]"] - var/datum/entity/statistic/S = new() - S.name = ability_key - S.value = 0 - abilities_used["[ability_key]"] = S - return S - -/datum/entity/statistic/round/proc/recalculate_nemesis() - for(var/caste_statistic in caste_stats_list) - var/datum/entity/player_stats/caste/caste_entity = caste_stats_list[caste_statistic] - caste_entity.recalculate_nemesis() - for(var/job_statistic in job_stats_list) - var/datum/entity/player_stats/job/job_entity = job_stats_list[job_statistic] - job_entity.recalculate_nemesis() - -/datum/entity/statistic/round/proc/track_ability_usage(ability, amount = 1) - var/datum/entity/statistic/S = setup_ability(ability) - S.value += amount - -/datum/entity/statistic/round/proc/setup_faction(faction) + var/datum/entity/statistic_round/round_statistics = DB_ENTITY(/datum/entity/statistic_round) + round_statistics.round_name = operation_name + round_statistics.map_name = SSmapping.configs[GROUND_MAP].map_name + var/datum/entity/statistic_map/new_map = DB_EKEY(/datum/entity/statistic_map, round_statistics.map_name) + round_statistics.current_map = new_map + round_statistics.current_map.save() + round_statistics.round_id = SSperf_logging.round?.id + round_statistics.game_mode = name + round_statistics.real_time_start = world.realtime + round_statistics.save() + GLOB.round_statistics = round_statistics + +/datum/entity/statistic_round/proc/setup_faction(faction) if(!faction) return - var/faction_key = strip_improper(faction) - if(!participants["[faction_key]"]) - var/datum/entity/statistic/S = new() - S.name = faction_key - S.value = 0 - participants["[faction_key]"] = S - if(!final_participants["[faction_key]"]) - var/datum/entity/statistic/S = new() - S.name = faction_key - S.value = 0 - final_participants["[faction_key]"] = S - if(!hijack_participants["[faction_key]"]) - var/datum/entity/statistic/S = new() - S.name = faction_key - S.value = 0 - hijack_participants["[faction_key]"] = S - if(!total_deaths["[faction_key]"]) - var/datum/entity/statistic/S = new() - S.name = faction_key - S.value = 0 - total_deaths["[faction_key]"] = S - -/datum/entity/statistic/round/proc/track_new_participant(faction, amount = 1) + + if(!participants[faction]) + participants[faction] = 0 + + if(!final_participants[faction]) + final_participants[faction] = 0 + + if(!hijack_participants[faction]) + hijack_participants[faction] = 0 + + if(!total_deaths[faction]) + total_deaths[faction] = 0 + +/datum/entity/statistic_round/proc/track_new_participant(faction, amount = 1) if(!faction) return - if(!participants["[faction]"]) + + if(!participants[faction]) setup_faction(faction) - var/datum/entity/statistic/S = participants["[faction]"] - S.value += amount -/datum/entity/statistic/round/proc/track_final_participant(faction, amount = 1) + participants[faction]++ + +/datum/entity/statistic_round/proc/track_final_participant(faction, amount = 1) if(!faction) return - if(!final_participants["[faction]"]) + + if(!final_participants[faction]) setup_faction(faction) - var/datum/entity/statistic/S = final_participants["[faction]"] - S.value += amount -/datum/entity/statistic/round/proc/track_round_end() - real_time_end = world.realtime + final_participants[faction]++ + +/datum/entity/statistic_round/proc/track_round_end() + real_time_end = time2text(world.realtime) for(var/i in GLOB.alive_mob_list) var/mob/M = i - if(M.mind) - track_final_participant(M.faction) + if(M.mind && M.faction) + track_final_participant(M.faction?.name) + + if(current_map) + current_map.total_rounds++ + current_map.save() save() - detach() -/datum/entity/statistic/round/proc/track_hijack_participant(faction, amount = 1) +/datum/entity/statistic_round/proc/track_hijack_participant(faction, amount = 1) if(!faction) return - if(!hijack_participants["[faction]"]) + + if(!hijack_participants[faction]) setup_faction(faction) - var/datum/entity/statistic/S = hijack_participants["[faction]"] - S.value += amount -/datum/entity/statistic/round/proc/track_hijack() + hijack_participants[faction]++ + +/datum/entity/statistic_round/proc/track_hijack() for(var/i in GLOB.alive_mob_list) var/mob/M = i if(M.mind) - track_hijack_participant(M.faction) - round_hijack_time = world.time - save() + track_hijack_participant(M.faction?.name) + round_hijack_time = duration2text(world.time) + save() if(current_map) current_map.total_hijacks++ current_map.save() -/datum/entity/statistic/round/proc/track_dead_participant(faction, amount = 1) +/datum/entity/statistic_round/proc/track_dead_participant(faction, amount = 1) if(!faction) return - if(!total_deaths["[faction]"]) + + if(!total_deaths[faction]) setup_faction(faction) - var/datum/entity/statistic/S = total_deaths["[faction]"] - S.value += amount - -/datum/entity/statistic/round/proc/track_death(datum/entity/statistic/death/new_death) - if(new_death) - death_stats_list.Insert(1, new_death) - var/list/damage_list = list() - - if(new_death.total_brute > 0) - damage_list += list(list("name" = "brute", "value" = new_death.total_brute)) - if(new_death.total_burn > 0) - damage_list += list(list("name" = "burn", "value" = new_death.total_burn)) - if(new_death.total_oxy > 0) - damage_list += list(list("name" = "oxy", "value" = new_death.total_oxy)) - if(new_death.total_tox > 0) - damage_list += list(list("name" = "tox", "value" = new_death.total_tox)) - - var/new_time_of_death - if(new_death.time_of_death) - new_time_of_death = duration2text(new_death.time_of_death) - var/new_total_time_alive - if(new_death.total_time_alive) - new_total_time_alive = duration2text(new_death.total_time_alive) - - var/death = list(list( - "mob_name" = sanitize(new_death.mob_name), - "job_name" = new_death.role_name, - "area_name" = sanitize_area(new_death.area_name), - "cause_name" = sanitize_area(new_death.cause_name), - "total_kills" = new_death.total_kills, - "total_damage" = damage_list, - "time_of_death" = new_time_of_death, - "total_time_alive" = new_total_time_alive, - "total_damage_taken" = new_death.total_damage_taken, - "x" = new_death.x, - "y" = new_death.y, - "z" = new_death.z - )) - var/list/new_death_list = list() - if(death_data["death_stats_list"]) - new_death_list = death_data["death_stats_list"] - new_death_list.Insert(1, death) - if(length(new_death_list) > STATISTICS_DEATH_LIST_LEN) - new_death_list.Cut(STATISTICS_DEATH_LIST_LEN+1, length(new_death_list)) - death_data["death_stats_list"] = new_death_list - track_dead_participant(new_death.faction_name) - -/datum/entity/statistic/round/proc/log_round_statistics() + + total_deaths[faction]++ + +/datum/entity/statistic_round/proc/log_round_statistics() if(!GLOB.round_stats) return + var/total_xenos_created = 0 var/total_predators_spawned = 0 - var/total_predaliens = 0 + var/total_predaliens_spawned = 0 var/total_humans_created = 0 for(var/statistic in participants) - var/datum/entity/statistic/S = participants[statistic] - if(S.name in FACTION_LIST_XENOMORPH) - total_xenos_created += S.value - else if(S.name == FACTION_YAUTJA) - total_predators_spawned += S.value - else if(S.name == FACTION_PREDALIEN) - total_predators_spawned += S.value + if(statistic in FACTION_LIST_XENOMORPH) + total_xenos_created += participants[statistic] + if(statistic == FACTION_PREDALIEN) + total_predaliens_spawned += hijack_participants[statistic] + else if(statistic == FACTION_YAUTJA) + total_predators_spawned += participants[statistic] else - total_humans_created += S.value + total_humans_created += participants[statistic] var/xeno_count_during_hijack = 0 var/human_count_during_hijack = 0 for(var/statistic in hijack_participants) - var/datum/entity/statistic/S = hijack_participants[statistic] - if(S.name in FACTION_LIST_XENOMORPH) - xeno_count_during_hijack += S.value - else if(S.name == FACTION_PREDALIEN) - xeno_count_during_hijack += S.value - else if(S.name == FACTION_YAUTJA) + if(statistic == FACTION_PREDALIEN || (statistic in FACTION_LIST_XENOMORPH)) + xeno_count_during_hijack += hijack_participants[statistic] + else if(statistic == FACTION_YAUTJA) continue else - human_count_during_hijack += S.value + human_count_during_hijack += hijack_participants[statistic] var/end_of_round_marines = 0 var/end_of_round_xenos = 0 for(var/statistic in final_participants) - var/datum/entity/statistic/S = final_participants[statistic] - if(S.name in FACTION_LIST_XENOMORPH) - end_of_round_xenos += S.value - else if(S.name == FACTION_PREDALIEN) - end_of_round_xenos += S.value - else if(S.name == FACTION_YAUTJA) + if(statistic == FACTION_PREDALIEN || (statistic in FACTION_LIST_XENOMORPH)) + end_of_round_xenos += final_participants[statistic] + else if(statistic == FACTION_YAUTJA) continue else - end_of_round_marines += S.value + end_of_round_marines += final_participants[statistic] 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" + if(total_predators_spawned) + stats += "Total Preds spawned: [total_predators_spawned]\n" + if(total_predaliens_spawned) + stats += "Total Predaliens spawned: [total_predaliens_spawned]\n" stats += "Total humans spawned: [total_humans_created]\n" stats += "Xeno count during hijack: [xeno_count_during_hijack]\n" @@ -371,6 +228,7 @@ stats += "Total shots fired: [total_projectiles_fired]\n" stats += "Total friendly fire instances: [total_friendly_fire_instances]\n" + stats += "Total friendly kills: [total_friendly_kills]\n" stats += "Marines remaining: [end_of_round_marines]\n" stats += "Xenos remaining: [end_of_round_xenos]\n" @@ -387,14 +245,12 @@ if(!..()) return FALSE - if(!owner.client || !owner.client.player_entity) + if(!owner.client || !owner?.client?.player_data?.player_entity) return FALSE - return TRUE /datum/action/show_round_statistics/action_activate() - . = ..() if(!can_use_action()) return - owner.client.player_entity.show_statistics(owner, GLOB.round_statistics, TRUE) + owner.client.player_data.player_entity.tgui_interact(owner) diff --git a/code/datums/statistics/entities/weapon_stats.dm b/code/datums/statistics/entities/weapon_stats.dm deleted file mode 100644 index 9fff5c514458..000000000000 --- a/code/datums/statistics/entities/weapon_stats.dm +++ /dev/null @@ -1,49 +0,0 @@ -/datum/entity/weapon_stats - var/datum/entity/player - var/list/niche_stats = list() //! Indexed list of /datum/entity/statistic, "Total Reloads" = number - var/list/humans_killed = list() //! Indexed list of /datum/entity/statistic, "jobname2" = number - var/list/xenos_killed = list() //! Indexed list of /datum/entity/statistic, "caste" = number - var/name - var/total_kills = 0 - var/total_hits - var/total_shots - var/total_shots_hit - var/total_friendly_fire - var/display_stat = TRUE - -/datum/entity/weapon_stats/Destroy(force) - player = null - QDEL_LIST_ASSOC_VAL(niche_stats) - QDEL_LIST_ASSOC_VAL(humans_killed) - QDEL_LIST_ASSOC_VAL(xenos_killed) - return ..() - -/datum/entity/weapon_stats/proc/count_human_kill(job_name) - if(!job_name) - return - if(!humans_killed["[job_name]"]) - var/datum/entity/statistic/N = new() - N.name = job_name - humans_killed["[job_name]"] = N - var/datum/entity/statistic/S = humans_killed["[job_name]"] - S.value++ - -/datum/entity/weapon_stats/proc/count_xeno_kill(caste) - if(!caste) - return - if(!xenos_killed["[caste]"]) - var/datum/entity/statistic/N = new() - N.name = caste - xenos_killed["[caste]"] = N - var/datum/entity/statistic/S = xenos_killed["[caste]"] - S.value++ - -/datum/entity/weapon_stats/proc/count_niche_stat(niche_name, amount = 1) - if(!niche_name) - return - if(!niche_stats["[niche_name]"]) - var/datum/entity/statistic/N = new() - N.name = niche_name - niche_stats["[niche_name]"] = N - var/datum/entity/statistic/S = niche_stats["[niche_name]"] - S.value += amount diff --git a/code/datums/statistics/entities/xeno_stats.dm b/code/datums/statistics/entities/xeno_stats.dm deleted file mode 100644 index 9703c8c5e397..000000000000 --- a/code/datums/statistics/entities/xeno_stats.dm +++ /dev/null @@ -1,171 +0,0 @@ -/datum/entity/player_stats/xeno - var/total_hits = 0 - var/datum/entity/player_stats/caste/top_caste = null // reference to /datum/entity/player_stats/caste (i.e. ravager) - var/list/caste_stats_list = list() // list of types /datum/entity/player_stats/caste - var/list/datum/entity/statistic/medal/medal_list = list() // list of all royal jelly earned - -/datum/entity/player_stats/xeno/Destroy(force) - . = ..() - QDEL_NULL(top_caste) - QDEL_LIST_ASSOC_VAL(caste_stats_list) - QDEL_LIST(medal_list) - -/datum/entity/player_stats/xeno/get_playtime(type) - if(!type || type == FACTION_XENOMORPH) - return ..() - if(!caste_stats_list["[type]"]) - return 0 - var/datum/entity/player_stats/caste/S = caste_stats_list["[type]"] - return S.get_playtime() - -//****************** -//Stat Procs - setup -//****************** - -/datum/entity/player_stats/xeno/proc/setup_caste_stats(caste, noteworthy = TRUE) - if(!caste) - return - var/caste_key = strip_improper(caste) - if(caste_stats_list["[caste_key]"]) - var/datum/entity/player_stats/caste/S = caste_stats_list["[caste_key]"] - if(!S.display_stat && noteworthy) - S.display_stat = noteworthy - return S - var/datum/entity/player_stats/caste/new_stat = new() - new_stat.display_stat = noteworthy - new_stat.player = player - new_stat.name = caste_key - caste_stats_list["[caste_key]"] = new_stat - return new_stat - -//****************** -//Stat Procs - death -//****************** - -/mob/living/carbon/xenomorph/track_death_calculations() - if(statistic_exempt || statistic_tracked || !mind || !mind.player_entity) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - if(!xeno_stats.round_played) - xeno_stats.total_rounds_played++ - xeno_stats.round_played = TRUE - xeno_stats.total_playtime += life_time_total - xeno_stats.track_caste_playtime(caste_type, life_time_total) - xeno_stats.recalculate_top_caste() - xeno_stats.recalculate_nemesis() - ..() - -/datum/entity/player_stats/xeno/recalculate_nemesis() - for(var/caste_statistic in caste_stats_list) - var/datum/entity/player_stats/caste/caste_entity = caste_stats_list[caste_statistic] - caste_entity.recalculate_nemesis() - ..() - -/datum/entity/player_stats/xeno/proc/recalculate_top_caste() - for(var/statistics in caste_stats_list) - var/datum/entity/player_stats/caste/stat_entity = caste_stats_list[statistics] - if(!top_caste) - top_caste = stat_entity - continue - if(stat_entity.total_kills > top_caste.total_kills) - top_caste = stat_entity - -/datum/entity/player_stats/xeno/proc/track_caste_playtime(caste, time = 0) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - if(!S.round_played) - S.total_rounds_played++ - S.round_played = TRUE - S.total_playtime += time - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.total_playtime += time - -/datum/entity/player_stats/xeno/count_personal_death(caste) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.total_deaths++ - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.total_deaths++ - -//****************** -//Stat Procs - kills -//****************** - -/datum/entity/player_stats/xeno/count_personal_human_kill(job_name, cause, caste) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.count_human_kill(job_name, cause) - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.count_human_kill(job_name, cause) - recalculate_top_caste() - -/datum/entity/player_stats/xeno/count_personal_xeno_kill(caste_type, cause, caste) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.count_xeno_kill(caste_type, cause) - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.count_xeno_kill(caste_type, cause) - recalculate_top_caste() - -//***************** -//Mob Procs - minor -//***************** - -/datum/entity/player_stats/xeno/count_personal_niche_stat(niche_name, amount = 1, caste) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.count_niche_stat(niche_name, amount) - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.count_niche_stat(niche_name, amount) - -/datum/entity/player_stats/xeno/proc/track_personal_abilities_used(caste, ability, amount = 1) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.track_personal_abilities_used(ability, amount) - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.track_personal_abilities_used(ability, amount) - -/mob/living/carbon/xenomorph/proc/track_ability_usage(ability, caste, amount = 1) - if(statistic_exempt || !client || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(caste_type && !isnull(xeno_stats)) - xeno_stats.track_personal_abilities_used(caste_type, ability, amount) - -/datum/entity/player_stats/xeno/count_personal_steps_walked(caste, amount = 1) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.steps_walked += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.steps_walked += amount - -/mob/living/carbon/xenomorph/track_steps_walked(amount = 1) - if(statistic_exempt || !client || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - xeno_stats.steps_walked += amount - if(caste_type) - xeno_stats.count_personal_steps_walked(caste_type, amount) - -/datum/entity/player_stats/xeno/proc/count_personal_slashes(caste, amount = 1) - var/datum/entity/player_stats/caste/S = setup_caste_stats(caste) - S.total_hits += amount - if(GLOB.round_statistics) - var/datum/entity/player_stats/caste/R = GLOB.round_statistics.setup_caste_stats(caste) - R.total_hits += amount - -/mob/living/carbon/xenomorph/proc/track_slashes(caste, amount = 1) - if(statistic_exempt || !client || !mind) - return - var/datum/entity/player_stats/xeno/xeno_stats = mind.setup_xeno_stats() - if(isnull(xeno_stats)) - return - xeno_stats.total_hits += amount - if(caste_type) - xeno_stats.count_personal_slashes(caste_type, amount) - if(GLOB.round_statistics) - GLOB.round_statistics.total_slashes += amount diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 4a208b00a796..0914b4fa6b1f 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -986,7 +986,10 @@ Additional game mode variables. // for the toolbox /datum/game_mode/proc/end_round_message() - return "Extended round has ended." + if(round_finished) + return "Round has ended. [round_finished]." + else + return "Round has ended due to technical reasons." /datum/game_mode/proc/get_escape_menu() return "On the [SSmapping.configs[SHIP_MAP].map_name], orbiting..." diff --git a/code/game/gamemodes/colonialmarines/colonialmarines.dm b/code/game/gamemodes/colonialmarines/colonialmarines.dm index 14f5397b1f91..9eac36f7970c 100644 --- a/code/game/gamemodes/colonialmarines/colonialmarines.dm +++ b/code/game/gamemodes/colonialmarines/colonialmarines.dm @@ -12,6 +12,24 @@ flags_round_type = MODE_INFESTATION|MODE_FOG_ACTIVATED|MODE_NEW_SPAWN static_comms_amount = 1 var/round_status_flags + round_end_states = list(MODE_INFESTATION_X_MAJOR, MODE_INFESTATION_M_MAJOR, MODE_INFESTATION_X_MINOR, MODE_INFESTATION_M_MINOR, MODE_INFESTATION_DRAW_DEATH) + + faction_result_end_state = list( + FACTION_MARINE = list( + MODE_INFESTATION_M_MAJOR = list("marine_major", list('sound/music/round_end/winning_triumph1.ogg', 'sound/music/round_end/winning_triumph2.ogg'), list('sound/music/round_end/issomebodysinging.ogg')), + MODE_INFESTATION_M_MINOR = list("marine_major", list('sound/music/round_end/neutral_hopeful1.ogg', 'sound/music/round_end/neutral_hopeful2.ogg'), list()), + MODE_INFESTATION_X_MINOR = list("marine_minor", list('sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), list('sound/music/round_end/bluespace.ogg')), + MODE_INFESTATION_X_MAJOR = list("marine_minor", list('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg'), list('sound/music/round_end/end.ogg')), + MODE_GENERIC_DRAW_NUKE = list("draw", list('sound/music/round_end/nuclear_detonation1.ogg', 'sound/music/round_end/nuclear_detonation2.ogg'), list()), + ), + FACTION_XENOMORPH_NORMAL = list( + MODE_INFESTATION_X_MAJOR = list("xeno_major", list('sound/music/round_end/winning_triumph1.ogg', 'sound/music/round_end/winning_triumph2.ogg'), list()), + MODE_INFESTATION_X_MINOR = list("xeno_major", list('sound/music/round_end/neutral_hopeful1.ogg', 'sound/music/round_end/neutral_hopeful2.ogg'), list()), + MODE_INFESTATION_M_MINOR = list("xeno_minor", list('sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), list('sound/music/round_end/bluespace.ogg')), + MODE_INFESTATION_M_MAJOR = list("xeno_minor", list('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg'), list('sound/music/round_end/end.ogg')), + MODE_GENERIC_DRAW_NUKE = list("draw", list('sound/music/round_end/nuclear_detonation1.ogg', 'sound/music/round_end/nuclear_detonation2.ogg'), list()), + ) + ) var/research_allocation_interval = 10 MINUTES var/next_research_allocation = 0 @@ -462,26 +480,10 @@ ////////////////////////////////////////////////////////////////////// //Announces the end of the game with all relevant information stated// ////////////////////////////////////////////////////////////////////// -#define MAJORITY 0.5 // What percent do we consider a 'majority?' -/datum/game_mode/colonialmarines/declare_completion() - announce_ending() - var/musical_track - var/end_icon = "draw" - switch(round_finished) - if(MODE_INFESTATION_X_MAJOR) - musical_track = pick('sound/theme/sad_loss1.ogg','sound/theme/sad_loss2.ogg') - end_icon = "xeno_major" - if(GLOB.round_statistics && GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_xeno_victories++ - GLOB.round_statistics.current_map.total_xeno_majors++ - if(MODE_INFESTATION_M_MAJOR) - musical_track = pick('sound/theme/winning_triumph1.ogg','sound/theme/winning_triumph2.ogg') - end_icon = "marine_major" - if(GLOB.round_statistics && GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_marine_victories++ - GLOB.round_statistics.current_map.total_marine_majors++ - if(MODE_INFESTATION_X_MINOR) +/* TODO: PUT IT SOMEWHERE LATER +#define MAJORITY 0.5 // What percent do we consider a 'majority?' +if(MODE_INFESTATION_X_MINOR) var/list/living_player_list = count_humans_and_xenos(get_affected_zlevels()) if(living_player_list[1] && !living_player_list[2]) // If Xeno Minor but Xenos are dead and Humans are alive, see which faction is the last standing var/headcount = count_per_faction() @@ -505,29 +507,10 @@ end_icon = "xeno_minor" if(GLOB.round_statistics && GLOB.round_statistics.current_map) GLOB.round_statistics.current_map.total_xeno_victories++ - if(MODE_INFESTATION_M_MINOR) - musical_track = pick('sound/theme/neutral_hopeful1.ogg','sound/theme/neutral_hopeful2.ogg') - end_icon = "marine_minor" - if(GLOB.round_statistics && GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_marine_victories++ - if(MODE_INFESTATION_DRAW_DEATH) - end_icon = "draw" - musical_track = 'sound/theme/neutral_hopeful2.ogg' - if(GLOB.round_statistics && GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_draws++ - var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY) - S.status = SOUND_STREAM - sound_to(world, S) - if(GLOB.round_statistics) - GLOB.round_statistics.game_mode = name - GLOB.round_statistics.round_length = world.time - GLOB.round_statistics.round_result = round_finished - GLOB.round_statistics.end_round_player_population = length(GLOB.clients) - - GLOB.round_statistics.log_round_statistics() +*/ - calculate_end_statistics() - show_end_statistics(end_icon) +/datum/game_mode/colonialmarines/declare_completion() + . = ..() declare_completion_announce_fallen_soldiers() declare_completion_announce_xenomorphs() @@ -539,23 +522,6 @@ add_current_round_status_to_end_results("Round End") handle_round_results_statistics_output() - return 1 - -// for the toolbox -/datum/game_mode/colonialmarines/end_round_message() - switch(round_finished) - if(MODE_INFESTATION_X_MAJOR) - return "Round has ended. Xeno Major Victory." - if(MODE_INFESTATION_M_MAJOR) - return "Round has ended. Marine Major Victory." - if(MODE_INFESTATION_X_MINOR) - return "Round has ended. Xeno Minor Victory." - if(MODE_INFESTATION_M_MINOR) - return "Round has ended. Marine Minor Victory." - if(MODE_INFESTATION_DRAW_DEATH) - return "Round has ended. Draw." - return "Round has ended in a strange way." - /datum/game_mode/colonialmarines/proc/add_current_round_status_to_end_results(special_round_status as text) var/players = GLOB.clients var/list/counted_humans = list( @@ -609,7 +575,7 @@ var/datum/discord_embed/embed = new() embed.title = "[SSperf_logging.round?.id]" - embed.description = "[round_stats.round_name]\n[round_stats.map_name]\n[end_round_message()]" + embed.description = "[GLOB.round_statistics.round_name]\n[GLOB.round_statistics.map_name]\n[end_round_message()]" var/list/webhook_info = list() webhook_info["embeds"] = list(embed.convert_to_list()) @@ -710,4 +676,3 @@ #undef HIJACK_EXPLOSION_COUNT #undef MARINE_MAJOR_ROUND_END_DELAY -#undef MAJORITY diff --git a/code/game/gamemodes/colonialmarines/huntergames.dm b/code/game/gamemodes/colonialmarines/huntergames.dm index 23344ee9e8f0..3fb6d902aa43 100644 --- a/code/game/gamemodes/colonialmarines/huntergames.dm +++ b/code/game/gamemodes/colonialmarines/huntergames.dm @@ -423,9 +423,6 @@ GLOB.round_statistics.log_round_statistics() - - return 1 - /datum/game_mode/proc/auto_declare_completion_huntergames() return diff --git a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm index b3fd079d638c..25866d5ead33 100644 --- a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm +++ b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm @@ -37,6 +37,18 @@ /datum/job/marine/standard/whiskey = JOB_SQUAD_MARINE, ) + round_end_states = list(MODE_WISKEY_OUTPOST_X_MAJOR, MODE_WISKEY_OUTPOST_M_MAJOR) + + faction_result_end_state = list( + FACTION_MARINE = list( + MODE_WISKEY_OUTPOST_M_MAJOR = list("marine_major", list('sound/misc/hell_march.ogg'), list('sound/music/round_end/issomebodysinging.ogg')), + MODE_WISKEY_OUTPOST_X_MAJOR = list("marine_minor", list('sound/misc/Game_Over_Man.ogg'), list('sound/music/round_end/end.ogg')), + ), + FACTION_XENOMORPH_NORMAL = list( + MODE_WISKEY_OUTPOST_X_MAJOR = list("xeno_major", list('sound/misc/hell_march.ogg'), list('sound/music/round_end/bluespace.ogg')), + MODE_WISKEY_OUTPOST_M_MAJOR = list("xeno_minor", list('sound/misc/Game_Over_Man.ogg'), list('sound/music/round_end/end.ogg')), + ) + ) latejoin_larva_drop = 0 //You never know @@ -249,68 +261,31 @@ //Checks if the round is over// /////////////////////////////// /datum/game_mode/whiskey_outpost/check_finished() - if(finished != 0) - return 1 - - return 0 + if(round_finished) + return TRUE + return FALSE ////////////////////////////////////////////////////////////////////// //Announces the end of the game with all relevant information stated// ////////////////////////////////////////////////////////////////////// -/datum/game_mode/whiskey_outpost/declare_completion() - if(GLOB.round_statistics) - GLOB.round_statistics.track_round_end() - if(finished == 1) - log_game("Round end result - xenos won") - to_world(SPAN_ROUND_HEADER("The Xenos have successfully defended their hive from colonization.")) - to_world(SPAN_ROUNDBODY("Well done, you've secured LV-624 for the hive!")) - to_world(SPAN_ROUNDBODY("It will be another five years before the USCM returns to the Neroid Sector, with the arrival of the 2nd 'Falling Falcons' Battalion and the USS Almayer.")) - to_world(SPAN_ROUNDBODY("The xenomorph hive on LV-624 remains unthreatened until then...")) - world << sound('sound/misc/Game_Over_Man.ogg') - if(GLOB.round_statistics) - GLOB.round_statistics.round_result = MODE_INFESTATION_X_MAJOR - if(GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_xeno_victories++ - GLOB.round_statistics.current_map.total_xeno_majors++ - - else if(finished == 2) - log_game("Round end result - marines won") - to_world(SPAN_ROUND_HEADER("Against the onslaught, the marines have survived.")) - to_world(SPAN_ROUNDBODY("The signal rings out to the USS Alistoun, and Dust Raiders stationed elsewhere in the Neroid Sector begin to converge on LV-624.")) - to_world(SPAN_ROUNDBODY("Eventually, the Dust Raiders secure LV-624 and the entire Neroid Sector in 2182, pacifiying it and establishing peace in the sector for decades to come.")) - to_world(SPAN_ROUNDBODY("The USS Almayer and the 2nd 'Falling Falcons' Battalion are never sent to the sector and are spared their fate in 2186.")) - world << sound('sound/misc/hell_march.ogg') - if(GLOB.round_statistics) - GLOB.round_statistics.round_result = MODE_INFESTATION_M_MAJOR - if(GLOB.round_statistics.current_map) - GLOB.round_statistics.current_map.total_marine_victories++ - GLOB.round_statistics.current_map.total_marine_majors++ - - else - log_game("Round end result - no winners") - to_world(SPAN_ROUND_HEADER("NOBODY WON!")) - to_world(SPAN_ROUNDBODY("How? Don't ask me...")) - world << 'sound/misc/sadtrombone.ogg' - if(GLOB.round_statistics) - GLOB.round_statistics.round_result = MODE_INFESTATION_DRAW_DEATH - - if(GLOB.round_statistics) - GLOB.round_statistics.game_mode = name - GLOB.round_statistics.round_length = world.time - GLOB.round_statistics.end_round_player_population = length(GLOB.clients) - - GLOB.round_statistics.log_round_statistics() - - round_finished = 1 - - calculate_end_statistics() - - - return 1 - -/datum/game_mode/proc/auto_declare_completion_whiskey_outpost() - return +/datum/game_mode/whiskey_outpost/announce_ending() + log_game("Round end result: [round_finished]") + to_chat_spaced(world, margin_top = 2, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDHEADER("|Round Complete|")) + switch(round_finished) + if(MODE_WISKEY_OUTPOST_M_MAJOR) + to_world(SPAN_ROUND_HEADER("Against the onslaught, the marines have survived.")) + to_world(SPAN_ROUNDBODY("The signal rings out to the USS Alistoun, and Dust Raiders stationed elsewhere in the Neroid Sector begin to converge on LV-624.")) + to_world(SPAN_ROUNDBODY("Eventually, the Dust Raiders secure LV-624 and the entire Neroid Sector in 2182, pacifiying it and establishing peace in the sector for decades to come.")) + to_world(SPAN_ROUNDBODY("The USS Almayer and the 2nd 'Falling Falcons' Battalion are never sent to the sector and are spared their fate in 2186.")) + if(MODE_WISKEY_OUTPOST_X_MAJOR) + to_world(SPAN_ROUND_HEADER("The Xenos have successfully defended their hive from colonization.")) + to_world(SPAN_ROUNDBODY("Well done, you've secured LV-624 for the hive!")) + to_world(SPAN_ROUNDBODY("It will be another five years before the USCM returns to the Neroid Sector, with the arrival of the 2nd 'Falling Falcons' Battalion and the USS Almayer.")) + to_world(SPAN_ROUNDBODY("The xenomorph hive on LV-624 remains unthreatened until then...")) +/////////////////////////////// +//Other WO things to simulate// +/////////////////////////////// /datum/game_mode/whiskey_outpost/proc/place_whiskey_outpost_drop(OT = "sup") //Art revamping spawns 13JAN17 var/turf/T = pick(supply_spawns) var/randpick diff --git a/code/game/gamemodes/colonialmarines/xenovsxeno.dm b/code/game/gamemodes/colonialmarines/xenovsxeno.dm index e1672f362731..e2e4547fc9a8 100644 --- a/code/game/gamemodes/colonialmarines/xenovsxeno.dm +++ b/code/game/gamemodes/colonialmarines/xenovsxeno.dm @@ -214,7 +214,6 @@ if(istype(X) && is_hive_living(hive)) hivenumbers[hive.name].Add(X) - return hivenumbers /////////////////////////// @@ -243,39 +242,24 @@ else if (living_hives == 1) round_finished = "The [last_living_hive] has won." - /////////////////////////////// //Checks if the round is over// /////////////////////////////// /datum/game_mode/xenovs/check_finished() if(round_finished) return TRUE + return FALSE ////////////////////////////////////////////////////////////////////// //Announces the end of the game with all relevant information stated// ////////////////////////////////////////////////////////////////////// /datum/game_mode/xenovs/declare_completion() - announce_ending() - var/musical_track - musical_track = pick('sound/theme/neutral_melancholy1.ogg', 'sound/theme/neutral_melancholy2.ogg') - - var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY) - S.status = SOUND_STREAM - sound_to(world, S) - if(GLOB.round_statistics) - GLOB.round_statistics.game_mode = name - GLOB.round_statistics.round_length = world.time - GLOB.round_statistics.end_round_player_population = length(GLOB.clients) - - GLOB.round_statistics.log_round_statistics() + . = ..() declare_completion_announce_xenomorphs() calculate_end_statistics() declare_fun_facts() - - return TRUE - /datum/game_mode/xenovs/announce_ending() if(GLOB.round_statistics) GLOB.round_statistics.track_round_end() @@ -283,8 +267,21 @@ to_chat_spaced(world, margin_top = 2, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDHEADER("|Round Complete|")) to_chat_spaced(world, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDBODY("Thus ends the story of the battling hives on [SSmapping.configs[GROUND_MAP].map_name]. [round_finished]\nThe game-mode was: [GLOB.master_mode]!\n[CONFIG_GET(string/endofroundblurb)]")) -// for the toolbox -/datum/game_mode/xenovs/end_round_message() - if(round_finished) - return "Hive Wars Round has ended. [round_finished]" - return "Hive Wars Round has ended. No one has won" +/datum/game_mode/xenovs/get_winners_states() + var/list/icon_states = list() + var/list/musical_tracks = list() + var/sound/sound + for(var/faction_name in factions_pool) + var/pick = 2 + if(faction_won.faction_name == faction_name) + pick = 1 + + icon_states[faction_name] = faction_result_end_state[pick][1] + sound = sound(pick(faction_result_end_state[pick][2]), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + musical_tracks[faction_name] = sound + sound = sound(pick(faction_result_end_state[pick][3]), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + musical_tracks[faction_name] += sound + + return list(icon_states, musical_tracks) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 603f0313f840..9b8257ae146e 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -11,8 +11,6 @@ * */ -GLOBAL_DATUM(round_statistics, /datum/entity/statistic/round) -GLOBAL_LIST_INIT_TYPED(player_entities, /datum/entity/player_entity, list()) GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique tracking_ids to tacbinos and signal flares /datum/game_mode var/name = "invalid" @@ -20,6 +18,9 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/votable = TRUE var/vote_cycle = null var/probability = 0 + var/list/round_end_states = list() + var/list/faction_round_end_state = list() + var/list/faction_result_end_state = list() var/list/datum/mind/modePlayer = new var/required_players = 0 var/required_players_secret = 0 //Minimum number of players for that game mode to be chose in Secret @@ -32,8 +33,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/static_comms_amount = 0 var/obj/structure/machinery/computer/shuttle/dropship/flight/active_lz = null - var/datum/entity/statistic/round/round_stats = null - var/list/roles_to_roll var/corpses_to_spawn = 0 @@ -130,15 +129,11 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t return /datum/game_mode/proc/announce_ending() - if(GLOB.round_statistics) - GLOB.round_statistics.track_round_end() log_game("Round end result: [round_finished]") to_chat_spaced(world, margin_top = 2, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDHEADER("|Round Complete|")) to_chat_spaced(world, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDBODY("Thus ends the story of the brave men and women of the [MAIN_SHIP_NAME] and their struggle on [SSmapping.configs[GROUND_MAP].map_name].\nThe game-mode was: [GLOB.master_mode]!\n[CONFIG_GET(string/endofroundblurb)]")) /datum/game_mode/proc/declare_completion() - if(GLOB.round_statistics) - GLOB.round_statistics.track_round_end() var/clients = 0 var/surviving_humans = 0 var/surviving_total = 0 @@ -165,8 +160,50 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t if(surviving_total > 0) log_game("Round end - total: [surviving_total]") + announce_ending() - return 0 + var/list/winners_info = get_winners_states() + if(GLOB.round_statistics) + GLOB.round_statistics.game_mode = name + GLOB.round_statistics.round_length = world.time + GLOB.round_statistics.round_result = round_finished + if(!length(GLOB.round_statistics.current_map.victories)) + GLOB.round_statistics.current_map.victories = list() + GLOB.round_statistics.current_map.victories[round_finished]++ + GLOB.round_statistics.end_round_player_population = length(GLOB.clients) + + GLOB.round_statistics.log_round_statistics() + GLOB.round_statistics.track_round_end() + + calculate_end_statistics() + show_end_statistics(winners_info[1], winners_info[2], winners_info[3]) + +/datum/game_mode/proc/get_winners_states() + var/list/icon_states = list() + var/list/musical_tracks = list() + var/list/standart_payload = list() + standart_payload += "draw" + var/sound/sound = sound(pick('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg', 'sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + standart_payload += sound + sound = sound(pick('sound/music/round_end/end.ogg'), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + standart_payload += sound + for(var/faction_name in factions_pool) + if(faction_result_end_state[faction_name]) + icon_states[faction_name] = faction_result_end_state[faction_name][round_finished][1] + sound = sound(pick(faction_result_end_state[faction_name][round_finished][2]), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + musical_tracks[faction_name] = list(sound) + sound = sound(pick(faction_result_end_state[faction_name][round_finished][3]), channel = SOUND_CHANNEL_LOBBY) + sound.status = SOUND_STREAM + musical_tracks[faction_name] += sound + else + icon_states[faction_name] = standart_payload[1] + musical_tracks[faction_name] = list(standart_payload[2], standart_payload[3]) + + + return list(icon_states, musical_tracks, standart_payload) /datum/game_mode/proc/calculate_end_statistics() for(var/i in GLOB.alive_mob_list) @@ -181,14 +218,30 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t else record_playtime(M.client.player_data, M.job, type) -/datum/game_mode/proc/show_end_statistics(icon_state) - GLOB.round_statistics.update_panel_data() - for(var/mob/M in GLOB.player_list) - if(M.client) - give_action(M, /datum/action/show_round_statistics, null, icon_state) +/datum/game_mode/proc/show_end_statistics(icon_states, musical_tracks, standart_payload) + var/list/mobs = list() + for(var/faction_name in factions_pool) + var/faction_to_get = factions_pool[faction_name] + var/datum/faction/faction = GLOB.faction_datum[faction_to_get] + for(var/mob/mob in faction.totalMobs) + if(mob.client) + mobs += mob + give_action(mob, /datum/action/show_round_statistics, null, icon_states[faction_to_get]) + sound_to(mob, musical_tracks[faction.name][1]) + if(length(musical_tracks[faction_to_get]) > 1) + spawn(20 SECONDS) + sound_to(mob, musical_tracks[faction_to_get][2]) + + for(var/mob/mob in GLOB.player_list - mobs) + if(mob.client) + give_action(mob, /datum/action/show_round_statistics, null, standart_payload[1]) + sound_to(mob, standart_payload[2]) + if(length(standart_payload) > 2) + spawn(20 SECONDS) + sound_to(mob, standart_payload[3]) /datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. - return 0 + return FALSE /datum/game_mode/proc/get_players_for_role(role, override_jobbans = 0) var/list/players = list() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 84f02f0a5bbd..6a965c58195a 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -120,7 +120,7 @@ GLOBAL_LIST_INIT(airlock_wire_descriptions, list( if(damage >= damage_cap) if(M && istype(M)) - M.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_DOORS, 1) + M.count_statistic_stat(STATISTICS_DESTRUCTION_DOORS) SEND_SIGNAL(M, COMSIG_MOB_DESTROY_AIRLOCK, src) to_chat(loc, SPAN_DANGER("[src] blows apart!")) deconstruct(FALSE) diff --git a/code/game/machinery/doors/runed_sandstone.dm b/code/game/machinery/doors/runed_sandstone.dm index a6de7348dd7f..950f7ced3be0 100644 --- a/code/game/machinery/doors/runed_sandstone.dm +++ b/code/game/machinery/doors/runed_sandstone.dm @@ -183,7 +183,7 @@ if(damage >= damage_cap) if(M && istype(M)) - M.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_DOORS, 1) + M.count_statistic_stat(STATISTICS_DESTRUCTION_DOORS) SEND_SIGNAL(M, COMSIG_MOB_DESTROY_AIRLOCK, src) to_chat(loc, SPAN_DANGER("[src] blows apart!")) deconstruct(FALSE) diff --git a/code/game/machinery/fusion_engine.dm b/code/game/machinery/fusion_engine.dm index 72f836717b0f..bb52b23b7a28 100644 --- a/code/game/machinery/fusion_engine.dm +++ b/code/game/machinery/fusion_engine.dm @@ -334,6 +334,7 @@ return playsound(loc, 'sound/items/Ratchet.ogg', 25, 1) buildstate = BUILDSTATE_FUNCTIONAL + user.count_statistic_stat(STATISTICS_REPAIR_GENERATOR) update_icon() return diff --git a/code/game/objects/items/devices/defibrillator.dm b/code/game/objects/items/devices/defibrillator.dm index 518fdb1a9591..3b329a35f4de 100644 --- a/code/game/objects/items/devices/defibrillator.dm +++ b/code/game/objects/items/devices/defibrillator.dm @@ -218,6 +218,7 @@ H.apply_damage(-damage_heal_threshold, TOX) H.apply_damage(-damage_heal_threshold, CLONE) H.apply_damage(-H.getOxyLoss(), OXY) + user.track_heal_damage(initial(attached_to.name), H, attached_to.damage_heal_threshold * 3) H.updatehealth() //Needed for the check to register properly if(!(H.species?.flags & NO_CHEM_METABOLIZATION)) diff --git a/code/game/objects/items/explosives/grenades/grenade.dm b/code/game/objects/items/explosives/grenades/grenade.dm index b2f95646a966..44d126d08720 100644 --- a/code/game/objects/items/explosives/grenades/grenade.dm +++ b/code/game/objects/items/explosives/grenades/grenade.dm @@ -124,7 +124,7 @@ /obj/item/explosive/grenade/launch_towards(datum/launch_metadata/LM) if(active && ismob(LM.thrower)) var/mob/M = LM.thrower - M.count_niche_stat(STATISTICS_NICHE_GRENADES) + M.count_statistic_stat(STATISTICS_GRENADES) . = ..() diff --git a/code/game/objects/items/fulton.dm b/code/game/objects/items/fulton.dm index 9cdc2b78b609..f3f72e92268f 100644 --- a/code/game/objects/items/fulton.dm +++ b/code/game/objects/items/fulton.dm @@ -123,7 +123,7 @@ GLOBAL_LIST_EMPTY(deployed_fultons) transfer_fingerprints_to(F) src.add_fingerprint(user) F.add_fingerprint(user) - user.count_niche_stat(STATISTICS_NICHE_FULTON) + user.count_statistic_stat(STATISTICS_FULTON) use(1) F.deploy_fulton() else diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index af71b806ed42..d3ec9f0f7f4f 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -52,7 +52,7 @@ if(human_mob.has_limb_for_slot(WEAR_HANDCUFFS)) user.drop_inv_item_on_ground(src) human_mob.equip_to_slot_if_possible(src, WEAR_HANDCUFFS, 1, 0, 1, 1) - user.count_niche_stat(STATISTICS_NICHE_HANDCUFF) + user.count_statistic_stat(STATISTICS_HANDCUFF) else if(ismonkey(target)) user.visible_message(SPAN_NOTICE("[user] tries to put [src] on [target].")) diff --git a/code/game/objects/items/legcuffs.dm b/code/game/objects/items/legcuffs.dm index 1d216e6556e2..6661a1732781 100644 --- a/code/game/objects/items/legcuffs.dm +++ b/code/game/objects/items/legcuffs.dm @@ -37,7 +37,7 @@ if(human_target.has_limb_for_slot(WEAR_LEGCUFFS)) user.drop_inv_item_on_ground(src) human_target.equip_to_slot_if_possible(src, WEAR_LEGCUFFS, 1, 0, 1, 1) - user.count_niche_stat(STATISTICS_NICHE_HANDCUFF) + user.count_statistic_stat(STATISTICS_HANDCUFF) else if (ismonkey(target)) user.visible_message(SPAN_NOTICE("[user] tries to put [src] on [target].")) diff --git a/code/game/objects/items/reagent_containers/pill.dm b/code/game/objects/items/reagent_containers/pill.dm index 6c71d8be3c0c..037eacf75b4d 100644 --- a/code/game/objects/items/reagent_containers/pill.dm +++ b/code/game/objects/items/reagent_containers/pill.dm @@ -108,7 +108,7 @@ SPAN_HELPFUL("You fed [M] a pill."), SPAN_HELPFUL("[user] fed you a pill."), SPAN_NOTICE("[user] fed [M] a pill.")) - user.count_niche_stat(STATISTICS_NICHE_PILLS) + user.count_statistic_stat(STATISTICS_PILLS) var/rgt_list_text = get_reagent_list_text() diff --git a/code/game/objects/items/stacks/cable_coil.dm b/code/game/objects/items/stacks/cable_coil.dm index 1dd95464ddd5..772e5edb2929 100644 --- a/code/game/objects/items/stacks/cable_coil.dm +++ b/code/game/objects/items/stacks/cable_coil.dm @@ -327,6 +327,7 @@ return S.heal_damage(0, 15, TRUE) + user.track_heal_damage(initial(name), H, 15) H.pain.recalculate_pain() user.visible_message(SPAN_DANGER("\The [user] repairs some burn damage on \the [M]'s [S.display_name] with \the [src].")) return diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm index c4a496a12366..982112598da3 100644 --- a/code/game/objects/items/stacks/medical.dm +++ b/code/game/objects/items/stacks/medical.dm @@ -135,6 +135,7 @@ SPAN_HELPFUL("[user] salves the burns on your [affecting.display_name]."), SPAN_NOTICE("[user] salves the burns on [possessive_their] [affecting.display_name].")) affecting.heal_damage(burn = heal_burn) + user.track_heal_damage(initial(name), affecting, heal_burn) use(1) playsound(user, 'sound/handling/ointment_spreading.ogg', 25, 1, 2) if(WOUNDS_ALREADY_TREATED) @@ -185,6 +186,7 @@ if(SEND_SIGNAL(affecting, COMSIG_LIMB_ADD_SUTURES, TRUE, FALSE, heal_amt * 0.5)) heal_amt *= 0.5 affecting.heal_damage(brute = heal_amt) + user.track_heal_damage(initial(name), affecting, heal_amt) use(1) if(WOUNDS_ALREADY_TREATED) to_chat(user, SPAN_WARNING("The wounds on [possessive] [affecting.display_name] have already been treated.")) diff --git a/code/game/objects/items/weapons/blades.dm b/code/game/objects/items/weapons/blades.dm index ce1bb2ded072..0f66c0f495dd 100644 --- a/code/game/objects/items/weapons/blades.dm +++ b/code/game/objects/items/weapons/blades.dm @@ -195,10 +195,10 @@ embedded_human.embedded_items -= S organ = null for(var/i in 1 to S.count-1) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_SHRAPNEL) + user.count_statistic_stat(STATISTICS_SURGERY_SHRAPNEL) var/shrapnel = new S.type(S.loc) QDEL_IN(shrapnel, 300) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_SHRAPNEL) + user.count_statistic_stat(STATISTICS_SURGERY_SHRAPNEL) QDEL_IN(S, 300) if(length(removed_limbs)) diff --git a/code/game/objects/structures/barricade/barricade.dm b/code/game/objects/structures/barricade/barricade.dm index 28036f92d018..0c9819fc490b 100644 --- a/code/game/objects/structures/barricade/barricade.dm +++ b/code/game/objects/structures/barricade/barricade.dm @@ -50,7 +50,7 @@ if(health != maxhealth) //Update cades mapped with a custom health update_health(0, TRUE) if(user) - user.count_niche_stat(STATISTICS_NICHE_CADES) + user.count_statistic_stat(STATISTICS_CADES) addtimer(CALLBACK(src, PROC_REF(update_icon)), 0) starting_maxhealth = maxhealth @@ -383,7 +383,7 @@ user.visible_message(SPAN_NOTICE("[user] repairs some damage on [src]."), SPAN_NOTICE("You repair [src].")) - user.count_niche_stat(STATISTICS_NICHE_REPAIR_CADES) + user.count_statistic_stat(STATISTICS_REPAIR_CADES) update_health(-200) playsound(src.loc, 'sound/items/Welder2.ogg', 25, TRUE) diff --git a/code/game/objects/structures/barricade/deployable.dm b/code/game/objects/structures/barricade/deployable.dm index e53c917dc2bb..1a526f29b552 100644 --- a/code/game/objects/structures/barricade/deployable.dm +++ b/code/game/objects/structures/barricade/deployable.dm @@ -226,7 +226,7 @@ user.visible_message(SPAN_NOTICE("[user] repairs some damage on [src]."), SPAN_NOTICE("You repair [src].")) - user.count_niche_stat(STATISTICS_NICHE_REPAIR_CADES) + user.count_statistic_stat(STATISTICS_REPAIR_CADES) for(var/counter in 1 to length(stack_health)) stack_health[counter] += 200 diff --git a/code/game/objects/structures/barricade/metal.dm b/code/game/objects/structures/barricade/metal.dm index 3e79af2e21e1..bc67e395d266 100644 --- a/code/game/objects/structures/barricade/metal.dm +++ b/code/game/objects/structures/barricade/metal.dm @@ -128,7 +128,7 @@ to_chat(user, SPAN_NOTICE("You applied a composite upgrade.")) metal.use(2) - user.count_niche_stat(STATISTICS_NICHE_UPGRADE_CADES) + user.count_statistic_stat(STATISTICS_UPGRADE_CADES) update_icon() return else @@ -168,7 +168,7 @@ to_chat(user, SPAN_NOTICE("You applied a composite upgrade.")) metal.use(2) - user.count_niche_stat(STATISTICS_NICHE_UPGRADE_CADES) + user.count_statistic_stat(STATISTICS_UPGRADE_CADES) update_icon() return diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 154cc43d4af2..682dffa7e126 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -105,7 +105,7 @@ return if(health <= 0) if(user && istype(user)) - user.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_WINDOWS, 1) + user.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) SEND_SIGNAL(user, COMSIG_MOB_DESTROY_WINDOW, src) user.visible_message(SPAN_DANGER("[user] smashes through [src][AM ? " with [AM]":""]!")) if(is_mainship_level(z)) @@ -121,13 +121,22 @@ //Tasers and the like should not damage windows. var/ammo_flags = Proj.ammo.flags_ammo_behavior | Proj.projectile_override_flags if(Proj.ammo.damage_type == HALLOSS || Proj.damage <= 0 || ammo_flags == AMMO_ENERGY) - return 0 + return FALSE if(!not_damageable) //Impossible to destroy health -= Proj.damage + ..() healthcheck(user = Proj.firer) - return 1 + + if(health > 0) + return TRUE + + if(istype(proj.firer, /mob)) + var/mob/user = proj.firer + user.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) + + return TRUE /obj/structure/window/ex_act(severity, explosion_direction, datum/cause_data/cause_data) if(not_damageable) //Impossible to destroy @@ -146,7 +155,7 @@ create_shrapnel(location, rand(1,5), explosion_direction, shrapnel_type = /datum/ammo/bullet/shrapnel/light/glass, cause_data = cause_data) if(M) - M.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_WINDOWS, 1) + mob.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) SEND_SIGNAL(M, COMSIG_MOB_WINDOW_EXPLODED, src) handle_debris(severity, explosion_direction) @@ -537,7 +546,7 @@ return if(M) - M.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_WINDOWS, 1) + M.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) SEND_SIGNAL(M, COMSIG_MOB_EXPLODE_W_FRAME, src) if(health >= -3000) diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 8974eb36187f..3a4a3525c2f2 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -326,7 +326,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) COOLDOWN_START(src, next_fire, drop_cooldown) if(ismob(usr)) var/mob/M = usr - M.count_niche_stat(STATISTICS_NICHE_CRATES) + M.count_statistic_stat(STATISTICS_CRATES) playsound(crate.loc,'sound/effects/bamf.ogg', 50, 1) //Ehh var/obj/structure/droppod/supply/pod = new(null, crate) diff --git a/code/game/turfs/walls/walls.dm b/code/game/turfs/walls/walls.dm index bb1694359b98..d0622905612a 100644 --- a/code/game/turfs/walls/walls.dm +++ b/code/game/turfs/walls/walls.dm @@ -199,7 +199,7 @@ if(damage >= damage_cap) if(M && istype(M)) - M.count_niche_stat(STATISTICS_NICHE_DESTRUCTION_WALLS, 1) + M.count_statistic_stat(STATISTICS_DESTRUCTION_WALLS) SEND_SIGNAL(M, COMSIG_MOB_DESTROY_WALL, src) // Xenos used to be able to crawl through the wall, should suggest some structural damage to the girder if (acided_hole) diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm index 2facce7c3a59..a43ba16c003a 100644 --- a/code/modules/client/client_defines.dm +++ b/code/modules/client/client_defines.dm @@ -70,8 +70,6 @@ var/xeno_postfix = "" var/xeno_name_ban = FALSE - var/datum/entity/player_entity/player_entity = null - //Asset cache // List of all asset filenames sent to this client by the asset cache, along with their assoicated md5s var/list/sent_assets = list() diff --git a/code/modules/cm_marines/overwatch.dm b/code/modules/cm_marines/overwatch.dm index 84a27622959a..30928701acb1 100644 --- a/code/modules/cm_marines/overwatch.dm +++ b/code/modules/cm_marines/overwatch.dm @@ -804,7 +804,7 @@ busy = FALSE if(istype(T)) GLOB.almayer_orbital_cannon.fire_ob_cannon(T, user, current_squad) - user.count_niche_stat(STATISTICS_NICHE_OB) + user.count_statistic_stat(STATISTICS_OB) /obj/structure/machinery/computer/overwatch/proc/handle_supplydrop() SHOULD_NOT_SLEEP(TRUE) @@ -852,7 +852,7 @@ COOLDOWN_START(current_squad, next_supplydrop, 500 SECONDS) if(ismob(usr)) var/mob/M = usr - M.count_niche_stat(STATISTICS_NICHE_CRATES) + M.count_statistic_stat(STATISTICS_CRATES) playsound(crate.loc,'sound/effects/bamf.ogg', 50, 1) //Ehh var/obj/structure/droppod/supply/pod = new(null, crate) diff --git a/code/modules/cm_tech/implements/ammo_kits.dm b/code/modules/cm_tech/implements/ammo_kits.dm index bcf267a54ca8..e0f9b1e2f005 100644 --- a/code/modules/cm_tech/implements/ammo_kits.dm +++ b/code/modules/cm_tech/implements/ammo_kits.dm @@ -41,6 +41,8 @@ uses-- playsound(get_turf(user), "sound/machines/fax.ogg", 5) + user.count_statistic_stat(STATISTICS_AMMO_CONVERTED) + if(uses <= 0) user.drop_held_item(src) qdel(src) diff --git a/code/modules/cm_tech/implements/engi_czsp.dm b/code/modules/cm_tech/implements/engi_czsp.dm index f3024129b3eb..5031e2c27f0e 100644 --- a/code/modules/cm_tech/implements/engi_czsp.dm +++ b/code/modules/cm_tech/implements/engi_czsp.dm @@ -52,4 +52,5 @@ D.forceMove(H.loc) H.drop_held_item(src) + user.count_statistic_stat(STATISTICS_UPGRADE_TURRETS) qdel(src) diff --git a/code/modules/cm_tech/implements/implants.dm b/code/modules/cm_tech/implements/implants.dm index 8dbbe5d11c87..e008512138b9 100644 --- a/code/modules/cm_tech/implements/implants.dm +++ b/code/modules/cm_tech/implements/implants.dm @@ -87,12 +87,26 @@ /obj/item/device/implanter/attack_self(mob/user) ..() + + if(!uses || !implant_type) + return ..() + + if(LAZYISIN(user.implants, implant_type)) + to_chat(user, SPAN_WARNING("You already have this implant!")) + return + + if(length(user.implants) >= user.max_implants) + to_chat(user, SPAN_WARNING("You can't take any more implants!")) + return + implant(user, TRUE) /obj/item/device/implanter/proc/implant(mob/M, self_inject) if(uses <= 0) return + user.count_statistic_stat(STATISTICS_IMPLANTS_IMPLANTED) + if(LAZYISIN(M.implants, implant_type)) QDEL_NULL(M.implants[implant_type]) @@ -191,7 +205,9 @@ INVOKE_ASYNC(src, PROC_REF(revive), M) /obj/item/device/internal_implant/rejuv/proc/revive(mob/living/M) + M.track_revive() M.heal_all_damage() + M.count_statistic_stat(STATISTICS_REVIVED_BY_IMPLANT) for(var/i in stimulant_to_inject) var/reagent_id = i diff --git a/code/modules/desert_dam/motion_sensor/sensortower.dm b/code/modules/desert_dam/motion_sensor/sensortower.dm index a3f33d4da078..6cd95eb0ea57 100644 --- a/code/modules/desert_dam/motion_sensor/sensortower.dm +++ b/code/modules/desert_dam/motion_sensor/sensortower.dm @@ -187,6 +187,7 @@ return FALSE playsound(loc, 'sound/items/Ratchet.ogg', 25, 1) buildstate = SENSORTOWER_BUILDSTATE_WORKING + user.count_statistic_stat(STATISTICS_REPAIR_SENSORTOWER) user.visible_message(SPAN_NOTICE("[user] repairs \the [src]'s tubing and plating."), SPAN_NOTICE("You repair \the [src]'s tubing and plating.")) update_icon() diff --git a/code/modules/mob/emote.dm b/code/modules/mob/emote.dm index fa7c7ec3176e..67bc4ec3d445 100644 --- a/code/modules/mob/emote.dm +++ b/code/modules/mob/emote.dm @@ -8,6 +8,8 @@ act = lowertext(act) var/list/key_emotes = GLOB.emote_list[act] + if(act == "scream") + track_scream() if(!length(key_emotes)) if(intentional && !force_silence) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 36d2518d7e75..9c6054eb9d45 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -203,7 +203,7 @@ apply_effect(6, STUN)//This should work for now, more is really silly and makes you lay there forever apply_effect(6, WEAKEN) - count_niche_stat(STATISTICS_NICHE_SHOCK) + count_statistic_stat(STATISTICS_SHOCK) else src.visible_message( diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm index e664143be74d..1b1ab59fac80 100644 --- a/code/modules/mob/living/carbon/human/human_attackhand.dm +++ b/code/modules/mob/living/carbon/human/human_attackhand.dm @@ -150,7 +150,7 @@ for(var/turf/T in view()) turfs += T var/turf/target = pick(turfs) - count_niche_stat(STATISTICS_NICHE_DISCHARGE) + count_statistic_stat(STATISTICS_DISCHARGE) attack_log += "\[[time_stamp()]\] [key_name(src)] accidentally fired [held_weapon.name] in [get_area(src)] triggered by [key_name(attacking_mob)]." attacking_mob.attack_log += "\[[time_stamp()]\] [key_name(src)] accidentally fired [held_weapon.name] in [get_area(src)] triggered by [key_name(attacking_mob)]." diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index 843cfeac540b..d29fbc2fe9e9 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -701,6 +701,7 @@ X.use_plasma(400) X.place_construction(T, structure_template) + xeno.count_statistic_stat(STATISTIC_XENO_STRUCTURES_BUILD) return ..() diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm index bff59186fd04..03f73c6e492c 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm @@ -63,10 +63,9 @@ /datum/action/xeno_action/proc/track_xeno_ability_stats() if(!owner) return - var/mob/living/carbon/xenomorph/X = owner - if (ability_name && GLOB.round_statistics) - GLOB.round_statistics.track_ability_usage(ability_name) - X.track_ability_usage(ability_name, X.caste_type) + var/mob/living/carbon/xenomorph/xeno = owner + if(ability_name) + xeno.track_ability_usage(ability_name, xeno.caste_type) /datum/action/xeno_action/can_use_action() if(!owner) diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm index 9d42eb982d2e..81bb3e49d7e7 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm @@ -159,8 +159,7 @@ if(!did_hug) qdel(hugger) return - if(client) - client.player_data?.adjust_stat(PLAYER_STAT_FACEHUGS, STAT_CATEGORY_XENO, 1) + track_ability_usage(STATISTICS_FACEHUGGE, caste_type, 1) qdel(src) return did_hug @@ -170,7 +169,7 @@ age = XENO_NORMAL - total_facehugs = get_client_stat(client, PLAYER_STAT_FACEHUGS) + total_facehugs = client?.player_data?.player_entity?.get_statistic(STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) switch(total_facehugs) if(FACEHUG_TIER_1 to FACEHUG_TIER_2) age = XENO_MATURE diff --git a/code/modules/mob/living/simple_animal/friendly/cat.dm b/code/modules/mob/living/simple_animal/friendly/cat.dm index 272bc289b2ec..b20d8ee513b7 100644 --- a/code/modules/mob/living/simple_animal/friendly/cat.dm +++ b/code/modules/mob/living/simple_animal/friendly/cat.dm @@ -105,7 +105,7 @@ if(last_damage_data) var/mob/user = last_damage_data.resolve_mob() if(user) - user.count_niche_stat(STATISTICS_NICHE_CAT) + user.count_statistic_stat(STATISTICS_CAT) /mob/living/simple_animal/cat/proc/handle_movement_target() turns_since_scan++ diff --git a/code/modules/mob/living/simple_animal/friendly/corgi.dm b/code/modules/mob/living/simple_animal/friendly/corgi.dm index 5b896203a704..5f5aef8c7bfd 100644 --- a/code/modules/mob/living/simple_animal/friendly/corgi.dm +++ b/code/modules/mob/living/simple_animal/friendly/corgi.dm @@ -96,7 +96,7 @@ if(last_damage_data) var/mob/user = last_damage_data.resolve_mob() if(user) - user.count_niche_stat(STATISTICS_NICHE_CORGI) + user.count_statistic_stat(STATISTICS_CORGI) /obj/item/reagent_container/food/snacks/meat/corgi name = "Corgi meat" diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 47b54196301d..7f0549b903a0 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -147,7 +147,7 @@ if(last_damage_data) var/mob/user = last_damage_data.resolve_mob() if(user) - user.count_niche_stat(STATISTICS_NICHE_COW) + user.count_statistic_stat(STATISTICS_COW) /mob/living/simple_animal/cow/attack_hand(mob/living/carbon/M as mob) if(!stat && M.a_intent == INTENT_DISARM && icon_state != icon_dead) @@ -257,7 +257,7 @@ GLOBAL_VAR_INIT(chicken_count, 0) if(last_damage_data) var/mob/user = last_damage_data.resolve_mob() if(user) - user.count_niche_stat(STATISTICS_NICHE_CHICKEN) + user.count_statistic_stat(STATISTICS_CHICKEN) /mob/living/simple_animal/chicken/attackby(obj/item/O as obj, mob/user as mob) if(istype(O, /obj/item/reagent_container/food/snacks/grown/wheat)) //feedin' dem chickens diff --git a/code/modules/objectives/data_retrieval.dm b/code/modules/objectives/data_retrieval.dm index ee5053f26c4b..d8599fbb5802 100644 --- a/code/modules/objectives/data_retrieval.dm +++ b/code/modules/objectives/data_retrieval.dm @@ -251,7 +251,7 @@ uploading = 1 objective.activate() to_chat(user, SPAN_NOTICE("You start uploading the data.")) - user.count_niche_stat(STATISTICS_NICHE_UPLOAD) + user.count_statistic_stat(STATISTICS_UPLOAD) /obj/structure/machinery/computer/objective/proc/check_if_usable(mob/living/user) if(!powered()) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 6c1c234eaadd..cf551e57ff07 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -761,7 +761,7 @@ GLOBAL_LIST_INIT(apc_wire_descriptions, list( if(do_after(user, 50 * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) user.visible_message(SPAN_NOTICE("[user] replaces [src]'s damaged frontal panel with a new one."), SPAN_NOTICE("You replace [src]'s damaged frontal panel with a new one.")) - user.count_niche_stat(STATISTICS_NICHE_REPAIR_APC) + user.count_statistic_stat(STATISTICS_REPAIR_APC) qdel(W) beenhit = 0 stat &= ~BROKEN diff --git a/code/modules/reagents/chemistry_machinery/reagent_analyzer.dm b/code/modules/reagents/chemistry_machinery/reagent_analyzer.dm index 967177bda978..1b7d46af22e0 100644 --- a/code/modules/reagents/chemistry_machinery/reagent_analyzer.dm +++ b/code/modules/reagents/chemistry_machinery/reagent_analyzer.dm @@ -97,7 +97,7 @@ GLOB.chemical_data.save_new_properties(S.properties) if(S.chemclass >= CHEM_CLASS_SPECIAL && !GLOB.chemical_data.chemical_identified_list[S.id]) if(last_used) - last_used.count_niche_stat(STATISTICS_NICHE_CHEMS) + last_used.count_statistic_stat(STATISTICS_CHEMS) var/datum/chem_property/P = S.get_property(PROPERTY_DNA_DISINTEGRATING) if(P) if(GLOB.chemical_data.clearance_level >= S.gen_tier) diff --git a/code/modules/shuttle/shuttles/crashable/lifeboats.dm b/code/modules/shuttle/shuttles/crashable/lifeboats.dm index 617ab0869afb..d31eb287722f 100644 --- a/code/modules/shuttle/shuttles/crashable/lifeboats.dm +++ b/code/modules/shuttle/shuttles/crashable/lifeboats.dm @@ -25,6 +25,7 @@ continue survivors++ to_chat(survived_human, "

[SPAN_CENTERBOLD("You have successfully left the [MAIN_SHIP_NAME]. You may now ghost and observe the rest of the round.")]
") + survived_human.count_statistic_stat(STATISTICS_ESCAPE) /// Port Aft Lifeboat (bottom-right, doors on its left side) /obj/docking_port/mobile/crashable/lifeboat/port diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 502d7c1ffde4..b4e8e8b1052f 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -301,7 +301,7 @@ GLOBAL_LIST_EMPTY(shuttle_controls) message_all_yautja("The serpent Queen has commanded the landing shuttle to depart.") playsound(src, 'sound/misc/queen_alarm.ogg') - Q.count_niche_stat(STATISTICS_NICHE_FLIGHT) + Q.count_statistic_stat(STATISTICS_FLIGHT) if(Q.hive) addtimer(CALLBACK(Q.hive, TYPE_PROC_REF(/datum/hive_status, abandon_on_hijack)), DROPSHIP_WARMUP_TIME + 5 SECONDS, TIMER_UNIQUE) //+ 5 seconds catch standing in doorways @@ -328,7 +328,7 @@ GLOBAL_LIST_EMPTY(shuttle_controls) if(is_ground_level(z)) shuttle.transit_gun_mission = 0 //remote launch always do transport flight. shuttle.launch(src) if(onboard && !shuttle.iselevator) - M.count_niche_stat(STATISTICS_NICHE_FLIGHT) + M.count_statistic_stat(STATISTICS_FLIGHT) msg_admin_niche("[M] ([M.key]) launched \a [shuttle.iselevator? "elevator" : "shuttle"] using [src].") ui_interact(usr) diff --git a/code/modules/surgery/amputation.dm b/code/modules/surgery/amputation.dm index c9c1c92d4877..d71229f91d91 100644 --- a/code/modules/surgery/amputation.dm +++ b/code/modules/surgery/amputation.dm @@ -166,7 +166,7 @@ SPAN_WARNING("[user] cuts your [surgery.affected_limb.display_name] off!"), SPAN_NOTICE("[user] cuts [target]'s [surgery.affected_limb.display_name] off.")) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_AMPUTATE) + user.count_statistic_stat(STATISTICS_SURGERY_AMPUTATE) surgery.affected_limb.droplimb(amputation = TRUE, surgery_in_progress = TRUE) target.incision_depths[target_zone] = SURGERY_DEPTH_SURFACE log_interact(user, target, "[key_name(user)] successfully severed [key_name(target)]'s [surgery.affected_limb.display_name] with \the [tool].") @@ -191,7 +191,7 @@ SPAN_WARNING("[user] hacks [target]'s [surgery.affected_limb.display_name] off!")) user.animation_attack_on(target) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_AMPUTATE) + user.count_statistic_stat(STATISTICS_SURGERY_AMPUTATE) surgery.affected_limb.droplimb() //This will sever the limb messily and reset incision depth. The stump cleanup surgery will have to be done to properly amputate, but doing this saved two seconds. Worth it? target.apply_damage(20, BRUTE, surgery.affected_limb.parent) log_interact(user, target, "[key_name(user)] hacked [key_name(target)]'s [surgery.affected_limb.display_name] off with \the [tool], ending [surgery].") diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm index 399f5f5360c3..1849296645e7 100644 --- a/code/modules/surgery/bones.dm +++ b/code/modules/surgery/bones.dm @@ -198,7 +198,7 @@ SPAN_NOTICE("[user] sets the bones in your [surgery.affected_limb.display_name]."), SPAN_NOTICE("[user] sets the bones in [target]'s [surgery.affected_limb.display_name].")) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_BONES) + user.count_statistic_stat(STATISTICS_SURGERY_BONES) if(surgery.affected_limb.status & LIMB_SPLINTED_INDESTRUCTIBLE) new /obj/item/stack/medical/splint/nano(get_turf(target), 1) surgery.affected_limb.status &= ~(LIMB_SPLINTED|LIMB_SPLINTED_INDESTRUCTIBLE|LIMB_BROKEN) diff --git a/code/modules/surgery/brainrepair.dm b/code/modules/surgery/brainrepair.dm index 2b4e51292203..428aa624de38 100644 --- a/code/modules/surgery/brainrepair.dm +++ b/code/modules/surgery/brainrepair.dm @@ -51,7 +51,7 @@ SPAN_NOTICE("[user] finishes extracting fragments of bone from your brain."), SPAN_NOTICE("[user] finishes extracting fragments of bone from [target]'s brain.")) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_BRAIN) + user.count_statistic_stat(STATISTICS_SURGERY_BRAIN) var/datum/internal_organ/brain/B = target.internal_organs_by_name["brain"] if(B) diff --git a/code/modules/surgery/chestburster.dm b/code/modules/surgery/chestburster.dm index a840bd026c40..b3e44f0fa403 100644 --- a/code/modules/surgery/chestburster.dm +++ b/code/modules/surgery/chestburster.dm @@ -159,7 +159,7 @@ else user.apply_damage(15, BURN, "r_hand") - user.count_niche_stat(STATISTICS_NICHE_SURGERY_LARVA) + user.count_statistic_stat(STATISTICS_SURGERY_LARVA) var/mob/living/carbon/xenomorph/larva/L = locate() in target //the larva was fully grown, ready to burst. if(L) L.forceMove(target.loc) diff --git a/code/modules/surgery/eye.dm b/code/modules/surgery/eye.dm index b9efb0371ee3..7e95a18166ea 100644 --- a/code/modules/surgery/eye.dm +++ b/code/modules/surgery/eye.dm @@ -167,7 +167,7 @@ target.disabilities &= ~NEARSIGHTED target.sdisabilities &= ~DISABILITY_BLIND surgery.target_eyes.heal_damage(surgery.target_eyes.damage) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_EYE) + user.count_statistic_stat(STATISTICS_SURGERY_EYE) target.pain.recalculate_pain() /datum/surgery_step/cauterize/eyes/failure(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, tool_type, datum/surgery/eye_repair/surgery) diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm index 8f2e6156831a..622765826516 100644 --- a/code/modules/surgery/implant.dm +++ b/code/modules/surgery/implant.dm @@ -295,10 +295,10 @@ surgery.affected_limb.implants -= S target.embedded_items -= S for(var/i in 1 to S.count-1) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_SHRAPNEL) + user.count_statistic_stat(STATISTICS_SURGERY_SHRAPNEL) var/shrap = new S.type(S.loc) QDEL_IN(shrap, 30 SECONDS) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_SHRAPNEL) + user.count_statistic_stat(STATISTICS_SURGERY_SHRAPNEL) QDEL_IN(S, 30 SECONDS) else var/obj/item/obj = surgery.affected_limb.implants[1] @@ -318,7 +318,7 @@ if(is_sharp(obj)) target.embedded_items -= obj - user.count_niche_stat(STATISTICS_NICHE_SURGERY_SHRAPNEL) + user.count_statistic_stat(STATISTICS_SURGERY_SHRAPNEL) log_interact(user, target, "[key_name(user)] removed [obj] from [key_name(target)]'s [surgery.affected_limb.display_name] with \the [tool], ending [surgery].") else diff --git a/code/modules/surgery/internal_bleeding.dm b/code/modules/surgery/internal_bleeding.dm index e4afcad5ec99..f2cf1428acba 100644 --- a/code/modules/surgery/internal_bleeding.dm +++ b/code/modules/surgery/internal_bleeding.dm @@ -38,7 +38,7 @@ log_interact(user, target, "[key_name(user)] began repairing internal bleeding in [key_name(target)]'s [surgery.affected_limb.display_name], beginning [surgery].") /datum/surgery_step/fix_vein/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, tool_type, datum/surgery/surgery) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_IB) + user.count_statistic_stat(STATISTICS_SURGERY_IB) user.affected_message(target, SPAN_NOTICE("You finish repairing [target]'s damaged vein."), diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm index 37f3be625f1b..3a97cf843012 100644 --- a/code/modules/surgery/organs_internal.dm +++ b/code/modules/surgery/organs_internal.dm @@ -82,7 +82,7 @@ and organ transplant code which may come in handy in future but haven't been edi SPAN_NOTICE("[user] finishes treating your damaged [I.name]."), SPAN_NOTICE("[user] finishes treating [target]'s damaged [I.name].")) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_ORGAN_REPAIR) + user.count_statistic_stat(STATISTICS_SURGERY_ORGAN_REPAIR) I.rejuvenate() target.pain.recalculate_pain() break @@ -289,7 +289,7 @@ and organ transplant code which may come in handy in future but haven't been edi SPAN_NOTICE("You have removed [target]'s [affected.surgery_organ] with \the [tool].")) log_interact(user, target, "[key_name(user)] removed [key_name(target)]'s [affected.surgery_organ] with \the [tool].") - user.count_niche_stat(STATISTICS_NICHE_SURGERY_ORGAN_REMOVE) + user.count_statistic_stat(STATISTICS_SURGERY_ORGAN_REMOVE) //Extract the organ! if(affected.surgery_organ) @@ -479,7 +479,7 @@ and organ transplant code which may come in handy in future but haven't been edi SPAN_NOTICE("You have reattached [target]'s [affected.surgery_organ] with \the [tool].")) log_interact(user, target, "[key_name(user)] reattached [key_name(target)]'s [affected.surgery_organ] with \the [tool].") - user.count_niche_stat(STATISTICS_NICHE_SURGERY_ORGAN_ATTACH) + user.count_statistic_stat(STATISTICS_SURGERY_ORGAN_ATTACH) var/datum/internal_organ/I = target.internal_organs_by_name[affected.surgery_organ] I.cut_away = FALSE diff --git a/code/modules/surgery/robotic_organs_internal.dm b/code/modules/surgery/robotic_organs_internal.dm index 7081a7cb3ccb..e783cada4b88 100644 --- a/code/modules/surgery/robotic_organs_internal.dm +++ b/code/modules/surgery/robotic_organs_internal.dm @@ -77,7 +77,7 @@ and organ transplant code which may come in handy in future but haven't been edi SPAN_NOTICE("[user] finishes treating your damaged [I.name]."), SPAN_NOTICE("[user] finishes treating [target]'s damaged [I.name].")) - user.count_niche_stat(STATISTICS_NICHE_SURGERY_ORGAN_REPAIR) + user.count_statistic_stat(STATISTICS_SURGERY_ORGAN_REPAIR) I.rejuvenate() break diff --git a/colonialmarines.dme b/colonialmarines.dme index 54760dde8594..4c604a325d15 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -99,7 +99,7 @@ #include "code\__DEFINES\sounds.dm" #include "code\__DEFINES\speech_channels.dm" #include "code\__DEFINES\stamina.dm" -#include "code\__DEFINES\stats.dm" +#include "code\__DEFINES\statistic.dm" #include "code\__DEFINES\status_effects.dm" #include "code\__DEFINES\strippable.dm" #include "code\__DEFINES\STUI.dm" @@ -644,19 +644,13 @@ #include "code\datums\stamina\_stamina.dm" #include "code\datums\stamina\none.dm" #include "code\datums\statistics\cause_data.dm" -#include "code\datums\statistics\entities\caste_stats.dm" #include "code\datums\statistics\entities\death_stats.dm" -#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\medal_stats.dm" #include "code\datums\statistics\entities\panel_stats.dm" #include "code\datums\statistics\entities\player_entity.dm" -#include "code\datums\statistics\entities\player_save.dm" #include "code\datums\statistics\entities\player_stats.dm" #include "code\datums\statistics\entities\round_stats.dm" -#include "code\datums\statistics\entities\weapon_stats.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" #include "code\datums\statistics\random_facts\kills_fact.dm" diff --git a/tgui/packages/tgui/interfaces/Playtime.tsx b/tgui/packages/tgui/interfaces/Playtime.tsx index d09726a0c415..c1f1d116efd5 100644 --- a/tgui/packages/tgui/interfaces/Playtime.tsx +++ b/tgui/packages/tgui/interfaces/Playtime.tsx @@ -14,12 +14,26 @@ interface PlaytimeRecord { icondisplay: string | undefined; } -interface PlaytimeData { +interface PlaytimeRecordGlob { + ckey: string; + job: string; + playtime: number; + bgcolor: string; + textcolor: string; + icondisplay: string | undefined; +} + +interface PlaytimeRowsPrivate { stored_human_playtime: PlaytimeRecord[]; stored_xeno_playtime: PlaytimeRecord[]; stored_other_playtime: PlaytimeRecord[]; } +interface PlaytimeRows { + playtime: PlaytimeRowsPrivate; + playtimeglob: PlaytimeRecordGlob[]; +} + const PlaytimeRow = (props: { readonly data: PlaytimeRecord }) => { return ( <> @@ -44,6 +58,33 @@ const PlaytimeRow = (props: { readonly data: PlaytimeRecord }) => { ); }; +const PlaytimeRowGlob = (props: { readonly data: PlaytimeRecordGlob }) => { + return ( + <> + + {props.data.icondisplay && ( + + )} + + + {props.data.job} + + + {props.data.ckey} + + + {props.data.playtime.toFixed(1)} hr + + + ); +}; + const PlaytimeTable = (props: { readonly data: PlaytimeRecord[] }) => { return ( @@ -59,52 +100,91 @@ const PlaytimeTable = (props: { readonly data: PlaytimeRecord[] }) => { ); }; +const PlaytimeTableGlob = (props: { readonly data: PlaytimeRecordGlob[] }) => { + return ( +
+ {props.data + .filter((x) => x.playtime !== 0) + .map((x) => ( + + + + ))} +
+ ); +}; + export const Playtime = (props) => { - const { data } = useBackend(); - const [selected, setSelected] = useState('human'); + const { data } = useBackend(); + const { playtime, playtimeglob } = data; + const [selected, setSelected] = useState('private'); + const [selectedplaytime, setSelectedplaytime] = useState('human'); const humanTime = - data.stored_human_playtime.length > 0 - ? data.stored_human_playtime[0].playtime + playtime.stored_human_playtime.length > 0 + ? playtime.stored_human_playtime[0].playtime : 0; const xenoTime = - data.stored_xeno_playtime.length > 0 - ? data.stored_xeno_playtime[0].playtime + playtime.stored_xeno_playtime.length > 0 + ? playtime.stored_xeno_playtime[0].playtime : 0; const otherTime = - data.stored_other_playtime.length > 0 - ? data.stored_other_playtime[0].playtime + playtime.stored_other_playtime.length > 0 + ? playtime.stored_other_playtime[0].playtime : 0; + return ( setSelected('human')} - > - Human ({humanTime} hr) - - setSelected('xeno')} + selected={selected === 'global'} + onClick={() => setSelected('global')} > - Xeno ({xenoTime} hr) + Global setSelected('other')} + selected={selected === 'private'} + onClick={() => setSelected('private')} > - Other ({otherTime} hr) + Private - {selected === 'human' && ( - - )} - {selected === 'xeno' && ( - - )} - {selected === 'other' && ( - + {selected === 'global' ? ( + + +
+ ) : ( + + + setSelectedplaytime('human')} + > + Human ({humanTime} hr) + + setSelectedplaytime('xeno')} + > + Xeno ({xenoTime} hr) + + setSelectedplaytime('other')} + > + Other ({otherTime} hr) + + + {selectedplaytime === 'human' && ( + + )} + {selectedplaytime === 'xeno' && ( + + )} + {selectedplaytime === 'other' && ( + + )} +
)}
From 459718b4cc84dcade2f95c64779e717cab71a0fb Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 16:15:31 +0500 Subject: [PATCH 02/69] b2 --- code/_onclick/item_attack.dm | 12 +++++-- .../effects/xeno_strains/prae_acid_stacks.dm | 4 +++ .../statistics/entities/player_stats.dm | 16 ++++----- code/game/objects/explosion_recursive.dm | 12 +++---- code/game/objects/items/stacks/nanopaste.dm | 1 + code/game/objects/items/storage/smartpack.dm | 1 + .../objects/items/tools/maintenance_tools.dm | 1 + code/modules/mob/living/carbon/carbon.dm | 7 +++- .../mob/living/carbon/human/human_defense.dm | 18 ++++++---- .../xenomorph/abilities/queen/queen_powers.dm | 36 ++++++++++--------- .../living/carbon/xenomorph/damage_procs.dm | 4 +++ .../xenomorph/strains/castes/drone/healer.dm | 1 + code/modules/mob/living/living_defense.dm | 10 +++--- .../modules/projectiles/guns/flamer/flamer.dm | 9 ++--- code/modules/projectiles/projectile.dm | 13 +++++++ 15 files changed, 96 insertions(+), 49 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 1a3c279db8b3..9f0a9d221069 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -110,11 +110,17 @@ if("fire") M.apply_damage(power,BURN) to_chat(M, SPAN_WARNING("It burns!")) + + if(user.faction == M.faction) + user.track_friendly_hit(initial(name)) + user.track_friendly_damage(initial(name), M, power) + else + user.track_hit(initial(name)) + user.track_damage(initial(name), M, power) + if(power > 5) M.last_damage_data = create_cause_data(initial(name), user) - user.track_hit(initial(name)) - if(user.faction == M.faction) - user.track_friendly_fire(initial(name)) + M.updatehealth() else var/mob/living/carbon/human/H = M diff --git a/code/datums/effects/xeno_strains/prae_acid_stacks.dm b/code/datums/effects/xeno_strains/prae_acid_stacks.dm index aaf3c50e82f8..7758e9de70ec 100644 --- a/code/datums/effects/xeno_strains/prae_acid_stacks.dm +++ b/code/datums/effects/xeno_strains/prae_acid_stacks.dm @@ -71,6 +71,10 @@ var/mob/living/carbon/human/H = affected_atom H.apply_damage(proc_damage, BURN) + if(cause_mob.faction == H.faction) + cause_mob.track_friendly_damage("Acid", H, proc_damage) + else + cause_mob.track_damage("Acid", H, proc_damage) to_chat(H, SPAN_XENODANGER("You feel acid eat into your skin!")) qdel(src) return diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index 2fc32087ef83..7fbf2cc30581 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -34,13 +34,13 @@ /mob/proc/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) if(statistic_exempt || !client || !client.player_data || !faction) return FALSE - if(SSticker.mode.round_statistics) - SSticker.mode.round_statistics.total_projectiles_hit += amount + if(GLOB.round_statistics) + GLOB.round_statistics.total_projectiles_hit += amount if(shot_mob) if(ishuman(shot_mob)) - SSticker.mode.round_statistics.total_projectiles_hit_human += amount + GLOB.round_statistics.total_projectiles_hit_human += amount else if(isxeno(shot_mob)) - SSticker.mode.round_statistics.total_projectiles_hit_xeno += amount + GLOB.round_statistics.total_projectiles_hit_xeno += amount return TRUE /mob/proc/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) @@ -61,8 +61,8 @@ /mob/proc/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) if(statistic_exempt || !client || !client.player_data || !faction) return FALSE - if(SSticker.mode.round_statistics) - SSticker.mode.round_statistics.total_friendly_fire_instances += amount + if(GLOB.round_statistics) + GLOB.round_statistics.total_friendly_fire_instances += amount return TRUE /mob/proc/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) @@ -83,8 +83,8 @@ /mob/proc/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) if(statistic_exempt || !client || !client.player_data || !faction) return FALSE - if(SSticker.mode.round_statistics) - SSticker.mode.round_statistics.total_slashes += amount + if(GLOB.round_statistics) + GLOB.round_statistics.total_slashes += amount return TRUE /mob/proc/track_ability_usage(ability, caste, amount = 1) diff --git a/code/game/objects/explosion_recursive.dm b/code/game/objects/explosion_recursive.dm index 855f6c2f43c7..2e13ed6a178e 100644 --- a/code/game/objects/explosion_recursive.dm +++ b/code/game/objects/explosion_recursive.dm @@ -273,21 +273,21 @@ explosion resistance exactly as much as their health if(M.stat == DEAD) ff_living = FALSE msg_admin_ff(ff_msg, ff_living) - if(ishuman(firingMob)) - var/mob/living/carbon/human/H = firingMob - H.track_friendly_fire(explosion_source) + firingMob.track_friendly_damage(initial(name), M, severity) + firingMob.count_statistic_stat(STATISTICS_EXPLODED_MOBS) else M.attack_log += "\[[time_stamp()]\] [firingMob]/[firingMob.ckey] blew up [M]/[M.ckey] with \a [explosion_source] in [get_area(firingMob)]." firingMob:attack_log += "\[[time_stamp()]\] [firingMob]/[firingMob.ckey] blew up [M]/[M.ckey] with \a [explosion_source] in [get_area(firingMob)]." msg_admin_attack("[firingMob] ([firingMob.ckey]) blew up [M] ([M.ckey]) with \a [explosion_source] in [get_area(firingMob)] ([location_of_mob.z],[location_of_mob.y],[location_of_mob.z])", location_of_mob.x, location_of_mob.y, location_of_mob.z) + firingMob.track_damage(initial(name), M, severity) + firingMob.count_statistic_stat(STATISTICS_EXPLODED_MOBS) else if(explosion_source_mob) var/mob/firingMob = explosion_source_mob var/turf/location_of_mob = get_turf(firingMob) - if(ishuman(firingMob)) - var/mob/living/carbon/human/H = firingMob - H.track_shot_hit(initial(name), M) M.attack_log += "\[[time_stamp()]\] [firingMob] blew up [M]/[M.ckey] with a [explosion_source] in [get_area(firingMob)]." msg_admin_attack("[firingMob] ([firingMob.ckey]) blew up [M] ([M.ckey]) with \a [explosion_source] in [get_area(firingMob)] ([location_of_mob.z],[location_of_mob.y],[location_of_mob.z])", location_of_mob.x, location_of_mob.y, location_of_mob.z) + firingMob.track_damage(initial(name), M, severity) + firingMob.count_statistic_stat(STATISTICS_EXPLODED_MOBS) else if(explosion_source) M.attack_log += "\[[time_stamp()]\] [M]/[M.ckey] was blown up with a [explosion_source] in [get_area(M)]." else diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 156fbf548f5f..b3dc0d5583e7 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -26,6 +26,7 @@ if (S && (S.status & (LIMB_ROBOT|LIMB_SYNTHSKIN))) if(S.get_damage()) S.heal_damage(15, 15, robo_repair = 1) + user.track_heal_damage(initial(name), H, 30) H.pain.recalculate_pain() H.updatehealth() use(1) diff --git a/code/game/objects/items/storage/smartpack.dm b/code/game/objects/items/storage/smartpack.dm index 3763064aa333..f7842158feed 100644 --- a/code/game/objects/items/storage/smartpack.dm +++ b/code/game/objects/items/storage/smartpack.dm @@ -293,6 +293,7 @@ playsound(loc, 'sound/items/Welder2.ogg', 25, TRUE) battery_charge -= REPAIR_COST H.heal_overall_damage(50, 50, TRUE) + user.track_heal_damage(initial(name), H, 100) H.pain.recalculate_pain() repair_form = FALSE update_icon(user) diff --git a/code/game/objects/items/tools/maintenance_tools.dm b/code/game/objects/items/tools/maintenance_tools.dm index 8febff63ee5d..8eb9c7336319 100644 --- a/code/game/objects/items/tools/maintenance_tools.dm +++ b/code/game/objects/items/tools/maintenance_tools.dm @@ -243,6 +243,7 @@ return limb.heal_damage(15, 0, TRUE) + user.track_heal_damage(initial(name), human, 15) human.pain.recalculate_pain() human.UpdateDamageIcon() user.visible_message(SPAN_WARNING("\The [user] patches some dents on \the [human]'s [limb.display_name] with \the [src]."), \ diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 9c6054eb9d45..f95d389ed76b 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -62,7 +62,12 @@ for(var/mob/M as anything in viewers(user, null)) if(M.client) M.show_message(text(SPAN_DANGER("[user] attacks [src]'s stomach wall with the [I.name]!")), SHOW_MESSAGE_AUDIBLE) - user.track_hit(initial(I.name)) + if(user.faction == faction) + user.track_friendly_hit(initial(I.name)) + user.track_friendly_damage(initial(I.name), src, d) + else + user.track_hit(initial(I.name)) + user.track_damage(initial(I.name), src, d) playsound(user.loc, 'sound/effects/attackblob.ogg', 25, 1) if(prob(max(4*(100*getBruteLoss()/maxHealth - 75),0))) //4% at 24% health, 80% at 5% health diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 09ce5bb9c149..cd95651b506a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -216,12 +216,15 @@ Contains most of the procs that are called when a mob is attacked by something var/damage = armor_damage_reduction(GLOB.marine_melee, I.force, armor, (weapon_sharp?30:0) + (weapon_edge?10:0)) // no penetration frm punches apply_damage(damage, I.damtype, affecting, sharp=weapon_sharp, edge=weapon_edge, used_weapon=I) + if(user.faction == faction) + user.track_friendly_hit(initial(I.name)) + user.track_friendly_damage(initial(I.name), src, damage) + else + user.track_hit(initial(I.name)) + user.track_damage(initial(I.name), src, damage) if(damage > 5) last_damage_data = create_cause_data(initial(I.name), user) - user.track_hit(initial(I.name)) - if(user.faction == faction) - user.track_friendly_fire(initial(I.name)) var/bloody = FALSE if((I.damtype == BRUTE || I.damtype == HALLOSS) && prob(I.force*2 + 25)) @@ -329,11 +332,14 @@ Contains most of the procs that are called when a mob is attacked by something if (ismob(LM.thrower)) var/mob/M = LM.thrower var/client/assailant = M.client + if(M.faction == faction) + M.track_friendly_hit(initial(I.name)) + M.track_friendly_damage(initial(I.name), src, damage) + else + M.track_hit(initial(I.name)) + M.track_damage(initial(I.name), src, damage) if (damage > 5) last_damage_mob = M - M.track_hit(initial(O.name)) - if (M.faction == faction) - M.track_friendly_fire(initial(O.name)) if (assailant) src.attack_log += text("\[[time_stamp()]\] Has been hit with \a [O], thrown by [key_name(M)]") M.attack_log += text("\[[time_stamp()]\] Hit [key_name(src)] with a thrown [O]") diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm index 6ef111aed66f..57d73201b941 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm @@ -251,48 +251,50 @@ return ..() /datum/action/xeno_action/activable/queen_heal/use_ability(atom/A, verbose) - var/mob/living/carbon/xenomorph/queen/X = owner - if(!X.check_state()) + var/mob/living/carbon/xenomorph/queen/user_xeno = owner + if(!user_xeno.check_state()) return if(!action_cooldown_check()) return - var/turf/T = get_turf(A) - if(!T) - to_chat(X, SPAN_WARNING("You must select a valid turf to heal around.")) + var/turf/target_turf = get_turf(A) + if(!target_turf) + to_chat(user_xeno, SPAN_WARNING("You must select a valid turf to heal around.")) return - if(X.loc.z != T.loc.z) - to_chat(X, SPAN_XENOWARNING("You are too far away to do this here.")) + if(user_xeno.loc.z != target_turf.loc.z) + to_chat(user_xeno, SPAN_XENOWARNING("You are too far away to do this here.")) return if(!check_and_use_plasma_owner()) return - for(var/mob/living/carbon/xenomorph/Xa in range(4, T)) - if(!X.can_not_harm(Xa)) + for(var/mob/living/carbon/xenomorph/target_xeno in range(4, target_turf)) + if(!user_xeno.can_not_harm(target_xeno)) continue - if(SEND_SIGNAL(Xa, COMSIG_XENO_PRE_HEAL) & COMPONENT_CANCEL_XENO_HEAL) + if(SEND_SIGNAL(target_xeno, COMSIG_XENO_PRE_HEAL) & COMPONENT_CANCEL_XENO_HEAL) if(verbose) - to_chat(X, SPAN_XENOMINORWARNING("You cannot heal [Xa]!")) + to_chat(user_xeno, SPAN_XENOMINORWARNING("You cannot heal [target_xeno]!")) continue - if(Xa == X) + if(target_xeno == user_xeno) continue - if(Xa.stat == DEAD || QDELETED(Xa)) + if(target_xeno.stat == DEAD || QDELETED(target_xeno)) continue - if(!Xa.caste.can_be_queen_healed) + if(!target_xeno.caste.can_be_queen_healed) continue - new /datum/effects/heal_over_time(Xa, Xa.maxHealth * 0.3, 2 SECONDS, 2) - Xa.flick_heal_overlay(3 SECONDS, "#D9F500") //it's already hard enough to gauge health without hp overlays! + var/amount_heal = target_xeno.maxHealth * 0.3 + user_xeno.track_heal_damage(null, target_xeno, amount_heal) + new /datum/effects/heal_over_time(target_xeno, amount_heal, 2 SECONDS, 2) + target_xeno.flick_heal_overlay(3 SECONDS, "#D9F500") //it's already hard enough to gauge health without hp overlays! apply_cooldown() - to_chat(X, SPAN_XENONOTICE("You channel your plasma to heal your sisters' wounds around this area.")) + to_chat(user_xeno, SPAN_XENONOTICE("You channel your plasma to heal your sisters' wounds around this area.")) return ..() /datum/action/xeno_action/onclick/manage_hive/proc/give_evo_points() diff --git a/code/modules/mob/living/carbon/xenomorph/damage_procs.dm b/code/modules/mob/living/carbon/xenomorph/damage_procs.dm index 4c97ce20b4eb..6cf9b4e5fdb6 100644 --- a/code/modules/mob/living/carbon/xenomorph/damage_procs.dm +++ b/code/modules/mob/living/carbon/xenomorph/damage_procs.dm @@ -280,6 +280,10 @@ var/dmg = list("damage" = acid_blood_damage) if(SEND_SIGNAL(src, COMSIG_XENO_DEAL_ACID_DAMAGE, victim, dmg) & COMPONENT_BLOCK_DAMAGE) continue + if(faction == victim.faction) + track_friendly_damage("Acid", victim, acid_blood_damage) + else + track_damage("Acid", victim, acid_blood_damage) i++ victim.visible_message(SPAN_DANGER("\The [victim] is scalded with hissing green blood!"), \ SPAN_DANGER("You are splattered with sizzling blood! IT BURNS!")) diff --git a/code/modules/mob/living/carbon/xenomorph/strains/castes/drone/healer.dm b/code/modules/mob/living/carbon/xenomorph/strains/castes/drone/healer.dm index 7ceaf2fed75e..ecd609deba38 100644 --- a/code/modules/mob/living/carbon/xenomorph/strains/castes/drone/healer.dm +++ b/code/modules/mob/living/carbon/xenomorph/strains/castes/drone/healer.dm @@ -123,6 +123,7 @@ face_atom(target_xeno) adjustBruteLoss(amount * damage_taken_mod) use_plasma(amount * 2) + track_heal_damage(null, target_xeno, amount * damage_taken_mod) updatehealth() new /datum/effects/heal_over_time(target_xeno, amount, 10, 1) target_xeno.xeno_jitter(1 SECONDS) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index b19afb0450cd..311a622d512a 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -67,10 +67,12 @@ var/mob/M if(ismob(LM.thrower)) M = LM.thrower - if(damage_done > 5) - M.track_hit(initial(O.name)) - if (M.faction == faction) - M.track_friendly_fire(initial(O.name)) + if(M.faction == faction) + M.track_friendly_hit(initial(I.name)) + M.track_friendly_damage(initial(I.name), src, power) + else + M.track_hit(initial(I.name)) + M.track_damage(initial(I.name), src, power) var/client/assailant = M.client if(assailant) src.attack_log += text("\[[time_stamp()]\] Has been hit with \a [O], thrown by [key_name(M)]") diff --git a/code/modules/projectiles/guns/flamer/flamer.dm b/code/modules/projectiles/guns/flamer/flamer.dm index c54d62e148b7..cca4c6aeb097 100644 --- a/code/modules/projectiles/guns/flamer/flamer.dm +++ b/code/modules/projectiles/guns/flamer/flamer.dm @@ -664,10 +664,11 @@ else to_chat(ignited_morb, SPAN_HIGHDANGER(msg)) - if(weapon_cause_data) - var/mob/SM = weapon_cause_data.resolve_mob() - if(istype(SM)) - SM.track_shot_hit(weapon_cause_data.cause_name) + if(shoot_mob) + if(shoot_mob.faction == ignited_morb.faction) + shoot_mob.track_friendly_damage(weapon_cause_data.cause_name, ignited_morb, firedamage) + else + shoot_mob.track_damage(weapon_cause_data.cause_name, ignited_morb, firedamage) RegisterSignal(SSdcs, COMSIG_GLOB_WEATHER_CHANGE, PROC_REF(update_in_weather_status)) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index d91e2ca47c1a..8c91aafd65cc 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -1058,6 +1058,13 @@ if(!stat && pain.feels_pain) emote("scream") to_chat(src, SPAN_HIGHDANGER("You scream in pain as the impact sends shrapnel into the wound!")) + + if(shoot_mob) + if(shoot_mob.faction == faction) + shoot_mob.track_friendly_damage(P.weapon_cause_data.cause_name, src, damage) + else + shoot_mob.track_damage(P.weapon_cause_data.cause_name, src, damage) + SEND_SIGNAL(P, COMSIG_POST_BULLET_ACT_HUMAN, src, damage, damage_result) //Deal with xeno bullets. @@ -1127,6 +1134,12 @@ if(damage) //only apply the blood splatter if we do damage + if(shoot_mob) + if(shoot_mob.faction == faction) + shoot_mob.track_friendly_damage(P.weapon_cause_data.cause_name, src, damage) + else + shoot_mob.track_damage(P.weapon_cause_data.cause_name, src, damage) + handle_blood_splatter(get_dir(P.starting, loc)) apply_damage(damage_result,P.ammo.damage_type, P.def_zone) //Deal the damage. From 79cfdbfd4a8ecf7114d702dcf849200cbce7520b Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 16:28:07 +0500 Subject: [PATCH 03/69] a1 --- code/__DEFINES/factions.dm | 175 ++++++++++++++++++ code/__DEFINES/mode.dm | 60 ------ .../effects/xeno_strains/prae_acid_stacks.dm | 1 + code/datums/entities/player.dm | 9 +- code/modules/mob/living/carbon/human/human.dm | 1 - .../mob/living/carbon/human/human_defense.dm | 8 +- .../xenomorph/abilities/general_powers.dm | 2 +- colonialmarines.dme | 1 + 8 files changed, 183 insertions(+), 74 deletions(-) create mode 100644 code/__DEFINES/factions.dm diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm new file mode 100644 index 000000000000..8670b9d8df8a --- /dev/null +++ b/code/__DEFINES/factions.dm @@ -0,0 +1,175 @@ +//WARNING, IF YOU WISH TO RENAME SOMETHING REMEMBER TO UPDATE IT IN STATISTIC, DEATHS AND MEDALS DB TABLES OR I WILL HUNT YOU DOWN AND Bzz5%2 bzz%( pssssssss ---Transmition ended, error accured in main relay + +//FACTION NAMES +#define FACTION_NEUTRAL "neutral" +//USCM +#define FACTION_USCM "uscm" +#define FACTION_MARINE "cm" +#define FACTION_CMB "cmb" +#define FACTION_MARSOC "msoc" +//CONTRACTOR +#define FACTION_CONTRACTOR "contractor" +//WY +#define FACTION_WY "wey_yu" +#define FACTION_PMC "pmc" +#define FACTION_WY_DEATHSQUAD "wy_death_sqaud" +//UPP +#define FACTION_UPP "upp" +//CLF +#define FACTION_CLF "clf" +//COLON +#define FACTION_COLONIST "colonist" +//OTHER +#define FACTION_RESS "ress" +#define FACTION_TWE "twe" +#define FACTION_MERCENARY "mercenary" +#define FACTION_FREELANCER "freelancer" +#define FACTION_HEFA "hefa_order" +#define FACTION_DUTCH "dutch's_dozen" +#define FACTION_PIRATE "pirate" +#define FACTION_GLADIATOR "gladiator" +#define FACTION_PIZZA "pizza_delivery" +#define FACTION_SOUTO "souto" +#define FACTION_THREEWE "threewe" +//ZOMBIE +#define FACTION_ZOMBIE "zombie" +//YAUTJA +#define FACTION_YAUTJA "yautja" +//XENOS +#define FACTION_XENOMORPH "xeno" +#define FACTION_XENOMORPH_NORMAL "xenomorph" +#define FACTION_XENOMORPH_CORRUPTED "corrupted_xenomoprh" +#define FACTION_XENOMORPH_ALPHA "alpha_xenomorph" +#define FACTION_XENOMORPH_BRAVO "bravo_xenomorph" +#define FACTION_XENOMORPH_CHARLIE "charlie_xenomorph" +#define FACTION_XENOMORPH_DELTA "delta_xenomorph" +#define FACTION_XENOMORPH_FERAL "feral_xenomorph" +#define FACTION_XENOMORPH_FORSAKEN "forsaken_xenomorph" +#define FACTION_XENOMORPH_TAMED "tamed_xenomorph" +#define FACTION_XENOMORPH_MUTATED "mutated_xenomorph" +#define FACTION_XENOMORPH_YAUTJA "yautja_xenomorph" +#define FACTION_XENOMORPH_RENEGADE "renegade_xenomorph" + +#define FACTION_LIST_MARINE list(FACTION_USCM, FACTION_MARINE, FACTION_CMB, FACTION_MARSOC) +#define FACTION_LIST_WY list(FACTION_WY, FACTION_PMC, FACTION_WY_DEATHSQUAD) +#define FACTION_LIST_HUMANOID list(FACTION_NEUTRAL, FACTION_CONTRACTOR, FACTION_CLF, FACTION_UPP, FACTION_FREELANCER, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA) + FACTION_LIST_MARINE + FACTION_LIST_WY +#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH_NORMAL, FACTION_XENOMORPH_CORRUPTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA, FACTION_XENOMORPH_FERAL, FACTION_XENOMORPH_FORSAKEN, FACTION_XENOMORPH_TAMED, FACTION_XENOMORPH_MUTATED, FACTION_XENOMORPH_YAUTJA, FACTION_XENOMORPH_RENEGADE) +#define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH + +//NAMES +#define NAME_FACTION_NEUTRAL "Neutral Faction" +//USCM +#define NAME_FACTION_USCM "United States Colonial Marines" +#define NAME_FACTION_MARINE "Colonial Marines" +#define NAME_FACTION_CMB "Colonial Marshal Bureau" +#define NAME_FACTION_MARSOC "Marine Special Operations Command" +//CONTRACTOR +#define NAME_FACTION_CONTRACTOR "Vanguard's Arrow Incorporated" +//WY +#define NAME_FACTION_WY "Weyland-Yutani" +#define NAME_FACTION_PMC "Private Military Company" +#define NAME_FACTION_WY_DEATHSQUAD "Corporate Commandos" +//UPP +#define NAME_FACTION_UPP "Union of Progressive Peoples" +//CLF +#define NAME_FACTION_CLF "Colonial Liberation Front" +//COLON +#define NAME_FACTION_COLONIST "Colonists" +//OTHER +#define NAME_FACTION_RESS "Royal Empire of the Shining Sun" +#define NAME_FACTION_TWE "Royal Marines Commando" +#define NAME_FACTION_MERCENARY "Mercenary Group" +#define NAME_FACTION_FREELANCER "Freelancer Mercenaries" +#define NAME_FACTION_HEFA "HEFA Knights" +#define NAME_FACTION_DUTCH "Dutch's Dozen" +#define NAME_FACTION_PIRATE "Pirates of Free Space" +#define NAME_FACTION_GLADIATOR "Gladiators" +#define NAME_FACTION_PIZZA "Pizza Galaxy" +#define NAME_FACTION_SOUTO "Souto Space" +#define NAME_FACTION_THREEWE "Three World Empire" +//ZOMBIE +#define NAME_FACTION_ZOMBIE "Zombie Horde" +//YAUTJA +#define NAME_FACTION_YAUTJA "Yautja Hunting Groop" +//XENOS +#define NAME_FACTION_XENOMORPH "Xenomorphs" +#define NAME_FACTION_XENOMORPH_NORMAL "Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_CORRUPTED "Corrupted Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_ALPHA "Alpha Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_BRAVO "Bravo Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_DELTA "Delta Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_FERAL "Feral Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_FORSAKEN "Forsaken Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_TAMED "Tamed Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_MUTATED "Mutated Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_YAUTJA "Yautja Xenomorph Hive" +#define NAME_FACTION_XENOMORPH_RENEGADE "Renegade Xenomorph Hive" + +#define NAME_FACTION_LIST_MARINE list(NAME_FACTION_USCM, NAME_FACTION_MARINE, NAME_FACTION_MARSOC) +#define NAME_FACTION_LIST_WY list(NAME_FACTION_WY, NAME_FACTION_PMC, NAME_FACTION_WY_DEATHSQUAD) +#define NAME_FACTION_LIST_HUMANOID list(NAME_FACTION_NEUTRAL, NAME_FACTION_CLF, NAME_FACTION_UPP, NAME_FACTION_FREELANCER, NAME_FACTION_COLONIST, NAME_FACTION_MERCENARY, NAME_FACTION_DUTCH, NAME_FACTION_HEFA, NAME_FACTION_GLADIATOR, NAME_FACTION_PIRATE, NAME_FACTION_PIZZA, NAME_FACTION_SOUTO, NAME_FACTION_ZOMBIE, NAME_FACTION_YAUTJA) + NAME_FACTION_LIST_MARINE + NAME_FACTION_LIST_WY +#define NAME_FACTION_LIST_XENOMORPH list(NAME_FACTION_XENOMORPH_NORMAL, NAME_FACTION_XENOMORPH_CORRUPTED, NAME_FACTION_XENOMORPH_ALPHA, NAME_FACTION_XENOMORPH_BRAVO, NAME_FACTION_XENOMORPH_CHARLIE, NAME_FACTION_XENOMORPH_DELTA, NAME_FACTION_XENOMORPH_FERAL, NAME_FACTION_XENOMORPH_FORSAKEN, NAME_FACTION_XENOMORPH_TAMED, NAME_FACTION_XENOMORPH_MUTATED, NAME_FACTION_XENOMORPH_YAUTJA, NAME_FACTION_XENOMORPH_YAUTJA) +#define NAME_FACTION_LIST_ALL NAME_FACTION_LIST_HUMANOID + NAME_FACTION_LIST_XENOMORPH + +// Faction allegiances within a certain faction. +#define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") + +/* + + +// Faction names +#define FACTION_NEUTRAL "Neutral" +#define FACTION_MARINE "USCM" +#define FACTION_SURVIVOR "Survivor" +#define FACTION_UPP "UPP" +#define FACTION_TWE "TWE" +#define FACTION_WY "Wey-Yu" +#define FACTION_CLF "CLF" +#define FACTION_PMC "PMC" +#define FACTION_CONTRACTOR "VAI" +#define FACTION_MARSHAL "Colonial Marshal" +#define FACTION_WY_DEATHSQUAD "WY Death Squad" +#define FACTION_MERCENARY "Mercenary" +#define FACTION_FREELANCER "Freelancer" +#define FACTION_HEFA "HEFA Order" +#define FACTION_DUTCH "Dutch's Dozen" +#define FACTION_PIRATE "Pirate" +#define FACTION_GLADIATOR "Gladiator" +#define FACTION_PIZZA "Pizza Delivery" +#define FACTION_SOUTO "Souto Man" +#define FACTION_COLONIST "Colonist" +#define FACTION_YAUTJA "Yautja" +#define FACTION_ZOMBIE "Zombie" +#define FACTION_MONKEY "Monkey" // Nanu + +#define FACTION_LIST_MARINE list(FACTION_MARINE) +#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE) +#define FACTION_LIST_ERT list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO) +#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_UPP list(FACTION_UPP) +#define FACTION_LIST_CLF list(FACTION_CLF) +#define FACTION_LIST_TWE list(FACTION_TWE) +#define FACTION_LIST_FREELANCER list(FACTION_FREELANCER) +#define FACTION_LIST_CONTRACTOR list(FACTION_CONTRACTOR) +#define FACTION_LIST_MERCENARY list(FACTION_MERCENARY) +#define FACTION_LIST_MARSHAL list(FACTION_MARSHAL) +#define FACTION_LIST_DUTCH list(FACTION_DUTCH) +#define FACTION_LIST_SURVIVOR_WY list(FACTION_SURVIVOR, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_MARINE_WY list(FACTION_MARINE, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_MARINE_UPP list(FACTION_MARINE, FACTION_UPP) +#define FACTION_LIST_MARINE_TWE list(FACTION_MARINE, FACTION_TWE) + +// Xenomorphs +#define FACTION_PREDALIEN "Predalien" + +#define FACTION_XENOMORPH "Xenomorph" +#define FACTION_XENOMORPH_CORRPUTED "Corrupted Xenomoprh" +#define FACTION_XENOMORPH_ALPHA "Alpha Xenomorph" +#define FACTION_XENOMORPH_BRAVO "Bravo Xenomorph" +#define FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph" +#define FACTION_XENOMORPH_DELTA "Delta Xenomorph" + +#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) + +*/ diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index 4c3a658ff421..c38727979800 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -251,66 +251,6 @@ DEFINE_BITFIELD(whitelist_status, list( /// Misc. defines for objectives #define APC_SCORE_INTERVAL 10 MINUTES -//================================================= - -// Faction names -#define FACTION_NEUTRAL "Neutral" -#define FACTION_MARINE "USCM" -#define FACTION_SURVIVOR "Survivor" -#define FACTION_UPP "UPP" -#define FACTION_TWE "TWE" -#define FACTION_WY "Wey-Yu" -#define FACTION_CLF "CLF" -#define FACTION_PMC "PMC" -#define FACTION_CONTRACTOR "VAI" -#define FACTION_MARSHAL "Colonial Marshal" -#define FACTION_WY_DEATHSQUAD "WY Death Squad" -#define FACTION_MERCENARY "Mercenary" -#define FACTION_FREELANCER "Freelancer" -#define FACTION_HEFA "HEFA Order" -#define FACTION_DUTCH "Dutch's Dozen" -#define FACTION_PIRATE "Pirate" -#define FACTION_GLADIATOR "Gladiator" -#define FACTION_PIZZA "Pizza Delivery" -#define FACTION_SOUTO "Souto Man" -#define FACTION_COLONIST "Colonist" -#define FACTION_YAUTJA "Yautja" -#define FACTION_ZOMBIE "Zombie" -#define FACTION_MONKEY "Monkey" // Nanu - -#define FACTION_LIST_MARINE list(FACTION_MARINE) -#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE) -#define FACTION_LIST_ERT list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO) -#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_UPP list(FACTION_UPP) -#define FACTION_LIST_CLF list(FACTION_CLF) -#define FACTION_LIST_TWE list(FACTION_TWE) -#define FACTION_LIST_FREELANCER list(FACTION_FREELANCER) -#define FACTION_LIST_CONTRACTOR list(FACTION_CONTRACTOR) -#define FACTION_LIST_MERCENARY list(FACTION_MERCENARY) -#define FACTION_LIST_MARSHAL list(FACTION_MARSHAL) -#define FACTION_LIST_DUTCH list(FACTION_DUTCH) -#define FACTION_LIST_SURVIVOR_WY list(FACTION_SURVIVOR, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_MARINE_WY list(FACTION_MARINE, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_MARINE_UPP list(FACTION_MARINE, FACTION_UPP) -#define FACTION_LIST_MARINE_TWE list(FACTION_MARINE, FACTION_TWE) - -// Xenomorphs -#define FACTION_PREDALIEN "Predalien" - -#define FACTION_XENOMORPH "Xenomorph" -#define FACTION_XENOMORPH_CORRPUTED "Corrupted Xenomoprh" -#define FACTION_XENOMORPH_ALPHA "Alpha Xenomorph" -#define FACTION_XENOMORPH_BRAVO "Bravo Xenomorph" -#define FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph" -#define FACTION_XENOMORPH_DELTA "Delta Xenomorph" - -#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) - -// Faction allegiances within a certain faction. - -#define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") - // global vars to prevent spam of the "one xyz alive" messages GLOBAL_VAR(last_ares_callout) diff --git a/code/datums/effects/xeno_strains/prae_acid_stacks.dm b/code/datums/effects/xeno_strains/prae_acid_stacks.dm index 7758e9de70ec..6f8fa6a7b98d 100644 --- a/code/datums/effects/xeno_strains/prae_acid_stacks.dm +++ b/code/datums/effects/xeno_strains/prae_acid_stacks.dm @@ -70,6 +70,7 @@ return var/mob/living/carbon/human/H = affected_atom + var/mob/cause_mob = cause_data.resolve_mob() H.apply_damage(proc_damage, BURN) if(cause_mob.faction == H.faction) cause_mob.track_friendly_damage("Acid", H, proc_damage) diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm index 3d8b58eebed7..4b9b1f40aa6d 100644 --- a/code/datums/entities/player.dm +++ b/code/datums/entities/player.dm @@ -51,8 +51,7 @@ var/list/datum/entity/player_note/notes var/list/datum/entity/player_job_ban/job_bans var/list/datum/entity/player_time/playtimes - var/list/datum/entity/player_stat/stats - var/datum/entity/player_entity/player_entity = null + var/datum/player_entity/player_entity var/list/playtime_data // For the NanoUI menu var/client/owning_client @@ -409,7 +408,6 @@ BSQL_PROTECT_DATUM(/datum/entity/player) INVOKE_ASYNC(src, TYPE_PROC_REF(/datum/entity/player, migrate_jobbans)) DB_FILTER(/datum/entity/player_time, DB_COMP("player_id", DB_EQUALS, id), CALLBACK(src, TYPE_PROC_REF(/datum/entity/player, on_read_timestat))) - DB_FILTER(/datum/entity/player_stat, DB_COMP("player_id", DB_EQUALS, id), CALLBACK(src, TYPE_PROC_REF(/datum/entity/player, on_read_stats))) if(!migrated_bans && !migrating_bans) migrating_bans = TRUE @@ -463,11 +461,6 @@ BSQL_PROTECT_DATUM(/datum/entity/player) for(var/datum/entity/player_time/S in _stat) LAZYSET(playtimes, S.role_id, S) -/datum/entity/player/proc/on_read_stats(list/datum/entity/player_stat/_stat) - if(_stat) - for(var/datum/entity/player_stat/S as anything in _stat) - LAZYSET(stats, S.stat_id, S) - /datum/entity/player/proc/load_byond_account_age() var/list/http_request = world.Export("http://byond.com/members/[ckey]?format=text") if(!http_request) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 2c5ddf44b3ee..2a0cfc9967b0 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1690,7 +1690,6 @@ if(new_player.mind) new_player.mind_initialize() new_player.mind.transfer_to(target, TRUE) - new_player.mind.setup_human_stats() target.sec_hud_set_ID() target.hud_set_squad() diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index cd95651b506a..f971ca4e6b0a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -333,11 +333,11 @@ Contains most of the procs that are called when a mob is attacked by something var/mob/M = LM.thrower var/client/assailant = M.client if(M.faction == faction) - M.track_friendly_hit(initial(I.name)) - M.track_friendly_damage(initial(I.name), src, damage) + M.track_friendly_hit(initial(O.name)) + M.track_friendly_damage(initial(O.name), src, damage) else - M.track_hit(initial(I.name)) - M.track_damage(initial(I.name), src, damage) + M.track_hit(initial(O.name)) + M.track_damage(initial(O.name), src, damage) if (damage > 5) last_damage_mob = M if (assailant) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index d29fbc2fe9e9..a768376e0a78 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -701,7 +701,7 @@ X.use_plasma(400) X.place_construction(T, structure_template) - xeno.count_statistic_stat(STATISTIC_XENO_STRUCTURES_BUILD) + X.count_statistic_stat(STATISTIC_XENO_STRUCTURES_BUILD) return ..() diff --git a/colonialmarines.dme b/colonialmarines.dme index 4c604a325d15..b612ac349685 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -57,6 +57,7 @@ #include "code\__DEFINES\emote_panels.dm" #include "code\__DEFINES\equipment.dm" #include "code\__DEFINES\events.dm" +#include "code\__DEFINES\factions.dm" #include "code\__DEFINES\fire.dm" #include "code\__DEFINES\flags.dm" #include "code\__DEFINES\fonts.dm" From cd66a8d2162fdfaf4bdeb71f9dbb14e91beeaead Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 16:28:30 +0500 Subject: [PATCH 04/69] CR1 --- code/controllers/subsystem/influxstats.dm | 2 +- code/game/machinery/nuclearbomb.dm | 4 ++-- code/game/machinery/telecomms/presets.dm | 2 +- code/modules/clothing/glasses/hud.dm | 4 ++-- code/modules/defenses/sentry.dm | 4 ++-- code/modules/gear_presets/corpses.dm | 2 +- .../riot_in_progress_insert_fiorina_nightmare.dm | 2 +- .../gear_presets/survivors/lv_522/forcon_survivors.dm | 4 ++-- .../survivors/lv_624/clfship_insert_lv624.dm | 2 +- .../survivors/lv_624/corporate_dome_insert_lv624.dm | 2 +- .../shivas_snowball/panic_room_insert_shivas.dm | 2 +- .../solaris/crashlanding-offices_insert_bigred.dm | 10 +++++----- code/modules/gear_presets/survivors/survivors.dm | 4 ++-- .../trijent/crashlanding_upp_bar_insert_trijent.dm | 4 ++-- code/modules/gear_presets/synths.dm | 4 ++-- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/code/controllers/subsystem/influxstats.dm b/code/controllers/subsystem/influxstats.dm index 0362a689704b..ae7f70e00357 100644 --- a/code/controllers/subsystem/influxstats.dm +++ b/code/controllers/subsystem/influxstats.dm @@ -123,7 +123,7 @@ SUBSYSTEM_DEF(influxstats) team = "observers" else if(!job) continue - else if(mob.faction == FACTION_MARINE || mob.faction == FACTION_SURVIVOR) + else if(mob.faction == FACTION_MARINE || mob.faction == FACTION_COLONIST) team = "humans" var/mob/living/carbon/human/employed_human = mob if(istype(employed_human)) diff --git a/code/game/machinery/nuclearbomb.dm b/code/game/machinery/nuclearbomb.dm index 42b5d95694cb..e31b2a82cc65 100644 --- a/code/game/machinery/nuclearbomb.dm +++ b/code/game/machinery/nuclearbomb.dm @@ -324,7 +324,7 @@ GLOBAL_VAR_INIT(bomb_set, FALSE) if(current_mob.stat != CONSCIOUS || isyautja(current_mob)) humans_other -= current_mob continue - if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_SURVIVOR) //separating marines from other factions. Survs go here too + if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_COLONIST) //separating marines from other factions. Survs go here too humans_uscm += current_mob humans_other -= current_mob @@ -560,7 +560,7 @@ GLOBAL_VAR_INIT(bomb_set, FALSE) if(current_human.stat != CONSCIOUS || isyautja(current_human)) humans_other -= current_mob continue - if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_SURVIVOR) + if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_COLONIST) humans_uscm += current_mob humans_other -= current_mob diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm index 0c9e875534da..c276d855cdd1 100644 --- a/code/game/machinery/telecomms/presets.dm +++ b/code/game/machinery/telecomms/presets.dm @@ -275,7 +275,7 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers) if(!do_after(user, 10, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return switch(user.faction) - if(FACTION_SURVIVOR) + if(FACTION_COLONIST) freq_listening |= COLONY_FREQ if(FACTION_MARINE in user.faction_group) //FORECON survivors freq_listening |= SOF_FREQ diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 6e086e651a10..8072074f0e0b 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -36,7 +36,7 @@ return /datum/action/item_action/view_publications/can_use_action() - if(owner && !owner.is_mob_incapacitated() && owner.faction != FACTION_SURVIVOR) + if(owner && !owner.is_mob_incapacitated() && owner.faction != FACTION_COLONIST) return TRUE /datum/action/item_action/view_publications/action_activate() @@ -85,7 +85,7 @@ set name = "View Research Publications" set src in usr - if(!usr.stat && !usr.is_mob_restrained() && usr.faction != FACTION_SURVIVOR) + if(!usr.stat && !usr.is_mob_restrained() && usr.faction != FACTION_COLONIST) tgui_interact(usr) /obj/item/clothing/glasses/hud/health/Topic(href, href_list) diff --git a/code/modules/defenses/sentry.dm b/code/modules/defenses/sentry.dm index 8ad4cd407e75..5a5f8ea1f313 100644 --- a/code/modules/defenses/sentry.dm +++ b/code/modules/defenses/sentry.dm @@ -519,7 +519,7 @@ . = ..() /obj/structure/machinery/defenses/sentry/premade/deployable/colony - faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_SURVIVOR) + faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_COLONIST) /obj/structure/machinery/defenses/sentry/premade/deployable/colony/Initialize() . = ..() @@ -534,7 +534,7 @@ sentry_type = "wy_sentry" health = 350 health_max = 350 - faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_SURVIVOR, FACTION_WY) + faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_COLONIST, FACTION_WY) fire_delay = 0.6 SECONDS damage_mult = 2 diff --git a/code/modules/gear_presets/corpses.dm b/code/modules/gear_presets/corpses.dm index 7bf9592a6209..54c480ffd77b 100644 --- a/code/modules/gear_presets/corpses.dm +++ b/code/modules/gear_presets/corpses.dm @@ -968,7 +968,7 @@ paygrade = PAY_SHORT_ME5 idtype = /obj/item/card/id/dogtag role_comm_title = "FORECON" - faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) + faction_group = list(FACTION_MARINE, FACTION_COLONIST) access = list( ACCESS_CIVILIAN_PUBLIC, ACCESS_CIVILIAN_ENGINEERING, diff --git a/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm b/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm index c09e6eee9385..b77624f91519 100644 --- a/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm +++ b/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm @@ -3,7 +3,7 @@ /datum/equipment_preset/survivor/cmb name = "Survivor - Colonial Marshal" faction = FACTION_MARSHAL - faction_group = list(FACTION_MARSHAL, FACTION_MARINE, FACTION_SURVIVOR) + faction_group = list(FACTION_MARSHAL, FACTION_MARINE, FACTION_COLONIST) languages = list(LANGUAGE_ENGLISH, LANGUAGE_JAPANESE) var/human_versus_human = FALSE access = list( diff --git a/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm b/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm index 4e9ab770fb2f..29673d418449 100644 --- a/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm +++ b/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm @@ -5,7 +5,7 @@ idtype = /obj/item/card/id/dogtag role_comm_title = "FORECON" rank = JOB_SURVIVOR - faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) + faction_group = list(FACTION_MARINE, FACTION_COLONIST) flags = EQUIPMENT_PRESET_START_OF_ROUND access = list( ACCESS_CIVILIAN_PUBLIC, @@ -280,7 +280,7 @@ /datum/equipment_preset/synth/survivor/forecon name = "Survivor - Synthetic - FORECON Synth" assignment = JOB_FORECON_SYN - faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) + faction_group = list(FACTION_MARINE, FACTION_COLONIST) idtype = /obj/item/card/id/gold /datum/equipment_preset/synth/survivor/forecon/load_gear(mob/living/carbon/human/preset_human) //Bishop from Aliens diff --git a/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm b/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm index 1bfeaaad9c43..0db4a118beb4 100644 --- a/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm +++ b/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm @@ -6,7 +6,7 @@ skills = /datum/skills/civilian/survivor/clf languages = list(LANGUAGE_ENGLISH, LANGUAGE_JAPANESE) faction = FACTION_CLF - faction_group = list(FACTION_CLF, FACTION_SURVIVOR) + faction_group = list(FACTION_CLF, FACTION_COLONIST) access = list(ACCESS_CIVILIAN_PUBLIC) survivor_variant = HOSTILE_SURVIVOR diff --git a/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm b/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm index 2c8ec04594ad..0de6f4bbbb7f 100644 --- a/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm +++ b/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm @@ -8,7 +8,7 @@ skills = /datum/skills/civilian/survivor/manager assignment = "LV-624 Corporate Liaison" idtype = /obj/item/card/id/silver/clearance_badge/cl - faction_group = list(FACTION_WY, FACTION_SURVIVOR) + faction_group = list(FACTION_WY, FACTION_COLONIST) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm b/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm index 9f1e2c705efb..cf074663202d 100644 --- a/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm +++ b/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm @@ -8,7 +8,7 @@ skills = /datum/skills/civilian/survivor/manager assignment = "Assistant Operations Manager" idtype = /obj/item/card/id/silver/clearance_badge/manager - faction_group = list(FACTION_WY, FACTION_SURVIVOR) + faction_group = list(FACTION_WY, FACTION_COLONIST) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm b/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm index 124bf2772be5..a4cb118e2b28 100644 --- a/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm +++ b/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm @@ -5,8 +5,8 @@ name = "Survivor - PMC" flags = EQUIPMENT_PRESET_START_OF_ROUND assignment = "Weyland-Yutani PMC" - faction = FACTION_SURVIVOR - faction_group = list(FACTION_WY, FACTION_SURVIVOR) + faction = FACTION_COLONIST + faction_group = list(FACTION_WY, FACTION_COLONIST) paygrade = PAY_SHORT_PMC_OP idtype = /obj/item/card/id/pmc skills = /datum/skills/civilian/survivor/pmc @@ -85,7 +85,7 @@ assignment = "Colony Supervisor" role_comm_title = "Supervisor" idtype = /obj/item/card/id/silver/clearance_badge/manager - faction_group = list(FACTION_WY, FACTION_SURVIVOR) + faction_group = list(FACTION_WY, FACTION_COLONIST) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, @@ -127,8 +127,8 @@ // only used on the spawner of all of those above... /datum/equipment_preset/synth/survivor/pmc name = "Survivor - Synthetic - PMC Support Synth" - faction = FACTION_SURVIVOR - faction_group = list(FACTION_WY, FACTION_SURVIVOR) + faction = FACTION_COLONIST + faction_group = list(FACTION_WY, FACTION_COLONIST) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/survivors.dm b/code/modules/gear_presets/survivors/survivors.dm index 71a2aaa94b7f..0551c2c79bd2 100644 --- a/code/modules/gear_presets/survivors/survivors.dm +++ b/code/modules/gear_presets/survivors/survivors.dm @@ -7,8 +7,8 @@ languages = list(LANGUAGE_ENGLISH) paygrade = PAY_SHORT_CIV idtype = /obj/item/card/id/lanyard - faction = FACTION_SURVIVOR - faction_group = list(FACTION_SURVIVOR) + faction = FACTION_COLONIST + faction_group = list(FACTION_COLONIST) origin_override = ORIGIN_CIVILIAN access = list(ACCESS_CIVILIAN_PUBLIC) diff --git a/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm b/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm index cfb3dee1dc47..f631b4b3c186 100644 --- a/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm +++ b/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm @@ -8,7 +8,7 @@ skills = /datum/skills/military/survivor/upp_private languages = list(LANGUAGE_RUSSIAN, LANGUAGE_GERMAN, LANGUAGE_CHINESE) faction = FACTION_UPP - faction_group = list(FACTION_UPP, FACTION_SURVIVOR) + faction_group = list(FACTION_UPP, FACTION_COLONIST) role_comm_title = "173/RECON" idtype = /obj/item/card/id/dogtag flags = EQUIPMENT_PRESET_EXTRA @@ -177,7 +177,7 @@ assignment = JOB_UPP_SUPPORT_SYNTH rank = JOB_UPP_SUPPORT_SYNTH faction = FACTION_UPP - faction_group = list(FACTION_UPP, FACTION_SURVIVOR) + faction_group = list(FACTION_UPP, FACTION_COLONIST) skills = /datum/skills/colonial_synthetic paygrade = PAY_SHORT_SYN idtype = /obj/item/card/id/dogtag diff --git a/code/modules/gear_presets/synths.dm b/code/modules/gear_presets/synths.dm index 2fde67e931b9..8d1d5a9ea3a8 100644 --- a/code/modules/gear_presets/synths.dm +++ b/code/modules/gear_presets/synths.dm @@ -105,8 +105,8 @@ /datum/equipment_preset/synth/survivor name = "Survivor - Synthetic - Classic Joe" flags = EQUIPMENT_PRESET_EXTRA - faction = FACTION_SURVIVOR - faction_group = list(FACTION_SURVIVOR) + faction = FACTION_COLONIST + faction_group = list(FACTION_COLONIST) idtype = /obj/item/card/id/lanyard assignment = JOB_SYNTH rank = JOB_SYNTH_SURVIVOR From b1bc33023a3532c87c7b85fb7da49ab439ba86ce Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 17:47:40 +0500 Subject: [PATCH 05/69] CR2 --- code/__DEFINES/factions.dm | 36 ++ code/_globalvars/global_lists.dm | 22 - code/datums/event_info_text.dm | 40 +- code/datums/factions/_misc/helpers.dm | 29 ++ code/datums/factions/_misc/iff_tag.dm | 121 ++++++ code/datums/factions/_modules/module.dm | 6 + code/datums/factions/_modules/relations.dm | 59 +++ code/datums/factions/clf.dm | 157 +------ code/datums/factions/cmb.dm | 3 - code/datums/factions/colonists.dm | 28 ++ code/datums/factions/contractor.dm | 7 +- code/datums/factions/dutch's_dozen.dm | 6 + code/datums/factions/faction.dm | 334 ++++++++++++++- code/datums/factions/freelancer.dm | 7 + code/datums/factions/gladiator.dm | 5 + code/datums/factions/hefa_order.dm | 8 + code/datums/factions/helpers.dm | 14 - code/datums/factions/mercenary.dm | 5 + code/datums/factions/pirate.dm | 5 + code/datums/factions/pizza_delivery.dm | 7 + code/datums/factions/pmc.dm | 95 ----- code/datums/factions/ress.dm | 5 + code/datums/factions/souto.dm | 5 + code/datums/factions/threewe.dm | 9 + .../commando.dm} | 22 +- code/datums/factions/upp.dm | 46 ++- code/datums/factions/uscm.dm | 90 ++-- code/datums/factions/uscm/cmb.dm | 3 + code/datums/factions/uscm/marine.dm | 53 +++ code/datums/factions/uscm/marsoc.dm | 5 + code/datums/factions/wy.dm | 34 ++ code/datums/factions/wy/deathsquad.dm | 6 + code/datums/factions/wy/pmc.dm | 5 + code/datums/factions/xeno.dm | 386 ++++++++++++++++++ code/datums/factions/xeno/alpha.dm | 7 + code/datums/factions/xeno/bravo.dm | 7 + code/datums/factions/xeno/charlie.dm | 7 + code/datums/factions/xeno/corrupted.dm | 38 ++ code/datums/factions/xeno/delta.dm | 7 + code/datums/factions/xeno/feral.dm | 13 + code/datums/factions/xeno/forsaken.dm | 13 + code/datums/factions/xeno/mutated.dm | 9 + code/datums/factions/xeno/normal.dm | 32 ++ code/datums/factions/xeno/renegade.dm | 13 + code/datums/factions/xeno/yautja.dm | 13 + code/datums/factions/yautja.dm | 35 ++ code/datums/factions/zombie.dm | 60 +++ code/datums/mind.dm | 2 - .../statistics/entities/player_entity.dm | 2 +- .../statistics/entities/player_stats.dm | 23 ++ code/game/gamemodes/cm_process.dm | 5 +- code/game/gamemodes/game_mode.dm | 2 +- code/game/objects/items/cards_ids.dm | 1 - .../cm_tech/implements/xeno_handler.dm | 6 +- .../modules/gear_presets/_select_equipment.dm | 21 +- code/modules/gear_presets/other.dm | 16 +- code/modules/mob/dead/observer/observer.dm | 70 +--- code/modules/mob/dead/observer/orbit.dm | 1 + code/modules/mob/living/brain/brain.dm | 4 +- code/modules/mob/living/carbon/carbon.dm | 4 + .../mob/living/carbon/xenomorph/Xenomorph.dm | 43 +- code/modules/mob/living/living_defense.dm | 8 +- code/modules/mob/new_player/new_player.dm | 68 +-- colonialmarines.dme | 29 +- 64 files changed, 1667 insertions(+), 555 deletions(-) create mode 100644 code/datums/factions/_misc/helpers.dm create mode 100644 code/datums/factions/_misc/iff_tag.dm create mode 100644 code/datums/factions/_modules/module.dm create mode 100644 code/datums/factions/_modules/relations.dm delete mode 100644 code/datums/factions/cmb.dm create mode 100644 code/datums/factions/colonists.dm create mode 100644 code/datums/factions/dutch's_dozen.dm create mode 100644 code/datums/factions/freelancer.dm create mode 100644 code/datums/factions/gladiator.dm create mode 100644 code/datums/factions/hefa_order.dm delete mode 100644 code/datums/factions/helpers.dm create mode 100644 code/datums/factions/mercenary.dm create mode 100644 code/datums/factions/pirate.dm create mode 100644 code/datums/factions/pizza_delivery.dm delete mode 100644 code/datums/factions/pmc.dm create mode 100644 code/datums/factions/ress.dm create mode 100644 code/datums/factions/souto.dm create mode 100644 code/datums/factions/threewe.dm rename code/datums/factions/{royalmarinescommando.dm => twe/commando.dm} (90%) create mode 100644 code/datums/factions/uscm/cmb.dm create mode 100644 code/datums/factions/uscm/marine.dm create mode 100644 code/datums/factions/uscm/marsoc.dm create mode 100644 code/datums/factions/wy.dm create mode 100644 code/datums/factions/wy/deathsquad.dm create mode 100644 code/datums/factions/wy/pmc.dm create mode 100644 code/datums/factions/xeno.dm create mode 100644 code/datums/factions/xeno/alpha.dm create mode 100644 code/datums/factions/xeno/bravo.dm create mode 100644 code/datums/factions/xeno/charlie.dm create mode 100644 code/datums/factions/xeno/corrupted.dm create mode 100644 code/datums/factions/xeno/delta.dm create mode 100644 code/datums/factions/xeno/feral.dm create mode 100644 code/datums/factions/xeno/forsaken.dm create mode 100644 code/datums/factions/xeno/mutated.dm create mode 100644 code/datums/factions/xeno/normal.dm create mode 100644 code/datums/factions/xeno/renegade.dm create mode 100644 code/datums/factions/xeno/yautja.dm create mode 100644 code/datums/factions/yautja.dm create mode 100644 code/datums/factions/zombie.dm diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm index 8670b9d8df8a..65545ff6df44 100644 --- a/code/__DEFINES/factions.dm +++ b/code/__DEFINES/factions.dm @@ -112,9 +112,45 @@ #define NAME_FACTION_LIST_XENOMORPH list(NAME_FACTION_XENOMORPH_NORMAL, NAME_FACTION_XENOMORPH_CORRUPTED, NAME_FACTION_XENOMORPH_ALPHA, NAME_FACTION_XENOMORPH_BRAVO, NAME_FACTION_XENOMORPH_CHARLIE, NAME_FACTION_XENOMORPH_DELTA, NAME_FACTION_XENOMORPH_FERAL, NAME_FACTION_XENOMORPH_FORSAKEN, NAME_FACTION_XENOMORPH_TAMED, NAME_FACTION_XENOMORPH_MUTATED, NAME_FACTION_XENOMORPH_YAUTJA, NAME_FACTION_XENOMORPH_YAUTJA) #define NAME_FACTION_LIST_ALL NAME_FACTION_LIST_HUMANOID + NAME_FACTION_LIST_XENOMORPH +//FACTIONS RELATIONS +#define RELATIONS_FACTION_NEUTRAL list(FACTION_USCM = RELATIONS_NEUTRAL, FACTION_WY = RELATIONS_NEUTRAL, FACTION_UPP = RELATIONS_NEUTRAL, FACTION_CLF = RELATIONS_NEUTRAL, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_NEUTRAL, FACTION_TWE = RELATIONS_NEUTRAL, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_NEUTRAL) +#define RELATIONS_FACTION_USCM list(FACTION_WY = RELATIONS_FRIENDLY, FACTION_UPP = RELATIONS_HOSTILE, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_FRIENDLY, FACTION_TWE = RELATIONS_FRIENDLY, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_TENSE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) +#define RELATIONS_FACTION_WY list(FACTION_USCM = RELATIONS_FRIENDLY, FACTION_UPP = RELATIONS_NEUTRAL, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_FRIENDLY, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_NEUTRAL, FACTION_NEUTRAL = RELATIONS_NEUTRAL) +#define RELATIONS_FACTION_CLF list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_NEUTRAL, FACTION_UPP = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) +#define RELATIONS_FACTION_UPP list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_FRIENDLY, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_FRIENDLY, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) +#define RELATIONS_FACTION_XENOMORPH list(FACTION_XENOMORPH_NORMAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_CORRUPTED = RELATIONS_HOSTILE, FACTION_XENOMORPH_ALPHA = RELATIONS_HOSTILE, FACTION_XENOMORPH_BRAVO = RELATIONS_HOSTILE, FACTION_XENOMORPH_CHARLIE = RELATIONS_HOSTILE, FACTION_XENOMORPH_DELTA = RELATIONS_HOSTILE, FACTION_XENOMORPH_FERAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_FORSAKEN = RELATIONS_HOSTILE, FACTION_XENOMORPH_TAMED = RELATIONS_HOSTILE, FACTION_XENOMORPH_MUTATED = RELATIONS_HOSTILE, FACTION_XENOMORPH_YAUTJA = RELATIONS_HOSTILE, FACTION_XENOMORPH_RENEGADE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) + +#define RELATIONS_MAP list(FACTION_NEUTRAL = null, FACTION_USCM = null, FACTION_MARINE = null, FACTION_CMB = null, FACTION_MARSOC = null, FACTION_CONTRACTOR = null, FACTION_WY = null, FACTION_PMC = null, FACTION_WY_DEATHSQUAD = null, FACTION_CLF = null, FACTION_UPP = null, FACTION_FREELANCER = null, FACTION_COLONIST = null, FACTION_MERCENARY = null, FACTION_DUTCH = null, FACTION_HEFA = null, FACTION_GLADIATOR = null, FACTION_PIRATE = null, FACTION_PIZZA = null, FACTION_SOUTO = null, FACTION_YAUTJA = null, FACTION_XENOMORPH_NORMAL = null, FACTION_XENOMORPH_CORRUPTED = null, FACTION_XENOMORPH_ALPHA = null, FACTION_XENOMORPH_BRAVO = null, FACTION_XENOMORPH_CHARLIE = null, FACTION_XENOMORPH_DELTA = null, FACTION_XENOMORPH_FERAL = null, FACTION_XENOMORPH_FORSAKEN = null, FACTION_XENOMORPH_TAMED = null, FACTION_XENOMORPH_MUTATED = null, FACTION_XENOMORPH_YAUTJA = null) +#define RELATIONS_MAP_HOSTILE list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_HOSTILE, FACTION_UPP = RELATIONS_HOSTILE, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_HOSTILE, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_XENOMORPH_NORMAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_CORRUPTED = RELATIONS_HOSTILE, FACTION_XENOMORPH_ALPHA = RELATIONS_HOSTILE, FACTION_XENOMORPH_BRAVO = RELATIONS_HOSTILE, FACTION_XENOMORPH_CHARLIE = RELATIONS_HOSTILE, FACTION_XENOMORPH_DELTA = RELATIONS_HOSTILE, FACTION_XENOMORPH_FERAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_FORSAKEN = RELATIONS_HOSTILE, FACTION_XENOMORPH_TAMED = RELATIONS_HOSTILE, FACTION_XENOMORPH_MUTATED = RELATIONS_HOSTILE, FACTION_XENOMORPH_YAUTJA = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_HOSTILE) + +#define RELATIONS_UNKNOWN null +#define RELATIONS_DISABLED list(0, 0) +#define RELATIONS_WAR list(1, 200) +#define RELATIONS_HOSTILE list(201, 400) +#define RELATIONS_TENSE list(401, 500) +#define RELATIONS_NEUTRAL list(501, 700) +#define RELATIONS_FRIENDLY list(701, 900) +#define RELATIONS_VERY_GOOD list(901, 1000) +#define RELATIONS_SELF 1100 +#define RELATIONS_MAX 1000 + +//FACTION TREES +#define SIDE_FACTION_NEUTRAL "NEUTRAL_T" +#define SIDE_FACTION_USCM "USCM_T" +#define SIDE_FACTION_WY "W-Y_T" +#define SIDE_FACTION_CLF "CLF_T" +#define SIDE_FACTION_UPP "UPP_T" +#define SIDE_FACTION_ZOMBIE "ZOMBIE_T" +#define SIDE_FACTION_YAUTJA "YAUTJA_T" +#define SIDE_FACTION_XENOMORPH "XENOMORPH_T" + +#define SIDE_ORGANICAL_DOM list(SIDE_FACTION_ZOMBIE, SIDE_FACTION_XENOMORPH) + // Faction allegiances within a certain faction. #define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") +#define MODULE_CODE_NAME_RELATIONS "relations_handler" + /* diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index b6b8f0c16c9c..ea1e07a7e39e 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -225,8 +225,6 @@ GLOBAL_LIST_INIT(xeno_evolve_times, setup_xeno_evolve_times()) for(var/datum/caste_datum/caste as anything in subtypesof(/datum/caste_datum)) LAZYADDASSOCLIST(., num2text(initial(caste.minimum_evolve_time)), caste) -GLOBAL_LIST_INIT(custom_event_info_list, setup_custom_event_info()) - // Posters GLOBAL_LIST_INIT(poster_designs, subtypesof(/datum/poster)) @@ -450,26 +448,6 @@ GLOBAL_LIST_INIT(hj_emotes, setup_hazard_joe_emotes()) mobtypes["[T]"] = typecacheof(T.target_mobtypes) return mobtypes -/proc/setup_custom_event_info() - //faction event messages - var/list/custom_event_info_list = list() - var/datum/custom_event_info/CEI = new /datum/custom_event_info - CEI.faction = "Global" //the old public one for whole server to see - custom_event_info_list[CEI.faction] = CEI - for(var/T in FACTION_LIST_HUMANOID) - CEI = new /datum/custom_event_info - CEI.faction = T - custom_event_info_list[T] = CEI - - var/datum/hive_status/hive - for(var/hivenumber in GLOB.hive_datum) - hive = GLOB.hive_datum[hivenumber] - CEI = new /datum/custom_event_info - CEI.faction = hive.internal_faction - custom_event_info_list[hive.name] = CEI - - return custom_event_info_list - /proc/setup_taskbar_icons() var/list/png_list = flist("icons/taskbar") for(var/png in png_list) diff --git a/code/datums/event_info_text.dm b/code/datums/event_info_text.dm index 21469ed379cd..9b433f6e1893 100644 --- a/code/datums/event_info_text.dm +++ b/code/datums/event_info_text.dm @@ -1,18 +1,13 @@ /datum/custom_event_info - var/faction = "default" //here category/faction/hive name stored - var/msg = "" //here is the message itself - + var/name = "default" + var/faction_name = "default" + var/datum/faction/faction = null + var/msg = "" //this shows event info to player. can pass clients and mobs -/datum/custom_event_info/proc/show_player_event_info(user) - - if(!istype(user, /client)) - if(ismob(user)) - var/mob/M = user - if(!M.client) - return - else - return +/datum/custom_event_info/proc/show_player_event_info(client/user) + if(!istype(user)) + return if(msg == "") return @@ -26,7 +21,6 @@ //this shows changed event info to everyone in the category /datum/custom_event_info/proc/handle_event_info_update() - if(!msg) return @@ -37,26 +31,16 @@ to_world(dat) return - else if(faction in FACTION_LIST_HUMANOID) - for(var/mob/M in GLOB.human_mob_list) - if(M && M.faction == faction) - show_player_event_info(M) + else if(faction_name) + for(var/mob/M in faction.totalMobs) + show_player_event_info(M.client) return - else - var/datum/hive_status/hive - for(var/hivenumber in GLOB.hive_datum) - hive = GLOB.hive_datum[hivenumber] - if(hive.name == faction) - for(var/mob/M in hive.totalXenos) - show_player_event_info(M) - return - message_admins("ERROR, ([faction ? faction : "name lost"]) faction is not found for event info.") return -/mob/proc/check_event_info(category = "Global") +/proc/check_event_info(category = "Global", client/user) if(GLOB.custom_event_info_list[category]) var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[category] if(CEI.msg) - CEI.show_player_event_info(src) + CEI.show_player_event_info(user) diff --git a/code/datums/factions/_misc/helpers.dm b/code/datums/factions/_misc/helpers.dm new file mode 100644 index 000000000000..c3d715fef3b7 --- /dev/null +++ b/code/datums/factions/_misc/helpers.dm @@ -0,0 +1,29 @@ +GLOBAL_LIST_INIT_TYPED(faction_datums, /datum/faction, setup_factions_list()) + +/proc/setup_factions_list() + . = list() + for(var/path in typesof(/datum/faction)) + var/datum/faction/faction = new path + .[faction.faction_name] = faction + +GLOBAL_LIST_INIT_TYPED(custom_event_info_list, /datum/custom_event_info, setup_custom_event_info()) + +/proc/setup_custom_event_info() + . = list() + var/datum/custom_event_info/CEI = new() + CEI.faction_name = "Global" + .[CEI.faction_name] = CEI + for(var/faction_to_get in FACTION_LIST_ALL) + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + CEI = new() + CEI.faction_name = faction.name + CEI.faction = faction + .[CEI.faction_name] = CEI + +GLOBAL_LIST_INIT_TYPED(faction_modules, /datum/faction_module, setup_faction_modules_list()) + +/proc/setup_faction_modules_list() + . = list() + for(var/path in typesof(/datum/faction_module)) + var/datum/faction_module/module = new path + .[module.module_name] = module diff --git a/code/datums/factions/_misc/iff_tag.dm b/code/datums/factions/_misc/iff_tag.dm new file mode 100644 index 000000000000..cdcd27fafea2 --- /dev/null +++ b/code/datums/factions/_misc/iff_tag.dm @@ -0,0 +1,121 @@ +#define INJECTABLE_TAG (1<<0) +#define REPROGRAMMABLE_TAG (1<<1) +#define ORGAN_TAG (1<<2) + +DEFINE_BITFIELD(iff_flag_flags, list( + "INJECTABLE_TAG" = INJECTABLE_TAG, + "REPROGRAMMABLE_TAG" = REPROGRAMMABLE_TAG, + "ORGAN_TAG" = ORGAN_TAG, +)) + +/mob/living/carbon + var/obj/item/faction_tag/organ/organ_faction_tag = null + var/obj/item/faction_tag/faction_tag = null + +/obj/item/faction_tag + name = "Faction IFF tag" + desc = "A tag containing a small IFF computer that gets inserted into the body. You can modify the IFF groups by using an access tuner on it, or on the body of implanted if it's already implanted." + icon = 'icons/obj/items/iff_tag.dmi' + icon_state = "iff_tag" + var/tag_flags = INJECTABLE_TAG|REPROGRAMMABLE_TAG + var/list/datum/faction/factions = list() + +/obj/item/faction_tag/Initialize(mapload, faction_ref) + faction = faction_ref + + . = ..() + if(faction) + factions |= faction + if(faction.ally_factions_initialize) + for(var/datum/faction/faction_ally in faction.relations_datum.allies) + factions |= faction_ally + +/obj/item/faction_tag/attack(mob/living/carbon/mob, mob/living/carbon/injector) + if((isxeno(mob) || ishuman(mob)) && tag_flags & INJECTABLE_TAG) + if(mob.stat == DEAD) + to_chat(injector, SPAN_WARNING("\The [mob] is dead...")) + return + if(mob.faction_tag) + to_chat(injector, SPAN_WARNING("\The [mob] already has a tag inside it.")) + return + injector.visible_message(SPAN_NOTICE("[injector] starts forcing \the [src] into [mob]'s body..."), SPAN_NOTICE("You start forcing \the [src] into [mob]'s body...")) + if(!do_after(injector, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC, mob, INTERRUPT_DIFF_LOC, BUSY_ICON_GENERIC)) + return + injector.visible_message(SPAN_NOTICE("[injector] forces \the [src] into [mob]'s body!"), SPAN_NOTICE("You force \the [src] into [mob]'s body!")) + mob.faction_tag = src + injector.drop_inv_item_to_loc(src, mob) + return + return ..() + +/obj/item/faction_tag/attackby(obj/item/W, mob/user) + if(HAS_TRAIT(W, TRAIT_TOOL_MULTITOOL) && ishuman(user) && tag_flags & REPROGRAMMABLE_TAG) + handle_reprogramming(user) + return + return ..() + +/obj/item/faction_tag/proc/handle_reprogramming(mob/living/carbon/human/programmer, mob/living/carbon/mob) + var/list/datum/faction/id_faction_groups = programmer.faction + var/option = tgui_alert(programmer, "Current Faction IFF reads as: [english_list(factions, "None")]\nYour ID's Faction IFF reads as: [english_list(id_faction_groups, "None")]", "Faction IFF Tag", list("Overwrite", "Add", "Remove")) + if(!option) + return FALSE + if(mob) + if(!mob.faction_tag) + to_chat(programmer, SPAN_WARNING("\The [src]'s tag got removed while you were reprogramming it!")) + return FALSE + if(!programmer.Adjacent(mob)) + to_chat(programmer, SPAN_WARNING("You need to stay close to the tag to reprogram the tag!")) + return FALSE + switch(option) + if("Overwrite") + factions = id_faction_groups + if("Add") + factions |= id_faction_groups + if("Remove") + factions = list() + to_chat(programmer, SPAN_NOTICE("You [option] the Faction IFF data, the Faction IFF on the tag now reads as: [english_list(factions, "None")]")) + return TRUE + +/obj/item/faction_tag/organ + name = "Sticky Gland" + desc = "Strange organic object, that somehow help to be indentificated." + icon_state = "gland_tag" + tag_flags = ORGAN_TAG + +/obj/item/faction_tag/organ/meshy_rooting_gland + faction_to_get = FACTION_ZOMBIE + +/obj/item/faction_tag/organ/pheromones_receptor + faction_to_get = FACTION_XENOMORPH + +//CASE FOR TAGS +/obj/item/storage/tag_case + name = "tag case" + desc = "A sturdy case designed to store IFF tags." + icon = 'icons/obj/items/iff_tag.dmi' + icon_state = "tag_box" + use_sound = "toolbox" + storage_slots = 8 + can_hold = list( + /obj/item/faction_tag, + /obj/item/device/multitool + ) + black_market_value = 25 + +/obj/item/storage/tag_case/full/fill_preset_inventory() + for(var/i = 1 to storage_slots - 1) + new /obj/item/faction_tag(src) + new /obj/item/device/multitool(src) + +/obj/item/storage/tag_case/uscm/marine + +/obj/item/storage/tag_case/uscm/marine/full/fill_preset_inventory() + for(var/i = 1 to storage_slots - 1) + new /obj/item/faction_tag(src, GLOB.faction_datums[FACTION_MARINE]) + new /obj/item/device/multitool(src) + +/obj/item/storage/tag_case/wy + +/obj/item/storage/tag_case/wy/full/fill_preset_inventory() + for(var/i = 1 to storage_slots - 1) + new /obj/item/faction_tag(src, GLOB.faction_datums[FACTION_WY]) + new /obj/item/device/multitool(src) diff --git a/code/datums/factions/_modules/module.dm b/code/datums/factions/_modules/module.dm new file mode 100644 index 000000000000..74573bb99925 --- /dev/null +++ b/code/datums/factions/_modules/module.dm @@ -0,0 +1,6 @@ +/datum/faction_module + var/module_name + var/datum/faction/faction + +/datum/faction_module/New(datum/faction/faction_to_set) + faction = faction_to_set diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm new file mode 100644 index 000000000000..3366c6a2af3a --- /dev/null +++ b/code/datums/factions/_modules/relations.dm @@ -0,0 +1,59 @@ +/datum/faction_module/relations + module_name = MODULE_CODE_NAME_RELATIONS + + var/relations[] = RELATIONS_MAP + var/list/allies = list() + +/datum/faction_module/relations/New(datum/faction/faction_to_set) + . = ..() + generate_relations_helper() + +/datum/faction_module/relations/proc/generate_relations_helper() + spawn(30 SECONDS) + for(var/i in FACTION_LIST_ALL) + if(i == faction.faction_name) + relations[i] = RELATIONS_SELF + continue + if(i in faction.relations_pregen) + relations[i] = rand(faction.relations_pregen[i][1], faction.relations_pregen[i][2]) + if(RELATIONS_FRIENDLY[2] < faction.relations_pregen[i]) + allies += GLOB.faction_datums[i] + continue + relations[i] = RELATIONS_UNKNOWN + +/datum/faction_module/relations/proc/can_acting(datum/faction/target_faction) + if(isnull(relations[target_faction.faction_name]) || relations[target_faction.faction_name] < RELATIONS_WAR[1] || relations[target_faction.faction_name] > RELATIONS_MAX) + return FALSE + return TRUE + +/datum/faction_module/relations/proc/gain_opinion(datum/faction/target_faction, opinion) + relations[target_faction.faction_name] = clamp(relations[target_faction.faction_name] + opinion, RELATIONS_WAR[1], RELATIONS_MAX) + +/datum/faction_module/relations/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, source, ui) + if(!ui) + ui = new(user, source, "FactionRelations", "[faction] Relations") + ui.open() + ui.set_autoupdate(TRUE) + +/datum/faction_module/relations/ui_data(mob/user) + . = list() + var/list/relations_mapping = list() + for(var/i in relations) + if(relations[i] == null || relations[i] > 1000) + continue + relations_mapping += list(list("name" = GLOB.faction_datums[i].name, "desc" = GLOB.faction_datums[i].desc, "color" = GLOB.faction_datums[i].ui_color, "value" = relations[i])) + + .["actions"] = can_handle_action(user) + + .["faction_color"] = faction.ui_color + .["faction_relations"] = relations_mapping + +/datum/faction_module/relations/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + +/datum/faction_module/relations/ui_status(mob/user, datum/ui_state/state) + return UI_INTERACTIVE + +/datum/faction_module/relations/proc/can_handle_action(mob/user) + return FALSE diff --git a/code/datums/factions/clf.dm b/code/datums/factions/clf.dm index ce53b505b352..c236f6cadd5d 100644 --- a/code/datums/factions/clf.dm +++ b/code/datums/factions/clf.dm @@ -1,156 +1,21 @@ /datum/faction/clf - name = "Colonial Liberation Front" - faction_tag = FACTION_CLF + name = NAME_FACTION_CLF + desc = "The Colonial Liberation Front is a paramilitary group primarily located in the Neroid sector of United Americas space. Their stated goal is to secure the independence of all of the colonies in the Neroid sector. They are the largest and most active militant group pushing for the independence of the colonies. \ + The United Americas government classifies the CLF as a terrorist organization, with membership in the organization or providing financial or material support for the CLF being prosecutable offenses. The CLF grew organically from several different groups that formed in the wake of the Slaughter of Xibou in 2164. Prior to the slaughter of Xibou the conflicts between the United Americas government and the colonists of the Neroid sector had remained mostly non-violent. \ + The sudden increase in tensions after Xibou, combined with the images of slaughtered fighters and civilians alike, greatly increased the willingness of the colonists to take up arms against the United Americas. Several different militant groups formed in the years following the Slaughter, and as they negotiated with one another and found common cause the CLF was formed from their union." + + faction_name = FACTION_CLF + faction_tag = SIDE_FACTION_CLF + relations_pregen = RELATIONS_FACTION_CLF /datum/faction/clf/modify_hud_holder(image/holder, mob/living/carbon/human/human) var/hud_icon_state - var/obj/item/card/id/ID = human.get_idcard() + var/obj/item/card/id/id_card = human.get_idcard() var/_role if(human.mind) _role = human.job - else if(ID) - _role = ID.rank + else if(id_card) + _role = id_card.rank switch(_role) if(JOB_CLF_ENGI) hud_icon_state = "engi" - if(JOB_CLF_MEDIC) - hud_icon_state = "med" - if(JOB_CLF_SPECIALIST) - hud_icon_state = "spec" - if(JOB_CLF_LEADER) - hud_icon_state = "sl" - if(JOB_CLF_SYNTH) - hud_icon_state = "synth" - if(JOB_CLF_COMMANDER) - hud_icon_state = "cellcom" - if(hud_icon_state) - holder.overlays += image('icons/mob/hud/marine_hud.dmi', human, "clf_[hud_icon_state]") - -/datum/faction/clf/get_antag_guns_snowflake_equipment() - return list( - list("PRIMARY FIREARMS", 0, null, null, null), - list("ABR-40 Hunting Rifle", 30, /obj/item/weapon/gun/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), - list("Basira-Armstrong Bolt-Action", 15, /obj/item/weapon/gun/boltaction, null, VENDOR_ITEM_REGULAR), - list("Double Barrel Shotgun", 30, /obj/item/weapon/gun/shotgun/double, null, VENDOR_ITEM_REGULAR), - list("HG 37-12 Pump Shotgun", 30, /obj/item/weapon/gun/shotgun/double/sawn, null, VENDOR_ITEM_REGULAR), - list("M16 Rifle", 30, /obj/item/weapon/gun/rifle/m16, null, VENDOR_ITEM_REGULAR), - list("MAR-30 Battle Carbine", 30, /obj/item/weapon/gun/rifle/mar40/carbine, null, VENDOR_ITEM_REGULAR), - list("MAR-40 Battle Rifle", 30, /obj/item/weapon/gun/rifle/mar40, null, VENDOR_ITEM_REGULAR), - list("Type-64 Submachinegun", 20, /obj/item/weapon/gun/smg/bizon, null, VENDOR_ITEM_REGULAR), - list("MAC-15 Submachinegun", 20, /obj/item/weapon/gun/smg/mac15, null, VENDOR_ITEM_REGULAR), - list("MP27 Submachinegun", 20, /obj/item/weapon/gun/smg/mp27, null, VENDOR_ITEM_REGULAR), - list("MP5 Submachinegun", 20, /obj/item/weapon/gun/smg/mp5, null, VENDOR_ITEM_REGULAR), - list("Sawn-Off Shotgun", 30, /obj/item/weapon/gun/shotgun/pump/dual_tube/cmb, null, VENDOR_ITEM_REGULAR), - - list("PRIMARY AMMUNITION", 0, null, null, null), - list("ABR-40 Magazine (10x24mm)", 20, /obj/item/ammo_magazine/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), - list("Basira-Armstrong Magazine (6.5mm)", 5, /obj/item/ammo_magazine/rifle/boltaction, null, VENDOR_ITEM_REGULAR), - list("Box Of Buckshot Shells", 10, /obj/item/ammo_magazine/shotgun/buckshot, null, VENDOR_ITEM_REGULAR), - list("Box Of Flechette Shells", 10, /obj/item/ammo_magazine/shotgun/flechette, null, VENDOR_ITEM_REGULAR), - list("Box Of Shotgun Slugs", 10, /obj/item/ammo_magazine/shotgun, null, VENDOR_ITEM_REGULAR), - list("M16 AP Magazine (5.56x45mm)", 15, /obj/item/ammo_magazine/rifle/m16/ap, null, VENDOR_ITEM_REGULAR), - list("M16 Magazine (5.56x45mm)", 5, /obj/item/ammo_magazine/rifle/m16, null, VENDOR_ITEM_REGULAR), - list("MAC-15 Magazine (9mm)", 5, /obj/item/ammo_magazine/smg/mac15, null, VENDOR_ITEM_REGULAR), - list("MAR Magazine (7.62x39mm)", 5, /obj/item/ammo_magazine/rifle/mar40, null, VENDOR_ITEM_REGULAR), - list("MAR Extended Magazine (7.62x39mm)", 15, /obj/item/ammo_magazine/rifle/mar40/extended, null, VENDOR_ITEM_REGULAR), - list("Type-64 Helical Magazine (.7.62x19mm)", 5, /obj/item/ammo_magazine/smg/bizon, null, VENDOR_ITEM_REGULAR), - list("MP27 Magazine (4.6x30mm)", 5, /obj/item/ammo_magazine/smg/mp27, null, VENDOR_ITEM_REGULAR), - list("MP5 Magazine (9mm)", 5, /obj/item/ammo_magazine/smg/mp5, null, VENDOR_ITEM_REGULAR), - - list("SIDEARMS", 0, null, null, null), - list("88 Mod 4 Combat Pistol", 15, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), - list("Beretta 92FS Pistol", 15, /obj/item/weapon/gun/pistol/b92fs, null, VENDOR_ITEM_REGULAR), - list("CMB Spearhead Autorevolver", 15, /obj/item/weapon/gun/revolver/cmb, null, VENDOR_ITEM_REGULAR), - list("Holdout Pistol", 10, /obj/item/weapon/gun/pistol/holdout, null, VENDOR_ITEM_REGULAR), - list("KT-42 Automag", 15, /obj/item/weapon/gun/pistol/kt42, null, VENDOR_ITEM_REGULAR), - list("S&W .357 Revolver", 15, /obj/item/weapon/gun/revolver/small, null, VENDOR_ITEM_REGULAR), - - list("SIDEARM AMMUNITION", 0, null, null, null), - list("88M4 AP Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), - list("Beretta 92FS Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/b92fs, null, VENDOR_ITEM_REGULAR), - list("KT-42 Magazine (.44)", 5, /obj/item/ammo_magazine/pistol/kt42, null, VENDOR_ITEM_REGULAR), - list("Spearhead Speed Loader (.357)", 10, /obj/item/ammo_magazine/revolver/cmb/normalpoint, VENDOR_ITEM_REGULAR), - list("Hollowpoint Spearhead Speed Loader (.357)", 5, /obj/item/ammo_magazine/revolver/cmb, VENDOR_ITEM_REGULAR), - list("S&W Speed Loader (.357)", 5, /obj/item/ammo_magazine/revolver/small, null, VENDOR_ITEM_REGULAR), - list("Tiny Pistol Magazine (.22)", 5, /obj/item/ammo_magazine/pistol/holdout, null, VENDOR_ITEM_REGULAR), - - list("ATTACHMENTS", 0, null, null, null), - list("2x Hunting Mini-Scope", 20, /obj/item/attachable/scope/mini/hunting, null, VENDOR_ITEM_REGULAR), - list("Angled Grip", 15, /obj/item/attachable/angledgrip, null, VENDOR_ITEM_REGULAR), - list("Burst Fire Assembly", 15, /obj/item/attachable/burstfire_assembly, null, VENDOR_ITEM_REGULAR), - list("Extended Barrel", 15, /obj/item/attachable/extended_barrel, null, VENDOR_ITEM_REGULAR), - list("Laser Sight", 15, /obj/item/attachable/lasersight, null, VENDOR_ITEM_REGULAR), - list("Rail Flashlight", 5, /obj/item/attachable/flashlight, null, VENDOR_ITEM_REGULAR), - list("Red-Dot Sight", 15, /obj/item/attachable/reddot, null, VENDOR_ITEM_REGULAR), - list("Reflex Sight", 15, /obj/item/attachable/reflex, null, VENDOR_ITEM_REGULAR), - list("Suppressor", 15, /obj/item/attachable/suppressor, null, VENDOR_ITEM_REGULAR), - list("Vertical Grip", 15, /obj/item/attachable/verticalgrip, null, VENDOR_ITEM_REGULAR), - - list("UTILITIES", 0, null, null, null), - list("Type 80 Bayonet", 3, /obj/item/attachable/bayonet/upp, null, VENDOR_ITEM_REGULAR), - list("Lunge Mine", 120, /obj/item/weapon/twohanded/lungemine, null, VENDOR_ITEM_REGULAR), - list("Melee Weapon (Random)", 7, /obj/effect/essentials_set/random/clf_melee, null, VENDOR_ITEM_REGULAR), - list("M94 Marking Flare Pack", 3, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), - list("Smoke Grenade", 7, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) - ) - -/datum/faction/clf/get_antag_guns_sorted_equipment() - return list( - list("PRIMARY FIREARMS", -1, null, null), - list("ABR-40 Hunting Rifle", 30, /obj/item/weapon/gun/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), - list("Basira-Armstrong Bolt-Action", 15, /obj/item/weapon/gun/boltaction, null, VENDOR_ITEM_REGULAR), - list("Double Barrel Shotgun", 20, /obj/item/weapon/gun/shotgun/double, VENDOR_ITEM_REGULAR), - list("HG 37-12 Pump Shotgun", 20, /obj/item/weapon/gun/shotgun/double/sawn, VENDOR_ITEM_REGULAR), - list("M16 Rifle", 20, /obj/item/weapon/gun/rifle/m16, VENDOR_ITEM_REGULAR), - list("MAC-15 Submachinegun", 20, /obj/item/weapon/gun/smg/mac15, VENDOR_ITEM_REGULAR), - list("MAR-30 Battle Carbine", 20, /obj/item/weapon/gun/rifle/mar40/carbine, VENDOR_ITEM_REGULAR), - list("MAR-40 Battle Rifle", 20, /obj/item/weapon/gun/rifle/mar40, VENDOR_ITEM_REGULAR), - list("Type 64 Submachinegun", 20, /obj/item/weapon/gun/smg/bizon, VENDOR_ITEM_REGULAR), - list("MP27 Submachinegun", 20, /obj/item/weapon/gun/smg/mp27, VENDOR_ITEM_REGULAR), - list("MP5 Submachinegun", 20, /obj/item/weapon/gun/smg/mp5, VENDOR_ITEM_REGULAR), - list("Sawn-Off Shotgun", 20, /obj/item/weapon/gun/shotgun/pump/dual_tube/cmb, VENDOR_ITEM_REGULAR), - - list("PRIMARY AMMUNITION", -1, null, null), - list("ABR-40 Magazine (10x24mm)", 20, /obj/item/ammo_magazine/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), - list("Basira-Armstrong Magazine (6.5mm)", 5, /obj/item/ammo_magazine/rifle/boltaction, null, VENDOR_ITEM_REGULAR), - list("Box Of Buckshot Shells", 15, /obj/item/ammo_magazine/shotgun/buckshot, VENDOR_ITEM_REGULAR), - list("Box Of Flechette Shells", 15, /obj/item/ammo_magazine/shotgun/flechette, VENDOR_ITEM_REGULAR), - list("Box Of Shotgun Slugs", 15, /obj/item/ammo_magazine/shotgun, VENDOR_ITEM_REGULAR), - list("M16 AP Magazine (5.56x45mm)", 10, /obj/item/ammo_magazine/rifle/m16/ap, VENDOR_ITEM_REGULAR), - list("M16 Magazine (5.56x45mm)", 60, /obj/item/ammo_magazine/rifle/m16, VENDOR_ITEM_REGULAR), - list("MAC-15 Magazine (9mm)", 60, /obj/item/ammo_magazine/smg/mac15, VENDOR_ITEM_REGULAR), - list("MAR Magazine (7.62x39mm)", 60, /obj/item/ammo_magazine/rifle/mar40, VENDOR_ITEM_REGULAR), - list("MAR Extended Magazine (7.62x39mm)", 10, /obj/item/ammo_magazine/rifle/mar40/extended, VENDOR_ITEM_REGULAR), - list("Type 64 Helical Magazine (7.62x19mm)", 60, /obj/item/ammo_magazine/smg/bizon, VENDOR_ITEM_REGULAR), - list("MP27 Magazine (4.6x30mm)", 60, /obj/item/ammo_magazine/smg/mp27, VENDOR_ITEM_REGULAR), - list("MP5 Magazine (9mm)", 60, /obj/item/ammo_magazine/smg/mp5, VENDOR_ITEM_REGULAR), - - list("SIDEARMS", -1, null, null), - list("88 Mod 4 Combat Pistol", 20, /obj/item/weapon/gun/pistol/mod88, VENDOR_ITEM_REGULAR), - list("Beretta 92FS Pistol", 20, /obj/item/weapon/gun/pistol/b92fs, VENDOR_ITEM_REGULAR), - list("CMB Spearhead Autorevolver", 20, /obj/item/weapon/gun/revolver/cmb, VENDOR_ITEM_REGULAR), - list("Holdout Pistol", 20, /obj/item/weapon/gun/pistol/holdout, VENDOR_ITEM_REGULAR), - list("KT-42 Automag", 20, /obj/item/weapon/gun/pistol/kt42, VENDOR_ITEM_REGULAR), - list("S&W .357 Revolver", 20, /obj/item/weapon/gun/revolver/small, VENDOR_ITEM_REGULAR), - - list("SIDEARM AMMUNITION", -1, null, null), - list("88M4 AP Magazine (9mm)", 40, /obj/item/ammo_magazine/pistol/mod88, VENDOR_ITEM_REGULAR), - list("Beretta 92FS Magazine (9mm)", 40, /obj/item/ammo_magazine/pistol/b92fs, VENDOR_ITEM_REGULAR), - list("KT-42 Magazine (.44)", 40, /obj/item/ammo_magazine/pistol/kt42, VENDOR_ITEM_REGULAR), - list("Spearhead Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/cmb/normalpoint, VENDOR_ITEM_REGULAR), - list("Hollowpoint Spearhead Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/cmb, VENDOR_ITEM_REGULAR), - list("S&W Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/small, VENDOR_ITEM_REGULAR), - list("Tiny Pistol Magazine (.22)", 40, /obj/item/ammo_magazine/pistol/holdout, VENDOR_ITEM_REGULAR), - - list("MELEE WEAPONS", -1, null, null), - list("Baseball Bat", 10, /obj/item/weapon/baseballbat, VENDOR_ITEM_REGULAR), - list("Baseball Bat (Metal)", 5, /obj/item/weapon/baseballbat/metal, VENDOR_ITEM_REGULAR), - list("Fireaxe", 5, /obj/item/weapon/twohanded/fireaxe, VENDOR_ITEM_REGULAR), - list("Hatchet", 15, /obj/item/tool/hatchet, VENDOR_ITEM_REGULAR), - list("Spear", 10, /obj/item/weapon/twohanded/spear, VENDOR_ITEM_REGULAR), - - list("UTILITIES", -1, null, null), - list("M94 Marking Flare Pack", 20, /obj/item/storage/box/m94, VENDOR_ITEM_REGULAR), - list("Smoke Grenade", 5, /obj/item/explosive/grenade/smokebomb, VENDOR_ITEM_REGULAR), - list("Type 80 Bayonet", 40, /obj/item/attachable/bayonet/upp, VENDOR_ITEM_REGULAR), - ) diff --git a/code/datums/factions/cmb.dm b/code/datums/factions/cmb.dm deleted file mode 100644 index 6201d3467e0d..000000000000 --- a/code/datums/factions/cmb.dm +++ /dev/null @@ -1,3 +0,0 @@ -/datum/faction/cmb - name = "Colonial Marshal Bureau" - faction_tag = FACTION_MARINE diff --git a/code/datums/factions/colonists.dm b/code/datums/factions/colonists.dm new file mode 100644 index 000000000000..9ba0557c1023 --- /dev/null +++ b/code/datums/factions/colonists.dm @@ -0,0 +1,28 @@ +/datum/faction/colonist + name = NAME_FACTION_COLONIST + desc = "Colonists, the most ordinary citizens of the colonies, ADDITIONAL INFORMATION IS CHANGED" + + faction_name = FACTION_COLONIST + + role_mappings = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) + roles_list = list( + MODE_NAME_EXTENDED = ROLES_REGULAR_SURV, + MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_SURV, + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list( + JOB_SURVIVOR + ), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list( + JOB_SURVIVOR + ) + ) diff --git a/code/datums/factions/contractor.dm b/code/datums/factions/contractor.dm index 5e0f125b06b0..a564ae5841ba 100644 --- a/code/datums/factions/contractor.dm +++ b/code/datums/factions/contractor.dm @@ -1,3 +1,6 @@ /datum/faction/contractor - name = "Vanguard's Arrow Incorporated" - faction_tag = FACTION_CONTRACTOR + name = NAME_FACTION_CONTRACTOR + desc = "There is no information" + + faction_name = FACTION_CONTRACTOR + faction_iff_tag_type = /obj/item/faction_tag diff --git a/code/datums/factions/dutch's_dozen.dm b/code/datums/factions/dutch's_dozen.dm new file mode 100644 index 000000000000..455224371e13 --- /dev/null +++ b/code/datums/factions/dutch's_dozen.dm @@ -0,0 +1,6 @@ +/datum/faction/dutchs_dozen + name = NAME_FACTION_DUTCH + desc = "Like the Colonial Liberation Front and the better-equipped Freelancer Mercenaries before them, the Dozens start with non-standard UA weaponry, employing equipment of the United Americas such as the M16A2 assault rifle and the minigun. While the weapons on their own are outdated and cannot take most attachments, their automatic weaponry is equally deadly, meant for hunting their targets. \ + The Dozens will also expect a guerrilla style of gameplay, as unlike most modern forces of this era, the Dozens use special techniques related to survival and can handle themselves on the ground without support. Whether it would take place in a jungle landscape or in urban grounds. One advantage of the Dutch's Mercenary Team is their speed and aggressiveness, which are primarily used to eliminate their target(s), due to the target's equal amount of speed, aggressiveness and robustness." + + faction_name = FACTION_DUTCH diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index a6201da70467..7b21c0c86750 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -1,13 +1,343 @@ /datum/faction - var/name = "Neutral Faction" - var/faction_tag = FACTION_NEUTRAL + var/name = NAME_FACTION_NEUTRAL + var/desc = "Neutral Faction" + + var/faction_name = FACTION_NEUTRAL + var/faction_tag = SIDE_FACTION_NEUTRAL + + var/organ_faction_iff_tag_type + var/faction_iff_tag_type + var/ally_factions_initialize = TRUE + + var/relations_pregen[] = RELATIONS_NEUTRAL + var/hud_type = FACTION_HUD + var/orders = "Survive" + var/color = "#22888a" + var/ui_color = "#22888a" + var/prefix = "" + var/list/totalMobs = list() + var/list/totalDeadMobs = list() + var/list/faction_leaders = list() + var/list/late_join_landmarks = list() + var/mob/living/carbon/faction_leader + + var/need_round_end_check = FALSE + +//////////////// +//BALANCE DEFS// +//////////////// + var/list/role_mappings = list() + var/list/roles_list = list() + + var/spawning_enabled = TRUE + var/latejoin_enabled = TRUE + +/////////// +//MODULES// +/////////// + var/list/modules_to_add = list(MODULE_CODE_NAME_RELATIONS = list()) // list(MODULE_NAME = list(MODULE_VARS = VALUE, ...), ...) + var/list/datum/faction_module/modules = list() + +////////////// +/datum/faction/New() + for(var/module in modules_to_add) + if(!GLOB.faction_modules[module]) + return + modules[module] = new GLOB.faction_modules[module](src, ...modules_to_add[module]) + +/datum/faction/can_vv_modify() + return FALSE /datum/faction/proc/modify_hud_holder(image/holder, mob/living/carbon/human/H) return +/datum/faction/proc/add_mob(mob/living/carbon/carbon) + if(!carbon || !istype(carbon)) + return + + if(carbon.faction && carbon.faction != src) + carbon.faction.remove_mob(carbon, TRUE) + + if(carbon in totalMobs) + return + + carbon.faction = src + + if(carbon.hud_list) + carbon.hud_update() + + if(!carbon.statistic_exempt) + totalMobs += carbon + +/datum/faction/proc/remove_mob(mob/living/carbon/carbon, hard = FALSE) + if(!carbon || !istype(carbon)) + return + + if(!(carbon in totalMobs)) + return + + if(hard) + carbon.faction = null + else + totalDeadMobs += carbon + + totalMobs -= carbon + +/datum/faction/proc/can_delay_round_end(mob/living/carbon/carbon) + return TRUE + +//Ally procs +/atom/movable/proc/ally(datum/faction/ally_faction) + if(!ally_faction) + return FALSE + + var/list/factions = list() + factions += ally_faction + var/datum/faction_module/relations/module = ally_faction.modules[MODULE_CODE_NAME_RELATIONS] + for(var/datum/faction/allies in module.allies) + factions += allies + if(isnull(factions) || !faction) + return FALSE + + return faction in factions + +/mob/ally(datum/faction/ally_faction) + if(!ally_faction) + return FALSE + + var/list/factions = list() + factions += ally_faction + var/datum/faction_module/relations/module = ally_faction.modules[MODULE_CODE_NAME_RELATIONS] + for(var/datum/faction/allies in module.allies) + factions += allies + + if(isnull(factions) || !faction) + return FALSE + + return faction in factions + +/mob/living/carbon/ally(datum/faction/ally_faction) + if(!ally_faction) + return FALSE + + if((organ_faction_tag || (faction.faction_tag in SIDE_ORGANICAL_DOM)) && (ally_faction.faction_tag in SIDE_ORGANICAL_DOM)) + if(organ_faction_tag) + return ally_faction.organ_faction_tag_is_ally(organ_faction_tag) + else if(faction == ally_faction) + return TRUE + else if(faction_tag) + return ally_faction.faction_tag_is_ally(faction_tag) + + return FALSE + +/datum/faction/proc/organ_faction_tag_is_ally(obj/item/faction_tag/organ/organ_tag) + if(organ_tag.faction == src) + return TRUE + var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] + for(var/datum/faction/faction in organ_tag.factions + organ_tag.faction) + if(module.allies[faction.faction_name]) + return TRUE + + return FALSE + +/datum/faction/proc/faction_tag_is_ally(obj/item/faction_tag/object_tag) + if(object_tag.faction == src) + return TRUE + var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] + for(var/datum/faction/faction in object_tag.factions + object_tag.faction) + if(module.allies[faction.faction_name]) + return TRUE + else if(faction.faction_tag == faction_tag) + return TRUE + + return FALSE + +/datum/faction/proc/faction_is_ally(datum/faction/faction_to_check) + if(faction_to_check.faction_tag == faction_tag) + return TRUE + + var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] + if(module.allies[faction_to_check.faction_name]) + return TRUE + + return FALSE + /datum/faction/proc/get_antag_guns_snowflake_equipment() return list() /datum/faction/proc/get_antag_guns_sorted_equipment() return list() + +/datum/faction/proc/store_objective(datum/cm_objective/O) + if(objective_memory) + objective_memory.store_objective(O) + +//FACTION INFO PANEL +/datum/faction/ui_state(mob/user) + return GLOB.not_incapacitated_state + +/datum/faction/ui_status(mob/user, datum/ui_state/state) + . = ..() + if(isobserver(user)) + return UI_INTERACTIVE + +/datum/faction/ui_data(mob/user) + . = list() + .["faction_orders"] = orders + +/datum/faction/ui_static_data(mob/user) + . = list() + .["faction_color"] = ui_color + .["faction_name"] = name + .["faction_desc"] = desc + .["actions"] = get_faction_actions() + +/datum/faction/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "FactionStatus", "[name] Статус") + ui.set_autoupdate(FALSE) + ui.open() + +/datum/faction/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + switch(action) + if("relations") + relations_datum.tgui_interact(usr) + if("tasks") + task_interface.tgui_interact(usr) + if("clues") + if(!skillcheck(usr, SKILL_INTEL, SKILL_INTEL_TRAINED)) + to_chat(usr, SPAN_WARNING("You have no access to the [name] intel network.")) + return + objective_interface.tgui_interact(usr) + if("researchs") + if(!skillcheck(usr, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED)) + to_chat(usr, SPAN_WARNING("You have no access to the [name] research network.")) + return + research_objective_interface.tgui_interact(usr) + if("status") + get_faction_info(usr) + +/datum/faction/proc/get_faction_actions(mob/user) + . = list() + . += list(list("name" = "Faction Relations", "action" = "relations")) + . += list(list("name" = "Faction Tasks", "action" = "tasks")) + . += list(list("name" = "Faction Clues", "action" = "clues")) + . += list(list("name" = "Faction Researchs", "action" = "researchs")) + . += list(list("name" = "Faction Status", "action" = "status")) + return . + +/datum/faction/proc/get_faction_info(mob/user) + var/dat = GLOB.data_core.get_manifest(FALSE, src) + if(!dat) + return FALSE + show_browser(user, dat, "Список Экипажа [name]", "manifest", "size=450x750") + return TRUE + +/datum/faction/proc/get_join_status(mob/new_player/user, dat) + +/* Right now don't wanna mess around for one factions solution, if making this, this need to be working for ALL factions as well as for MARINES + if(roles_show & FLAG_SHOW_CIC && GLOB.ROLES_CIC.Find(J.title)) + dat += "Command:
" + roles_show ^= FLAG_SHOW_CIC + + else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && GLOB.ROLES_AUXIL_SUPPORT.Find(J.title)) + dat += "
Auxiliary Combat Support:
" + roles_show ^= FLAG_SHOW_AUXIL_SUPPORT + + else if(roles_show & FLAG_SHOW_MISC && GLOB.ROLES_MISC.Find(J.title)) + dat += "
Other:
" + roles_show ^= FLAG_SHOW_MISC + + else if(roles_show & FLAG_SHOW_POLICE && GLOB.ROLES_POLICE.Find(J.title)) + dat += "
Military Police:
" + roles_show ^= FLAG_SHOW_POLICE + + else if(roles_show & FLAG_SHOW_ENGINEERING && GLOB.ROLES_ENGINEERING.Find(J.title)) + dat += "
Engineering:
" + roles_show ^= FLAG_SHOW_ENGINEERING + + else if(roles_show & FLAG_SHOW_REQUISITION && GLOB.ROLES_REQUISITION.Find(J.title)) + dat += "
Requisitions:
" + roles_show ^= FLAG_SHOW_REQUISITION + + else if(roles_show & FLAG_SHOW_MEDICAL && GLOB.ROLES_MEDICAL.Find(J.title)) + dat += "
Medbay:
" + roles_show ^= FLAG_SHOW_MEDICAL + + else if(roles_show & FLAG_SHOW_MARINES && GLOB.ROLES_MARINES.Find(J.title)) + dat += "
Marines:
" + roles_show ^= FLAG_SHOW_MARINES + + dat += "[J.disp_title] ([J.current_positions]) (Active: [active])
" +*/ + + dat = "
" + dat += "[user.client.auto_lang(LANGUAGE_LOBBY_ROUND_TIME)]: [DisplayTimeText(world.time, language = user.client.language)]
" + dat += "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CHOSE)]:
" + dat += additional_join_status(user) + + if(!latejoin_enabled) + dat = "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CLOSED)]:
" + + else if(!SSautobalancer.can_join(src)) + dat = "[user.client.auto_lang(LANGUAGE_JS_BALANCE_ISSUE)]:
" + + else + var/list/roles = roles_list[SSticker.mode.name] + for(var/role in roles) + var/datum/job/job = SSticker.role_authority.roles_by_name[role] + var/check_result = SSticker.role_authority.check_role_entry(user, job, src, TRUE) + var/active = 0 + for(var/mob/mob in GLOB.player_list) + if(mob.client && mob.job == job.title) + active++ + + if(check_result) + dat += "[job.disp_title] ([job.current_positions]): [check_result] ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" + else + dat += "[job.disp_title] ([job.current_positions]) ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" + + dat += "
" + show_browser(user, dat, "Late Join", "latechoices", "size=420x700") + +/datum/faction/proc/additional_join_status(mob/new_player/user, dat = "") + return +/* + if(roles_show & FLAG_SHOW_CIC && ROLES_CIC & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_COM)]:
" + roles_show ^= FLAG_SHOW_CIC + + else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && ROLES_AUXIL_SUPPORT & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_SUP)]:
" + roles_show ^= FLAG_SHOW_AUXIL_SUPPORT + + else if(roles_show & FLAG_SHOW_MISC && ROLES_MISC & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_OTH)]:
" + roles_show ^= FLAG_SHOW_MISC + + else if(roles_show & FLAG_SHOW_POLICE && ROLES_POLICE & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_POL)]:
" + roles_show ^= FLAG_SHOW_POLICE + + else if(roles_show & FLAG_SHOW_ENGINEERING && ROLES_ENGINEERING & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ENG)]:
" + roles_show ^= FLAG_SHOW_ENGINEERING + + else if(roles_show & FLAG_SHOW_REQUISITION && ROLES_REQUISITION & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CAG)]:
" + roles_show ^= FLAG_SHOW_REQUISITION + + else if(roles_show & FLAG_SHOW_MEDICAL && ROLES_MEDICAL & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MED)]:
" + roles_show ^= FLAG_SHOW_MEDICAL + + else if(roles_show & FLAG_SHOW_MARINES && ROLES_MARINES & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MAR)]:
" + roles_show ^= FLAG_SHOW_MARINES +*/ diff --git a/code/datums/factions/freelancer.dm b/code/datums/factions/freelancer.dm new file mode 100644 index 000000000000..7d675f78e3a0 --- /dev/null +++ b/code/datums/factions/freelancer.dm @@ -0,0 +1,7 @@ +/datum/faction/freelancers + name = NAME_FACTION_FREELANCER + desc = "The term Freelancers come in various forms. Whether one is an independent entrepreneur selling services or a Freelance worker offering their labour for cash. In the business of killing and protecting, the term Freelancers are usually associated with a group of mercenaries that bare such a moniker. \ + These Freelance Mercenaries have become a small but noticeable security firm that has grown somewhat popular in the outer rim of the galaxy. Yet many sovereign nations view them as a nuisance because of the many questionable activities they've conducted. \ + None the less they're the least hated group in the galaxy as they've usually kept out of any major incidents that would reflect poorly on the Freelancers. Their alignment in the grand scheme of things usually favour those who pay them, with or without ethics." + + faction_name = FACTION_FREELANCER diff --git a/code/datums/factions/gladiator.dm b/code/datums/factions/gladiator.dm new file mode 100644 index 000000000000..ad2c023bf7b1 --- /dev/null +++ b/code/datums/factions/gladiator.dm @@ -0,0 +1,5 @@ +/datum/faction/gladiator + name = NAME_FACTION_GLADIATOR + desc = "Warning, something corrupted, this is row is not exist. Our story teller is SLEEPING, try again in some weeks." + + faction_name = FACTION_GLADIATOR diff --git a/code/datums/factions/hefa_order.dm b/code/datums/factions/hefa_order.dm new file mode 100644 index 000000000000..f6a5dbbc3fbd --- /dev/null +++ b/code/datums/factions/hefa_order.dm @@ -0,0 +1,8 @@ +/datum/faction/hefa + name = NAME_FACTION_HEFA + desc = "The Holy Order of the High-Explosive Fragmenting-Antipersonnel hand grenade (also known as the HEFA Knights, the Knights of HEFA, and or the HEFA Order), is a religious cult that is actively opposed to the United Americas and the Union of Progressive Peoples. \ + The Order's operations are loosely coordinated between two cell types, a 'temple' group, acting as a dispatch and administration center, and a 'shard' or more traditionally described splinter that actually carries out the strike. \ + It is believed that all HEFA Knight 'temple' cells operate out of the derelict Kerchner 2155 Horn Nebula mining expedition way-stations due to their proximity to supply lanes leading to the Neroid sector and other frontier sectors. The group is classified as an intergalactic terrorist organization by both the UPP, and UA. \ + HEFA Knight members or Shrapnelsworn, are devoted to the worship of the M40 High-Explosive Fragmenting-Antipersonnel hand grenade, viewing the object as a divine gift from an unknown benefactor that has influenced humanity. Order members are trained to have no regard for their personal safety. To die in battle is to die gloriously, and to solidify one's devotion to the HEFA hand grenade." + + faction_name = FACTION_HEFA diff --git a/code/datums/factions/helpers.dm b/code/datums/factions/helpers.dm deleted file mode 100644 index 38cd6dd85d58..000000000000 --- a/code/datums/factions/helpers.dm +++ /dev/null @@ -1,14 +0,0 @@ -GLOBAL_LIST_INIT_TYPED(faction_datums, /datum/faction, setup_faction_list()) - -/proc/setup_faction_list() - var/list/faction_datums_list = list() - for(var/T in typesof(/datum/faction)) - var/datum/faction/F = new T - faction_datums_list[F.faction_tag] = F - return faction_datums_list - -/proc/get_faction(faction = FACTION_MARINE) - var/datum/faction/F = GLOB.faction_datums[faction] - if(F) - return F - return GLOB.faction_datums[FACTION_NEUTRAL] diff --git a/code/datums/factions/mercenary.dm b/code/datums/factions/mercenary.dm new file mode 100644 index 000000000000..d2fb5c8e1ea0 --- /dev/null +++ b/code/datums/factions/mercenary.dm @@ -0,0 +1,5 @@ +/datum/faction/mercenary + name = NAME_FACTION_MERCENARY + desc = "Warning, potential dead story teller." + + faction_name = FACTION_MERCENARY diff --git a/code/datums/factions/pirate.dm b/code/datums/factions/pirate.dm new file mode 100644 index 000000000000..97db12664ab1 --- /dev/null +++ b/code/datums/factions/pirate.dm @@ -0,0 +1,5 @@ +/datum/faction/pirate + name = NAME_FACTION_PIRATE + desc = "Pirates, all information encrupted." + + faction_name = FACTION_PIRATE diff --git a/code/datums/factions/pizza_delivery.dm b/code/datums/factions/pizza_delivery.dm new file mode 100644 index 000000000000..24ccd82aa3c9 --- /dev/null +++ b/code/datums/factions/pizza_delivery.dm @@ -0,0 +1,7 @@ +/datum/faction/pizza + name = NAME_FACTION_PIZZA + desc = "Pizza Galaxy is the galaxy's largest pizza chain, known for its incredible variety in pizzas, and pizza related products. Customers can get anything from a plain cheese pizza, to a pizza stuffed Mr. Pizza Man mascot, with ranch cups for eyes. \ + Most Pizza Galaxy stations also have a play room for kids, called \"Pizza Party\". Pizza Galaxy is a big employer, from 16 year olds trying to pay off space college, to 40 year olds who just got discharged from the USCM for thinking that the MP was a \"red communist\". \ + The current owner and CEO of Pizza Galaxy is Mr. James Kepplinger, a prestigious businessman with a knack for bargaining." + + faction_name = FACTION_PIZZA diff --git a/code/datums/factions/pmc.dm b/code/datums/factions/pmc.dm deleted file mode 100644 index c5b319a13c7b..000000000000 --- a/code/datums/factions/pmc.dm +++ /dev/null @@ -1,95 +0,0 @@ -/datum/faction/pmc - name = "Private Military Company" - faction_tag = FACTION_PMC - -/datum/faction/pmc/modify_hud_holder(image/holder, mob/living/carbon/human/H) - var/hud_icon_state - var/obj/item/card/id/ID = H.get_idcard() - var/_role - if(H.mind) - _role = H.job - else if(ID) - _role = ID.rank - switch(_role) - if(JOB_PMC_DIRECTOR) - hud_icon_state = "sd" - if(JOB_PMC_LEADER, JOB_PMC_LEAD_INVEST) - hud_icon_state = "ld" - if(JOB_PMC_DOCTOR) - hud_icon_state = "td" - if(JOB_PMC_ENGINEER) - hud_icon_state = "ct" - if(JOB_PMC_MEDIC, JOB_PMC_INVESTIGATOR) - hud_icon_state = "md" - if(JOB_PMC_SYNTH) - hud_icon_state = "syn" - if(hud_icon_state) - holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "pmc_[hud_icon_state]") - -/datum/faction/pmc/get_antag_guns_snowflake_equipment() - return list( - list("PRIMARY FIREARMS", 0, null, null, null), - list("M41A/2 Pulse Rifle", 30, /obj/item/weapon/gun/rifle/m41a/elite, null, VENDOR_ITEM_REGULAR), - list("M39B/2 submachinegun", 30, /obj/item/weapon/gun/smg/m39/elite, null, VENDOR_ITEM_REGULAR), - list("NSG23 assault rifle", 20, /obj/item/weapon/gun/rifle/nsg23, null, VENDOR_ITEM_REGULAR), - - list("PRIMARY AMMUNITION", 0, null, null, null), - list("M41A AP magazine (10x24mm)", 10, /obj/item/ammo_magazine/rifle/ap, null, VENDOR_ITEM_REGULAR), - list("M41A extended magazine (10x24mm)", 5, /obj/item/ammo_magazine/rifle/extended, null, VENDOR_ITEM_REGULAR), - list("M39 AP magazine (10x20mm)", 10, /obj/item/ammo_magazine/smg/m39/ap, null, VENDOR_ITEM_REGULAR), - list("M39 HV extended magazine (10x20mm)", 5, /obj/item/ammo_magazine/smg/m39/extended, null, VENDOR_ITEM_REGULAR), - list("NSG 23 armor-piercing magazine (10x24mm)", 10, /obj/item/ammo_magazine/rifle/nsg23/ap, null, VENDOR_ITEM_REGULAR), - list("NSG 23 extended magazine (10x24mm)", 5, /obj/item/ammo_magazine/rifle/nsg23/extended, null, VENDOR_ITEM_REGULAR), - - list("SIDEARMS", 0, null, null, null), - list("VP78 pistol", 20, /obj/item/weapon/gun/pistol/vp78, null, VENDOR_ITEM_REGULAR), - list("88 Mod 4 Combat Pistol", 15, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), - - list("SIDEARM AMMUNITION", 0, null, null, null), - list("VP78 magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/vp78, null, VENDOR_ITEM_REGULAR), - list("88M4 AP Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), - - list("ATTACHMENTS", 0, null, null, null), - list("Angled Grip", 15, /obj/item/attachable/angledgrip, null, VENDOR_ITEM_REGULAR), - list("Burst Fire Assembly", 15, /obj/item/attachable/burstfire_assembly, null, VENDOR_ITEM_REGULAR), - list("Extended Barrel", 15, /obj/item/attachable/extended_barrel, null, VENDOR_ITEM_REGULAR), - list("Advanced Underbarrel Flamethrower", 15, /obj/item/attachable/attached_gun/flamer/advanced, null, VENDOR_ITEM_REGULAR), - list("Laser Sight", 15, /obj/item/attachable/lasersight, null, VENDOR_ITEM_REGULAR), - list("Rail Flashlight", 5, /obj/item/attachable/flashlight, null, VENDOR_ITEM_REGULAR), - list("Red-Dot Sight", 15, /obj/item/attachable/reddot, null, VENDOR_ITEM_REGULAR), - list("Reflex Sight", 15, /obj/item/attachable/reflex, null, VENDOR_ITEM_REGULAR), - list("Suppressor", 15, /obj/item/attachable/suppressor, null, VENDOR_ITEM_REGULAR), - list("Vertical Grip", 15, /obj/item/attachable/verticalgrip, null, VENDOR_ITEM_REGULAR), - - list("UTILITIES", 0, null, null, null), - list("M94 Marking Flare Pack", 3, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), - list("Smoke Grenade", 7, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) - ) - -/datum/faction/pmc/get_antag_guns_sorted_equipment() - return list( - list("PRIMARY FIREARMS", 0, null, null, null), - list("M41A/2 Pulse Rifle", 30, /obj/item/weapon/gun/rifle/m41a/elite, null, VENDOR_ITEM_REGULAR), - list("M39B/2 submachinegun", 30, /obj/item/weapon/gun/smg/m39/elite, null, VENDOR_ITEM_REGULAR), - list("NSG23 assault rifle", 30, /obj/item/weapon/gun/rifle/nsg23, null, VENDOR_ITEM_REGULAR), - - list("PRIMARY AMMUNITION", 0, null, null, null), - list("M41A AP magazine (10x24mm)", 30, /obj/item/ammo_magazine/rifle/ap, null, VENDOR_ITEM_REGULAR), - list("M41A extended magazine (10x24mm)", 50, /obj/item/ammo_magazine/rifle/extended, null, VENDOR_ITEM_REGULAR), - list("M39 AP magazine (10x20mm)", 30, /obj/item/ammo_magazine/smg/m39/ap, null, VENDOR_ITEM_REGULAR), - list("M39 HV extended magazine (10x20mm)", 50, /obj/item/ammo_magazine/smg/m39/extended, null, VENDOR_ITEM_REGULAR), - list("NSG 23 armor-piercing magazine (10x24mm)", 30, /obj/item/ammo_magazine/rifle/nsg23/ap, null, VENDOR_ITEM_REGULAR), - list("NSG 23 extended magazine (10x24mm)", 50, /obj/item/ammo_magazine/rifle/nsg23/extended, null, VENDOR_ITEM_REGULAR), - - list("SIDEARMS", 0, null, null, null), - list("VP78 pistol", 20, /obj/item/weapon/gun/pistol/vp78, null, VENDOR_ITEM_REGULAR), - list("88 Mod 4 Combat Pistol", 30, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), - - list("SIDEARM AMMUNITION", 0, null, null, null), - list("VP78 magazine (9mm)", 50, /obj/item/ammo_magazine/pistol/vp78, null, VENDOR_ITEM_REGULAR), - list("88M4 AP Magazine (9mm)", 50, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), - - list("UTILITIES", 0, null, null, null), - list("M94 Marking Flare Pack", 30, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), - list("Smoke Grenade", 30, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) - ) diff --git a/code/datums/factions/ress.dm b/code/datums/factions/ress.dm new file mode 100644 index 000000000000..70d6e9a05d9d --- /dev/null +++ b/code/datums/factions/ress.dm @@ -0,0 +1,5 @@ +/datum/faction/ress + name = NAME_FACTION_RESS + desc = "No information given, please update your local data." + + faction_name = FACTION_RESS diff --git a/code/datums/factions/souto.dm b/code/datums/factions/souto.dm new file mode 100644 index 000000000000..3e007da6ee0e --- /dev/null +++ b/code/datums/factions/souto.dm @@ -0,0 +1,5 @@ +/datum/faction/souto + name = NAME_FACTION_SOUTO + desc = "Souto delivery, information encrypted due to error." + + faction_name = FACTION_SOUTO diff --git a/code/datums/factions/threewe.dm b/code/datums/factions/threewe.dm new file mode 100644 index 000000000000..119a47c2bf71 --- /dev/null +++ b/code/datums/factions/threewe.dm @@ -0,0 +1,9 @@ +/datum/faction/threewe + name = NAME_FACTION_THREEWE + desc = "Formed in 2088, the Three World Empire (3WE) was a federation of nations created by the joining of the United Kingdom and Japan, as well as allied nations including India, Indonesia, and Australia. Following the formation of this federation, the Japanese Yutani Corporation purchased and merged with the British Weyland Corporation leading to the 3WE’s status as the most significant economic force in Sol. The name, Three World Empire, is drawn from the first three worlds colonized by humanity: Earth, Mars, and Titan. \ + Supported by the technological advances of the Weyland-Yutani Corporation, the Three World Empire quickly amassed the largest and most advanced naval fleet that humanity had ever seen. These advances in Starflight allowed members of the 3WE to be the first humans to leave the cradle of Sol in search of new homes among the stars. As a result, the 3WE has colonized a plurality of all known resource-rich and naturally habitable worlds. \ + These early colonies would come to be known as the Core Systems. Due to their heavy reliance on the navy, the Three World Empire can ill afford to field a large standing army like the United Americas (UA) or the Union of Progressive Peoples (UPP). The safety of its territories outside of Sol is primarily contracted to Weyland-Yutani Private Military Contractors (PMCs) as well as the UA’s United States Colonial Marine Corps (USCMC). \ + While the USCMC is exclusively tasked with patrol and rapid response, Wey-Yu PMCs fill a wide array of roles. While the contractors are primarily hired to patrol and garrison 3WE territory, it is not uncommon to see them filling the role of peacekeepers not dissimilar to beat cops on worlds without a strong Colonial Marshal presence. For its economic influence and role in the Three World Empire’s stability and prosperity, Weyland-Yutani was granted a permanent seat in the Empire’s Parliament. \ + So far, Weyland-Yutani is the only non-governmental entity to be bestowed this honour. While all governmental parties claim that Weyland-Yutani has remained unbiased in its governance, none can deny that since being invited into Parliament, the Corporation’s economic power has increased ten-fold. In contrast, the majority of its competition have floundered under strict economic regulation and bureaucratic red tape." + + faction_name = FACTION_THREEWE diff --git a/code/datums/factions/royalmarinescommando.dm b/code/datums/factions/twe/commando.dm similarity index 90% rename from code/datums/factions/royalmarinescommando.dm rename to code/datums/factions/twe/commando.dm index 2fab0348bcfa..c2da3242e072 100644 --- a/code/datums/factions/royalmarinescommando.dm +++ b/code/datums/factions/twe/commando.dm @@ -1,15 +1,17 @@ -/datum/faction/royal_marines_commando - name = "Royal Marines Commando" +/datum/faction/twe/royal_commando + name = NAME_FACTION_TWE + desc = "No information given, please update your local data." + faction_tag = FACTION_TWE -/datum/faction/royal_marines_commando/modify_hud_holder(image/holder, mob/living/carbon/human/H) +/datum/faction/twe/royal_commando/modify_hud_holder(image/holder, mob/living/carbon/human/human) var/hud_icon_state - var/obj/item/card/id/dogtag/ID = H.get_idcard() + var/obj/item/card/id/id_card = human.get_idcard() var/_role - if(H.mind) - _role = H.job - else if(ID) - _role = ID.rank + if(human.mind) + _role = human.job + else if(id_card) + _role = id_card.rank switch(_role) if(JOB_TWE_RMC_LIEUTENANT) hud_icon_state = "lieutenant" @@ -26,7 +28,7 @@ if(hud_icon_state) holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "rmc_[hud_icon_state]") -/datum/faction/royal_marines_commando/get_antag_guns_snowflake_equipment() +/datum/faction/twe/royal_commando/get_antag_guns_snowflake_equipment() return list( list("PRIMARY FIREARMS", 0, null, null, null), list("F903A1 Rifle", 20, /obj/item/weapon/gun/rifle/rmc_f90, null, VENDOR_ITEM_REGULAR), @@ -65,7 +67,7 @@ list("L5 bayonet", 3, /obj/item/attachable/bayonet/rmc, null, VENDOR_ITEM_REGULAR), ) -/datum/faction/royal_marines_commando/get_antag_guns_sorted_equipment() +/datum/faction/twe/royal_commando/get_antag_guns_sorted_equipment() return list( list("PRIMARY FIREARMS", -1, null, null), list("F903A1 Rifle", 20, /obj/item/weapon/gun/rifle/rmc_f90, null, VENDOR_ITEM_REGULAR), diff --git a/code/datums/factions/upp.dm b/code/datums/factions/upp.dm index 90b04765cf85..f63e9d5e0cb0 100644 --- a/code/datums/factions/upp.dm +++ b/code/datums/factions/upp.dm @@ -1,6 +1,32 @@ /datum/faction/upp - name = "Union of Progressive Peoples" - faction_tag = FACTION_UPP + name = NAME_FACTION_UPP + desc = "A wide-reaching and powerful socialist authoritarian state. The UPP acts as the political and ideological rival of the United States and the UA. Though they have a relatively large presence on Earth (particularly in the Eastern sphere), the UPP is also largely active in colonizing the frontier. \ + While the United Americas have never engaged the UPP in an official war, hostilities broke out between a USCM Task Force and a UPP Expeditionary Force during Operation Canton in mid 2165. The engagement ended in a ceasefire. The reason was fears that the conflict would spread to the more densely populated Sol System. \ + The incident greatly enraged many senior officials in the UPP, who viewed the battle of Canton as an attempt by the United States to annex UPP sovereign territory. “Such an insult (referring to Canton) can only be repaid in American blood. Mark my words, this will happen”, Kolonel Ganbaatar of the UPP Armed Forces was quoted saying in May 2168." + + faction_name = FACTION_UPP + faction_tag = SIDE_FACTION_UPP + relations_pregen = RELATIONS_FACTION_UPP + faction_iff_tag_type = /obj/item/faction_tag/upp + + role_mappings = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) + roles_list = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = UPP_JOB_LIST, + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) /datum/faction/upp/modify_hud_holder(image/holder, mob/living/carbon/human/H) var/hud_icon_state @@ -25,24 +51,12 @@ hud_icon_state = "lt" if(JOB_UPP_SRLT_OFFICER) hud_icon_state = "slt" - if(JOB_UPP_KPT_OFFICER) - hud_icon_state = "xo" if(JOB_UPP_MAY_OFFICER) - hud_icon_state = "co" - if(JOB_UPP_LTKOL_OFFICER) - hud_icon_state = "co" + hud_icon_state = "may" if(JOB_UPP_KOL_OFFICER) - hud_icon_state = "co" - if(JOB_UPP_MAY_GENERAL) - hud_icon_state = "co" - if(JOB_UPP_LT_GENERAL) - hud_icon_state = "co" - if(JOB_UPP_GENERAL) - hud_icon_state = "co" + hud_icon_state = "kol" if(JOB_UPP_COMBAT_SYNTH) hud_icon_state = "synth" - if(JOB_UPP_SUPPORT_SYNTH) - hud_icon_state = "synth" if(JOB_UPP_COMMANDO) hud_icon_state = "com" if(JOB_UPP_COMMANDO_MEDIC) diff --git a/code/datums/factions/uscm.dm b/code/datums/factions/uscm.dm index f7c49321f305..bad4dc3cdb5f 100644 --- a/code/datums/factions/uscm.dm +++ b/code/datums/factions/uscm.dm @@ -1,6 +1,13 @@ /datum/faction/uscm - name = "United States Colonial Marines" - faction_tag = FACTION_MARINE + name = NAME_FACTION_USCM + desc = "The USCM is divided into three overarching branches, called the Marine Space Forces: Sol, overseeing the core colonies and earth, the largest of the three; Eridani, operating among the Chinese and American colonised arms; Herculis, going through the Anglo-Japanese arms and the outer fringes. Each branch operates independently, but all are responsible for protecting American space territory and working together in that goal. \ + There is also a fourth group, the Reserves, which is stationed mostly on earth and serves to reinforce the other branches. They have not seen any active use yet, but who knows what the future holds. Marine Space Force, Herculis, Chinook 91 GSO station is a military space station in geosynchronous orbit around the colony world Georgia 525 (70 Ophiuchi A V), and is the headquarters for the Herculis branch of the USCM. Under its control are the 4th Colonial Marine Division, 4th Colonial Marine Brigade, 4th Aerospace Wing, and 1st Colonial Support Group of the USCM. \ + Chinook 91 reports directly to O'Neill station in Earth-Lunar space. The O'Neill station is the main communication base between the three branches. Supervising orders from the homeworld, controlling the First Fleet and rare joint operations. It is an extremely vital station and well guarded by the First Fleet in all its might. Tithonis Mountain on Bernice 378 is another large garrison of USCM troops, such as the 1st Colonial Support Group, and there are more minor garrisons along the Anglo-Japanese arm. The 2nd Company of the 2nd Battalion of the 4th Brigade, the Falling Falcons, and the USS Almayer are stationed in Herculis." + + faction_name = FACTION_USCM + faction_tag = SIDE_FACTION_USCM + relations_pregen = RELATIONS_FACTION_USCM + faction_iff_tag_type = /obj/item/faction_tag/uscm /datum/faction/uscm/modify_hud_holder(image/holder, mob/living/carbon/human/current_human) var/datum/squad/squad = current_human.assigned_squad @@ -14,26 +21,42 @@ else if(I) _role = I.rank switch(GET_DEFAULT_ROLE(_role)) - if(JOB_SQUAD_ENGI) marine_rk = "engi" - if(JOB_SQUAD_SPECIALIST) marine_rk = "spec" - if(JOB_SQUAD_TEAM_LEADER) marine_rk = "tl" - if(JOB_SQUAD_MEDIC) marine_rk = "med" - if(JOB_SQUAD_SMARTGUN) marine_rk = "gun" - if(JOB_XO) marine_rk = "xo" - if(JOB_CO) marine_rk = "co" - if(JOB_GENERAL) marine_rk = "general" - if(JOB_CAS_PILOT) marine_rk = "gp" - if(JOB_DROPSHIP_PILOT) marine_rk = "dp" - if(JOB_TANK_CREW) marine_rk = "tc" - if(JOB_INTEL) marine_rk = "io" - if(JOB_DROPSHIP_CREW_CHIEF) marine_rk = "dcc" - if(JOB_MARINE_RAIDER) marine_rk = "soc" - if(JOB_MARINE_RAIDER_SL) marine_rk = "soctl" - if(JOB_MARINE_RAIDER_CMD) marine_rk = "soccmd" + if(JOB_SQUAD_ENGI) + marine_rk = "engi" + if(JOB_SQUAD_SPECIALIST) + marine_rk = "spec" + if(JOB_SQUAD_TEAM_LEADER) + marine_rk = "tl" + if(JOB_SQUAD_MEDIC) + marine_rk = "med" + if(JOB_SQUAD_SMARTGUN) + marine_rk = "gun" + if(JOB_XO) + marine_rk = "xo" + if(JOB_CO) + marine_rk = "co" + if(JOB_GENERAL) + marine_rk = "general" + if(JOB_PILOT) + marine_rk = "po" + if(JOB_INTEL) + marine_rk = "io" + if(JOB_DROPSHIP_CREW_CHIEF) + marine_rk = "dcc" + if(JOB_CREWMAN) + marine_rk = "tc" + if(JOB_MARINE_RAIDER) + marine_rk = "soc" + if(JOB_MARINE_RAIDER_SL) + marine_rk = "soctl" + if(JOB_MARINE_RAIDER_CMD) + marine_rk = "soccmd" if(squad.squad_leader == current_human) switch(squad.squad_type) - if("Squad") marine_rk = "leader_a" - if("Team") marine_rk = "soctl_a" + if("Squad") + marine_rk = "leader_a" + if("Team") + marine_rk = "soctl_a" current_human.langchat_styles = "langchat_bolded" // bold text for bold leaders else @@ -41,7 +64,8 @@ current_human.langchat_color = current_human.assigned_squad.chat_color - if(!marine_rk) marine_rk = current_human.rank_fallback + if(!marine_rk) + marine_rk = current_human.rank_fallback if(marine_rk) var/image/IMG = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad") if(squad_clr) @@ -75,9 +99,6 @@ if(JOB_CO) marine_rk = "co" border_rk = "command" - if(JOB_USCM_OBSV) - marine_rk = "vo" - border_rk = "command" if(JOB_SO) marine_rk = "so" border_rk = "command" @@ -89,10 +110,8 @@ border_rk = "command" if(JOB_INTEL) marine_rk = "io" - if(JOB_CAS_PILOT) - marine_rk = "gp" - if(JOB_DROPSHIP_PILOT) - marine_rk = "dp" + if(JOB_PILOT) + marine_rk = "po" if(JOB_DROPSHIP_CREW_CHIEF) marine_rk = "dcc" if(JOB_CHIEF_POLICE) @@ -100,8 +119,6 @@ border_rk = "command" if(JOB_POLICE) marine_rk = "mp" - if(JOB_TANK_CREW) - marine_rk = "tc" if(JOB_WARDEN) marine_rk = "warden" border_rk = "command" @@ -197,19 +214,6 @@ if(JOB_CMB_OBS) marine_rk = "obs" icon_prefix = "cmb_" - // Check squad marines here too, for the unique ones - if(JOB_SQUAD_ENGI) - marine_rk = "engi" - if(JOB_SQUAD_MEDIC) - marine_rk = "med" - if(JOB_SQUAD_SPECIALIST) - marine_rk = "spec" - if(JOB_SQUAD_SMARTGUN) - marine_rk = "gun" - if(JOB_SQUAD_TEAM_LEADER) - marine_rk = "tl" - if(JOB_SQUAD_LEADER) - marine_rk = "leader" if(marine_rk) var/image/I = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad") diff --git a/code/datums/factions/uscm/cmb.dm b/code/datums/factions/uscm/cmb.dm new file mode 100644 index 000000000000..0b11200ba0c1 --- /dev/null +++ b/code/datums/factions/uscm/cmb.dm @@ -0,0 +1,3 @@ +/datum/faction/uscm/cmb + name = NAME_FACTION_CMB + faction_name = FACTION_CMB diff --git a/code/datums/factions/uscm/marine.dm b/code/datums/factions/uscm/marine.dm new file mode 100644 index 000000000000..750fbb8a7be7 --- /dev/null +++ b/code/datums/factions/uscm/marine.dm @@ -0,0 +1,53 @@ +/datum/faction/uscm/marine + name = NAME_FACTION_MARINE + faction_name = FACTION_MARINE + + role_mappings = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list( + /datum/job/command/commander/whiskey = JOB_CO, + /datum/job/command/executive/whiskey = JOB_XO, + /datum/job/civilian/synthetic/whiskey = JOB_SYNTH, + /datum/job/command/warrant/whiskey = JOB_CHIEF_POLICE, + /datum/job/command/bridge/whiskey = JOB_SO, + /datum/job/command/tank_crew/whiskey = JOB_CREWMAN, + /datum/job/command/police/whiskey = JOB_POLICE, + /datum/job/command/pilot/whiskey = JOB_PILOT, + /datum/job/logistics/requisition/whiskey = JOB_CHIEF_REQUISITION, + /datum/job/civilian/professor/whiskey = JOB_CMO, + /datum/job/civilian/doctor/whiskey = JOB_DOCTOR, + /datum/job/civilian/researcher/whiskey = JOB_RESEARCHER, + /datum/job/logistics/engineering/whiskey = JOB_CHIEF_ENGINEER, + /datum/job/logistics/otech/maint/whiskey = JOB_MAINT_TECH, + /datum/job/logistics/cargo/whiskey = JOB_CARGO_TECH, + /datum/job/uscm/squad/leader/whiskey = JOB_SQUAD_LEADER, + /datum/job/uscm/squad/specialist/whiskey = JOB_SQUAD_SPECIALIST, + /datum/job/uscm/squad/smartgunner/whiskey = JOB_SQUAD_SMARTGUN, + /datum/job/uscm/squad/medic/whiskey = JOB_SQUAD_MEDIC, + /datum/job/uscm/squad/engineer/whiskey = JOB_SQUAD_ENGI, + /datum/job/uscm/squad/standard/whiskey = JOB_SQUAD_MARINE + ), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) + roles_list = list( + MODE_NAME_EXTENDED = ROLES_REGULAR_USCM, + MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_USCM, + MODE_NAME_FACTION_CLASH = ROLES_REGULAR_USCM, + MODE_NAME_WISKEY_OUTPOST = ROLES_WO_USCM, + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = ROLES_REGULAR_USCM + ) + +/datum/faction/uscm/marine/additional_join_status(mob/new_player/user, dat = "") + if(SSevacuation) + switch(SSevacuation.evac_status) + if(EVACUATION_STATUS_INITIATING) + dat += "[replacetext(user.client.auto_lang(LANGUAGE_LOBBY_EVAC_STARTED), "###MAIN_SHIP###", "[MAIN_SHIP_NAME]")]
" + if(EVACUATION_STATUS_COMPLETE) + dat += "[replacetext(user.client.auto_lang(LANGUAGE_LOBBY_EVAC_FINISHED), "###MAIN_SHIP###", "[MAIN_SHIP_NAME]")]
" + . = ..() diff --git a/code/datums/factions/uscm/marsoc.dm b/code/datums/factions/uscm/marsoc.dm new file mode 100644 index 000000000000..2614de5052bb --- /dev/null +++ b/code/datums/factions/uscm/marsoc.dm @@ -0,0 +1,5 @@ +/datum/faction/uscm/marsoc + name = NAME_FACTION_MARSOC + desc = "Decryption required" + + faction_name = FACTION_MARSOC diff --git a/code/datums/factions/wy.dm b/code/datums/factions/wy.dm new file mode 100644 index 000000000000..53ddfd04ba80 --- /dev/null +++ b/code/datums/factions/wy.dm @@ -0,0 +1,34 @@ +/datum/faction/wy + name = NAME_FACTION_WY + desc = "Weyland Yutani also known as \"the Company\", has a wide range of business. This includes dealing with high-tech armaments, synthetic humanoids, spaceships, computer parts, terraforming equipment, and household appliances. They also offers shipping and receiving services, among other ventures. Following an aggressive expansion into terraforming new colonial world, Weyland-Yutani secured rights and privileges from the United States government. One of those privileges is the close relationship with the USCM. \ + the Colonial Marines use corporate-supplied equipment in exchange for protecting and monitoring border colonies. This, however, does not mean that the interests of the company are aligned with the USCM. It is more accurate to say that Weyland-Yutani considers the USCM a valuable, but still disposable, asset. This has led to an increasing amount of hostility between the two factions. Weyland-Yutani has enough wealth and influence to hire private military contractors. These are highly trained mercenaries, generally ex-military veterans. \ + They do black site protection detail, undertaking dangerous assignments, and otherwise supply Weyland-Yutani with firepower in the absence of the USCM. They are compensated well for their services, and demand is always there. Rumors speak of even more well-equipped and well-selected military units within Weyland-Yutani's employment, but that is not officially verified. The Company has refused to comment on it." + + faction_name = FACTION_WY + faction_tag = SIDE_FACTION_WY + relations_pregen = RELATIONS_FACTION_WY + faction_iff_tag_type = /obj/item/faction_tag/wy + +/datum/faction/wy/modify_hud_holder(image/holder, mob/living/carbon/human/H) + var/hud_icon_state + var/obj/item/card/id/ID = H.get_idcard() + var/_role + if(H.mind) + _role = H.job + else if(ID) + _role = ID.rank + switch(_role) + if(JOB_PMC_DIRECTOR) + hud_icon_state = "sd" + if(JOB_PMC_LEADER, JOB_PMC_LEAD_INVEST) + hud_icon_state = "ld" + if(JOB_PMC_DOCTOR) + hud_icon_state = "td" + if(JOB_PMC_ENGINEER) + hud_icon_state = "ct" + if(JOB_PMC_MEDIC, JOB_PMC_INVESTIGATOR) + hud_icon_state = "md" + if(JOB_PMC_SYNTH) + hud_icon_state = "syn" + if(hud_icon_state) + holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "pmc_[hud_icon_state]") diff --git a/code/datums/factions/wy/deathsquad.dm b/code/datums/factions/wy/deathsquad.dm new file mode 100644 index 000000000000..9a622aace662 --- /dev/null +++ b/code/datums/factions/wy/deathsquad.dm @@ -0,0 +1,6 @@ +/datum/faction/wy/deathsquad + name = NAME_FACTION_WY_DEATHSQUAD + desc = "Decryption required" + + faction_name = FACTION_WY_DEATHSQUAD + ally_factions_initialize = FALSE diff --git a/code/datums/factions/wy/pmc.dm b/code/datums/factions/wy/pmc.dm new file mode 100644 index 000000000000..0f1eb7d2ff42 --- /dev/null +++ b/code/datums/factions/wy/pmc.dm @@ -0,0 +1,5 @@ +/datum/faction/wy/pmc + name = NAME_FACTION_PMC + desc = "Weyland-Yutani PMCs are military personnel owned and operated by the company. They are equipped with advanced modern military equipment and weaponry akin to the USCM and similar national militaries. The tasks of the PMCs are never limited to one specific job and they are often deployed on 'shadow missions'. Their deployment is often kept secret from the USCM to avoid conflict with the anti-corporate officers in the USCM. The recruitment process largely consists of those who have personal contacts with higher Weyland-Yutani employees, or those who have caught the eye of the superiors and been hand-picked. The superiors value abilities in the field and willingness to obey company directives, for a large sum of money, despite of their moral beliefs. Following the defeat of the Dust Raiders and the withdrawal of the United Americas of the Neroid sector, a group of employees became skilled mercenaries. They are part of Weyland-Yutani's Task Force Oberon that was stationed aboard the USCSS Royce, a powerful Weyland-Yutani cruiser that patrols the outer edges of the Neroid sector. Under the directive of Weyland-Yutani's board member Johan Almric, they act as private security for company science teams. The USCSS Royce contains a crew of roughly two hundred PMCs, and one hundred scientists and support personnel. Rumors say that a Weyland-Yutani Special Task Force known as \"Royal\" of the USCSS Lunalorne are part of a different specialization, designed to capture anomalies associated with alien and supernatural life." + + faction_name = FACTION_PMC diff --git a/code/datums/factions/xeno.dm b/code/datums/factions/xeno.dm new file mode 100644 index 000000000000..70ce3eb79ca2 --- /dev/null +++ b/code/datums/factions/xeno.dm @@ -0,0 +1,386 @@ +/datum/faction/xenomorph + name = NAME_FACTION_XENOMORPH + desc = "Xenomorph hive among the all other hives." + + faction_name = FACTION_XENOMORPH + faction_tag = SIDE_FACTION_XENOMORPH + organ_faction_iff_tag_type = /obj/item/faction_tag/organ/pheromones_receptor + relations_pregen = RELATIONS_FACTION_XENOMORPH + +/datum/faction/xenomorph/faction_is_ally(datum/faction/faction) + if(!living_xeno_queen) + return FALSE + . = ..() + +/datum/faction/xenomorph/New() + . = ..() + mutators = new(src) + mark_ui = new(src) + faction_ui = new(src) + +/datum/faction/xenomorph/can_delay_round_end(mob/living/carbon/carbon) + if(!faction_is_ally(GLOB.faction_datums[FACTION_MARINE])) + return TRUE + return FALSE + +// Adds a xeno to this hive +/datum/faction/xenomorph/add_mob(mob/living/carbon/xenomorph/xenomorph) + if(!xenomorph || !istype(xenomorph)) + return + + // If the xeno is part of another hive, they should be removed from that one first + if(xenomorph.faction && xenomorph.faction != src) + xenomorph.faction.remove_mob(xenomorph, TRUE) + + // Already in the hive + if(xenomorph in totalMobs) + return + + // Can only have one queen. + if(isqueen(xenomorph)) + if(!living_xeno_queen && !xenomorph.statistic_exempt) // Don't consider xenos in admin level + set_living_xeno_queen(xenomorph) + + xenomorph.faction = src + + if(xenomorph.hud_list) + xenomorph.hud_update() + + if(!xenomorph.statistic_exempt) + totalMobs += xenomorph + if(xenomorph.tier == 2) + tier_2_xenos += xenomorph + else if(xenomorph.tier == 3) + tier_3_xenos += xenomorph + + // Xenos are a fuckfest of cross-dependencies of different datums that are initialized at different times + // So don't even bother trying updating UI here without large refactors + +// Removes the xeno from the hive +/datum/faction/xenomorph/remove_mob(mob/living/carbon/xenomorph/xenomorph, hard = FALSE, light_mode = FALSE) + if(!xenomorph || !istype(xenomorph)) + return + + // Make sure the xeno was in the hive in the first place + if(!(xenomorph in totalMobs)) + return + + if(isqueen(xenomorph)) + if(living_xeno_queen == xenomorph) + var/mob/living/carbon/xenomorph/queen/next_queen + for(var/mob/living/carbon/xenomorph/queen/Q in totalMobs) + if(!Q.statistic_exempt) + continue + next_queen = Q + break + + set_living_xeno_queen(next_queen) // either null or a queen + + // We allow "soft" removals from the hive (the xeno still retains information about the hive) + // This is so that xenos can add themselves back to the hive if they should die or otherwise go "on leave" from the hive + if(hard) + xenomorph.faction = null + + totalMobs -= xenomorph + if(xenomorph.tier == 2) + tier_2_xenos -= xenomorph + else if(xenomorph.tier == 3) + tier_3_xenos -= xenomorph + + if(!light_mode) + faction_ui.update_xeno_counts() + faction_ui.xeno_removed(xenomorph) + +/datum/faction/xenomorph/get_faction_info(mob/user) + if(!user || !faction_ui) + return + + if(!faction_ui.data_initialized) + faction_ui.update_all_data() + + faction_ui.tgui_interact(user) + return TRUE + +/datum/faction/xenomorph/get_join_status(mob/new_player/user, dat) + if(SSticker.current_state != GAME_STATE_PLAYING || !SSticker.mode) + to_chat(user, SPAN_WARNING(user.client.auto_lang(LANGUAGE_LOBBY_ROUND_NO_JOIN))) + return + + if(alert(user, user.client.auto_lang(LANGUAGE_LOBBY_JOIN_XENOMORPH), user.client.auto_lang(LANGUAGE_CONFIRM), user.client.auto_lang(LANGUAGE_YES), user.client.auto_lang(LANGUAGE_NO)) == user.client.auto_lang(LANGUAGE_YES)) + if(SSticker.mode.check_xeno_late_join(user)) + var/mob/new_xeno = SSticker.mode.attempt_to_join_as_xeno(user, 0) + if(new_xeno && !istype(new_xeno, /mob/living/carbon/xenomorph/larva)) + SSticker.mode.transfer_xenomorph(user, new_xeno) + user.close_spawn_windows() + + +//LANDMARKS +/datum/xeno_mark_define + var/name = "xeno_declare" + var/icon_state = "empty" + var/desc = "Xenos make psychic markers with this meaning as positional lasting communication to eachother" + +/datum/xeno_mark_define/fortify + name = "Fortify" + desc = "Fortify this area!" + icon_state = "fortify" + +/datum/xeno_mark_define/weeds + name = "Need Weeds" + desc = "Need weeds here!" + icon_state = "weed" + +/datum/xeno_mark_define/nest + name = "Nest" + desc = "Nest enemies here!" + icon_state = "nest" + +/datum/xeno_mark_define/hosts + name = "Hosts" + desc = "Hosts here!" + icon_state = "hosts" + +/datum/xeno_mark_define/aide + name = "Aide" + desc = "Aide here!" + icon_state = "aide" + +/datum/xeno_mark_define/defend + name = "Defend" + desc = "Defend the hive here!" + icon_state = "defend" + +/datum/xeno_mark_define/danger + name = "Danger Warning" + desc = "Caution, danger here!" + icon_state = "danger" + +/datum/xeno_mark_define/rally + name = "Rally" + desc = "Group up here!" + icon_state = "rally" + +/datum/xeno_mark_define/hold + name = "Hold" + desc = "Hold this area!" + icon_state = "hold" + +/datum/xeno_mark_define/ambush + name = "Ambush" + desc = "Ambush the enemy here!" + icon_state = "ambush" + +/datum/xeno_mark_define/attack + name = "Attack" + desc = "Attack the enemy here!" + icon_state = "attack" + + +//HIVE STATUS +/datum/hive_status_ui + var/name = "Hive Status" + + // Data to pass when rendering the UI (not static) + var/total_xenos + var/list/xeno_counts + var/list/tier_slots + var/list/xeno_vitals + var/list/xeno_keys + var/list/xeno_info + var/faction_location + var/burrowed_larva + var/evolution_level + + var/data_initialized = FALSE + + var/datum/faction/assoc_hive = null + +/datum/hive_status_ui/New(datum/faction/faction) + assoc_hive = faction + update_all_data() + START_PROCESSING(SShive_status, src) + +/datum/hive_status_ui/process() + update_xeno_vitals() + update_xeno_info(FALSE) + SStgui.update_uis(src) + +// Updates the list tracking how many xenos there are in each tier, and how many there are in total +/datum/hive_status_ui/proc/update_xeno_counts(send_update = TRUE) + xeno_counts = assoc_hive.get_xeno_counts() + + total_xenos = 0 + for(var/counts in xeno_counts) + for(var/caste in counts) + total_xenos += counts[caste] + + if(send_update) + SStgui.update_uis(src) + + xeno_counts[1] -= "Queen" // don't show queen in the amount of xenos + + // Also update the amount of T2/T3 slots + tier_slots = assoc_hive.get_tier_slots() + +// Updates the hive location using the area name of the defined hive location turf +/datum/hive_status_ui/proc/update_faction_location(send_update = TRUE) + if(!assoc_hive.faction_location) + return + + faction_location = strip_improper(get_area_name(assoc_hive.faction_location)) + + if(send_update) + SStgui.update_uis(src) + +// Updates the sorted list of all xenos that we use as a key for all other information +/datum/hive_status_ui/proc/update_xeno_keys(send_update = TRUE) + xeno_keys = assoc_hive.get_xeno_keys() + + if(send_update) + SStgui.update_uis(src) + +// Mildly related to the above, but only for when xenos are removed from the hive +// If a xeno dies, we don't have to regenerate all xeno info and sort it again, just remove them from the data list +/datum/hive_status_ui/proc/xeno_removed(mob/living/carbon/xenomorph/xenomorph) + if(!xeno_keys) + return + + for(var/index in 1 to length(xeno_keys)) + var/list/info = xeno_keys[index] + if(info["nicknumber"] == xenomorph.nicknumber) + + // tried Remove(), didn't work. *shrug* + xeno_keys[index] = null + xeno_keys -= null + return + + SStgui.update_uis(src) + +// Updates the list of xeno names, strains and references +/datum/hive_status_ui/proc/update_xeno_info(send_update = TRUE) + xeno_info = assoc_hive.get_xeno_info() + + if(send_update) + SStgui.update_uis(src) + +// Updates vital information about xenos such as health and location. Only info that should be updated regularly +/datum/hive_status_ui/proc/update_xeno_vitals() + xeno_vitals = assoc_hive.get_xeno_vitals() + +// Updates how many buried larva there are +/datum/hive_status_ui/proc/update_burrowed_larva(send_update = TRUE) + burrowed_larva = assoc_hive.stored_larva + if(SSxevolution) + evolution_level = SSxevolution.get_evolution_boost_power(assoc_hive) + else + evolution_level = 1 + + if(send_update) + SStgui.update_uis(src) + +// Updates all data except pooled larva +/datum/hive_status_ui/proc/update_all_xeno_data(send_update = TRUE) + update_xeno_counts(FALSE) + update_xeno_vitals() + update_xeno_keys(FALSE) + update_xeno_info(FALSE) + + if(send_update) + SStgui.update_uis(src) + +// Updates all data, including pooled larva +/datum/hive_status_ui/proc/update_all_data() + data_initialized = TRUE + update_all_xeno_data(FALSE) + update_burrowed_larva(FALSE) + SStgui.update_uis(src) + +/datum/hive_status_ui/ui_state(mob/user) + return GLOB.hive_state[assoc_hive.faction_name] + +/datum/hive_status_ui/ui_status(mob/user, datum/ui_state/state) + . = ..() + if(isobserver(user)) + return UI_INTERACTIVE + +/datum/hive_status_ui/ui_data(mob/user) + . = list() + .["total_xenos"] = total_xenos + .["xeno_counts"] = xeno_counts + .["tier_slots"] = tier_slots + .["xeno_keys"] = xeno_keys + .["xeno_info"] = xeno_info + .["xeno_vitals"] = xeno_vitals + .["queen_location"] = get_area_name(assoc_hive.living_xeno_queen) + .["faction_location"] = faction_location + .["burrowed_larva"] = burrowed_larva + .["evolution_level"] = evolution_level + + var/mob/living/carbon/xenomorph/queen/Q = user + .["is_in_ovi"] = istype(Q) && Q.ovipositor + +/datum/hive_status_ui/ui_static_data(mob/user) + . = list() + .["user_ref"] = REF(user) + .["hive_color"] = assoc_hive.ui_color + .["hive_name"] = assoc_hive.name + +/datum/hive_status_ui/tgui_interact(mob/user, datum/tgui/ui) + if(!assoc_hive) + return + + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "HiveStatus", "[assoc_hive.name] Status") + ui.set_autoupdate(FALSE) + ui.open() + +/datum/hive_status_ui/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) + . = ..() + if(.) + return + + switch(action) + if("give_plasma") + var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list + var/mob/living/carbon/xenomorph/xenomorph = ui.user + + if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) + return + + if(xenomorph.stat == DEAD) + return + + var/datum/action/xeno_action/A = get_xeno_action_by_type(xenomorph, /datum/action/xeno_action/activable/queen_give_plasma) + A?.use_ability_wrapper(target_xenomorph) + + if("heal") + var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list + var/mob/living/carbon/xenomorph/xenomorph = ui.user + + if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) + return + + if(xenomorph.stat == DEAD) + return + + var/datum/action/xeno_action/A = get_xeno_action_by_type(xenomorph, /datum/action/xeno_action/activable/queen_heal) + A?.use_ability_wrapper(target_xenomorph, TRUE) + + if("overwatch") + var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list + var/mob/living/carbon/xenomorph/xenomorph = ui.user + + if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) + return + + if(xenomorph.stat == DEAD) + if(isobserver(xenomorph)) + var/mob/dead/observer/O = xenomorph + O.ManualFollow(target_xenomorph) + return + + if(!xenomorph.check_state(TRUE)) + return + + xenomorph.overwatch(target_xenomorph) diff --git a/code/datums/factions/xeno/alpha.dm b/code/datums/factions/xeno/alpha.dm new file mode 100644 index 000000000000..8672bfe6cc40 --- /dev/null +++ b/code/datums/factions/xeno/alpha.dm @@ -0,0 +1,7 @@ +/datum/faction/xenomorph/alpha + name = NAME_FACTION_XENOMORPH_ALPHA + faction_name = FACTION_XENOMORPH_ALPHA + + prefix = "Alpha " + color = "#ff4040" + ui_color = "#992626" diff --git a/code/datums/factions/xeno/bravo.dm b/code/datums/factions/xeno/bravo.dm new file mode 100644 index 000000000000..ac3d4eb5de8a --- /dev/null +++ b/code/datums/factions/xeno/bravo.dm @@ -0,0 +1,7 @@ +/datum/faction/xenomorph/bravo + name = NAME_FACTION_XENOMORPH_BRAVO + faction_name = FACTION_XENOMORPH_BRAVO + + prefix = "Bravo " + color = "#ffff80" + ui_color = "#99994d" diff --git a/code/datums/factions/xeno/charlie.dm b/code/datums/factions/xeno/charlie.dm new file mode 100644 index 000000000000..318007559c5b --- /dev/null +++ b/code/datums/factions/xeno/charlie.dm @@ -0,0 +1,7 @@ +/datum/faction/xenomorph/charlie + name = NAME_FACTION_XENOMORPH_CHARLIE + faction_name = FACTION_XENOMORPH_CHARLIE + + prefix = "Charlie " + color = "#bb40ff" + ui_color = "#702699" diff --git a/code/datums/factions/xeno/corrupted.dm b/code/datums/factions/xeno/corrupted.dm new file mode 100644 index 000000000000..d37ab89b82a9 --- /dev/null +++ b/code/datums/factions/xeno/corrupted.dm @@ -0,0 +1,38 @@ +/datum/faction/xenomorph/corrupted + name = NAME_FACTION_XENOMORPH_CORRUPTED + faction_name = FACTION_XENOMORPH_CORRUPTED + + prefix = "Corrupted " + color = "#80ff80" + ui_color ="#4d994d" + +/datum/faction/xenomorph/corrupted/add_mob(mob/living/carbon/xenomorph/X) + . = ..() + X.add_language(LANGUAGE_ENGLISH) + +/datum/faction/xenomorph/corrupted/remove_mob(mob/living/carbon/xenomorph/X, hard) + . = ..() + X.remove_language(LANGUAGE_ENGLISH) + + +/datum/faction/xenomorph/corrupted/tamed + name = NAME_FACTION_XENOMORPH_TAMED + faction_name = FACTION_XENOMORPH_TAMED + + prefix = "Tamed " + color = "#80ff80" + + dynamic_evolution = FALSE + allow_no_queen_actions = TRUE + allow_queen_evolve = FALSE + ignore_slots = TRUE + +/datum/faction/xenomorph/corrupted/tamed/New() + . = ..() + faction_structures_limit[XENO_STRUCTURE_EGGMORPH] = 0 + faction_structures_limit[XENO_STRUCTURE_EVOPOD] = 0 + +/datum/faction/xenomorph/corrupted/tamed/add_mob(mob/living/carbon/xenomorph/xenomorph) + . = ..() + if(faction_leader) + xenomorph.faction = faction_leader.faction diff --git a/code/datums/factions/xeno/delta.dm b/code/datums/factions/xeno/delta.dm new file mode 100644 index 000000000000..940a3ce5b1fd --- /dev/null +++ b/code/datums/factions/xeno/delta.dm @@ -0,0 +1,7 @@ +/datum/faction/xenomorph/delta + name = NAME_FACTION_XENOMORPH_DELTA + faction_name = FACTION_XENOMORPH_DELTA + + prefix = "Delta " + color = "#8080ff" + ui_color = "#4d4d99" diff --git a/code/datums/factions/xeno/feral.dm b/code/datums/factions/xeno/feral.dm new file mode 100644 index 000000000000..d463e75ac998 --- /dev/null +++ b/code/datums/factions/xeno/feral.dm @@ -0,0 +1,13 @@ +/datum/faction/xenomorph/feral + name = NAME_FACTION_XENOMORPH_FERAL + faction_name = FACTION_XENOMORPH_FERAL + + prefix = "Feral " + color = "#828296" + ui_color = "#828296" + + construction_allowed = XENO_QUEEN + dynamic_evolution = FALSE + allow_no_queen_actions = TRUE + allow_queen_evolve = FALSE + ignore_slots = TRUE diff --git a/code/datums/factions/xeno/forsaken.dm b/code/datums/factions/xeno/forsaken.dm new file mode 100644 index 000000000000..b8d3e84e668e --- /dev/null +++ b/code/datums/factions/xeno/forsaken.dm @@ -0,0 +1,13 @@ +/datum/faction/xenomorph/forsaken + name = NAME_FACTION_XENOMORPH_FORSAKEN + faction_name = FACTION_XENOMORPH_FORSAKEN + + prefix = "Feral " + color = "#828296" + ui_color = "#828296" + + construction_allowed = XENO_QUEEN + dynamic_evolution = FALSE + allow_no_queen_actions = TRUE + allow_queen_evolve = FALSE + ignore_slots = TRUE diff --git a/code/datums/factions/xeno/mutated.dm b/code/datums/factions/xeno/mutated.dm new file mode 100644 index 000000000000..399a032955a6 --- /dev/null +++ b/code/datums/factions/xeno/mutated.dm @@ -0,0 +1,9 @@ +/datum/faction/xenomorph/mutated + name = NAME_FACTION_XENOMORPH_MUTATED + faction_name = FACTION_XENOMORPH_MUTATED + + prefix = "Mutated " + color = "#6abd99" + ui_color = "#6abd99" + + hive_inherant_traits = list(TRAIT_XENONID) diff --git a/code/datums/factions/xeno/normal.dm b/code/datums/factions/xeno/normal.dm new file mode 100644 index 000000000000..cb57762afd2c --- /dev/null +++ b/code/datums/factions/xeno/normal.dm @@ -0,0 +1,32 @@ +/datum/faction/xenomorph/normal + name = NAME_FACTION_XENOMORPH_NORMAL + faction_name = FACTION_XENOMORPH_NORMAL + + evolution_without_ovipositor = FALSE + color = null + ui_color = null + + role_mappings = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) + roles_list = list( + MODE_NAME_EXTENDED = ROLES_REGULAR_XENO, + MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_XENO, + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list( + JOB_XENOMORPH + ), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list( + JOB_XENOMORPH + ), + MODE_NAME_INFECTION = list( + JOB_XENOMORPH + ) + ) diff --git a/code/datums/factions/xeno/renegade.dm b/code/datums/factions/xeno/renegade.dm new file mode 100644 index 000000000000..7bd620d8dad3 --- /dev/null +++ b/code/datums/factions/xeno/renegade.dm @@ -0,0 +1,13 @@ +/datum/faction/xenomorph/renegade + name = NAME_FACTION_XENOMORPH_RENEGADE + faction_name = FACTION_XENOMORPH_RENEGADE + + dynamic_evolution = FALSE + allow_no_queen_actions = TRUE + allow_queen_evolve = FALSE + ignore_slots = TRUE + + need_round_end_check = TRUE + +/datum/faction/xenomorph/renegade/can_delay_round_end(mob/living/carbon/carbon) + return FALSE diff --git a/code/datums/factions/xeno/yautja.dm b/code/datums/factions/xeno/yautja.dm new file mode 100644 index 000000000000..1e7ff5d55896 --- /dev/null +++ b/code/datums/factions/xeno/yautja.dm @@ -0,0 +1,13 @@ +/datum/faction/xenomorph/yautja + name = NAME_FACTION_XENOMORPH_YAUTJA + faction_name = FACTION_XENOMORPH_YAUTJA + + dynamic_evolution = FALSE + allow_no_queen_actions = TRUE + allow_queen_evolve = FALSE + ignore_slots = TRUE + + need_round_end_check = TRUE + +/datum/faction/xenomorph/yautja/can_delay_round_end(mob/living/carbon/carbon) + return FALSE diff --git a/code/datums/factions/yautja.dm b/code/datums/factions/yautja.dm new file mode 100644 index 000000000000..b24935e42a72 --- /dev/null +++ b/code/datums/factions/yautja.dm @@ -0,0 +1,35 @@ +/datum/faction/yautja + name = NAME_FACTION_YAUTJA + desc = "Unable to extract addition information." + + faction_name = FACTION_YAUTJA + faction_tag = SIDE_FACTION_YAUTJA + relations_pregen = RELATIONS_HOSTILE + + role_mappings = list( + MODE_NAME_EXTENDED = list(), + MODE_NAME_DISTRESS_SIGNAL = list(), + MODE_NAME_FACTION_CLASH = list(), + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = list(), + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = list() + ) + roles_list = list( + MODE_NAME_EXTENDED = ROLES_REGULAR_YAUT, + MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_YAUT, + MODE_NAME_FACTION_CLASH = ROLES_REGULAR_YAUT, + MODE_NAME_WISKEY_OUTPOST = list(), + MODE_NAME_HUNTER_GAMES = ROLES_REGULAR_YAUT, + MODE_NAME_HIVE_WARS = list(), + MODE_NAME_INFECTION = ROLES_REGULAR_YAUT + ) + +/datum/faction/yautja/get_join_status(mob/new_player/user, dat) + if(alert(user, user.client.auto_lang(LANGUAGE_LOBBY_JOIN_HUNT), user.client.auto_lang(LANGUAGE_CONFIRM), user.client.auto_lang(LANGUAGE_YES), user.client.auto_lang(LANGUAGE_NO)) == user.client.auto_lang(LANGUAGE_YES)) + if(SSticker.mode.check_predator_late_join(user, 0)) + user.close_spawn_windows() + SSticker.mode.attempt_to_join_as_predator(user) + else + to_chat(user, SPAN_WARNING(user.client.auto_lang(LANGUAGE_LOBBY_NO_JOIN_HUNT))) + user.new_player_panel() diff --git a/code/datums/factions/zombie.dm b/code/datums/factions/zombie.dm new file mode 100644 index 000000000000..b3e0778b7056 --- /dev/null +++ b/code/datums/factions/zombie.dm @@ -0,0 +1,60 @@ +/datum/faction/zombie + name = NAME_FACTION_ZOMBIE + desc = "Unknow virus that makes all dead rise back and fight, for additional information required access 6X-X / XC-X or higher..." + + faction_name = FACTION_ZOMBIE + faction_tag = SIDE_FACTION_ZOMBIE + relations_pregen = RELATIONS_MAP_HOSTILE + organ_faction_iff_tag_type = /obj/item/faction_tag/organ/meshy_rooting_gland + +/datum/faction/zombie/get_join_status(mob/user, dat) + if(!user.client) + return + + if(SSticker.current_state < GAME_STATE_PLAYING || !SSticker.mode) + to_chat(src, SPAN_WARNING("The game hasn't started yet!")) + return + + var/list/zombie_list = list() + if(length(GLOB.zombie_landmarks)) + zombie_list += list("Underground Zombie" = "Underground Zombie") + + for(var/mob/living/carbon/human/A in GLOB.zombie_list) + if(!A.client && A.stat != DEAD) // Only living zombies + zombie_list += list(A.real_name = A) + + if(!length(zombie_list)) + to_chat(src, SPAN_DANGER("There are no available zombies.")) + return + + var/choice = tgui_input_list(usr, "Pick a Zombie:", "Join as Zombie", zombie_list) + if(!choice) + return + + if(!user.client || !user.mind) + return + + if(choice == "Underground Zombie") + if(!length(GLOB.zombie_landmarks)) + to_chat(src, SPAN_WARNING("Sorry, the last underground zombie just got taken.")) + return + + var/obj/effect/landmark/zombie/spawn_point = pick(GLOB.zombie_landmarks) + spawn_point.spawn_zombie(src) + return + + var/mob/living/carbon/human/zombie = zombie_list[choice] + + if(!zombie || QDELETED(zombie)) + return + + if(zombie.stat == DEAD) + to_chat(src, SPAN_WARNING("This zombie is dead!")) + return + + if(zombie.client) + to_chat(src, SPAN_WARNING("That player is still connected.")) + return + + user.mind.transfer_to(zombie, TRUE) + msg_admin_niche("[key_name(usr)] has joined as a [zombie].") diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 3e3e8cc140fe..d64d8eb2979c 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -10,8 +10,6 @@ var/memory - var/datum/entity/player_entity/player_entity = null - //put this here for easier tracking ingame var/datum/money_account/initial_account diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 8d48e30085f5..1eb9ccd69327 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -200,7 +200,7 @@ var/datum/statistic_groups/new_group = statistics[faction_to_get] if(!new_group) new_group = new() - new_group.group_name = GLOB.faction_datum[faction_to_get].name + new_group.group_name = GLOB.faction_datums[faction_to_get].name new_group.group_parameter = faction_to_get new_group.player = src statistics[faction_to_get] = new_group diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index 7fbf2cc30581..12558641af0a 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -26,6 +26,11 @@ return FALSE return TRUE +/mob/proc/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) + if(statistic_exempt || !client || !client.player_data || !faction) + return FALSE + return TRUE + /mob/proc/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) if(statistic_exempt || !client || !client.player_data || !faction) return FALSE @@ -128,6 +133,15 @@ if(weapon) track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) +/mob/living/carbon/human/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + /mob/living/carbon/human/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) @@ -238,6 +252,15 @@ if(weapon) track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) +/mob/living/carbon/xenomorph/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) + . = ..() + if(!.) + return FALSE + + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + if(weapon) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + /mob/living/carbon/xenomorph/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) diff --git a/code/game/gamemodes/cm_process.dm b/code/game/gamemodes/cm_process.dm index d6519bbcd887..fc47fa6f4636 100644 --- a/code/game/gamemodes/cm_process.dm +++ b/code/game/gamemodes/cm_process.dm @@ -196,6 +196,8 @@ GLOBAL_VAR_INIT(next_admin_bioscan, 30 MINUTES) for(var/mob/M in GLOB.player_list) if(M.z && (M.z in z_levels) && M.stat != DEAD && !istype(M.loc, /turf/open/space)) //If they have a z var, they are on a turf. + if(!M.faction || (M.faction.need_round_end_check && !M.faction.can_delay_round_end(M))) + continue if(ishuman(M) && !isyautja(M) && !(M.status_flags & XENO_HOST) && !iszombie(M)) var/mob/living/carbon/human/H = M if(((H.species && H.species.name == "Human") || (H.is_important)) && !H.hivenumber) //only real humans count, or those we have set to also be included @@ -206,9 +208,6 @@ GLOBAL_VAR_INIT(next_admin_bioscan, 30 MINUTES) var/mob/living/carbon/xenomorph/xeno = M if(!xeno.counts_for_roundend) continue - var/datum/hive_status/xeno_hive = GLOB.hive_datum[xeno.hivenumber] - if(!xeno_hive || (xeno_hive.need_round_end_check && !xeno_hive.can_delay_round_end(xeno))) - continue if (A.flags_area & AREA_AVOID_BIOSCAN) continue num_xenos++ diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 9b8257ae146e..5e02a475a42b 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -222,7 +222,7 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/list/mobs = list() for(var/faction_name in factions_pool) var/faction_to_get = factions_pool[faction_name] - var/datum/faction/faction = GLOB.faction_datum[faction_to_get] + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] for(var/mob/mob in faction.totalMobs) if(mob.client) mobs += mob diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 80044e2fab3e..823ea9259385 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -62,7 +62,6 @@ icon_state = "id" item_state = "card-id" var/access = list() - var/faction = FACTION_NEUTRAL var/list/faction_group /// The name registered_name on the card diff --git a/code/modules/cm_tech/implements/xeno_handler.dm b/code/modules/cm_tech/implements/xeno_handler.dm index cbafec7499ee..7c35bf9def84 100644 --- a/code/modules/cm_tech/implements/xeno_handler.dm +++ b/code/modules/cm_tech/implements/xeno_handler.dm @@ -38,9 +38,9 @@ else var/picked = pick(/mob/living/carbon/xenomorph/drone, /mob/living/carbon/xenomorph/spitter, /mob/living/carbon/xenomorph/lurker) - new_mob = new picked(spawn_loc, null, XENO_HIVE_TAMED) - var/mob/living/carbon/xenomorph/X = new_mob - X.iff_tag = new /obj/item/iff_tag/pmc_handler(X) + new_mob = new picked(spawn_loc, null, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) + new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_USCM]) + new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) if(M) M.transfer_to(new_mob, TRUE) else diff --git a/code/modules/gear_presets/_select_equipment.dm b/code/modules/gear_presets/_select_equipment.dm index 138e091ad5a4..2fd1ebaced4f 100644 --- a/code/modules/gear_presets/_select_equipment.dm +++ b/code/modules/gear_presets/_select_equipment.dm @@ -115,7 +115,6 @@ if(assignment) ID.name += " ([assignment])" ID.access = access.Copy(1, 0) - ID.faction = faction ID.faction_group = faction_group.Copy() ID.assignment = assignment ID.rank = rank @@ -126,7 +125,6 @@ ID.paygrade = load_rank(new_human) || ID.paygrade ID.uniform_sets = uniform_sets new_human.equip_to_slot_or_del(ID, WEAR_ID) - new_human.faction = faction new_human.faction_group = faction_group.Copy() if(new_human.mind) new_human.mind.name = new_human.real_name @@ -138,6 +136,25 @@ new_human.set_languages(languages) /datum/equipment_preset/proc/load_preset(mob/living/carbon/human/new_human, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE) + if(!istype(new_human, /mob/living/carbon/human/dummy)) + var/datum/faction/mob_faction + if(!faction) + mob_faction = GLOB.faction_datums[FACTION_NEUTRAL] + else + mob_faction = GLOB.faction_datums[faction] + + if(mob_faction && (!new_human.faction || force_update_faction)) + mob_faction.add_mob(new_human) + if(mob_faction.organ_faction_iff_tag_type) + if(new_human.organ_faction_tag) + QDEL_NULL(new_human.organ_faction_tag) + new_human.organ_faction_tag = new mob_faction.organ_faction_iff_tag_type(new_human, mob_faction) + + if(mob_faction.faction_iff_tag_type) + if(new_human.faction_tag) + QDEL_NULL(new_human.faction_tag) + new_human.faction_tag = new mob_faction.faction_iff_tag_type(new_human, mob_faction) + if(!new_human.hud_used) new_human.create_hud() diff --git a/code/modules/gear_presets/other.dm b/code/modules/gear_presets/other.dm index 4d7ef9bda559..876beedf5fe4 100644 --- a/code/modules/gear_presets/other.dm +++ b/code/modules/gear_presets/other.dm @@ -602,6 +602,12 @@ //Overloading the function to be able to spawn gear first /datum/equipment_preset/other/zombie/load_preset(mob/living/carbon/human/new_human, randomise = FALSE) + GLOB.faction_datum[faction].add_mob(new_human) + if(new_human.faction?.organ_faction_iff_tag_type) + if(new_human.organ_faction_tag) + QDEL_NULL(new_human.organ_faction_tag) + new_human.organ_faction_tag = new new_human.faction.organ_faction_iff_tag_type(new_human, new_human.faction) + if(randomise) load_name(new_human) load_skills(new_human) //skills are set before equipment because of skill restrictions on certain clothes. @@ -628,7 +634,6 @@ uniform.has_sensor = UNIFORM_HAS_SENSORS uniform.sensor_faction = FACTION_COLONIST new_human.job = "Zombie" - new_human.faction = faction return ..() /datum/equipment_preset/other/zombie/load_race(mob/living/carbon/human/new_human) @@ -767,17 +772,10 @@ new_human.equip_to_slot_or_del(new /obj/item/clothing/gloves/marine/veteran(new_human), WEAR_HANDS) //*****************************************************************************************************/ -/datum/equipment_preset/other/xeno_cultist/load_status(mob/living/carbon/human/new_human, hivenumber = XENO_HIVE_NORMAL) +/datum/equipment_preset/other/xeno_cultist/load_status(mob/living/carbon/human/new_human) if(SSticker.mode && new_human.mind) SSticker.mode.xenomorphs += new_human.mind - var/datum/hive_status/hive = GLOB.hive_datum[hivenumber] - if(hive) - new_human.faction = hive.internal_faction - if(hive.leading_cult_sl == new_human) - hive.leading_cult_sl = null - new_human.hivenumber = hivenumber - GLOB.xeno_cultists += new_human var/list/huds_to_add = list(MOB_HUD_XENO_INFECTION, MOB_HUD_XENO_STATUS) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index d4db6bccde83..442967bdd063 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -462,13 +462,10 @@ Works together with spawning an observer, noted above. if(!can_reenter_corpse) away_timer = 300 //They'll never come back, so we can max out the timer right away. - if(GLOB.round_statistics) - GLOB.round_statistics.update_panel_data() track_death_calculations() //This needs to be done before mind is nullified if(ghost.mind) ghost.mind.original = ghost - else if(ghost.mind && ghost.mind.player_entity) //Use else here because track_death_calculations() already calls this. - ghost.mind.player_entity.update_panel_data(GLOB.round_statistics) + else if(ghost.client) ghost.mind.original = src mind = null @@ -516,8 +513,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/living/proc/do_ghost() if(stat == DEAD) - if(mind && mind.player_entity) - mind.player_entity.update_panel_data(GLOB.round_statistics) + if(client && client.player_data) + client.player_data.setup_statistics() ghostize(TRUE) else var/list/options = list("Ghost", "Stay in body") @@ -963,55 +960,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Join as Zombie" set desc = "Select an alive but logged-out Zombie to rejoin the game." - if (!client) - return - - if(SSticker.current_state < GAME_STATE_PLAYING || !SSticker.mode) - to_chat(src, SPAN_WARNING("The game hasn't started yet!")) - return - - var/list/zombie_list = list() - if(length(GLOB.zombie_landmarks)) - zombie_list += list("Underground Zombie" = "Underground Zombie") - for(var/mob/living/carbon/human/A in GLOB.zombie_list) - if(!A.client && A.stat != DEAD) // Only living zombies - zombie_list += list(A.real_name = A) - - if(!length(zombie_list)) - to_chat(src, SPAN_DANGER("There are no available zombies.")) - return - - var/choice = tgui_input_list(usr, "Pick a Zombie:", "Join as Zombie", zombie_list) - if(!choice) - return - - if(!client || !mind) - return - - if(choice == "Underground Zombie") - if(!length(GLOB.zombie_landmarks)) - to_chat(src, SPAN_WARNING("Sorry, the last underground zombie just got taken.")) - return - var/obj/effect/landmark/zombie/spawn_point = pick(GLOB.zombie_landmarks) - spawn_point.spawn_zombie(src) - return - - var/mob/living/carbon/human/Z = zombie_list[choice] - - if(!Z || QDELETED(Z)) - return - - if(Z.stat == DEAD) - to_chat(src, SPAN_WARNING("This zombie is dead!")) - return - - if(Z.client) - to_chat(src, SPAN_WARNING("That player is still connected.")) - return - - mind.transfer_to(Z, TRUE) - msg_admin_niche("[key_name(usr)] has joined as a [Z].") - + GLOB.faction_datum[FACTION_ZOMBIE]?.get_join_status(src) /mob/dead/verb/join_as_freed_mob() set category = "Ghost.Join" @@ -1181,14 +1130,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp ref = WEAKREF(H) GLOB.data_core.manifest_modify(name, ref, null, null, "*Deceased*") - -/mob/dead/observer/verb/view_kill_feed() +/mob/dead/observer/verb/view_stats() set category = "Ghost.View" - set name = "View Kill Feed" - set desc = "View global kill statistics tied to the game." + set name = "View Statistics" + set desc = "View global and player statistics tied to the game." - if(GLOB.round_statistics) - GLOB.round_statistics.show_kill_feed(src) + if(client?.player_data?.player_entity) + client.player_data.player_entity.tgui_interact(src) /mob/dead/observer/get_status_tab_items() . = ..() diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index 4bc4abf7036c..58c78574a819 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -146,6 +146,7 @@ if(SSticker.mode.is_in_endgame == TRUE && !is_mainship_level(M.z) && !(human.faction in FACTION_LIST_ERT)) escaped += list(serialized) +// I will KRILL you, HOW DARE YOU DID THIS WAY... I need to do one more shit around or just put some sticks and leave it for somebody ELSE, thanks!!! else if(human.faction in FACTION_LIST_WY) wy += list(serialized) else if(issynth(human) && !isinfiltratorsynthetic(human)) diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index 0930d02f3601..3c4cd66f35d5 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -56,6 +56,6 @@ /mob/living/brain/synth/ghost() set desc = "Relinquish your sentience and visit the land of the past." - if(mind && mind.player_entity) - mind.player_entity.update_panel_data(GLOB.round_statistics) + if(client && client.player_data) + client.player_data.setup_statistics() ghostize(TRUE) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index f95d389ed76b..becfdf97f7f7 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -3,6 +3,10 @@ hunter_data = new /datum/huntdata hunter_data.name = "[src.real_name]'s Hunter Data" hunter_data.owner = src + if(faction?.organ_faction_iff_tag_type && !organ_faction_tag) + organ_faction_tag = new faction.organ_faction_iff_tag_type(src, faction) + if(faction?.faction_iff_tag_type && !faction_tag) + faction_tag = new faction.faction_iff_tag_type(src, faction) /mob/living/carbon/Life(delta_time) ..() diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index eed2dce5f7a8..36de59cdd868 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -346,12 +346,11 @@ /// If TRUE, the xeno cannot slash anything var/cannot_slash = FALSE -/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/old_xeno, hivenumber) +/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/old_xeno, datum/faction/faction_to_set) + var/area/A = get_area(src) + if(A && A.statistic_exempt || SSticker.mode?.round_finished) + statistic_exempt = TRUE - if(old_xeno && old_xeno.hivenumber) - src.hivenumber = old_xeno.hivenumber - else if(hivenumber) - src.hivenumber = hivenumber //putting the organ in for research if(organ_value != 0) var/obj/item/organ/xeno/organ = new() //give @@ -360,11 +359,6 @@ organ.caste_origin = caste_type organ.icon_state = get_organ_icon() - var/datum/hive_status/hive = GLOB.hive_datum[src.hivenumber] - - if(hive) - hive.add_xeno(src) - wound_icon_holder = new(null, src) vis_contents += wound_icon_holder @@ -372,10 +366,21 @@ ///Handle transferring things from the old Xeno if we have one in the case of evolve, devolve etc. if(old_xeno) - src.nicknumber = old_xeno.nicknumber - src.life_kills_total = old_xeno.life_kills_total - src.life_damage_taken_total = old_xeno.life_damage_taken_total - src.evolution_stored = old_xeno.evolution_stored + old_xeno.faction.add_mob(src) + faction.remove_mob(old_xeno) + nicknumber = old_xeno.nicknumber + life_kills_total = old_xeno.life_kills_total + life_damage_taken_total = old_xeno.life_damage_taken_total + evolution_stored = old_xeno.evolution_stored + if(old_xeno.organ_faction_tag) + organ_faction_tag = old_xeno.organ_faction_tag + organ_faction_tag.forceMove(src) + old_xeno.faction_tag = null + + if(old_xeno.faction_tag) + faction_tag = old_xeno.faction_tag + faction_tag.forceMove(src) + old_xeno.faction_tag = null for(var/datum/language/language as anything in old_xeno.languages) add_language(language.name)//Make sure to keep languages (mostly for event Queens that know English) @@ -395,10 +400,8 @@ old_xeno.drop_inv_item_on_ground(item) old_xeno.empty_gut() - if(old_xeno.iff_tag) - iff_tag = old_xeno.iff_tag - iff_tag.forceMove(src) - old_xeno.iff_tag = null + else if(faction_to_set) + faction_to_set.add_mob(src) if(hive) for(var/trait in hive.hive_inherant_traits) @@ -492,10 +495,6 @@ var/selected_caste = GLOB.xeno_datum_list[caste_type]?.type hive.used_slots[selected_caste]++ - //Statistics - var/area/current_area = get_area(src) - if(current_area && current_area.statistic_exempt) - statistic_exempt = TRUE if(GLOB.round_statistics && !statistic_exempt) GLOB.round_statistics.track_new_participant(faction, 1) diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 311a622d512a..b9f27d188942 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -68,11 +68,11 @@ if(ismob(LM.thrower)) M = LM.thrower if(M.faction == faction) - M.track_friendly_hit(initial(I.name)) - M.track_friendly_damage(initial(I.name), src, power) + M.track_friendly_hit(initial(O.name)) + M.track_friendly_damage(initial(O.name), src, damage_done) else - M.track_hit(initial(I.name)) - M.track_damage(initial(I.name), src, power) + M.track_hit(initial(O.name)) + M.track_damage(initial(O.name), src, damage_done) var/client/assailant = M.client if(assailant) src.attack_log += text("\[[time_stamp()]\] Has been hit with \a [O], thrown by [key_name(M)]") diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 829379eb28b6..bce0d9857433 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -298,68 +298,18 @@ /mob/new_player/proc/LateChoices() - var/mills = world.time // 1/10 of a second, not real milliseconds but whatever - //var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence... or something - var/mins = (mills % 36000) / 600 - var/hours = mills / 36000 - - var/dat = "
" - dat += "Round Duration: [floor(hours)]h [floor(mins)]m
" - - if(SShijack) - switch(SShijack.evac_status) - if(EVACUATION_STATUS_INITIATED) - dat += "The [MAIN_SHIP_NAME] is being evacuated.
" - - dat += "Choose from the following open positions:
" - var/roles_show = FLAG_SHOW_ALL_JOBS - - for(var/i in GLOB.RoleAuthority.roles_for_mode) - var/datum/job/J = GLOB.RoleAuthority.roles_for_mode[i] - if(!GLOB.RoleAuthority.check_role_entry(src, J, TRUE)) + var/list/faction_to_get_list = list() + for(var/faction_to_get in SSticker.mode.factions_pool) + var/datum/faction/faction = GLOB.faction_datum[SSticker.mode.factions_pool[faction_to_get]] + if(!faction.spawning_enabled || (!faction.force_spawning && !faction.weight_act[SSticker.mode.name])) continue - var/active = 0 - // Only players with the job assigned and AFK for less than 10 minutes count as active - for(var/mob/M in GLOB.player_list) - if(M.client && M.job == J.title) - active++ - if(roles_show & FLAG_SHOW_CIC && GLOB.ROLES_CIC.Find(J.title)) - dat += "Command:
" - roles_show ^= FLAG_SHOW_CIC - - else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && GLOB.ROLES_AUXIL_SUPPORT.Find(J.title)) - dat += "
Auxiliary Combat Support:
" - roles_show ^= FLAG_SHOW_AUXIL_SUPPORT - - else if(roles_show & FLAG_SHOW_MISC && GLOB.ROLES_MISC.Find(J.title)) - dat += "
Other:
" - roles_show ^= FLAG_SHOW_MISC - - else if(roles_show & FLAG_SHOW_POLICE && GLOB.ROLES_POLICE.Find(J.title)) - dat += "
Military Police:
" - roles_show ^= FLAG_SHOW_POLICE + faction_to_get_list += faction_to_get - else if(roles_show & FLAG_SHOW_ENGINEERING && GLOB.ROLES_ENGINEERING.Find(J.title)) - dat += "
Engineering:
" - roles_show ^= FLAG_SHOW_ENGINEERING - - else if(roles_show & FLAG_SHOW_REQUISITION && GLOB.ROLES_REQUISITION.Find(J.title)) - dat += "
Requisitions:
" - roles_show ^= FLAG_SHOW_REQUISITION - - else if(roles_show & FLAG_SHOW_MEDICAL && GLOB.ROLES_MEDICAL.Find(J.title)) - dat += "
Medbay:
" - roles_show ^= FLAG_SHOW_MEDICAL - - else if(roles_show & FLAG_SHOW_MARINES && GLOB.ROLES_MARINES.Find(J.title)) - dat += "
Marines:
" - roles_show ^= FLAG_SHOW_MARINES - - dat += "[J.disp_title] ([J.current_positions]) (Active: [active])
" - - dat += "
" - show_browser(src, dat, "Late Join", "latechoices", "size=420x700") + var/choice = tgui_input_list(src, "Choose faction to join:", "Factions", faction_to_get_list) + if(!choice) + return + GLOB.faction_datum[SSticker.mode.factions_pool[choice]].get_join_status(src) /mob/new_player/proc/create_character(is_late_join = FALSE) spawning = TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index b612ac349685..52f36bda5a48 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -564,16 +564,37 @@ #include "code\datums\entities\ticket.dm" #include "code\datums\entities\logs\player_times_log.dm" #include "code\datums\factions\clf.dm" -#include "code\datums\factions\cmb.dm" +#include "code\datums\factions\colonists.dm" #include "code\datums\factions\contractor.dm" +#include "code\datums\factions\dutch's_dozen.dm" #include "code\datums\factions\faction.dm" -#include "code\datums\factions\helpers.dm" -#include "code\datums\factions\pmc.dm" -#include "code\datums\factions\royalmarinescommando.dm" +#include "code\datums\factions\freelancer.dm" +#include "code\datums\factions\gladiator.dm" +#include "code\datums\factions\hefa_order.dm" +#include "code\datums\factions\mercenary.dm" +#include "code\datums\factions\pirate.dm" +#include "code\datums\factions\pizza_delivery.dm" +#include "code\datums\factions\ress.dm" +#include "code\datums\factions\souto.dm" +#include "code\datums\factions\threewe.dm" #include "code\datums\factions\upp.dm" #include "code\datums\factions\uscm.dm" +#include "code\datums\factions\wy.dm" +#include "code\datums\factions\xeno.dm" +#include "code\datums\factions\yautja.dm" +#include "code\datums\factions\zombie.dm" +#include "code\datums\factions\_misc\helpers.dm" +#include "code\datums\factions\_modules\module.dm" +#include "code\datums\factions\_modules\relations.dm" +#include "code\datums\factions\twe\commando.dm" +#include "code\datums\factions\uscm\cmb.dm" +#include "code\datums\factions\uscm\marine.dm" +#include "code\datums\factions\uscm\marsoc.dm" +#include "code\datums\factions\wy\pmc.dm" #include "code\datums\helper_datums\getrev.dm" +#include "code\datums\factions\wy\deathsquad.dm" #include "code\datums\helper_datums\stack_end_detector.dm" +#include "code\datums\factions\_misc\iff_tag.dm" #include "code\datums\helper_datums\teleport.dm" #include "code\datums\helper_datums\topic_input.dm" #include "code\datums\keybinding\_keybindings.dm" From e427452522cdaa558975042c2e7bb5a0bcf3e29b Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:01:34 +0500 Subject: [PATCH 06/69] CR3 --- code/datums/factions/_modules/relations.dm | 4 +- code/datums/factions/faction.dm | 69 +++------------------- code/game/gamemodes/game_mode.dm | 12 ++++ code/modules/client/preferences.dm | 64 +++++++++++++------- 4 files changed, 66 insertions(+), 83 deletions(-) diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm index 3366c6a2af3a..e59628b4aadf 100644 --- a/code/datums/factions/_modules/relations.dm +++ b/code/datums/factions/_modules/relations.dm @@ -30,9 +30,9 @@ relations[target_faction.faction_name] = clamp(relations[target_faction.faction_name] + opinion, RELATIONS_WAR[1], RELATIONS_MAX) /datum/faction_module/relations/tgui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, source, ui) + ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, source, "FactionRelations", "[faction] Relations") + ui = new(user, src, "FactionRelations", "[faction] Relations") ui.open() ui.set_autoupdate(TRUE) diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index 7b21c0c86750..579c8b045204 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -169,10 +169,6 @@ /datum/faction/proc/get_antag_guns_sorted_equipment() return list() -/datum/faction/proc/store_objective(datum/cm_objective/O) - if(objective_memory) - objective_memory.store_objective(O) - //FACTION INFO PANEL /datum/faction/ui_state(mob/user) return GLOB.not_incapacitated_state @@ -207,19 +203,8 @@ switch(action) if("relations") - relations_datum.tgui_interact(usr) - if("tasks") - task_interface.tgui_interact(usr) - if("clues") - if(!skillcheck(usr, SKILL_INTEL, SKILL_INTEL_TRAINED)) - to_chat(usr, SPAN_WARNING("You have no access to the [name] intel network.")) - return - objective_interface.tgui_interact(usr) - if("researchs") - if(!skillcheck(usr, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED)) - to_chat(usr, SPAN_WARNING("You have no access to the [name] research network.")) - return - research_objective_interface.tgui_interact(usr) + var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] + module.tgui_interact(usr) if("status") get_faction_info(usr) @@ -278,66 +263,30 @@ */ dat = "
" - dat += "[user.client.auto_lang(LANGUAGE_LOBBY_ROUND_TIME)]: [DisplayTimeText(world.time, language = user.client.language)]
" - dat += "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CHOSE)]:
" + dat += "Round Time: [DisplayTimeText(world.time)]
" + dat += "Chose from lower opened positions:
" dat += additional_join_status(user) if(!latejoin_enabled) - dat = "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CLOSED)]:
" - - else if(!SSautobalancer.can_join(src)) - dat = "[user.client.auto_lang(LANGUAGE_JS_BALANCE_ISSUE)]:
" + dat = "You can't right now join round for that faction:
" else var/list/roles = roles_list[SSticker.mode.name] for(var/role in roles) - var/datum/job/job = SSticker.role_authority.roles_by_name[role] - var/check_result = SSticker.role_authority.check_role_entry(user, job, src, TRUE) + var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role] + var/check_result = GLOB.RoleAuthority.check_role_entry(user, job, src, TRUE) var/active = 0 for(var/mob/mob in GLOB.player_list) if(mob.client && mob.job == job.title) active++ if(check_result) - dat += "[job.disp_title] ([job.current_positions]): [check_result] ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" + dat += "[job.disp_title] ([job.current_positions]): [check_result] (Active: [active])
" else - dat += "[job.disp_title] ([job.current_positions]) ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" + dat += "[job.disp_title] ([job.current_positions]) (Active: [active])
" dat += "
" show_browser(user, dat, "Late Join", "latechoices", "size=420x700") /datum/faction/proc/additional_join_status(mob/new_player/user, dat = "") return -/* - if(roles_show & FLAG_SHOW_CIC && ROLES_CIC & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_COM)]:
" - roles_show ^= FLAG_SHOW_CIC - - else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && ROLES_AUXIL_SUPPORT & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_SUP)]:
" - roles_show ^= FLAG_SHOW_AUXIL_SUPPORT - - else if(roles_show & FLAG_SHOW_MISC && ROLES_MISC & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_OTH)]:
" - roles_show ^= FLAG_SHOW_MISC - - else if(roles_show & FLAG_SHOW_POLICE && ROLES_POLICE & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_POL)]:
" - roles_show ^= FLAG_SHOW_POLICE - - else if(roles_show & FLAG_SHOW_ENGINEERING && ROLES_ENGINEERING & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ENG)]:
" - roles_show ^= FLAG_SHOW_ENGINEERING - - else if(roles_show & FLAG_SHOW_REQUISITION && ROLES_REQUISITION & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CAG)]:
" - roles_show ^= FLAG_SHOW_REQUISITION - - else if(roles_show & FLAG_SHOW_MEDICAL && ROLES_MEDICAL & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MED)]:
" - roles_show ^= FLAG_SHOW_MEDICAL - - else if(roles_show & FLAG_SHOW_MARINES && ROLES_MARINES & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MAR)]:
" - roles_show ^= FLAG_SHOW_MARINES -*/ diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 5e02a475a42b..ef64e31ee9ec 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -33,6 +33,10 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/static_comms_amount = 0 var/obj/structure/machinery/computer/shuttle/dropship/flight/active_lz = null + var/list/active_roles_mappings_pool = list() + var/list/active_roles_pool = list() + var/list/factions_pool = list() + var/list/roles_to_roll var/corpses_to_spawn = 0 @@ -44,6 +48,14 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t if(taskbar_icon) GLOB.available_taskbar_icons |= taskbar_icon + for(var/faction_to_get in FACTION_LIST_ALL) + var/datum/faction/faction = GLOB.faction_datum[faction_to_get] + if(length(faction.roles_list[name])) + factions_pool[faction.name] = faction.faction_name + active_roles_mappings_pool += faction.role_mappings[name] + for(var/i in faction.roles_list[name]) + active_roles_pool += i + /datum/game_mode/proc/announce() //to be calles when round starts to_world("Notice: [src] did not define announce()") diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index b4ee572d8d2d..3538bf12daff 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -235,6 +235,8 @@ GLOBAL_LIST_INIT(bgstate_options, list( var/unlock_content = 0 + var/datum/faction/observing_faction + var/current_menu = MENU_MARINE /// if this client has custom cursors enabled @@ -667,25 +669,26 @@ GLOBAL_LIST_INIT(bgstate_options, list( * * width - Screen' width. * * height - Screen's height. */ -/datum/preferences/proc/SetChoices(mob/user, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) +/datum/preferences/proc/set_choices(mob/user, list/roles_pool, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) if(!GLOB.RoleAuthority) return + if(!observing_faction) + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + + if(!length(roles_pool)) + roles_pool = observing_faction.roles_list[SSticker.mode.name] + var/HTML = "" HTML += "
" HTML += "Choose occupation chances
Unavailable occupations are crossed out.

" + HTML += "Selected faction: [observing_faction]

" HTML += "
Done

" // Easier to press up here. HTML += "
" // Table within a table for alignment, also allows you to easily add more colomns. HTML += "" var/index = -1 - //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows. - - var/list/active_role_names = GLOB.gamemode_roles[GLOB.master_mode] - if(!active_role_names) - active_role_names = GLOB.ROLES_DISTRESS_SIGNAL - - for(var/role_name as anything in active_role_names) + for(var/role_name as anything in roles_pool) var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role_name] if(!job) debug_log("Missing job for prefs: [role_name]") @@ -752,6 +755,8 @@ GLOBAL_LIST_INIT(bgstate_options, list( HTML += "
" HTML += "
" + HTML += "

Change faction

" + if(user.client?.prefs) //Just makin sure var/b_color = "green" var/msg = "Get random job if preferences unavailable" @@ -785,25 +790,26 @@ GLOBAL_LIST_INIT(bgstate_options, list( * * width - Screen' width. * * height - Screen's height. */ -/datum/preferences/proc/set_job_slots(mob/user, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) +/datum/preferences/proc/set_job_slots(mob/user, list/roles_pool, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) if(!GLOB.RoleAuthority) return + if(!observing_faction) + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + + if(!length(roles_pool)) + roles_pool = observing_faction.roles_list[SSticker.mode.name] + var/HTML = "" HTML += "
" HTML += "Assign character slots to jobs.
Unavailable occupations are crossed out.

" + HTML += "Selected faction: [observing_faction]

" HTML += "
Done

" // Easier to press up here. HTML += "
" // Table within a table for alignment, also allows you to easily add more colomns. HTML += "" var/index = -1 - //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows. - - var/list/active_role_names = GLOB.gamemode_roles[GLOB.master_mode] - if(!active_role_names) - active_role_names = GLOB.ROLES_DISTRESS_SIGNAL - - for(var/role_name as anything in active_role_names) + for(var/role_name as anything in roles_pool) var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role_name] if(!job) debug_log("Missing job for prefs: [role_name]") @@ -833,6 +839,8 @@ GLOBAL_LIST_INIT(bgstate_options, list( HTML += "
" HTML += "

" + HTML += "

Change faction

" + var/b_color var/msg if(toggle_prefs & TOGGLE_START_JOIN_CURRENT_SLOT) @@ -905,7 +913,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( SetJobDepartment(job, priority) - SetChoices(user) + set_choices(user) return 1 /datum/preferences/proc/ResetJobs() @@ -993,7 +1001,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( ShowChoices(user) if("reset") ResetJobs() - SetChoices(user) + set_choices(user) if("random") if(alternate_option == GET_RANDOM_JOB || alternate_option == BE_MARINE || alternate_option == RETURN_TO_LOBBY) alternate_option++ @@ -1001,12 +1009,19 @@ GLOBAL_LIST_INIT(bgstate_options, list( alternate_option = 0 else return 0 - SetChoices(user) + set_choices(user) if("input") var/priority = text2num(href_list["target_priority"]) SetJob(user, href_list["text"], priority) + if("faction") + var/choice = tgui_input_list(user, "Choose faction to observer roles:", "Factions", SSticker.mode.factions_pool) + if(!choice) + return + + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] + set_choices(user) else - SetChoices(user) + set_choices(user) return TRUE if("job_slot") switch(href_list["task"]) @@ -1024,6 +1039,13 @@ GLOBAL_LIST_INIT(bgstate_options, list( if("reset") reset_job_slots() set_job_slots(user) + if("faction") + var/choice = tgui_input_list(user, "Choose faction to observer roles:", "Factions", SSticker.mode.factions_pool) + if(!choice) + return + + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] + set_job_slots(user) else set_job_slots(user) return TRUE @@ -1766,7 +1788,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return pref_special_job_options[job.title] = new_special_job_variant - SetChoices(user) + set_choices(user) return else switch(href_list["preference"]) From 6c63adb7d915129f4a1576a5cd2c57ee4ae70bfa Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:04:24 +0500 Subject: [PATCH 07/69] a2 --- code/__DEFINES/statistic.dm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index 3351e9119fe6..a1baed71dd6f 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -23,6 +23,7 @@ #define STATISTICS_SCREAM "Scream" #define STATISTICS_HIT "Hit" #define STATISTICS_FF_HIT "FF Hit" +#define STATISTICS_EXPLODED_MOBS "Blowjobs Done" #define STATISTICS_SLASH "Slash" #define STATISTICS_REVIVE "Revive" #define STATISTICS_REVIVED "Revived" @@ -65,7 +66,7 @@ #define STATISTICS_REPAIR_GENERATOR "Generators Repaired" #define STATISTICS_UPGRADE_TURRETS "Defenses Upgraded" #define STATISTICS_REPAIR_APC "APCs Repaired" -#define STATISTICS_DEFENSES_BUILT "Defenses Built" +#define STATISTICS_DEFENSES_BUILT "Defenses Built" // OOD #define STATISTICS_CORGI "Corgis Murdered" #define STATISTICS_CAT "Cats Murdered" @@ -77,12 +78,12 @@ #define STATISTICS_SURGERY_BRAIN "Brains Mended" #define STATISTICS_SURGERY_EYE "Eyes Mended" #define STATISTICS_SURGERY_LARVA "Larvae Removed" -#define STATISTICS_SURGERY_NECRO "Necro Limbs Fixed" +#define STATISTICS_SURGERY_NECRO "Necro Limbs Fixed" // OOD #define STATISTICS_SURGERY_SHRAPNEL "Shrapnel Removed" #define STATISTICS_SURGERY_AMPUTATE "Limbs Amputated" #define STATISTICS_SURGERY_ORGAN_REPAIR "Organs Repaired" -#define STATISTICS_SURGERY_ORGAN_ATTACH "Organs Implanted" -#define STATISTICS_SURGERY_ORGAN_REMOVE "Organs Harvested" +#define STATISTICS_SURGERY_ORGAN_ATTACH "Organs Implanted" // OOD +#define STATISTICS_SURGERY_ORGAN_REMOVE "Organs Harvested" // OOD #define STATISTICS_DESTRUCTION_WALLS "Walls Destroyed" #define STATISTICS_DESTRUCTION_DOORS "Doors Destroyed" From 0689d0a6cb6371d6aca2b461fcaee259c8dc72a0 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:06:59 +0500 Subject: [PATCH 08/69] a3 --- code/__DEFINES/statistic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index a1baed71dd6f..4bfc42d51a91 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -23,7 +23,7 @@ #define STATISTICS_SCREAM "Scream" #define STATISTICS_HIT "Hit" #define STATISTICS_FF_HIT "FF Hit" -#define STATISTICS_EXPLODED_MOBS "Blowjobs Done" +#define STATISTICS_EXPLODED_MOBS "Blowjobs Done" // :clueless_face: #define STATISTICS_SLASH "Slash" #define STATISTICS_REVIVE "Revive" #define STATISTICS_REVIVED "Revived" From 7f3e38893f26d2932bb1150fa7c6950b1b791cd7 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:28:34 +0500 Subject: [PATCH 09/69] CR4/A --- code/datums/mob_hud.dm | 7 +- code/game/gamemodes/cm_process.dm | 3 + .../gamemodes/colonialmarines/xenovsxeno.dm | 3 +- code/game/gamemodes/game_mode.dm | 3 +- code/game/jobs/job/antag/xeno/queen.dm | 4 +- code/game/jobs/job/antag/xeno/xenomorph.dm | 10 +-- .../antag/antag_guns_snowflake.dm | 19 ++--- .../vendor_types/antag/antag_guns_sorted.dm | 18 ++--- .../objects/items/devices/defibrillator.dm | 2 +- code/game/objects/structures/window.dm | 4 +- code/game/verbs/records.dm | 4 +- code/modules/client/preferences.dm | 8 +- .../cm_tech/implements/xeno_handler.dm | 6 +- code/modules/gear_presets/other.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 2 +- .../living/carbon/xenomorph/items/iff_tag.dm | 77 ------------------- code/modules/mob/new_player/new_player.dm | 31 ++++---- .../modules/projectiles/guns/flamer/flamer.dm | 1 + code/modules/projectiles/projectile.dm | 2 + .../modules/round_recording/round_recorder.dm | 2 +- colonialmarines.dme | 1 - 21 files changed, 65 insertions(+), 144 deletions(-) delete mode 100644 code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index 603f9a05d702..f65428001411 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -659,8 +659,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( return /mob/living/carbon/human/hud_set_squad() - var/datum/faction/F = get_faction(faction) - var/image/holder = hud_list[F.hud_type] + var/image/holder = hud_list[faction.hud_type] holder.icon_state = "hudblank" holder.overlays.Cut() @@ -668,7 +667,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( holder.overlays += image('icons/mob/hud/marine_hud.dmi', src, "hudmutineer") return - F.modify_hud_holder(holder, src) + faction.modify_hud_holder(holder, src) /mob/living/carbon/human/yautja/hud_set_squad() set waitfor = FALSE @@ -784,7 +783,7 @@ GLOBAL_DATUM(hud_icon_hudfocus, /image) // Vampire Execute HUD /mob/living/carbon/human/proc/update_execute_hud() var/image/execute_holder = hud_list[XENO_EXECUTE] - + execute_holder.icon_state = "hudblank" execute_holder.overlays.Cut() diff --git a/code/game/gamemodes/cm_process.dm b/code/game/gamemodes/cm_process.dm index fc47fa6f4636..8990ea14804c 100644 --- a/code/game/gamemodes/cm_process.dm +++ b/code/game/gamemodes/cm_process.dm @@ -7,6 +7,9 @@ #define MODE_INFESTATION_M_MINOR "Marine Minor Victory" #define MODE_INFESTATION_DRAW_DEATH "DRAW: Mutual Annihilation" +#define MODE_WISKEY_OUTPOST_X_MAJOR "Xenomorph Destroyed Marines" +#define MODE_WISKEY_OUTPOST_M_MAJOR "Marine Stay Alive" + #define MODE_INFECTION_ZOMBIE_WIN "Major Zombie Victory" #define MODE_BATTLEFIELD_W_MAJOR "Wey-Yu PMC Major Success" diff --git a/code/game/gamemodes/colonialmarines/xenovsxeno.dm b/code/game/gamemodes/colonialmarines/xenovsxeno.dm index e2e4547fc9a8..1e063c1a6568 100644 --- a/code/game/gamemodes/colonialmarines/xenovsxeno.dm +++ b/code/game/gamemodes/colonialmarines/xenovsxeno.dm @@ -239,8 +239,9 @@ if(!living_hives) round_finished = "No one has won." - else if (living_hives == 1) + else if(living_hives == 1) round_finished = "The [last_living_hive] has won." + SSticker.mode.faction_won = last_living_hive /////////////////////////////// //Checks if the round is over// diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index ef64e31ee9ec..bfee8cd0e023 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -33,6 +33,7 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/static_comms_amount = 0 var/obj/structure/machinery/computer/shuttle/dropship/flight/active_lz = null + var/datum/faction/faction_won = null var/list/active_roles_mappings_pool = list() var/list/active_roles_pool = list() var/list/factions_pool = list() @@ -49,7 +50,7 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t GLOB.available_taskbar_icons |= taskbar_icon for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datum[faction_to_get] + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] if(length(faction.roles_list[name])) factions_pool[faction.name] = faction.faction_name active_roles_mappings_pool += faction.role_mappings[name] diff --git a/code/game/jobs/job/antag/xeno/queen.dm b/code/game/jobs/job/antag/xeno/queen.dm index 144f8e42e6ad..7d793d5b0cf5 100644 --- a/code/game/jobs/job/antag/xeno/queen.dm +++ b/code/game/jobs/job/antag/xeno/queen.dm @@ -9,8 +9,8 @@ /datum/job/antag/xenos/queen/set_spawn_positions(count) return spawn_positions -/datum/job/antag/xenos/queen/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index) - SSticker.mode.pick_queen_spawn(human_to_transform, hive_index) +/datum/job/antag/xenos/queen/transform_to_xeno(mob/living/carbon/human/human_to_transform, faction_index) + SSticker.mode.pick_queen_spawn(human_to_transform, faction_index) /datum/job/antag/xenos/queen/announce_entry_message(mob/new_queen, account, whitelist_status) to_chat(new_queen, "You are now the alien queen!") diff --git a/code/game/jobs/job/antag/xeno/xenomorph.dm b/code/game/jobs/job/antag/xeno/xenomorph.dm index eeca16bc7f90..840230891623 100644 --- a/code/game/jobs/job/antag/xeno/xenomorph.dm +++ b/code/game/jobs/job/antag/xeno/xenomorph.dm @@ -23,12 +23,10 @@ . = ..() var/mob/living/carbon/human/H = . - transform_to_xeno(H, XENO_HIVE_NORMAL) + transform_to_xeno(H, FACTION_XENOMORPH_NORMAL) -/datum/job/antag/xenos/proc/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index) - var/datum/mind/new_xeno = human_to_transform.mind - new_xeno.setup_xeno_stats() - var/datum/hive_status/hive = GLOB.hive_datum[hive_index] +/datum/job/antag/xenos/proc/transform_to_xeno(mob/living/carbon/human/human_to_transform, faction_index) + var/datum/faction/faction = GLOB.faction_datums[faction_index] human_to_transform.first_xeno = TRUE human_to_transform.set_stat(UNCONSCIOUS) @@ -95,7 +93,7 @@ var/obj/item/alien_embryo/embryo = new /obj/item/alien_embryo(human_to_transform) //Put the initial larva in a host embryo.stage = 5 //Give the embryo a head-start (make the larva burst instantly) - embryo.hivenumber = hive.hivenumber + embryo.faction = faction /datum/job/antag/xenos/equip_job(mob/living/M) diff --git a/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm b/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm index 73a2c7346a4c..7a3e4293304f 100644 --- a/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm +++ b/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm @@ -16,24 +16,21 @@ vend_flags |= VEND_FACTION_THEMES /obj/structure/machinery/cm_vending/gear/antag_guns/get_listed_products(mob/user) - var/list/factions = GLOB.faction_datums if(!user) var/list/all_equipment = list() - for (var/i in 1 to length(factions)) - var/datum/faction/F = get_faction(factions[i]) - var/list/equipment = F.get_antag_guns_snowflake_equipment() - if(LAZYLEN(equipment)) + for(var/faction_to_get in FACTION_LIST_ALL) + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + var/list/equipment = faction.get_antag_guns_snowflake_equipment() + if(length(equipment)) all_equipment += equipment return all_equipment - var/mob/living/carbon/human/H = user - var/faction = H.faction ? H.faction : FACTION_CLF - if(!(faction in listed_products)) - var/datum/faction/F = get_faction(H.faction) - listed_products[faction] = F.get_antag_guns_snowflake_equipment() + var/mob/living/carbon/human/human = user + var/datum/faction/faction = human.faction ? human.faction : GLOB.faction_datums[FACTION_CLF] + if(!(faction.faction_name in listed_products)) + listed_products[faction.faction_name] = faction.get_antag_guns_snowflake_equipment() return listed_products[faction] - //--------------ESSENTIALS------------------------ /obj/effect/essentials_set/medic/upp diff --git a/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm b/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm index ab319f1eca1d..67be70dc9494 100644 --- a/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm +++ b/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm @@ -13,20 +13,18 @@ vend_flags |= VEND_FACTION_THEMES /obj/structure/machinery/cm_vending/sorted/cargo_guns/antag_guns/get_listed_products(mob/user) - var/list/factions = GLOB.faction_datums if(!user) var/list/all_equipment = list() - for (var/i in 1 to length(factions)) - var/datum/faction/F = get_faction(factions[i]) - var/list/equipment = F.get_antag_guns_sorted_equipment() - if(LAZYLEN(equipment)) + for(var/faction_to_get in FACTION_LIST_ALL) + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + var/list/equipment = faction.get_antag_guns_sorted_equipment() + if(length(equipment)) all_equipment += equipment return all_equipment - var/mob/living/carbon/human/H = user - var/faction = H.faction ? H.faction : FACTION_CLF - if(!(faction in listed_products)) - var/datum/faction/F = get_faction(H.faction) - listed_products[faction] = F.get_antag_guns_sorted_equipment() + var/mob/living/carbon/human/human = user + var/datum/faction/faction = human.faction ? human.faction : GLOB.faction_datums[FACTION_CLF] + if(!(faction.faction_name in listed_products)) + listed_products[faction.faction_name] = faction.get_antag_guns_sorted_equipment() return listed_products[faction] diff --git a/code/game/objects/items/devices/defibrillator.dm b/code/game/objects/items/devices/defibrillator.dm index 3b329a35f4de..370b0c1c64b6 100644 --- a/code/game/objects/items/devices/defibrillator.dm +++ b/code/game/objects/items/devices/defibrillator.dm @@ -218,7 +218,7 @@ H.apply_damage(-damage_heal_threshold, TOX) H.apply_damage(-damage_heal_threshold, CLONE) H.apply_damage(-H.getOxyLoss(), OXY) - user.track_heal_damage(initial(attached_to.name), H, attached_to.damage_heal_threshold * 3) + user.track_heal_damage(initial(name), H, damage_heal_threshold * 3) H.updatehealth() //Needed for the check to register properly if(!(H.species?.flags & NO_CHEM_METABOLIZATION)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 682dffa7e126..16e7c19bbbad 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -132,8 +132,8 @@ if(health > 0) return TRUE - if(istype(proj.firer, /mob)) - var/mob/user = proj.firer + if(istype(Proj.firer, /mob)) + var/mob/user = Proj.firer user.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) return TRUE diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index 3810bf7e99cb..750e0dafed79 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -161,7 +161,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) . = ..() .["medals"] = list() - for(var/datum/view_record/medal_view/medal as anything in get_medals(user)) + for(var/datum/view_record/statistic_medal/medal as anything in get_medals(user)) var/xeno_medal = FALSE if(medal.medal_type in GLOB.xeno_medals) xeno_medal = TRUE @@ -180,7 +180,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) .["medals"] += list(current_medal) /datum/medals_view_tgui/proc/get_medals(mob/user) - return DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id)) + return DB_VIEW(/datum/view_record/statistic_medal, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id)) /datum/medals_view_tgui/ui_state(mob/user) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3538bf12daff..a519bf1f53a6 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -674,7 +674,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return if(!observing_faction) - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] if(!length(roles_pool)) roles_pool = observing_faction.roles_list[SSticker.mode.name] @@ -795,7 +795,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return if(!observing_faction) - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] if(!length(roles_pool)) roles_pool = observing_faction.roles_list[SSticker.mode.name] @@ -1018,7 +1018,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( if(!choice) return - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] + observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[choice]] set_choices(user) else set_choices(user) @@ -1044,7 +1044,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( if(!choice) return - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] + observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[choice]] set_job_slots(user) else set_job_slots(user) diff --git a/code/modules/cm_tech/implements/xeno_handler.dm b/code/modules/cm_tech/implements/xeno_handler.dm index 7c35bf9def84..c85df2924181 100644 --- a/code/modules/cm_tech/implements/xeno_handler.dm +++ b/code/modules/cm_tech/implements/xeno_handler.dm @@ -38,9 +38,9 @@ else var/picked = pick(/mob/living/carbon/xenomorph/drone, /mob/living/carbon/xenomorph/spitter, /mob/living/carbon/xenomorph/lurker) - new_mob = new picked(spawn_loc, null, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) - new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_USCM]) - new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) + new_mob = new picked(spawn_loc, null, GLOB.faction_datums[FACTION_XENOMORPH_TAMED]) + new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datums[FACTION_USCM]) + new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datums[FACTION_XENOMORPH_TAMED]) if(M) M.transfer_to(new_mob, TRUE) else diff --git a/code/modules/gear_presets/other.dm b/code/modules/gear_presets/other.dm index 876beedf5fe4..692e57bc29d8 100644 --- a/code/modules/gear_presets/other.dm +++ b/code/modules/gear_presets/other.dm @@ -602,7 +602,7 @@ //Overloading the function to be able to spawn gear first /datum/equipment_preset/other/zombie/load_preset(mob/living/carbon/human/new_human, randomise = FALSE) - GLOB.faction_datum[faction].add_mob(new_human) + GLOB.faction_datums[faction].add_mob(new_human) if(new_human.faction?.organ_faction_iff_tag_type) if(new_human.organ_faction_tag) QDEL_NULL(new_human.organ_faction_tag) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 442967bdd063..40510cb9857e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -960,7 +960,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Join as Zombie" set desc = "Select an alive but logged-out Zombie to rejoin the game." - GLOB.faction_datum[FACTION_ZOMBIE]?.get_join_status(src) + GLOB.faction_datums[FACTION_ZOMBIE]?.get_join_status(src) /mob/dead/verb/join_as_freed_mob() set category = "Ghost.Join" diff --git a/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm b/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm deleted file mode 100644 index 4c63fc2b5923..000000000000 --- a/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm +++ /dev/null @@ -1,77 +0,0 @@ -/obj/item/iff_tag - name = "xenomorph IFF tag" - desc = "A tag containing a small IFF computer that gets inserted into the carapace of a xenomorph. You can modify the IFF groups by using an access tuner on it, or on the xeno if it's already implanted." - icon = 'icons/obj/items/xeno_tag.dmi' - icon_state = "xeno_tag" - var/list/faction_groups = list() - -/obj/item/iff_tag/attack(mob/living/carbon/xenomorph/xeno, mob/living/carbon/human/injector) - if(isxeno(xeno)) - if(xeno.stat == DEAD) - to_chat(injector, SPAN_WARNING("\The [xeno] is dead...")) - return - if(xeno.iff_tag) - to_chat(injector, SPAN_WARNING("\The [xeno] already has a tag inside it.")) - return - injector.visible_message(SPAN_NOTICE("[injector] starts forcing \the [src] into [xeno]'s carapace..."), SPAN_NOTICE("You start forcing \the [src] into [xeno]'s carapace...")) - if(!do_after(injector, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC, xeno, INTERRUPT_DIFF_LOC, BUSY_ICON_GENERIC)) - return - injector.visible_message(SPAN_NOTICE("[injector] forces \the [src] into [xeno]'s carapace!"), SPAN_NOTICE("You force \the [src] into [xeno]'s carapace!")) - xeno.iff_tag = src - injector.drop_inv_item_to_loc(src, xeno) - if(xeno.hive.hivenumber == XENO_HIVE_RENEGADE) //it's important to know their IFF settings for renegade - to_chat(xeno, SPAN_NOTICE("With the insertion of the device into your carapace, your instincts have changed compelling you to protect [english_list(faction_groups, "no one")].")) - return - return ..() - -/obj/item/iff_tag/attackby(obj/item/W, mob/user) - if(HAS_TRAIT(W, TRAIT_TOOL_MULTITOOL) && ishuman(user)) - handle_reprogramming(user) - return - return ..() - -/obj/item/iff_tag/proc/handle_reprogramming(mob/living/carbon/human/programmer, mob/living/carbon/xenomorph/xeno) - var/list/id_faction_groups = programmer.get_id_faction_group() - var/option = tgui_alert(programmer, "The xeno tag's current IFF groups reads as: [english_list(faction_groups, "None")]\nYour ID's IFF group reads as: [english_list(id_faction_groups, "None")]", "Xenomorph IFF Tag", list("Overwrite", "Add", "Remove")) - if(!option) - return FALSE - if(xeno) - if(!xeno.iff_tag) - to_chat(programmer, SPAN_WARNING("\The [src]'s tag got removed while you were reprogramming it!")) - return FALSE - if(!programmer.Adjacent(xeno)) - to_chat(programmer, SPAN_WARNING("You need to stay close to the xenomorph to reprogram the tag!")) - return FALSE - switch(option) - if("Overwrite") - faction_groups = id_faction_groups - if("Add") - faction_groups |= id_faction_groups - if("Remove") - faction_groups = list() - to_chat(programmer, SPAN_NOTICE("You [option] the IFF group data, the IFF group on the tag now reads as: [english_list(faction_groups, "None")]")) - if(xeno?.hive.hivenumber == XENO_HIVE_RENEGADE) //it's important to know their IFF settings for renegade - to_chat(xeno, SPAN_NOTICE("Your instincts have changed, you seem compelled to protect [english_list(faction_groups, "no one")].")) - return TRUE - -/obj/item/iff_tag/pmc_handler - faction_groups = FACTION_LIST_MARINE_WY - - -/obj/item/storage/xeno_tag_case - name = "xenomorph tag case" - desc = "A sturdy case designed to store and charge xenomorph IFF tags. Provided by the Wey-Yu Research and Data(TM) Division." - icon = 'icons/obj/items/xeno_tag.dmi' - icon_state = "tag_box" - use_sound = "toolbox" - storage_slots = 8 - can_hold = list( - /obj/item/iff_tag, - /obj/item/device/multitool, - ) - black_market_value = 25 - -/obj/item/storage/xeno_tag_case/full/fill_preset_inventory() - for(var/i = 1 to storage_slots - 1) - new /obj/item/iff_tag(src) - new /obj/item/device/multitool(src) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index bce0d9857433..f3155e277b81 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -24,8 +24,7 @@ /mob/new_player/verb/new_player_panel() set src = usr - if(client && client.player_entity) - client.player_entity.update_panel_data(null) + if(client) new_player_panel_proc() @@ -242,7 +241,7 @@ if(!GLOB.enter_allowed) to_chat(usr, SPAN_WARNING("There is an administrative lock on entering the game! (The dropship likely crashed into the Almayer. This should take at most 20 minutes.)")) return - if(!GLOB.RoleAuthority.assign_role(src, player_rank, 1)) + if(!GLOB.RoleAuthority.assign_role(src, GET_MAPPED_ROLE(player_rank), 1)) to_chat(src, alert("[rank] is not available. Please try another.")) return @@ -250,7 +249,7 @@ close_spawn_windows() var/mob/living/carbon/human/character = create_character(TRUE) //creates the human and transfers vars and mind - GLOB.RoleAuthority.equip_role(character, player_rank, late_join = TRUE) + GLOB.RoleAuthority.equip_role(character, GET_MAPPED_ROLE(player_rank), late_join = TRUE) EquipCustomItems(character) if((GLOB.security_level > SEC_LEVEL_BLUE || SShijack.hijack_status) && player_rank.gets_emergency_kit) @@ -258,9 +257,8 @@ character.put_in_hands(new /obj/item/storage/box/kit/cryo_self_defense(character.loc)) GLOB.data_core.manifest_inject(character) - SSticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. //TODO!!!!! ~Carn + SSticker.minds += character.mind SSticker.mode.latejoin_update(player_rank) - SSticker.mode.update_gear_scale() for(var/datum/squad/sq in GLOB.RoleAuthority.squads) if(sq) @@ -282,16 +280,17 @@ hive.stored_larva++ hive.hive_ui.update_burrowed_larva() - if(character.mind && character.mind.player_entity) - var/datum/entity/player_entity/player = character.mind.player_entity - if(player.get_playtime(STATISTIC_HUMAN) == 0 && player.get_playtime(STATISTIC_XENO) == 0) + if(character.mind && character.client.player_data) + var/list/xeno_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_xeno_playtime") + var/list/marine_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_human_playtime") + if(!xeno_playtimes && !marine_playtimes) msg_admin_niche("NEW JOIN: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") if(character.client) - var/client/client = character.client - if(client.player_data && client.player_data.playtime_loaded && length(client.player_data.playtimes) == 0) + var/client/C = character.client + if(C.player_data && C.player_data.playtime_loaded && length(C.player_data.playtimes) == 0) msg_admin_niche("NEW PLAYER: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") - if(client.player_data && client.player_data.playtime_loaded && ((round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= CONFIG_GET(number/notify_new_player_age))) - msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") + if(C.player_data && C.player_data.playtime_loaded && ((round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= CONFIG_GET(number/notify_new_player_age))) + msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [character.job] - Current location: [get_area(character)]") character.client.init_verbs() qdel(src) @@ -300,8 +299,8 @@ /mob/new_player/proc/LateChoices() var/list/faction_to_get_list = list() for(var/faction_to_get in SSticker.mode.factions_pool) - var/datum/faction/faction = GLOB.faction_datum[SSticker.mode.factions_pool[faction_to_get]] - if(!faction.spawning_enabled || (!faction.force_spawning && !faction.weight_act[SSticker.mode.name])) + var/datum/faction/faction = GLOB.faction_datums[SSticker.mode.factions_pool[faction_to_get]] + if(!faction.spawning_enabled) continue faction_to_get_list += faction_to_get @@ -309,7 +308,7 @@ if(!choice) return - GLOB.faction_datum[SSticker.mode.factions_pool[choice]].get_join_status(src) + GLOB.faction_datums[SSticker.mode.factions_pool[choice]].get_join_status(src) /mob/new_player/proc/create_character(is_late_join = FALSE) spawning = TRUE diff --git a/code/modules/projectiles/guns/flamer/flamer.dm b/code/modules/projectiles/guns/flamer/flamer.dm index cca4c6aeb097..f2452eb3efaa 100644 --- a/code/modules/projectiles/guns/flamer/flamer.dm +++ b/code/modules/projectiles/guns/flamer/flamer.dm @@ -664,6 +664,7 @@ else to_chat(ignited_morb, SPAN_HIGHDANGER(msg)) + var/mob/shoot_mob = cause_data.resolve_mob() if(shoot_mob) if(shoot_mob.faction == ignited_morb.faction) shoot_mob.track_friendly_damage(weapon_cause_data.cause_name, ignited_morb, firedamage) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 8c91aafd65cc..753ff3f0be7e 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -1059,6 +1059,7 @@ emote("scream") to_chat(src, SPAN_HIGHDANGER("You scream in pain as the impact sends shrapnel into the wound!")) + var/mob/shoot_mob = P.weapon_cause_data.resolve_mob() if(shoot_mob) if(shoot_mob.faction == faction) shoot_mob.track_friendly_damage(P.weapon_cause_data.cause_name, src, damage) @@ -1133,6 +1134,7 @@ return if(damage) + var/mob/shoot_mob = P.weapon_cause_data.resolve_mob() //only apply the blood splatter if we do damage if(shoot_mob) if(shoot_mob.faction == faction) diff --git a/code/modules/round_recording/round_recorder.dm b/code/modules/round_recording/round_recorder.dm index 8748b995aa6c..b973835a8328 100644 --- a/code/modules/round_recording/round_recorder.dm +++ b/code/modules/round_recording/round_recorder.dm @@ -32,7 +32,7 @@ map = SSmapping.configs[GROUND_MAP].map_name gamemode = GLOB.master_mode - round_name = GLOB.round_statistics.name + round_name = GLOB.round_statistics.round_name // Record the end time of the game and export the game history /datum/round_recorder/proc/end_game() diff --git a/colonialmarines.dme b/colonialmarines.dme index 52f36bda5a48..53fa8cd70797 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -2098,7 +2098,6 @@ #include "code\modules\mob\living\carbon\xenomorph\castes\Sentinel.dm" #include "code\modules\mob\living\carbon\xenomorph\castes\Spitter.dm" #include "code\modules\mob\living\carbon\xenomorph\castes\Warrior.dm" -#include "code\modules\mob\living\carbon\xenomorph\items\iff_tag.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\behavior_delegate.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\xeno_strain.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\castes\boiler\trapper.dm" From ded619ba0b8fbfc969f3c4f7680b0bb1169f45cf Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:29:04 +0500 Subject: [PATCH 10/69] Cool number count of problems mark passed --- code/datums/entities/player.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm index 4b9b1f40aa6d..bd356d4439fd 100644 --- a/code/datums/entities/player.dm +++ b/code/datums/entities/player.dm @@ -709,6 +709,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player) /datum/entity/player/proc/adjust_stat(stat_id, stat_category, num, set_to_num = FALSE) var/datum/entity/player_stat/stat = LAZYACCESS(stats, stat_id) + if(!stat) stat = DB_ENTITY(/datum/entity/player_stat) stat.player_id = id From 40dec4fe760cc8de7ca3b305746133b7e35499fc Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 7 Aug 2024 18:55:07 +0500 Subject: [PATCH 11/69] CR5 fuck it for now... --- code/__DEFINES/statistic.dm | 2 + code/datums/entities/player.dm | 15 --- code/datums/medal_awards.dm | 6 +- code/datums/statistics/cause_data.dm | 2 +- .../datums/statistics/entities/death_stats.dm | 28 +++--- .../datums/statistics/entities/medal_stats.dm | 4 +- .../statistics/entities/player_entity.dm | 16 ++- .../statistics/entities/player_stats.dm | 98 +++++++++---------- .../machinery/computer/dropship_weapons.dm | 2 +- .../computer/groundside_operations.dm | 3 +- code/game/objects/items/devices/flashlight.dm | 13 ++- code/game/objects/items/stacks/flags.dm | 18 ++-- .../objects/items/tools/experimental_tools.dm | 2 +- code/game/supplyshuttle.dm | 2 +- code/modules/admin/tabs/event_tab.dm | 31 +++--- .../carbon/xenomorph/castes/Facehugger.dm | 3 +- 16 files changed, 121 insertions(+), 124 deletions(-) diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index 4bfc42d51a91..c03b768fa431 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -12,6 +12,8 @@ #define STATISTIC_TYPE_JOB "Role" #define STATISTIC_TYPE_WEAPON "Weapon" +#define STATISTIC_TYPE_GLOBAL "global" // Don't have link to a faction + #define STATISTICS_DEATH_LIST_LEN 20 #define STATISTICS_FF_SHOT_HIT "FF Shot Hit" diff --git a/code/datums/entities/player.dm b/code/datums/entities/player.dm index bd356d4439fd..ea067cff9b02 100644 --- a/code/datums/entities/player.dm +++ b/code/datums/entities/player.dm @@ -707,21 +707,6 @@ BSQL_PROTECT_DATUM(/datum/entity/player) migrated_jobbans = TRUE save() -/datum/entity/player/proc/adjust_stat(stat_id, stat_category, num, set_to_num = FALSE) - var/datum/entity/player_stat/stat = LAZYACCESS(stats, stat_id) - - if(!stat) - stat = DB_ENTITY(/datum/entity/player_stat) - stat.player_id = id - stat.stat_id = stat_id - stat.stat_category = stat_category - LAZYSET(stats, stat_id, stat) - if(set_to_num) - stat.stat_number = num - else - stat.stat_number += num - stat.save() - /datum/entity/player/proc/check_whitelist_status(flag_to_check) if(whitelist_flags & flag_to_check) return TRUE diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 1d008ec6b821..edbb68d1861a 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -74,7 +74,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME if(!as_admin && mob == usr) // Giver: Increment their medals given stat giver_mob = mob - track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data.id) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data) if(found_other) break found_other = TRUE @@ -342,7 +342,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, if(mob == usr) // Giver: Increment their medals given stat giver_mob = mob - track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data.id) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, 1, giver_mob.client.player_data) break // Create the recipient_award @@ -446,7 +446,7 @@ GLOBAL_LIST_INIT(xeno_medals, list(XENO_SLAUGHTER_MEDAL, XENO_RESILIENCE_MEDAL, // Remove giver's stat if(giver_mob) - track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, -1, giver_mob.client.player_data.id) + track_statistic_earned(giver_mob.faction, STATISTIC_TYPE_MISC, STATISTICS_MEDALS_GIVE, -1, giver_mob.client.player_data) // Remove stats for recipient (this has a weakref to the mob, but theres a possibility of recipient.statistic_exempt) if(recipient_mob) diff --git a/code/datums/statistics/cause_data.dm b/code/datums/statistics/cause_data.dm index 36f1a664afa7..5904be46b5a5 100644 --- a/code/datums/statistics/cause_data.dm +++ b/code/datums/statistics/cause_data.dm @@ -29,5 +29,5 @@ if(M.mind) new_data.ckey = M.mind.ckey new_data.role = M.get_role_name() - new_data.faction = M.faction + new_data.faction = M.faction?.faction_name return new_data diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 71c2ac67601e..006a03730ba3 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -199,19 +199,21 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(ff_type) SSticker.mode.round_statistics.total_friendly_kills++ - if(isxeno(cause_mob)) - track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_CASTE, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) - else if(ishuman(cause_mob)) - track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_JOB, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) - if(new_death.cause_role_name) - track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, new_death.cause_player_id) - - if(isxeno(src)) - track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) - else if(ishuman(src)) - track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) - if(new_death.cause_name) - track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, new_death.player_id) + if(cause_player) + if(isxeno(cause_mob)) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_CASTE, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, cause_player) + else if(ishuman(cause_mob)) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_JOB, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, cause_player) + if(new_death.cause_role_name) + track_statistic_earned(new_death.cause_faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_role_name, ff_type ? STATISTICS_KILL_FF : STATISTICS_KILL, 1, cause_player) + + if(player_entity) + if(isxeno(src)) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) + else if(ishuman(src)) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) + if(new_death.cause_name) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) if(SSticker.mode && SSticker.mode.round_statistics) SSticker.mode.round_statistics.death_stats_list += new_death diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index bff81c5d6b26..cdd7f3ed32aa 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -73,7 +73,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) if(giver_player) new_medal.giver_player_id = giver_player.id - track_statistic_earned(new_recipient.faction.faction_name, STATISTICS_MEDALS, 1, new_recipient.client.player_data.id) + track_statistic_earned(new_recipient.faction.faction_name, STATISTICS_MEDALS, 1, new_recipient.client.player_data) medals += new_medal new_medal.save() new_medal.detach() @@ -86,7 +86,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) return FALSE var/round_id = SSperf_logging.round?.id - track_statistic_earned(recipient.faction.faction_name, STATISTICS_MEDALS, -1, recipient.client.player_data.id) + track_statistic_earned(recipient.faction.faction_name, STATISTICS_MEDALS, -1, recipient.client.player_data) for(var/datum/entity/statistic/medal/new_medal as anything in medals) if(new_medal.round_id == round_id && new_medal.recipient_name == recipient.real_name && new_medal.medal_type == medal_type && new_medal.citation == citation) medals -= new_medal diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 1eb9ccd69327..de14c0ee7c30 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -22,17 +22,23 @@ "value" = DB_FIELDTYPE_INT, ) -/proc/track_statistic_earned(faction, statistic_type, general_name, statistic_name, value, player_id) - if(!player_id || !faction || !statistic_type || !general_name || !statistic_name) +/proc/track_statistic_earned(faction, statistic_type, general_name, statistic_name, value, datum/entity/player/player) + if(!player || !faction || !statistic_type || !general_name || !statistic_name) + return + + var/datum/entity/statistic/statistic = player.player_entity?.get_statistic(faction, statistic_type, general_name, statistic_name) + if(statistic) + statistic.value += value + statistic.save() return DB_FILTER(/datum/entity/statistic, DB_AND( - DB_COMP("player_id", DB_EQUALS, player_id), + DB_COMP("player_id", DB_EQUALS, player.id), DB_COMP("faction", DB_EQUALS, faction), DB_COMP("statistic_type", DB_EQUALS, statistic_type), DB_COMP("general_name", DB_EQUALS, general_name), DB_COMP("statistic_name", DB_EQUALS, statistic_name)), - CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(track_statistic_earned_callback), faction, statistic_type, general_name, statistic_name, value, player_id)) + CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(track_statistic_earned_callback), faction, statistic_type, general_name, statistic_name, value, player.id)) /proc/track_statistic_earned_callback(faction, statistic_type, general_name, statistic_name, value, player_id, list/datum/entity/statistic/statistics) if(!length(statistics)) @@ -190,7 +196,7 @@ var/datum/entity/statistic/statistic = match_statistic.statistic_info[statistic_type][general_name][statistic_name] if(!statistic) return FALSE - return statistic.value + return statistic /datum/player_entity/proc/setup_entity() set waitfor = FALSE diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index 12558641af0a..59a86388eec4 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -106,116 +106,116 @@ if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) /mob/living/carbon/human/count_statistic_stat(statistic_name, amount = 1, weapon) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) ///////////////////////////////////////////////////////////////////////////////////// //Xenomorph @@ -225,128 +225,128 @@ if(!. || !faction) return - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) /mob/living/carbon/xenomorph/count_statistic_stat(statistic_name, amount = 1, weapon) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, statistic_name, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_ability_usage(ability, caste, amount = 1) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste, ability, amount, client.player_data.id) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, STATISTICS_ABILITES, amount, client.player_data.id) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste, ability, amount, client.player_data) + track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, STATISTICS_ABILITES, amount, client.player_data) diff --git a/code/game/machinery/computer/dropship_weapons.dm b/code/game/machinery/computer/dropship_weapons.dm index 7f8f4f2b3850..887f05619f6f 100644 --- a/code/game/machinery/computer/dropship_weapons.dm +++ b/code/game/machinery/computer/dropship_weapons.dm @@ -4,7 +4,7 @@ density = TRUE icon = 'icons/obj/structures/machinery/shuttle-parts.dmi' icon_state = "consoleright" - var/faction = FACTION_MARINE + fation_to_get = FACTION_MARINE circuit = null unslashable = TRUE unacidable = TRUE diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 591c63a76bee..416da7213c1e 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -8,6 +8,8 @@ unslashable = TRUE unacidable = TRUE + fation_to_get = FACTION_MARINE + var/obj/structure/machinery/camera/cam = null var/datum/squad/current_squad = null @@ -20,7 +22,6 @@ var/add_pmcs = TRUE var/lz_selection = TRUE var/has_squad_overwatch = TRUE - var/faction = FACTION_MARINE var/show_command_squad = FALSE /obj/structure/machinery/computer/groundside_operations/Initialize() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index e506f51ce21c..5bc1f88ef3ff 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -465,7 +465,6 @@ item_state = "cas_flare" layer = ABOVE_FLY_LAYER ammo_datum = /datum/ammo/flare/signal - var/faction = "" var/datum/cas_signal/signal var/activate_message = TRUE flame_base_tint = "#00aa00" @@ -487,13 +486,13 @@ /obj/item/device/flashlight/flare/signal/activate_signal(mob/living/carbon/human/user) ..() - if(faction && GLOB.cas_groups[faction]) + if(faction && cas_groups[faction.faction_name]) signal = new(src) signal.target_id = ++GLOB.cas_tracking_id_increment name = "[user.assigned_squad ? user.assigned_squad.name : "X"]-[signal.target_id] flare" signal.name = name signal.linked_cam = new(loc, name) - GLOB.cas_groups[user.faction].add_signal(signal) + GLOB.cas_groups[user.faction.faction_name].add_signal(signal) anchored = TRUE if(activate_message) visible_message(SPAN_DANGER("[src]'s flame reaches full strength. It's fully active now."), null, 5) @@ -513,14 +512,14 @@ /obj/item/device/flashlight/flare/signal/Destroy() STOP_PROCESSING(SSobj, src) if(signal) - GLOB.cas_groups[faction].remove_signal(signal) + GLOB.cas_groups[faction.faction_name].remove_signal(signal) QDEL_NULL(signal) return ..() -/obj/item/device/flashlight/flare/signal/turn_off() +/obj/item/device/flashlight/flare/signal/burn_out() anchored = FALSE if(signal) - GLOB.cas_groups[faction].remove_signal(signal) + GLOB.cas_groups[faction.faction_name].remove_signal(signal) qdel(signal) ..() @@ -547,7 +546,7 @@ /obj/item/device/flashlight/flare/signal/debug/activate_signal() turn_on() - faction = FACTION_MARINE + faction = GLOB.faction_datums[FACTION_MARINE] signal = new(src) signal.target_id = ++GLOB.cas_tracking_id_increment name += " [rand(100, 999)]" diff --git a/code/game/objects/items/stacks/flags.dm b/code/game/objects/items/stacks/flags.dm index 14833812b06c..de7bbb8d828f 100644 --- a/code/game/objects/items/stacks/flags.dm +++ b/code/game/objects/items/stacks/flags.dm @@ -182,8 +182,6 @@ /// The typepath of the flag structure that gets spawned when the flag is planted. var/flag_type = /obj/structure/flag/plantable - /// Used to check if nearby mobs belong to a faction when calculating for the stronger warcry. - var/faction /// Does the flag play a unique warcry when planted? (Only while on harm intent.) var/play_warcry = FALSE /// The warcry's sound path. @@ -197,11 +195,11 @@ /obj/item/flag/plantable/get_examine_text(mob/user) . = ..() - if(play_warcry && user.faction == faction) + if(play_warcry && user.ally(faction)) . += SPAN_NOTICE("Planting the flag while in HARM intent will cause you to bellow out a rallying warcry!") /// Proc for turning the flag item into a structure. -/obj/item/flag/plantable/proc/plant_flag(mob/living/user, play_warcry = FALSE, warcry_sound, warcry_extra_sound, faction) +/obj/item/flag/plantable/proc/plant_flag(mob/living/user, play_warcry = FALSE, warcry_sound, warcry_extra_sound) if(user.action_busy) return @@ -231,14 +229,15 @@ user.visible_message(SPAN_NOTICE("[user] plants [src] into the ground!"), SPAN_NOTICE("You plant [src] into the ground!")) var/obj/structure/flag/plantable/planted_flag = new flag_type(turf_to_plant) + planted_flag.faction = faction // If there are more than 14 allies nearby, play a stronger rallying cry. // Otherwise, play the default warcry sound if there is one. If not, play a generic flag raising sfx. - if(play_warcry && user.faction == faction && user.a_intent == INTENT_HARM) + if(play_warcry && user.ally(faction) && user.a_intent == INTENT_HARM) var/allies_nearby = 0 if(COOLDOWN_FINISHED(src, warcry_cooldown_item)) for(var/mob/living/carbon/human in orange(planted_flag, 7)) - if(human.is_dead() || human.faction != faction) + if(human.is_dead() || !human.ally(faction)) continue allies_nearby++ @@ -258,9 +257,14 @@ qdel(src) +/obj/item/flag/plantable/pick_up(mob/user) + ..() + if(!faction) + faction = user.faction + /obj/item/flag/plantable/attack_self(mob/user) ..() - plant_flag(user, play_warcry, warcry_sound, warcry_extra_sound, faction) + plant_flag(user, play_warcry, warcry_sound, warcry_extra_sound) // UNITED AMERICAS FLAG // ////////////////////////// diff --git a/code/game/objects/items/tools/experimental_tools.dm b/code/game/objects/items/tools/experimental_tools.dm index 140a05a534b7..846bbbe1766b 100644 --- a/code/game/objects/items/tools/experimental_tools.dm +++ b/code/game/objects/items/tools/experimental_tools.dm @@ -5,8 +5,8 @@ icon_state = "crew_monitor" flags_equip_slot = SLOT_WAIST w_class = SIZE_SMALL + faction_to_get = FACTION_MARINE var/datum/radar/lifeline/radar - var/faction = FACTION_MARINE /obj/item/tool/crew_monitor/Initialize(mapload, ...) . = ..() diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index 3a4a3525c2f2..a0aa2960cc8c 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -164,12 +164,12 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) icon_state = "security_cam" circuit = /obj/item/circuitboard/computer/supply_drop_console req_access = list(ACCESS_MARINE_CARGO) + fation_to_get = FACTION_MARINE var/x_supply = 0 var/y_supply = 0 var/datum/squad/current_squad = null var/drop_cooldown = 1 MINUTES var/can_pick_squad = TRUE - var/faction = FACTION_MARINE var/obj/structure/closet/crate/loaded_crate COOLDOWN_DECLARE(next_fire) diff --git a/code/modules/admin/tabs/event_tab.dm b/code/modules/admin/tabs/event_tab.dm index a155f2a37614..a73617c75449 100644 --- a/code/modules/admin/tabs/event_tab.dm +++ b/code/modules/admin/tabs/event_tab.dm @@ -6,41 +6,38 @@ to_chat(usr, "Only administrators may use this command.") return - if(!LAZYLEN(GLOB.custom_event_info_list)) + if(!length(GLOB.custom_event_info_list)) to_chat(usr, "custom_event_info_list is not initialized, tell a dev.") return var/list/temp_list = list() for(var/T in GLOB.custom_event_info_list) - var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[T] - temp_list["[CEI.msg ? "(x) [CEI.faction]" : CEI.faction]"] = CEI.faction + var/datum/custom_event_info/custom_event = GLOB.custom_event_info_list[T] + temp_list["[custom_event.msg ? "(x) [custom_event.faction_name]" : custom_event.faction_name]"] = custom_event.faction_name - var/faction = tgui_input_list(usr, "Select faction. Ghosts will see only \"Global\" category message. Factions with event message set are marked with (x).", "Faction Choice", temp_list) - if(!faction) + var/event_info_get = temp_list[tgui_input_list(usr, "Select faction. Ghosts will see only \"Global\" category message. Factions with event message set are marked with (x).", "Faction Choice", temp_list)] + if(!event_info_get) return - faction = temp_list[faction] - - if(!GLOB.custom_event_info_list[faction]) - to_chat(usr, "Error has occurred, [faction] category is not found.") + var/datum/custom_event_info/custom_info = GLOB.custom_event_info_list[event_info_get] + if(!custom_info) + to_chat(usr, "custom_event_info_list don't have [event_info_get] in list, tell a dev.") return - var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[faction] - - var/input = input(usr, "Enter the custom event message for \"[faction]\" category. Be descriptive. \nTo remove the event message, remove text and confirm.", "[faction] Event Message", CEI.msg) as message|null + var/input = tgui_input_text(usr, "Enter the custom event message for \"[event_info_get]\" category. Be descriptive. \nTo remove the event message, remove text and confirm.", "[event_info_get] Event Message", custom_info.msg, 4096, TRUE) if(isnull(input)) return if(input == "" || !input) - CEI.msg = "" - message_admins("[key_name_admin(usr)] has removed the event message for \"[faction]\" category.") + custom_info.msg = "" + message_admins("[key_name_admin(usr)] has removed the event message for \"[event_info_get]\" category.") return - CEI.msg = html_encode(input) - message_admins("[key_name_admin(usr)] has changed the event message for \"[faction]\" category.") + custom_info.msg = html_encode(input) + message_admins("[key_name_admin(usr)] has changed the event message for \"[event_info_get]\" category.") - CEI.handle_event_info_update(faction) + custom_info.handle_event_info_update() /client/proc/change_security_level() if(!check_rights(R_ADMIN)) diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm index 81bb3e49d7e7..dd9a111a2874 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm @@ -169,7 +169,8 @@ age = XENO_NORMAL - total_facehugs = client?.player_data?.player_entity?.get_statistic(STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) + var/datum/entity/statistic/statistic = client?.player_data?.player_entity?.get_statistic(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) + total_facehugs = statistic.value switch(total_facehugs) if(FACEHUG_TIER_1 to FACEHUG_TIER_2) age = XENO_MATURE From c4ab4128fd5f5a6c9978e37e9dc65139289fedde Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:09:36 +0500 Subject: [PATCH 12/69] fffff --- code/__DEFINES/factions.dm | 5 + code/_onclick/item_attack.dm | 2 +- code/datums/elements/bullet_trait/iff.dm | 23 ++-- code/datums/elements/strippable.dm | 2 +- code/datums/elements/suturing.dm | 11 +- code/datums/factions/_modules/module.dm | 2 +- code/datums/factions/_modules/relations.dm | 2 +- code/datums/factions/faction.dm | 2 +- code/datums/mob_hud.dm | 5 +- .../datums/statistics/entities/death_stats.dm | 10 +- code/defines/procs/announcement.dm | 109 ++++++------------ code/game/atoms_movable.dm | 4 + code/game/machinery/telecomms/presets.dm | 4 +- code/game/objects/items/cards_ids.dm | 1 - .../admin/player_panel/actions/physical.dm | 8 +- code/modules/admin/verbs/debug.dm | 5 +- code/modules/admin/verbs/select_equipment.dm | 10 +- code/modules/cm_marines/dropship_equipment.dm | 2 +- code/modules/cm_marines/marines_consoles.dm | 65 +++-------- code/modules/defenses/defenses.dm | 31 +++-- code/modules/mob/mob_defines.dm | 2 - 21 files changed, 121 insertions(+), 184 deletions(-) diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm index 65545ff6df44..9af94aa6d31f 100644 --- a/code/__DEFINES/factions.dm +++ b/code/__DEFINES/factions.dm @@ -151,6 +151,11 @@ #define MODULE_CODE_NAME_RELATIONS "relations_handler" +GLOBAL_LIST_INIT(ROLES_REGULAR_USCM, list(JOB_CO, JOB_XO, JOB_SO, JOB_INTEL, JOB_PILOT, JOB_DROPSHIP_CREW_CHIEF, JOB_CREWMAN, JOB_POLICE, JOB_CORPORATE_LIAISON, JOB_CHIEF_REQUISITION, JOB_CHIEF_ENGINEER, JOB_CMO, JOB_CHIEF_POLICE, JOB_SEA, JOB_SYNTH, JOB_WARDEN, JOB_ORDNANCE_TECH, JOB_MAINT_TECH, JOB_WORKING_JOE, JOB_MESS_SERGEANT, JOB_CARGO_TECH, JOB_RESEARCHER, JOB_DOCTOR, JOB_NURSE, JOB_SQUAD_LEADER, JOB_SQUAD_TEAM_LEADER, JOB_SQUAD_SPECIALIST, JOB_SQUAD_SMARTGUN, JOB_SQUAD_MEDIC, JOB_SQUAD_ENGI, JOB_SQUAD_MARINE)) +GLOBAL_LIST_INIT(ROLES_REGULAR_XENO, list(JOB_XENOMORPH_QUEEN, JOB_XENOMORPH)) +GLOBAL_LIST_INIT(ROLES_REGULAR_SURV, list(JOB_SYNTH_SURVIVOR, JOB_CO_SURVIVOR, JOB_SURVIVOR)) +GLOBAL_LIST_INIT(ROLES_REGULAR_YAUT, list(JOB_PREDATOR)) + /* diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 9f0a9d221069..7e61a16a70ad 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -45,7 +45,7 @@ /obj/item/proc/attack(mob/living/M, mob/living/user) - if((flags_item & NOBLUDGEON) || (MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) && M.stat == DEAD && !user.get_target_lock(M.faction_group))) + if((flags_item & NOBLUDGEON) || (MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) && M.stat == DEAD && !user.ally(M.faction))) return FALSE if(SEND_SIGNAL(M, COMSIG_ITEM_ATTEMPT_ATTACK, user, src) & COMPONENT_CANCEL_ATTACK) //Sent by target mob. diff --git a/code/datums/elements/bullet_trait/iff.dm b/code/datums/elements/bullet_trait/iff.dm index cee36acbed80..ceb5baa4439f 100644 --- a/code/datums/elements/bullet_trait/iff.dm +++ b/code/datums/elements/bullet_trait/iff.dm @@ -1,5 +1,5 @@ /// This is the iff_group -/obj/projectile/var/runtime_iff_group +/obj/item/projectile/var/datum/faction/runtime_iff_group /datum/element/bullet_trait_iff // General bullet trait vars @@ -7,11 +7,11 @@ id_arg_index = 2 /// The iff group for this bullet - var/iff_group + var/datum/faction/iff_group /// A cache of IFF groups for specific mobs - var/list/iff_group_cache + var/list/datum/faction/iff_group_cache -/datum/element/bullet_trait_iff/Attach(datum/target, iff_group) +/datum/element/bullet_trait_iff/Attach(datum/target, datum/faction/iff_group) . = ..() if(!istype(target, /obj/projectile)) return ELEMENT_INCOMPATIBLE @@ -33,7 +33,7 @@ /datum/element/bullet_trait_iff/proc/check_iff(datum/target, mob/living/carbon/human/projectile_target) SIGNAL_HANDLER - if(projectile_target.get_target_lock(iff_group)) + if(projectile_target.ally(iff_group)) return COMPONENT_SKIP_MOB /datum/element/bullet_trait_iff/proc/set_iff(datum/target, mob/living/carbon/human/firer) @@ -46,29 +46,20 @@ // The cache is reset when the user drops their ID /datum/element/bullet_trait_iff/proc/get_user_iff_group(mob/living/carbon/human/user) if(!ishuman(user)) - return user?.faction_group + return user.faction var/iff_group = LAZYACCESS(iff_group_cache, user) if(isnull(iff_group)) - iff_group = user.get_id_faction_group() + iff_group = user.faction LAZYSET(iff_group_cache, user, iff_group) // Remove them from the cache if they are deleted - RegisterSignal(user, COMSIG_HUMAN_EQUIPPED_ITEM, PROC_REF(handle_id_equip)) RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(reset_iff_group_cache)) return iff_group -/datum/element/bullet_trait_iff/proc/handle_id_equip(equipper, item, slot) - SIGNAL_HANDLER - if(slot == WEAR_ID) - reset_iff_group_cache(equipper) - UnregisterSignal(equipper, COMSIG_HUMAN_EQUIPPED_ITEM) - UnregisterSignal(equipper, COMSIG_PARENT_QDELETING) - /datum/element/bullet_trait_iff/proc/reset_iff_group_cache(mob/living/carbon/human/user) SIGNAL_HANDLER if(!user) iff_group_cache = null else LAZYREMOVE(iff_group_cache, user) - diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index e0daaee74a8c..08116a7d6cfa 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -131,7 +131,7 @@ if (ishuman(source)) var/mob/living/carbon/human/sourcehuman = source - if(MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_STRIPDRAG_ENEMY) && (sourcehuman.stat == DEAD || sourcehuman.health < HEALTH_THRESHOLD_CRIT) && !sourcehuman.get_target_lock(user.faction_group)) + if(MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_STRIPDRAG_ENEMY) && (sourcehuman.stat == DEAD || sourcehuman.health < HEALTH_THRESHOLD_CRIT) && !sourcehuman.ally(user.faction)) to_chat(user, SPAN_WARNING("You can't strip items of a crit or dead member of another faction!")) return FALSE diff --git a/code/datums/elements/suturing.dm b/code/datums/elements/suturing.dm index 114886b94d50..4a7df46361e0 100644 --- a/code/datums/elements/suturing.dm +++ b/code/datums/elements/suturing.dm @@ -155,7 +155,7 @@ YOU TO 200 DAMAGE. I ASK NOT FOR MY OWN MEDIC EGOSTROKING, BUT FOR THE GOOD OF T //Add the sutures. var/added_sutures = SEND_SIGNAL(target_limb, COMSIG_LIMB_ADD_SUTURES, suture_brute, suture_burn) if(!added_sutures) //No suture datum to answer the signal - new /datum/suture_handler(target_limb) + new /datum/suture_handler(target_limb, suturing_item, user, target) added_sutures = SEND_SIGNAL(target_limb, COMSIG_LIMB_ADD_SUTURES, suture_brute, suture_burn) //This time, with feeling. if(added_sutures & SUTURED_FULLY) @@ -181,8 +181,15 @@ YOU TO 200 DAMAGE. I ASK NOT FOR MY OWN MEDIC EGOSTROKING, BUT FOR THE GOOD OF T var/remaining_brute var/remaining_burn -/datum/suture_handler/New(obj/limb/target_limb) + var/obj/suturing_item + var/mob/healing + var/mob/healed + +/datum/suture_handler/New(obj/limb/target_limb, obj/item, mob/user, mob/target) . = ..() + suturing_item = item + healing = user + healed = target remaining_brute = target_limb.brute_dam remaining_burn = target_limb.burn_dam RegisterSignal(target_limb, COMSIG_LIMB_TAKEN_DAMAGE, PROC_REF(update_sutures)) diff --git a/code/datums/factions/_modules/module.dm b/code/datums/factions/_modules/module.dm index 74573bb99925..ebc9ec0ccaa0 100644 --- a/code/datums/factions/_modules/module.dm +++ b/code/datums/factions/_modules/module.dm @@ -2,5 +2,5 @@ var/module_name var/datum/faction/faction -/datum/faction_module/New(datum/faction/faction_to_set) +/datum/faction_module/New(datum/faction/faction_to_set, list/arguments) faction = faction_to_set diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm index e59628b4aadf..c74c6fba11bc 100644 --- a/code/datums/factions/_modules/relations.dm +++ b/code/datums/factions/_modules/relations.dm @@ -4,7 +4,7 @@ var/relations[] = RELATIONS_MAP var/list/allies = list() -/datum/faction_module/relations/New(datum/faction/faction_to_set) +/datum/faction_module/relations/New(datum/faction/faction_to_set, list/arguments) . = ..() generate_relations_helper() diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index 579c8b045204..a082c47f2e39 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -44,7 +44,7 @@ for(var/module in modules_to_add) if(!GLOB.faction_modules[module]) return - modules[module] = new GLOB.faction_modules[module](src, ...modules_to_add[module]) + modules[module] = new GLOB.faction_modules[module](src, modules_to_add[module]) /datum/faction/can_vv_modify() return FALSE diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index f65428001411..e36dc0a1820e 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -221,6 +221,9 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( /mob/proc/add_to_all_mob_huds() return +/mob/proc/hud_update() + return + /mob/hologram/queen/add_to_all_mob_huds() var/datum/mob_hud/hud = GLOB.huds[MOB_HUD_XENO_STATUS] hud.add_to_hud(src) @@ -590,7 +593,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( holder.icon_state = "xeno_banished" hud_list[XENO_BANISHED_HUD] = holder -/mob/living/carbon/xenomorph/proc/hud_update() +/mob/living/carbon/xenomorph/hud_update() var/image/holder = hud_list[XENO_STATUS_HUD] holder.overlays.Cut() if (stat == DEAD) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 006a03730ba3..aeb7d0a67eab 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -194,10 +194,10 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) new_death.total_revives_done = life_revives_total var/ff_type = new_death.cause_faction_name == new_death.faction_name ? 1 : 0 - if(SSticker.mode.round_statistics) - SSticker.mode.round_statistics.track_dead_participant(new_death.faction_name) + if(GLOB.round_statistics) + GLOB.round_statistics.track_dead_participant(new_death.faction_name) if(ff_type) - SSticker.mode.round_statistics.total_friendly_kills++ + GLOB.round_statistics.total_friendly_kills++ if(cause_player) if(isxeno(cause_mob)) @@ -215,8 +215,8 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(new_death.cause_name) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) - if(SSticker.mode && SSticker.mode.round_statistics) - SSticker.mode.round_statistics.death_stats_list += new_death + if(SSticker.mode && GLOB.round_statistics) + GLOB.round_statistics.death_stats_list += new_death new_death.save() new_death.detach() diff --git a/code/defines/procs/announcement.dm b/code/defines/procs/announcement.dm index 250c81dfc3dc..0ee68e9f0a14 100644 --- a/code/defines/procs/announcement.dm +++ b/code/defines/procs/announcement.dm @@ -9,90 +9,53 @@ #define HIGHER_FORCE_ANNOUNCE SPAN_ANNOUNCEMENT_HEADER_BLUE("Unknown Higher Force") //xenomorph hive announcement -/proc/xeno_announcement(message, hivenumber, title = QUEEN_ANNOUNCE) - var/list/targets = GLOB.living_xeno_list + GLOB.dead_mob_list - if(hivenumber == "everything") - for(var/mob/M in targets) - var/mob/living/carbon/xenomorph/X = M - if(!isobserver(X) && !istype(X)) //filter out any potential non-xenomorphs/observers mobs - targets.Remove(X) - - announcement_helper(message, title, targets, sound(get_sfx("queen"),wait = 0,volume = 50)) +/proc/xeno_announcement(message, datum/faction/faction_to_display = GLOB.faction_datums[FACTION_XENOMORPH_NORMAL], title = QUEEN_ANNOUNCE) + var/list/targets = GLOB.dead_mob_list.Copy() + if(faction_to_display == "Everyone") + for(var/faction_to_get in FACTION_LIST_XENOMORPH) + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + for(var/mob/mob as anything in faction.totalMobs) + if(mob.stat != CONSCIOUS) + continue + targets.Add(mob) else - for(var/mob/M in targets) - if(isobserver(M)) + for(var/mob/mob as anything in faction_to_display.totalMobs) + if(mob.stat != CONSCIOUS) continue - var/mob/living/carbon/X = M - if(!istype(X) || !X.ally_of_hivenumber(hivenumber)) //additionally filter out those of wrong hive - targets.Remove(X) + targets.Add(mob) - announcement_helper(message, title, targets, sound(get_sfx("queen"),wait = 0,volume = 50)) + announcement_helper(message, title, targets, sound(get_sfx("queen"), wait = 0, volume = 50)) -//general marine announcement -/proc/marine_announcement(message, title = COMMAND_ANNOUNCE, sound_to_play = sound('sound/misc/notice2.ogg'), faction_to_display = FACTION_MARINE, add_PMCs = TRUE, signature, logging = ARES_LOG_MAIN) - var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - if(faction_to_display == FACTION_MARINE) - for(var/mob/M in targets) - if(isobserver(M)) //observers see everything - continue - var/mob/living/carbon/human/H = M - if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) //base human checks - targets.Remove(H) - continue - if(is_mainship_level(H.z)) // People on ship see everything - continue - - // If they have iff AND a marine headset they will recieve announcements - var/obj/item/card/id/card = H.get_idcard() - if ((FACTION_MARINE in card?.faction_group) && (istype(H.wear_l_ear, /obj/item/device/radio/headset/almayer) || istype(H.wear_r_ear, /obj/item/device/radio/headset/almayer))) - continue - - if((H.faction != faction_to_display && !add_PMCs) || (H.faction != faction_to_display && add_PMCs && !(H.faction in FACTION_LIST_WY)) && !(faction_to_display in H.faction_group)) //faction checks - targets.Remove(H) - - switch(logging) +//general faction announcement +/proc/faction_announcement(message, title = COMMAND_ANNOUNCE, sound_to_play = sound('sound/misc/notice2.ogg'), datum/faction/faction_to_display = GLOB.faction_datums[FACTION_MARINE], signature, ares_logging = ARES_LOG_MAIN) + var/list/targets = GLOB.dead_mob_list.Copy() + if(faction_to_display == GLOB.faction_datums[FACTION_MARINE]) + switch(ares_logging) if(ARES_LOG_MAIN) log_ares_announcement(title, message, signature) if(ARES_LOG_SECURITY) log_ares_security(title, message, signature) - else if(faction_to_display == "Everyone (-Yautja)") - for(var/mob/M in targets) - if(isobserver(M)) //observers see everything - continue - var/mob/living/carbon/human/H = M - if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) - targets.Remove(H) + if(faction_to_display == "Everyone (-Yautja)") + for(var/faction_to_get in FACTION_LIST_HUMANOID - FACTION_YAUTJA) + var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + for(var/mob/mob as anything in faction.totalMobs) + if(mob.stat != CONSCIOUS) + continue + targets.Add(mob) else - for(var/mob/M in targets) - if(isobserver(M)) //observers see everything + for(var/mob/mob as anything in faction_to_display.totalMobs) + if(mob.stat != CONSCIOUS) continue - var/mob/living/carbon/human/H = M - if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) - targets.Remove(H) - continue - if(H.faction != faction_to_display) - targets.Remove(H) + targets.Add(mob) if(!isnull(signature)) message += "

Signed by,
[signature]
" announcement_helper(message, title, targets, sound_to_play) -//yautja ship AI announcement -/proc/yautja_announcement(message, title = YAUTJA_ANNOUNCE, sound_to_play = sound('sound/misc/notice1.ogg')) - var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - for(var/mob/M in targets) - if(isobserver(M)) //observers see everything - continue - var/mob/living/carbon/human/H = M - if(!isyautja(H) || H.stat != CONSCIOUS) - targets.Remove(H) - - announcement_helper(message, title, targets, sound_to_play) - //AI announcement that uses talking into comms /proc/ai_announcement(message, sound_to_play = sound('sound/misc/interference.ogg'), logging = ARES_LOG_MAIN) for(var/mob/M in (GLOB.human_mob_list + GLOB.dead_mob_list)) @@ -129,11 +92,11 @@ //to ensure that all humans on ship hear it regardless of comms and power /proc/shipwide_ai_announcement(message, title = MAIN_AI_SYSTEM, sound_to_play = sound('sound/misc/interference.ogg'), signature, ares_logging = ARES_LOG_MAIN) var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - for(var/mob/T in targets) - if(isobserver(T)) + for(var/mob/mob in targets) + if(isobserver(mob)) continue - if(!ishuman(T) || isyautja(T) || !is_mainship_level(T.z)) - targets.Remove(T) + if(!ishuman(mob) || isyautja(mob) || !is_mainship_level(mob.z)) + targets.Remove(mob) if(!isnull(signature)) message += "

Signed by,
[signature]
" @@ -148,11 +111,11 @@ //Subtype of AI shipside announcement for "All Hands On Deck" alerts (COs and SEAs joining the game) /proc/all_hands_on_deck(message, title = MAIN_AI_SYSTEM, sound_to_play = sound('sound/misc/sound_misc_boatswain.ogg')) var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - for(var/mob/T in targets) - if(isobserver(T)) + for(var/mob/mob in targets) + if(isobserver(mob)) continue - if(!ishuman(T) || isyautja(T) || !is_mainship_level((get_turf(T))?.z)) - targets.Remove(T) + if(!ishuman(mob) || isyautja(mob) || !is_mainship_level(mob.z)) + targets.Remove(mob) log_ares_announcement("Shipwide Update", message, title) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 52a35b715b1a..2c87157c166d 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -31,6 +31,9 @@ ///Highest-intensity light affecting us, which determines our visibility. var/affecting_dynamic_lumi = 0 + var/faction_to_get = null + var/datum/faction/faction = null + //=========================================================================== /atom/movable/Destroy(force) for(var/atom/movable/I in contents) @@ -46,6 +49,7 @@ orbiting.end_orbit(src) orbiting = null + faction = null vis_locs = null //clears this atom out of all viscontents if(length(vis_contents)) vis_contents.Cut() diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm index c276d855cdd1..26040c4f3d6f 100644 --- a/code/game/machinery/telecomms/presets.dm +++ b/code/game/machinery/telecomms/presets.dm @@ -274,10 +274,10 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers) else if(choice == "Add your faction's frequencies") if(!do_after(user, 10, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return - switch(user.faction) + switch(user.faction.faction_name) if(FACTION_COLONIST) freq_listening |= COLONY_FREQ - if(FACTION_MARINE in user.faction_group) //FORECON survivors + if(GLOB.faction_datums[FACTION_MARINE].faction_tag_is_ally(user.faction_tag)) //FORECON survivors freq_listening |= SOF_FREQ if(FACTION_CLF) freq_listening |= CLF_FREQS diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 823ea9259385..dd4442f1360c 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -62,7 +62,6 @@ icon_state = "id" item_state = "card-id" var/access = list() - var/list/faction_group /// The name registered_name on the card var/registered_name = "Unknown" diff --git a/code/modules/admin/player_panel/actions/physical.dm b/code/modules/admin/player_panel/actions/physical.dm index 21e6fed4f825..212888d476e0 100644 --- a/code/modules/admin/player_panel/actions/physical.dm +++ b/code/modules/admin/player_panel/actions/physical.dm @@ -220,11 +220,9 @@ permissions_required = R_VAREDIT /datum/player_action/set_faction/act(client/user, mob/living/carbon/human/target, list/params) - var/new_faction = tgui_input_list(usr, "Select faction.", "Faction Choice", FACTION_LIST_HUMANOID) - if(!new_faction) - new_faction = FACTION_NEUTRAL - target.faction = new_faction - target.faction_group = list(new_faction) + var/faction_to_get = tgui_input_list(usr, "Select faction", "Faction Choice", FACTION_LIST_ALL) + if(faction_to_get) + GLOB.faction_datums[faction_to_get].add_mob(target) message_admins("[key_name_admin(user)][new_faction ? "" : " failed to"] set [key_name_admin(target)]'s faction to [new_faction].") return TRUE diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 5228c2d80fba..1ec5d6f10f0f 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -303,9 +303,8 @@ M.ghostize() if(M.mind) - if(M.mind.player_entity) - M.track_death_calculations() - M.mind.player_entity = setup_player_entity(src.ckey) + M.track_death_calculations() + M.client.player_data.setup_statistics() M.statistic_tracked = FALSE usr.mind.transfer_to(M, TRUE) diff --git a/code/modules/admin/verbs/select_equipment.dm b/code/modules/admin/verbs/select_equipment.dm index 196079fe4739..c4c7d62fdc11 100644 --- a/code/modules/admin/verbs/select_equipment.dm +++ b/code/modules/admin/verbs/select_equipment.dm @@ -40,9 +40,7 @@ else switch(newrank) if("Weyland-Yutani") - - H.faction = FACTION_WY - H.faction_group = FACTION_LIST_WY + GLOB.faction_datums[FACTION_WY].add_mob(H) var/newskillset = tgui_input_list(usr, "Select a skillset", "Skill Set", (list("Keep Skillset") +GLOB.RoleAuthority.roles_by_name)) if(!newskillset || newskillset == "Keep Skillset") @@ -165,6 +163,8 @@ CRASH("arm_equipment !gear_path_presets_list[dresscode]") GLOB.gear_name_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear) - if(M.faction) - M.check_event_info(M.faction) + if(mob_client) + check_event_info("Global", mob_client) + if(!isobserver(M) && M.faction) + check_event_info(M.faction.name, mob_client) return diff --git a/code/modules/cm_marines/dropship_equipment.dm b/code/modules/cm_marines/dropship_equipment.dm index c4ac1ac98cad..a3d600a787b2 100644 --- a/code/modules/cm_marines/dropship_equipment.dm +++ b/code/modules/cm_marines/dropship_equipment.dm @@ -192,7 +192,7 @@ .["camera_available"] = defense.has_camera && is_deployed .["selection_state"] = list() .["kills"] = defense.kills - .["iff_status"] = defense.faction_group + .["iff_status"] = defense.faction.faction_name .["health"] = defense.health .["health_max"] = defense.health_max .["deployed"] = is_deployed diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index 7225556584de..dae661f91671 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -223,19 +223,7 @@ if("PRG_access") if(!authenticated || !target_id_card) return - - var/access_type = params["access_target"] - if(params["access_target"] in factions) - if(!target_id_card.faction_group) - target_id_card.faction_group = list() - if(params["access_target"] in target_id_card.faction_group) - target_id_card.faction_group -= params["access_target"] - log_idmod(target_id_card, " [user.real_name] revoked [access_type] IFF. ", key_name_admin(user)) - else - target_id_card.faction_group |= params["access_target"] - log_idmod(target_id_card, " [user.real_name] granted [access_type] IFF. ", key_name_admin(user)) - return TRUE - access_type = text2num(params["access_target"]) + var/access_type = text2num(params["access_target"]) if(access_type in (is_weyland ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN))) if(access_type in target_id_card.access) target_id_card.access -= access_type @@ -249,7 +237,6 @@ return target_id_card.access |= (is_weyland ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN)) - target_id_card.faction_group |= factions log_idmod(target_id_card, " [user.real_name] granted the ID all access and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_denyall") @@ -258,17 +245,11 @@ var/list/access = target_id_card.access access.Cut() - target_id_card.faction_group -= factions log_idmod(target_id_card, " [user.real_name] removed all accesses and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_grantregion") if(!authenticated || !target_id_card) return - - if(params["region"] == "Faction (IFF system)") - target_id_card.faction_group |= factions - log_idmod(target_id_card, " [user.real_name] granted USCM IFF. ", key_name_admin(user)) - return TRUE var/region = text2num(params["region"]) if(isnull(region)) return @@ -279,11 +260,6 @@ if("PRG_denyregion") if(!authenticated || !target_id_card) return - - if(params["region"] == "Faction (IFF system)") - target_id_card.faction_group -= factions - log_idmod(target_id_card, " [user.real_name] revoked USCM IFF. ", key_name_admin(user)) - return TRUE var/region = text2num(params["region"]) if(isnull(region)) return @@ -319,24 +295,24 @@ else if(Check_WO()) // I am not sure about WOs departments so it may need adjustment departments = list( - CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_WO, - CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_WO_USCM, CARDCON_DEPARTMENT_MARINE = GLOB.ROLES_MARINES ) else departments = list( - CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION - GLOB.ROLES_WO, - CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_REGULAR_USCM, CARDCON_DEPARTMENT_MARINE = GLOB.ROLES_MARINES ) data["jobs"] = list() @@ -376,12 +352,9 @@ "accesses" = accesses )) - // Factions goes here - if(target_id_card && target_id_card.faction_group && isnull(target_id_card.faction_group)) - target_id_card.faction_group = list() var/list/localfactions = list() // We can see only those factions which have our console tuned on - for(var/faction in factions) + for(var/datum/faction/faction in factions) localfactions += list(list( "desc" = faction, "ref" = faction, @@ -408,7 +381,7 @@ if(target_id_card) data["id_rank"] = target_id_card.assignment ? target_id_card.assignment : "Unassigned" data["id_owner"] = target_id_card.registered_name ? target_id_card.registered_name : "-----" - data["access_on_card"] = target_id_card.access + target_id_card.faction_group + data["access_on_card"] = target_id_card.access + target_id_card.faction data["id_account"] = target_id_card.associated_account_number return data @@ -522,7 +495,7 @@ req_access = list(ACCESS_MARINE_DATABASE) var/obj/item/card/id/ID_to_modify = null var/mob/living/carbon/human/person_to_modify = null - var/faction = FACTION_MARINE + faction_to_get = FACTION_MARINE /obj/structure/machinery/computer/squad_changer/verb/eject_id() set category = "Object" @@ -709,7 +682,7 @@ use_power = USE_POWER_IDLE idle_power_usage = 250 active_power_usage = 500 - var/faction = FACTION_MARINE + faction_to_get = FACTION_MARINE /// What type of /datum/crewmonitor this will create var/crewmonitor_type = /datum/crewmonitor diff --git a/code/modules/defenses/defenses.dm b/code/modules/defenses/defenses.dm index af4e497862fa..80e1a1b974e3 100644 --- a/code/modules/defenses/defenses.dm +++ b/code/modules/defenses/defenses.dm @@ -10,7 +10,6 @@ use_power = USE_POWER_NONE stat = DEFENSE_FUNCTIONAL health = 200 - var/list/faction_group var/health_max = 200 var/turned_on = FALSE var/mob/owner_mob = null @@ -44,27 +43,25 @@ var/list/selected_categories = list() -/obj/structure/machinery/defenses/Initialize() +/obj/structure/machinery/defenses/Initialize(mapload, datum/faction/faction_to_set, obj/item/defenses/handheld/handheld_ref) . = ..() + + if(faction_to_set) + faction = faction_to_set + + if(handheld_ref) + HD = handheld_ref + else + placed = TRUE + HD = new handheld_type(src, faction, src) + update_icon() - connect() /obj/structure/machinery/defenses/Destroy() if(!QDESTROYING(HD)) QDEL_NULL(HD) return ..() -/obj/structure/machinery/defenses/proc/connect() - if(static) - return FALSE - if(placed && !HD) - HD = new handheld_type - if(!HD.TR) - HD.TR = src - return TRUE - return TRUE - return FALSE - /obj/structure/machinery/defenses/update_icon() if(!composite_icon) icon_state = null @@ -120,7 +117,7 @@ selected_categories[category] = selection switch(category) if(SENTRY_CATEGORY_IFF) - handle_iff(selection) +// handle_iff(selection) return TRUE return FALSE @@ -129,7 +126,7 @@ nickname = selection return TRUE return FALSE - +/* /** * Update the IFF status of this structure. * @param selection: faction selection string. @@ -148,7 +145,7 @@ faction_group = FACTION_LIST_WY if(FACTION_UPP) faction_group = FACTION_LIST_UPP - +*/ /obj/structure/machinery/defenses/start_processing() if(!machine_processing) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 9806e5ce949c..d68f7d7e1638 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -156,8 +156,6 @@ var/job = null // Internal job title used when mob is spawned. Preds are "Predator", Xenos are "Xenomorph", Marines have their actual job title var/comm_title = "" - var/faction = FACTION_NEUTRAL - var/faction_group var/looc_overhead = FALSE From dfc45059314e5d3d73ea2c15b290f51bd800622e Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:14:29 +0500 Subject: [PATCH 13/69] Revert of factions 1 --- code/__DEFINES/factions.dm | 5 - code/_onclick/item_attack.dm | 2 +- code/datums/elements/bullet_trait/iff.dm | 23 ++-- code/datums/elements/strippable.dm | 2 +- code/datums/factions/_modules/module.dm | 2 +- code/datums/factions/_modules/relations.dm | 2 +- code/datums/factions/faction.dm | 2 +- code/datums/mob_hud.dm | 5 +- code/defines/procs/announcement.dm | 109 ++++++++++++------ code/game/atoms_movable.dm | 4 - code/game/machinery/telecomms/presets.dm | 4 +- code/game/objects/items/cards_ids.dm | 1 + .../admin/player_panel/actions/physical.dm | 8 +- code/modules/admin/verbs/select_equipment.dm | 10 +- code/modules/cm_marines/dropship_equipment.dm | 2 +- code/modules/cm_marines/marines_consoles.dm | 65 ++++++++--- code/modules/defenses/defenses.dm | 31 ++--- code/modules/mob/mob_defines.dm | 2 + 18 files changed, 174 insertions(+), 105 deletions(-) diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm index 9af94aa6d31f..65545ff6df44 100644 --- a/code/__DEFINES/factions.dm +++ b/code/__DEFINES/factions.dm @@ -151,11 +151,6 @@ #define MODULE_CODE_NAME_RELATIONS "relations_handler" -GLOBAL_LIST_INIT(ROLES_REGULAR_USCM, list(JOB_CO, JOB_XO, JOB_SO, JOB_INTEL, JOB_PILOT, JOB_DROPSHIP_CREW_CHIEF, JOB_CREWMAN, JOB_POLICE, JOB_CORPORATE_LIAISON, JOB_CHIEF_REQUISITION, JOB_CHIEF_ENGINEER, JOB_CMO, JOB_CHIEF_POLICE, JOB_SEA, JOB_SYNTH, JOB_WARDEN, JOB_ORDNANCE_TECH, JOB_MAINT_TECH, JOB_WORKING_JOE, JOB_MESS_SERGEANT, JOB_CARGO_TECH, JOB_RESEARCHER, JOB_DOCTOR, JOB_NURSE, JOB_SQUAD_LEADER, JOB_SQUAD_TEAM_LEADER, JOB_SQUAD_SPECIALIST, JOB_SQUAD_SMARTGUN, JOB_SQUAD_MEDIC, JOB_SQUAD_ENGI, JOB_SQUAD_MARINE)) -GLOBAL_LIST_INIT(ROLES_REGULAR_XENO, list(JOB_XENOMORPH_QUEEN, JOB_XENOMORPH)) -GLOBAL_LIST_INIT(ROLES_REGULAR_SURV, list(JOB_SYNTH_SURVIVOR, JOB_CO_SURVIVOR, JOB_SURVIVOR)) -GLOBAL_LIST_INIT(ROLES_REGULAR_YAUT, list(JOB_PREDATOR)) - /* diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 7e61a16a70ad..9f0a9d221069 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -45,7 +45,7 @@ /obj/item/proc/attack(mob/living/M, mob/living/user) - if((flags_item & NOBLUDGEON) || (MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) && M.stat == DEAD && !user.ally(M.faction))) + if((flags_item & NOBLUDGEON) || (MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) && M.stat == DEAD && !user.get_target_lock(M.faction_group))) return FALSE if(SEND_SIGNAL(M, COMSIG_ITEM_ATTEMPT_ATTACK, user, src) & COMPONENT_CANCEL_ATTACK) //Sent by target mob. diff --git a/code/datums/elements/bullet_trait/iff.dm b/code/datums/elements/bullet_trait/iff.dm index ceb5baa4439f..cee36acbed80 100644 --- a/code/datums/elements/bullet_trait/iff.dm +++ b/code/datums/elements/bullet_trait/iff.dm @@ -1,5 +1,5 @@ /// This is the iff_group -/obj/item/projectile/var/datum/faction/runtime_iff_group +/obj/projectile/var/runtime_iff_group /datum/element/bullet_trait_iff // General bullet trait vars @@ -7,11 +7,11 @@ id_arg_index = 2 /// The iff group for this bullet - var/datum/faction/iff_group + var/iff_group /// A cache of IFF groups for specific mobs - var/list/datum/faction/iff_group_cache + var/list/iff_group_cache -/datum/element/bullet_trait_iff/Attach(datum/target, datum/faction/iff_group) +/datum/element/bullet_trait_iff/Attach(datum/target, iff_group) . = ..() if(!istype(target, /obj/projectile)) return ELEMENT_INCOMPATIBLE @@ -33,7 +33,7 @@ /datum/element/bullet_trait_iff/proc/check_iff(datum/target, mob/living/carbon/human/projectile_target) SIGNAL_HANDLER - if(projectile_target.ally(iff_group)) + if(projectile_target.get_target_lock(iff_group)) return COMPONENT_SKIP_MOB /datum/element/bullet_trait_iff/proc/set_iff(datum/target, mob/living/carbon/human/firer) @@ -46,20 +46,29 @@ // The cache is reset when the user drops their ID /datum/element/bullet_trait_iff/proc/get_user_iff_group(mob/living/carbon/human/user) if(!ishuman(user)) - return user.faction + return user?.faction_group var/iff_group = LAZYACCESS(iff_group_cache, user) if(isnull(iff_group)) - iff_group = user.faction + iff_group = user.get_id_faction_group() LAZYSET(iff_group_cache, user, iff_group) // Remove them from the cache if they are deleted + RegisterSignal(user, COMSIG_HUMAN_EQUIPPED_ITEM, PROC_REF(handle_id_equip)) RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(reset_iff_group_cache)) return iff_group +/datum/element/bullet_trait_iff/proc/handle_id_equip(equipper, item, slot) + SIGNAL_HANDLER + if(slot == WEAR_ID) + reset_iff_group_cache(equipper) + UnregisterSignal(equipper, COMSIG_HUMAN_EQUIPPED_ITEM) + UnregisterSignal(equipper, COMSIG_PARENT_QDELETING) + /datum/element/bullet_trait_iff/proc/reset_iff_group_cache(mob/living/carbon/human/user) SIGNAL_HANDLER if(!user) iff_group_cache = null else LAZYREMOVE(iff_group_cache, user) + diff --git a/code/datums/elements/strippable.dm b/code/datums/elements/strippable.dm index 08116a7d6cfa..e0daaee74a8c 100644 --- a/code/datums/elements/strippable.dm +++ b/code/datums/elements/strippable.dm @@ -131,7 +131,7 @@ if (ishuman(source)) var/mob/living/carbon/human/sourcehuman = source - if(MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_STRIPDRAG_ENEMY) && (sourcehuman.stat == DEAD || sourcehuman.health < HEALTH_THRESHOLD_CRIT) && !sourcehuman.ally(user.faction)) + if(MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_STRIPDRAG_ENEMY) && (sourcehuman.stat == DEAD || sourcehuman.health < HEALTH_THRESHOLD_CRIT) && !sourcehuman.get_target_lock(user.faction_group)) to_chat(user, SPAN_WARNING("You can't strip items of a crit or dead member of another faction!")) return FALSE diff --git a/code/datums/factions/_modules/module.dm b/code/datums/factions/_modules/module.dm index ebc9ec0ccaa0..74573bb99925 100644 --- a/code/datums/factions/_modules/module.dm +++ b/code/datums/factions/_modules/module.dm @@ -2,5 +2,5 @@ var/module_name var/datum/faction/faction -/datum/faction_module/New(datum/faction/faction_to_set, list/arguments) +/datum/faction_module/New(datum/faction/faction_to_set) faction = faction_to_set diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm index c74c6fba11bc..e59628b4aadf 100644 --- a/code/datums/factions/_modules/relations.dm +++ b/code/datums/factions/_modules/relations.dm @@ -4,7 +4,7 @@ var/relations[] = RELATIONS_MAP var/list/allies = list() -/datum/faction_module/relations/New(datum/faction/faction_to_set, list/arguments) +/datum/faction_module/relations/New(datum/faction/faction_to_set) . = ..() generate_relations_helper() diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index a082c47f2e39..579c8b045204 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -44,7 +44,7 @@ for(var/module in modules_to_add) if(!GLOB.faction_modules[module]) return - modules[module] = new GLOB.faction_modules[module](src, modules_to_add[module]) + modules[module] = new GLOB.faction_modules[module](src, ...modules_to_add[module]) /datum/faction/can_vv_modify() return FALSE diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index e36dc0a1820e..f65428001411 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -221,9 +221,6 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( /mob/proc/add_to_all_mob_huds() return -/mob/proc/hud_update() - return - /mob/hologram/queen/add_to_all_mob_huds() var/datum/mob_hud/hud = GLOB.huds[MOB_HUD_XENO_STATUS] hud.add_to_hud(src) @@ -593,7 +590,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( holder.icon_state = "xeno_banished" hud_list[XENO_BANISHED_HUD] = holder -/mob/living/carbon/xenomorph/hud_update() +/mob/living/carbon/xenomorph/proc/hud_update() var/image/holder = hud_list[XENO_STATUS_HUD] holder.overlays.Cut() if (stat == DEAD) diff --git a/code/defines/procs/announcement.dm b/code/defines/procs/announcement.dm index 0ee68e9f0a14..250c81dfc3dc 100644 --- a/code/defines/procs/announcement.dm +++ b/code/defines/procs/announcement.dm @@ -9,53 +9,90 @@ #define HIGHER_FORCE_ANNOUNCE SPAN_ANNOUNCEMENT_HEADER_BLUE("Unknown Higher Force") //xenomorph hive announcement -/proc/xeno_announcement(message, datum/faction/faction_to_display = GLOB.faction_datums[FACTION_XENOMORPH_NORMAL], title = QUEEN_ANNOUNCE) - var/list/targets = GLOB.dead_mob_list.Copy() - if(faction_to_display == "Everyone") - for(var/faction_to_get in FACTION_LIST_XENOMORPH) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - for(var/mob/mob as anything in faction.totalMobs) - if(mob.stat != CONSCIOUS) - continue - targets.Add(mob) +/proc/xeno_announcement(message, hivenumber, title = QUEEN_ANNOUNCE) + var/list/targets = GLOB.living_xeno_list + GLOB.dead_mob_list + if(hivenumber == "everything") + for(var/mob/M in targets) + var/mob/living/carbon/xenomorph/X = M + if(!isobserver(X) && !istype(X)) //filter out any potential non-xenomorphs/observers mobs + targets.Remove(X) + + announcement_helper(message, title, targets, sound(get_sfx("queen"),wait = 0,volume = 50)) else - for(var/mob/mob as anything in faction_to_display.totalMobs) - if(mob.stat != CONSCIOUS) + for(var/mob/M in targets) + if(isobserver(M)) continue - targets.Add(mob) + var/mob/living/carbon/X = M + if(!istype(X) || !X.ally_of_hivenumber(hivenumber)) //additionally filter out those of wrong hive + targets.Remove(X) - announcement_helper(message, title, targets, sound(get_sfx("queen"), wait = 0, volume = 50)) + announcement_helper(message, title, targets, sound(get_sfx("queen"),wait = 0,volume = 50)) -//general faction announcement -/proc/faction_announcement(message, title = COMMAND_ANNOUNCE, sound_to_play = sound('sound/misc/notice2.ogg'), datum/faction/faction_to_display = GLOB.faction_datums[FACTION_MARINE], signature, ares_logging = ARES_LOG_MAIN) - var/list/targets = GLOB.dead_mob_list.Copy() - if(faction_to_display == GLOB.faction_datums[FACTION_MARINE]) - switch(ares_logging) +//general marine announcement +/proc/marine_announcement(message, title = COMMAND_ANNOUNCE, sound_to_play = sound('sound/misc/notice2.ogg'), faction_to_display = FACTION_MARINE, add_PMCs = TRUE, signature, logging = ARES_LOG_MAIN) + var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list + if(faction_to_display == FACTION_MARINE) + for(var/mob/M in targets) + if(isobserver(M)) //observers see everything + continue + var/mob/living/carbon/human/H = M + if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) //base human checks + targets.Remove(H) + continue + if(is_mainship_level(H.z)) // People on ship see everything + continue + + // If they have iff AND a marine headset they will recieve announcements + var/obj/item/card/id/card = H.get_idcard() + if ((FACTION_MARINE in card?.faction_group) && (istype(H.wear_l_ear, /obj/item/device/radio/headset/almayer) || istype(H.wear_r_ear, /obj/item/device/radio/headset/almayer))) + continue + + if((H.faction != faction_to_display && !add_PMCs) || (H.faction != faction_to_display && add_PMCs && !(H.faction in FACTION_LIST_WY)) && !(faction_to_display in H.faction_group)) //faction checks + targets.Remove(H) + + switch(logging) if(ARES_LOG_MAIN) log_ares_announcement(title, message, signature) if(ARES_LOG_SECURITY) log_ares_security(title, message, signature) - if(faction_to_display == "Everyone (-Yautja)") - for(var/faction_to_get in FACTION_LIST_HUMANOID - FACTION_YAUTJA) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - for(var/mob/mob as anything in faction.totalMobs) - if(mob.stat != CONSCIOUS) - continue - targets.Add(mob) + else if(faction_to_display == "Everyone (-Yautja)") + for(var/mob/M in targets) + if(isobserver(M)) //observers see everything + continue + var/mob/living/carbon/human/H = M + if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) + targets.Remove(H) else - for(var/mob/mob as anything in faction_to_display.totalMobs) - if(mob.stat != CONSCIOUS) + for(var/mob/M in targets) + if(isobserver(M)) //observers see everything continue - targets.Add(mob) + var/mob/living/carbon/human/H = M + if(!istype(H) || H.stat != CONSCIOUS || isyautja(H)) + targets.Remove(H) + continue + if(H.faction != faction_to_display) + targets.Remove(H) if(!isnull(signature)) message += "

Signed by,
[signature]
" announcement_helper(message, title, targets, sound_to_play) +//yautja ship AI announcement +/proc/yautja_announcement(message, title = YAUTJA_ANNOUNCE, sound_to_play = sound('sound/misc/notice1.ogg')) + var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list + for(var/mob/M in targets) + if(isobserver(M)) //observers see everything + continue + var/mob/living/carbon/human/H = M + if(!isyautja(H) || H.stat != CONSCIOUS) + targets.Remove(H) + + announcement_helper(message, title, targets, sound_to_play) + //AI announcement that uses talking into comms /proc/ai_announcement(message, sound_to_play = sound('sound/misc/interference.ogg'), logging = ARES_LOG_MAIN) for(var/mob/M in (GLOB.human_mob_list + GLOB.dead_mob_list)) @@ -92,11 +129,11 @@ //to ensure that all humans on ship hear it regardless of comms and power /proc/shipwide_ai_announcement(message, title = MAIN_AI_SYSTEM, sound_to_play = sound('sound/misc/interference.ogg'), signature, ares_logging = ARES_LOG_MAIN) var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - for(var/mob/mob in targets) - if(isobserver(mob)) + for(var/mob/T in targets) + if(isobserver(T)) continue - if(!ishuman(mob) || isyautja(mob) || !is_mainship_level(mob.z)) - targets.Remove(mob) + if(!ishuman(T) || isyautja(T) || !is_mainship_level(T.z)) + targets.Remove(T) if(!isnull(signature)) message += "

Signed by,
[signature]
" @@ -111,11 +148,11 @@ //Subtype of AI shipside announcement for "All Hands On Deck" alerts (COs and SEAs joining the game) /proc/all_hands_on_deck(message, title = MAIN_AI_SYSTEM, sound_to_play = sound('sound/misc/sound_misc_boatswain.ogg')) var/list/targets = GLOB.human_mob_list + GLOB.dead_mob_list - for(var/mob/mob in targets) - if(isobserver(mob)) + for(var/mob/T in targets) + if(isobserver(T)) continue - if(!ishuman(mob) || isyautja(mob) || !is_mainship_level(mob.z)) - targets.Remove(mob) + if(!ishuman(T) || isyautja(T) || !is_mainship_level((get_turf(T))?.z)) + targets.Remove(T) log_ares_announcement("Shipwide Update", message, title) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 2c87157c166d..52a35b715b1a 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -31,9 +31,6 @@ ///Highest-intensity light affecting us, which determines our visibility. var/affecting_dynamic_lumi = 0 - var/faction_to_get = null - var/datum/faction/faction = null - //=========================================================================== /atom/movable/Destroy(force) for(var/atom/movable/I in contents) @@ -49,7 +46,6 @@ orbiting.end_orbit(src) orbiting = null - faction = null vis_locs = null //clears this atom out of all viscontents if(length(vis_contents)) vis_contents.Cut() diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm index 26040c4f3d6f..c276d855cdd1 100644 --- a/code/game/machinery/telecomms/presets.dm +++ b/code/game/machinery/telecomms/presets.dm @@ -274,10 +274,10 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers) else if(choice == "Add your faction's frequencies") if(!do_after(user, 10, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return - switch(user.faction.faction_name) + switch(user.faction) if(FACTION_COLONIST) freq_listening |= COLONY_FREQ - if(GLOB.faction_datums[FACTION_MARINE].faction_tag_is_ally(user.faction_tag)) //FORECON survivors + if(FACTION_MARINE in user.faction_group) //FORECON survivors freq_listening |= SOF_FREQ if(FACTION_CLF) freq_listening |= CLF_FREQS diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index dd4442f1360c..823ea9259385 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -62,6 +62,7 @@ icon_state = "id" item_state = "card-id" var/access = list() + var/list/faction_group /// The name registered_name on the card var/registered_name = "Unknown" diff --git a/code/modules/admin/player_panel/actions/physical.dm b/code/modules/admin/player_panel/actions/physical.dm index 212888d476e0..21e6fed4f825 100644 --- a/code/modules/admin/player_panel/actions/physical.dm +++ b/code/modules/admin/player_panel/actions/physical.dm @@ -220,9 +220,11 @@ permissions_required = R_VAREDIT /datum/player_action/set_faction/act(client/user, mob/living/carbon/human/target, list/params) - var/faction_to_get = tgui_input_list(usr, "Select faction", "Faction Choice", FACTION_LIST_ALL) - if(faction_to_get) - GLOB.faction_datums[faction_to_get].add_mob(target) + var/new_faction = tgui_input_list(usr, "Select faction.", "Faction Choice", FACTION_LIST_HUMANOID) + if(!new_faction) + new_faction = FACTION_NEUTRAL + target.faction = new_faction + target.faction_group = list(new_faction) message_admins("[key_name_admin(user)][new_faction ? "" : " failed to"] set [key_name_admin(target)]'s faction to [new_faction].") return TRUE diff --git a/code/modules/admin/verbs/select_equipment.dm b/code/modules/admin/verbs/select_equipment.dm index c4c7d62fdc11..196079fe4739 100644 --- a/code/modules/admin/verbs/select_equipment.dm +++ b/code/modules/admin/verbs/select_equipment.dm @@ -40,7 +40,9 @@ else switch(newrank) if("Weyland-Yutani") - GLOB.faction_datums[FACTION_WY].add_mob(H) + + H.faction = FACTION_WY + H.faction_group = FACTION_LIST_WY var/newskillset = tgui_input_list(usr, "Select a skillset", "Skill Set", (list("Keep Skillset") +GLOB.RoleAuthority.roles_by_name)) if(!newskillset || newskillset == "Keep Skillset") @@ -163,8 +165,6 @@ CRASH("arm_equipment !gear_path_presets_list[dresscode]") GLOB.gear_name_presets_list[dresscode].load_preset(M, randomise, count_participant, mob_client, show_job_gear) - if(mob_client) - check_event_info("Global", mob_client) - if(!isobserver(M) && M.faction) - check_event_info(M.faction.name, mob_client) + if(M.faction) + M.check_event_info(M.faction) return diff --git a/code/modules/cm_marines/dropship_equipment.dm b/code/modules/cm_marines/dropship_equipment.dm index a3d600a787b2..c4ac1ac98cad 100644 --- a/code/modules/cm_marines/dropship_equipment.dm +++ b/code/modules/cm_marines/dropship_equipment.dm @@ -192,7 +192,7 @@ .["camera_available"] = defense.has_camera && is_deployed .["selection_state"] = list() .["kills"] = defense.kills - .["iff_status"] = defense.faction.faction_name + .["iff_status"] = defense.faction_group .["health"] = defense.health .["health_max"] = defense.health_max .["deployed"] = is_deployed diff --git a/code/modules/cm_marines/marines_consoles.dm b/code/modules/cm_marines/marines_consoles.dm index dae661f91671..7225556584de 100644 --- a/code/modules/cm_marines/marines_consoles.dm +++ b/code/modules/cm_marines/marines_consoles.dm @@ -223,7 +223,19 @@ if("PRG_access") if(!authenticated || !target_id_card) return - var/access_type = text2num(params["access_target"]) + + var/access_type = params["access_target"] + if(params["access_target"] in factions) + if(!target_id_card.faction_group) + target_id_card.faction_group = list() + if(params["access_target"] in target_id_card.faction_group) + target_id_card.faction_group -= params["access_target"] + log_idmod(target_id_card, " [user.real_name] revoked [access_type] IFF. ", key_name_admin(user)) + else + target_id_card.faction_group |= params["access_target"] + log_idmod(target_id_card, " [user.real_name] granted [access_type] IFF. ", key_name_admin(user)) + return TRUE + access_type = text2num(params["access_target"]) if(access_type in (is_weyland ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN))) if(access_type in target_id_card.access) target_id_card.access -= access_type @@ -237,6 +249,7 @@ return target_id_card.access |= (is_weyland ? get_access(ACCESS_LIST_WY_ALL) : get_access(ACCESS_LIST_MARINE_MAIN)) + target_id_card.faction_group |= factions log_idmod(target_id_card, " [user.real_name] granted the ID all access and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_denyall") @@ -245,11 +258,17 @@ var/list/access = target_id_card.access access.Cut() + target_id_card.faction_group -= factions log_idmod(target_id_card, " [user.real_name] removed all accesses and USCM IFF. ", key_name_admin(user)) return TRUE if("PRG_grantregion") if(!authenticated || !target_id_card) return + + if(params["region"] == "Faction (IFF system)") + target_id_card.faction_group |= factions + log_idmod(target_id_card, " [user.real_name] granted USCM IFF. ", key_name_admin(user)) + return TRUE var/region = text2num(params["region"]) if(isnull(region)) return @@ -260,6 +279,11 @@ if("PRG_denyregion") if(!authenticated || !target_id_card) return + + if(params["region"] == "Faction (IFF system)") + target_id_card.faction_group -= factions + log_idmod(target_id_card, " [user.real_name] revoked USCM IFF. ", key_name_admin(user)) + return TRUE var/region = text2num(params["region"]) if(isnull(region)) return @@ -295,24 +319,24 @@ else if(Check_WO()) // I am not sure about WOs departments so it may need adjustment departments = list( - CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_WO_USCM, - CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_WO_USCM, + CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_WO, + CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_WO, CARDCON_DEPARTMENT_MARINE = GLOB.ROLES_MARINES ) else departments = list( - CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION & GLOB.ROLES_REGULAR_USCM, - CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL & GLOB.ROLES_REGULAR_USCM, + CARDCON_DEPARTMENT_COMMAND = GLOB.ROLES_CIC - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_AUXCOM = GLOB.ROLES_AUXIL_SUPPORT - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_MISC = GLOB.ROLES_MISC - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_SECURITY = GLOB.ROLES_POLICE - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_ENGINEERING = GLOB.ROLES_ENGINEERING - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_SUPPLY = GLOB.ROLES_REQUISITION - GLOB.ROLES_WO, + CARDCON_DEPARTMENT_MEDICAL = GLOB.ROLES_MEDICAL - GLOB.ROLES_WO, CARDCON_DEPARTMENT_MARINE = GLOB.ROLES_MARINES ) data["jobs"] = list() @@ -352,9 +376,12 @@ "accesses" = accesses )) + // Factions goes here + if(target_id_card && target_id_card.faction_group && isnull(target_id_card.faction_group)) + target_id_card.faction_group = list() var/list/localfactions = list() // We can see only those factions which have our console tuned on - for(var/datum/faction/faction in factions) + for(var/faction in factions) localfactions += list(list( "desc" = faction, "ref" = faction, @@ -381,7 +408,7 @@ if(target_id_card) data["id_rank"] = target_id_card.assignment ? target_id_card.assignment : "Unassigned" data["id_owner"] = target_id_card.registered_name ? target_id_card.registered_name : "-----" - data["access_on_card"] = target_id_card.access + target_id_card.faction + data["access_on_card"] = target_id_card.access + target_id_card.faction_group data["id_account"] = target_id_card.associated_account_number return data @@ -495,7 +522,7 @@ req_access = list(ACCESS_MARINE_DATABASE) var/obj/item/card/id/ID_to_modify = null var/mob/living/carbon/human/person_to_modify = null - faction_to_get = FACTION_MARINE + var/faction = FACTION_MARINE /obj/structure/machinery/computer/squad_changer/verb/eject_id() set category = "Object" @@ -682,7 +709,7 @@ use_power = USE_POWER_IDLE idle_power_usage = 250 active_power_usage = 500 - faction_to_get = FACTION_MARINE + var/faction = FACTION_MARINE /// What type of /datum/crewmonitor this will create var/crewmonitor_type = /datum/crewmonitor diff --git a/code/modules/defenses/defenses.dm b/code/modules/defenses/defenses.dm index 80e1a1b974e3..af4e497862fa 100644 --- a/code/modules/defenses/defenses.dm +++ b/code/modules/defenses/defenses.dm @@ -10,6 +10,7 @@ use_power = USE_POWER_NONE stat = DEFENSE_FUNCTIONAL health = 200 + var/list/faction_group var/health_max = 200 var/turned_on = FALSE var/mob/owner_mob = null @@ -43,25 +44,27 @@ var/list/selected_categories = list() -/obj/structure/machinery/defenses/Initialize(mapload, datum/faction/faction_to_set, obj/item/defenses/handheld/handheld_ref) +/obj/structure/machinery/defenses/Initialize() . = ..() - - if(faction_to_set) - faction = faction_to_set - - if(handheld_ref) - HD = handheld_ref - else - placed = TRUE - HD = new handheld_type(src, faction, src) - update_icon() + connect() /obj/structure/machinery/defenses/Destroy() if(!QDESTROYING(HD)) QDEL_NULL(HD) return ..() +/obj/structure/machinery/defenses/proc/connect() + if(static) + return FALSE + if(placed && !HD) + HD = new handheld_type + if(!HD.TR) + HD.TR = src + return TRUE + return TRUE + return FALSE + /obj/structure/machinery/defenses/update_icon() if(!composite_icon) icon_state = null @@ -117,7 +120,7 @@ selected_categories[category] = selection switch(category) if(SENTRY_CATEGORY_IFF) -// handle_iff(selection) + handle_iff(selection) return TRUE return FALSE @@ -126,7 +129,7 @@ nickname = selection return TRUE return FALSE -/* + /** * Update the IFF status of this structure. * @param selection: faction selection string. @@ -145,7 +148,7 @@ faction_group = FACTION_LIST_WY if(FACTION_UPP) faction_group = FACTION_LIST_UPP -*/ + /obj/structure/machinery/defenses/start_processing() if(!machine_processing) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index d68f7d7e1638..9806e5ce949c 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -156,6 +156,8 @@ var/job = null // Internal job title used when mob is spawned. Preds are "Predator", Xenos are "Xenomorph", Marines have their actual job title var/comm_title = "" + var/faction = FACTION_NEUTRAL + var/faction_group var/looc_overhead = FALSE From 35d14cca9a95672be8f18d0d017d92aaef39d2d2 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:16:06 +0500 Subject: [PATCH 14/69] Revert of factions 2 --- code/datums/statistics/cause_data.dm | 2 +- .../machinery/computer/dropship_weapons.dm | 2 +- .../computer/groundside_operations.dm | 3 +- code/game/objects/items/devices/flashlight.dm | 13 ++++---- code/game/objects/items/stacks/flags.dm | 18 +++++------ .../objects/items/tools/experimental_tools.dm | 2 +- code/game/supplyshuttle.dm | 2 +- code/modules/admin/tabs/event_tab.dm | 31 ++++++++++--------- 8 files changed, 36 insertions(+), 37 deletions(-) diff --git a/code/datums/statistics/cause_data.dm b/code/datums/statistics/cause_data.dm index 5904be46b5a5..36f1a664afa7 100644 --- a/code/datums/statistics/cause_data.dm +++ b/code/datums/statistics/cause_data.dm @@ -29,5 +29,5 @@ if(M.mind) new_data.ckey = M.mind.ckey new_data.role = M.get_role_name() - new_data.faction = M.faction?.faction_name + new_data.faction = M.faction return new_data diff --git a/code/game/machinery/computer/dropship_weapons.dm b/code/game/machinery/computer/dropship_weapons.dm index 887f05619f6f..7f8f4f2b3850 100644 --- a/code/game/machinery/computer/dropship_weapons.dm +++ b/code/game/machinery/computer/dropship_weapons.dm @@ -4,7 +4,7 @@ density = TRUE icon = 'icons/obj/structures/machinery/shuttle-parts.dmi' icon_state = "consoleright" - fation_to_get = FACTION_MARINE + var/faction = FACTION_MARINE circuit = null unslashable = TRUE unacidable = TRUE diff --git a/code/game/machinery/computer/groundside_operations.dm b/code/game/machinery/computer/groundside_operations.dm index 416da7213c1e..591c63a76bee 100644 --- a/code/game/machinery/computer/groundside_operations.dm +++ b/code/game/machinery/computer/groundside_operations.dm @@ -8,8 +8,6 @@ unslashable = TRUE unacidable = TRUE - fation_to_get = FACTION_MARINE - var/obj/structure/machinery/camera/cam = null var/datum/squad/current_squad = null @@ -22,6 +20,7 @@ var/add_pmcs = TRUE var/lz_selection = TRUE var/has_squad_overwatch = TRUE + var/faction = FACTION_MARINE var/show_command_squad = FALSE /obj/structure/machinery/computer/groundside_operations/Initialize() diff --git a/code/game/objects/items/devices/flashlight.dm b/code/game/objects/items/devices/flashlight.dm index 5bc1f88ef3ff..e506f51ce21c 100644 --- a/code/game/objects/items/devices/flashlight.dm +++ b/code/game/objects/items/devices/flashlight.dm @@ -465,6 +465,7 @@ item_state = "cas_flare" layer = ABOVE_FLY_LAYER ammo_datum = /datum/ammo/flare/signal + var/faction = "" var/datum/cas_signal/signal var/activate_message = TRUE flame_base_tint = "#00aa00" @@ -486,13 +487,13 @@ /obj/item/device/flashlight/flare/signal/activate_signal(mob/living/carbon/human/user) ..() - if(faction && cas_groups[faction.faction_name]) + if(faction && GLOB.cas_groups[faction]) signal = new(src) signal.target_id = ++GLOB.cas_tracking_id_increment name = "[user.assigned_squad ? user.assigned_squad.name : "X"]-[signal.target_id] flare" signal.name = name signal.linked_cam = new(loc, name) - GLOB.cas_groups[user.faction.faction_name].add_signal(signal) + GLOB.cas_groups[user.faction].add_signal(signal) anchored = TRUE if(activate_message) visible_message(SPAN_DANGER("[src]'s flame reaches full strength. It's fully active now."), null, 5) @@ -512,14 +513,14 @@ /obj/item/device/flashlight/flare/signal/Destroy() STOP_PROCESSING(SSobj, src) if(signal) - GLOB.cas_groups[faction.faction_name].remove_signal(signal) + GLOB.cas_groups[faction].remove_signal(signal) QDEL_NULL(signal) return ..() -/obj/item/device/flashlight/flare/signal/burn_out() +/obj/item/device/flashlight/flare/signal/turn_off() anchored = FALSE if(signal) - GLOB.cas_groups[faction.faction_name].remove_signal(signal) + GLOB.cas_groups[faction].remove_signal(signal) qdel(signal) ..() @@ -546,7 +547,7 @@ /obj/item/device/flashlight/flare/signal/debug/activate_signal() turn_on() - faction = GLOB.faction_datums[FACTION_MARINE] + faction = FACTION_MARINE signal = new(src) signal.target_id = ++GLOB.cas_tracking_id_increment name += " [rand(100, 999)]" diff --git a/code/game/objects/items/stacks/flags.dm b/code/game/objects/items/stacks/flags.dm index de7bbb8d828f..14833812b06c 100644 --- a/code/game/objects/items/stacks/flags.dm +++ b/code/game/objects/items/stacks/flags.dm @@ -182,6 +182,8 @@ /// The typepath of the flag structure that gets spawned when the flag is planted. var/flag_type = /obj/structure/flag/plantable + /// Used to check if nearby mobs belong to a faction when calculating for the stronger warcry. + var/faction /// Does the flag play a unique warcry when planted? (Only while on harm intent.) var/play_warcry = FALSE /// The warcry's sound path. @@ -195,11 +197,11 @@ /obj/item/flag/plantable/get_examine_text(mob/user) . = ..() - if(play_warcry && user.ally(faction)) + if(play_warcry && user.faction == faction) . += SPAN_NOTICE("Planting the flag while in HARM intent will cause you to bellow out a rallying warcry!") /// Proc for turning the flag item into a structure. -/obj/item/flag/plantable/proc/plant_flag(mob/living/user, play_warcry = FALSE, warcry_sound, warcry_extra_sound) +/obj/item/flag/plantable/proc/plant_flag(mob/living/user, play_warcry = FALSE, warcry_sound, warcry_extra_sound, faction) if(user.action_busy) return @@ -229,15 +231,14 @@ user.visible_message(SPAN_NOTICE("[user] plants [src] into the ground!"), SPAN_NOTICE("You plant [src] into the ground!")) var/obj/structure/flag/plantable/planted_flag = new flag_type(turf_to_plant) - planted_flag.faction = faction // If there are more than 14 allies nearby, play a stronger rallying cry. // Otherwise, play the default warcry sound if there is one. If not, play a generic flag raising sfx. - if(play_warcry && user.ally(faction) && user.a_intent == INTENT_HARM) + if(play_warcry && user.faction == faction && user.a_intent == INTENT_HARM) var/allies_nearby = 0 if(COOLDOWN_FINISHED(src, warcry_cooldown_item)) for(var/mob/living/carbon/human in orange(planted_flag, 7)) - if(human.is_dead() || !human.ally(faction)) + if(human.is_dead() || human.faction != faction) continue allies_nearby++ @@ -257,14 +258,9 @@ qdel(src) -/obj/item/flag/plantable/pick_up(mob/user) - ..() - if(!faction) - faction = user.faction - /obj/item/flag/plantable/attack_self(mob/user) ..() - plant_flag(user, play_warcry, warcry_sound, warcry_extra_sound) + plant_flag(user, play_warcry, warcry_sound, warcry_extra_sound, faction) // UNITED AMERICAS FLAG // ////////////////////////// diff --git a/code/game/objects/items/tools/experimental_tools.dm b/code/game/objects/items/tools/experimental_tools.dm index 846bbbe1766b..140a05a534b7 100644 --- a/code/game/objects/items/tools/experimental_tools.dm +++ b/code/game/objects/items/tools/experimental_tools.dm @@ -5,8 +5,8 @@ icon_state = "crew_monitor" flags_equip_slot = SLOT_WAIST w_class = SIZE_SMALL - faction_to_get = FACTION_MARINE var/datum/radar/lifeline/radar + var/faction = FACTION_MARINE /obj/item/tool/crew_monitor/Initialize(mapload, ...) . = ..() diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index a0aa2960cc8c..3a4a3525c2f2 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -164,12 +164,12 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) icon_state = "security_cam" circuit = /obj/item/circuitboard/computer/supply_drop_console req_access = list(ACCESS_MARINE_CARGO) - fation_to_get = FACTION_MARINE var/x_supply = 0 var/y_supply = 0 var/datum/squad/current_squad = null var/drop_cooldown = 1 MINUTES var/can_pick_squad = TRUE + var/faction = FACTION_MARINE var/obj/structure/closet/crate/loaded_crate COOLDOWN_DECLARE(next_fire) diff --git a/code/modules/admin/tabs/event_tab.dm b/code/modules/admin/tabs/event_tab.dm index a73617c75449..a155f2a37614 100644 --- a/code/modules/admin/tabs/event_tab.dm +++ b/code/modules/admin/tabs/event_tab.dm @@ -6,38 +6,41 @@ to_chat(usr, "Only administrators may use this command.") return - if(!length(GLOB.custom_event_info_list)) + if(!LAZYLEN(GLOB.custom_event_info_list)) to_chat(usr, "custom_event_info_list is not initialized, tell a dev.") return var/list/temp_list = list() for(var/T in GLOB.custom_event_info_list) - var/datum/custom_event_info/custom_event = GLOB.custom_event_info_list[T] - temp_list["[custom_event.msg ? "(x) [custom_event.faction_name]" : custom_event.faction_name]"] = custom_event.faction_name + var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[T] + temp_list["[CEI.msg ? "(x) [CEI.faction]" : CEI.faction]"] = CEI.faction - var/event_info_get = temp_list[tgui_input_list(usr, "Select faction. Ghosts will see only \"Global\" category message. Factions with event message set are marked with (x).", "Faction Choice", temp_list)] - if(!event_info_get) + var/faction = tgui_input_list(usr, "Select faction. Ghosts will see only \"Global\" category message. Factions with event message set are marked with (x).", "Faction Choice", temp_list) + if(!faction) return - var/datum/custom_event_info/custom_info = GLOB.custom_event_info_list[event_info_get] - if(!custom_info) - to_chat(usr, "custom_event_info_list don't have [event_info_get] in list, tell a dev.") + faction = temp_list[faction] + + if(!GLOB.custom_event_info_list[faction]) + to_chat(usr, "Error has occurred, [faction] category is not found.") return - var/input = tgui_input_text(usr, "Enter the custom event message for \"[event_info_get]\" category. Be descriptive. \nTo remove the event message, remove text and confirm.", "[event_info_get] Event Message", custom_info.msg, 4096, TRUE) + var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[faction] + + var/input = input(usr, "Enter the custom event message for \"[faction]\" category. Be descriptive. \nTo remove the event message, remove text and confirm.", "[faction] Event Message", CEI.msg) as message|null if(isnull(input)) return if(input == "" || !input) - custom_info.msg = "" - message_admins("[key_name_admin(usr)] has removed the event message for \"[event_info_get]\" category.") + CEI.msg = "" + message_admins("[key_name_admin(usr)] has removed the event message for \"[faction]\" category.") return - custom_info.msg = html_encode(input) - message_admins("[key_name_admin(usr)] has changed the event message for \"[event_info_get]\" category.") + CEI.msg = html_encode(input) + message_admins("[key_name_admin(usr)] has changed the event message for \"[faction]\" category.") - custom_info.handle_event_info_update() + CEI.handle_event_info_update(faction) /client/proc/change_security_level() if(!check_rights(R_ADMIN)) From d7978cafadae88aa029693ee8cd0b806de8eec64 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:18:43 +0500 Subject: [PATCH 15/69] Revert of factions 3 --- code/datums/mob_hud.dm | 7 +- .../gamemodes/colonialmarines/xenovsxeno.dm | 3 +- code/game/gamemodes/game_mode.dm | 3 +- code/game/jobs/job/antag/xeno/queen.dm | 4 +- code/game/jobs/job/antag/xeno/xenomorph.dm | 10 ++- .../antag/antag_guns_snowflake.dm | 19 +++-- .../vendor_types/antag/antag_guns_sorted.dm | 18 +++-- code/modules/client/preferences.dm | 8 +- .../cm_tech/implements/xeno_handler.dm | 6 +- code/modules/gear_presets/other.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 2 +- .../living/carbon/xenomorph/items/iff_tag.dm | 77 +++++++++++++++++++ code/modules/mob/new_player/new_player.dm | 28 +++---- colonialmarines.dme | 1 + 14 files changed, 136 insertions(+), 52 deletions(-) create mode 100644 code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm diff --git a/code/datums/mob_hud.dm b/code/datums/mob_hud.dm index f65428001411..603f9a05d702 100644 --- a/code/datums/mob_hud.dm +++ b/code/datums/mob_hud.dm @@ -659,7 +659,8 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( return /mob/living/carbon/human/hud_set_squad() - var/image/holder = hud_list[faction.hud_type] + var/datum/faction/F = get_faction(faction) + var/image/holder = hud_list[F.hud_type] holder.icon_state = "hudblank" holder.overlays.Cut() @@ -667,7 +668,7 @@ GLOBAL_LIST_INIT_TYPED(huds, /datum/mob_hud, list( holder.overlays += image('icons/mob/hud/marine_hud.dmi', src, "hudmutineer") return - faction.modify_hud_holder(holder, src) + F.modify_hud_holder(holder, src) /mob/living/carbon/human/yautja/hud_set_squad() set waitfor = FALSE @@ -783,7 +784,7 @@ GLOBAL_DATUM(hud_icon_hudfocus, /image) // Vampire Execute HUD /mob/living/carbon/human/proc/update_execute_hud() var/image/execute_holder = hud_list[XENO_EXECUTE] - + execute_holder.icon_state = "hudblank" execute_holder.overlays.Cut() diff --git a/code/game/gamemodes/colonialmarines/xenovsxeno.dm b/code/game/gamemodes/colonialmarines/xenovsxeno.dm index 1e063c1a6568..e2e4547fc9a8 100644 --- a/code/game/gamemodes/colonialmarines/xenovsxeno.dm +++ b/code/game/gamemodes/colonialmarines/xenovsxeno.dm @@ -239,9 +239,8 @@ if(!living_hives) round_finished = "No one has won." - else if(living_hives == 1) + else if (living_hives == 1) round_finished = "The [last_living_hive] has won." - SSticker.mode.faction_won = last_living_hive /////////////////////////////// //Checks if the round is over// diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index bfee8cd0e023..ef64e31ee9ec 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -33,7 +33,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/static_comms_amount = 0 var/obj/structure/machinery/computer/shuttle/dropship/flight/active_lz = null - var/datum/faction/faction_won = null var/list/active_roles_mappings_pool = list() var/list/active_roles_pool = list() var/list/factions_pool = list() @@ -50,7 +49,7 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t GLOB.available_taskbar_icons |= taskbar_icon for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] + var/datum/faction/faction = GLOB.faction_datum[faction_to_get] if(length(faction.roles_list[name])) factions_pool[faction.name] = faction.faction_name active_roles_mappings_pool += faction.role_mappings[name] diff --git a/code/game/jobs/job/antag/xeno/queen.dm b/code/game/jobs/job/antag/xeno/queen.dm index 7d793d5b0cf5..144f8e42e6ad 100644 --- a/code/game/jobs/job/antag/xeno/queen.dm +++ b/code/game/jobs/job/antag/xeno/queen.dm @@ -9,8 +9,8 @@ /datum/job/antag/xenos/queen/set_spawn_positions(count) return spawn_positions -/datum/job/antag/xenos/queen/transform_to_xeno(mob/living/carbon/human/human_to_transform, faction_index) - SSticker.mode.pick_queen_spawn(human_to_transform, faction_index) +/datum/job/antag/xenos/queen/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index) + SSticker.mode.pick_queen_spawn(human_to_transform, hive_index) /datum/job/antag/xenos/queen/announce_entry_message(mob/new_queen, account, whitelist_status) to_chat(new_queen, "You are now the alien queen!") diff --git a/code/game/jobs/job/antag/xeno/xenomorph.dm b/code/game/jobs/job/antag/xeno/xenomorph.dm index 840230891623..eeca16bc7f90 100644 --- a/code/game/jobs/job/antag/xeno/xenomorph.dm +++ b/code/game/jobs/job/antag/xeno/xenomorph.dm @@ -23,10 +23,12 @@ . = ..() var/mob/living/carbon/human/H = . - transform_to_xeno(H, FACTION_XENOMORPH_NORMAL) + transform_to_xeno(H, XENO_HIVE_NORMAL) -/datum/job/antag/xenos/proc/transform_to_xeno(mob/living/carbon/human/human_to_transform, faction_index) - var/datum/faction/faction = GLOB.faction_datums[faction_index] +/datum/job/antag/xenos/proc/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index) + var/datum/mind/new_xeno = human_to_transform.mind + new_xeno.setup_xeno_stats() + var/datum/hive_status/hive = GLOB.hive_datum[hive_index] human_to_transform.first_xeno = TRUE human_to_transform.set_stat(UNCONSCIOUS) @@ -93,7 +95,7 @@ var/obj/item/alien_embryo/embryo = new /obj/item/alien_embryo(human_to_transform) //Put the initial larva in a host embryo.stage = 5 //Give the embryo a head-start (make the larva burst instantly) - embryo.faction = faction + embryo.hivenumber = hive.hivenumber /datum/job/antag/xenos/equip_job(mob/living/M) diff --git a/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm b/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm index 7a3e4293304f..73a2c7346a4c 100644 --- a/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm +++ b/code/game/machinery/vending/vendor_types/antag/antag_guns_snowflake.dm @@ -16,21 +16,24 @@ vend_flags |= VEND_FACTION_THEMES /obj/structure/machinery/cm_vending/gear/antag_guns/get_listed_products(mob/user) + var/list/factions = GLOB.faction_datums if(!user) var/list/all_equipment = list() - for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - var/list/equipment = faction.get_antag_guns_snowflake_equipment() - if(length(equipment)) + for (var/i in 1 to length(factions)) + var/datum/faction/F = get_faction(factions[i]) + var/list/equipment = F.get_antag_guns_snowflake_equipment() + if(LAZYLEN(equipment)) all_equipment += equipment return all_equipment - var/mob/living/carbon/human/human = user - var/datum/faction/faction = human.faction ? human.faction : GLOB.faction_datums[FACTION_CLF] - if(!(faction.faction_name in listed_products)) - listed_products[faction.faction_name] = faction.get_antag_guns_snowflake_equipment() + var/mob/living/carbon/human/H = user + var/faction = H.faction ? H.faction : FACTION_CLF + if(!(faction in listed_products)) + var/datum/faction/F = get_faction(H.faction) + listed_products[faction] = F.get_antag_guns_snowflake_equipment() return listed_products[faction] + //--------------ESSENTIALS------------------------ /obj/effect/essentials_set/medic/upp diff --git a/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm b/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm index 67be70dc9494..ab319f1eca1d 100644 --- a/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm +++ b/code/game/machinery/vending/vendor_types/antag/antag_guns_sorted.dm @@ -13,18 +13,20 @@ vend_flags |= VEND_FACTION_THEMES /obj/structure/machinery/cm_vending/sorted/cargo_guns/antag_guns/get_listed_products(mob/user) + var/list/factions = GLOB.faction_datums if(!user) var/list/all_equipment = list() - for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - var/list/equipment = faction.get_antag_guns_sorted_equipment() - if(length(equipment)) + for (var/i in 1 to length(factions)) + var/datum/faction/F = get_faction(factions[i]) + var/list/equipment = F.get_antag_guns_sorted_equipment() + if(LAZYLEN(equipment)) all_equipment += equipment return all_equipment - var/mob/living/carbon/human/human = user - var/datum/faction/faction = human.faction ? human.faction : GLOB.faction_datums[FACTION_CLF] - if(!(faction.faction_name in listed_products)) - listed_products[faction.faction_name] = faction.get_antag_guns_sorted_equipment() + var/mob/living/carbon/human/H = user + var/faction = H.faction ? H.faction : FACTION_CLF + if(!(faction in listed_products)) + var/datum/faction/F = get_faction(H.faction) + listed_products[faction] = F.get_antag_guns_sorted_equipment() return listed_products[faction] diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index a519bf1f53a6..3538bf12daff 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -674,7 +674,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return if(!observing_faction) - observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] if(!length(roles_pool)) roles_pool = observing_faction.roles_list[SSticker.mode.name] @@ -795,7 +795,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return if(!observing_faction) - observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] if(!length(roles_pool)) roles_pool = observing_faction.roles_list[SSticker.mode.name] @@ -1018,7 +1018,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( if(!choice) return - observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[choice]] + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] set_choices(user) else set_choices(user) @@ -1044,7 +1044,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( if(!choice) return - observing_faction = GLOB.faction_datums[SSticker.mode.factions_pool[choice]] + observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] set_job_slots(user) else set_job_slots(user) diff --git a/code/modules/cm_tech/implements/xeno_handler.dm b/code/modules/cm_tech/implements/xeno_handler.dm index c85df2924181..7c35bf9def84 100644 --- a/code/modules/cm_tech/implements/xeno_handler.dm +++ b/code/modules/cm_tech/implements/xeno_handler.dm @@ -38,9 +38,9 @@ else var/picked = pick(/mob/living/carbon/xenomorph/drone, /mob/living/carbon/xenomorph/spitter, /mob/living/carbon/xenomorph/lurker) - new_mob = new picked(spawn_loc, null, GLOB.faction_datums[FACTION_XENOMORPH_TAMED]) - new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datums[FACTION_USCM]) - new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datums[FACTION_XENOMORPH_TAMED]) + new_mob = new picked(spawn_loc, null, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) + new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_USCM]) + new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) if(M) M.transfer_to(new_mob, TRUE) else diff --git a/code/modules/gear_presets/other.dm b/code/modules/gear_presets/other.dm index 692e57bc29d8..876beedf5fe4 100644 --- a/code/modules/gear_presets/other.dm +++ b/code/modules/gear_presets/other.dm @@ -602,7 +602,7 @@ //Overloading the function to be able to spawn gear first /datum/equipment_preset/other/zombie/load_preset(mob/living/carbon/human/new_human, randomise = FALSE) - GLOB.faction_datums[faction].add_mob(new_human) + GLOB.faction_datum[faction].add_mob(new_human) if(new_human.faction?.organ_faction_iff_tag_type) if(new_human.organ_faction_tag) QDEL_NULL(new_human.organ_faction_tag) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 40510cb9857e..442967bdd063 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -960,7 +960,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Join as Zombie" set desc = "Select an alive but logged-out Zombie to rejoin the game." - GLOB.faction_datums[FACTION_ZOMBIE]?.get_join_status(src) + GLOB.faction_datum[FACTION_ZOMBIE]?.get_join_status(src) /mob/dead/verb/join_as_freed_mob() set category = "Ghost.Join" diff --git a/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm b/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm new file mode 100644 index 000000000000..4c63fc2b5923 --- /dev/null +++ b/code/modules/mob/living/carbon/xenomorph/items/iff_tag.dm @@ -0,0 +1,77 @@ +/obj/item/iff_tag + name = "xenomorph IFF tag" + desc = "A tag containing a small IFF computer that gets inserted into the carapace of a xenomorph. You can modify the IFF groups by using an access tuner on it, or on the xeno if it's already implanted." + icon = 'icons/obj/items/xeno_tag.dmi' + icon_state = "xeno_tag" + var/list/faction_groups = list() + +/obj/item/iff_tag/attack(mob/living/carbon/xenomorph/xeno, mob/living/carbon/human/injector) + if(isxeno(xeno)) + if(xeno.stat == DEAD) + to_chat(injector, SPAN_WARNING("\The [xeno] is dead...")) + return + if(xeno.iff_tag) + to_chat(injector, SPAN_WARNING("\The [xeno] already has a tag inside it.")) + return + injector.visible_message(SPAN_NOTICE("[injector] starts forcing \the [src] into [xeno]'s carapace..."), SPAN_NOTICE("You start forcing \the [src] into [xeno]'s carapace...")) + if(!do_after(injector, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC, xeno, INTERRUPT_DIFF_LOC, BUSY_ICON_GENERIC)) + return + injector.visible_message(SPAN_NOTICE("[injector] forces \the [src] into [xeno]'s carapace!"), SPAN_NOTICE("You force \the [src] into [xeno]'s carapace!")) + xeno.iff_tag = src + injector.drop_inv_item_to_loc(src, xeno) + if(xeno.hive.hivenumber == XENO_HIVE_RENEGADE) //it's important to know their IFF settings for renegade + to_chat(xeno, SPAN_NOTICE("With the insertion of the device into your carapace, your instincts have changed compelling you to protect [english_list(faction_groups, "no one")].")) + return + return ..() + +/obj/item/iff_tag/attackby(obj/item/W, mob/user) + if(HAS_TRAIT(W, TRAIT_TOOL_MULTITOOL) && ishuman(user)) + handle_reprogramming(user) + return + return ..() + +/obj/item/iff_tag/proc/handle_reprogramming(mob/living/carbon/human/programmer, mob/living/carbon/xenomorph/xeno) + var/list/id_faction_groups = programmer.get_id_faction_group() + var/option = tgui_alert(programmer, "The xeno tag's current IFF groups reads as: [english_list(faction_groups, "None")]\nYour ID's IFF group reads as: [english_list(id_faction_groups, "None")]", "Xenomorph IFF Tag", list("Overwrite", "Add", "Remove")) + if(!option) + return FALSE + if(xeno) + if(!xeno.iff_tag) + to_chat(programmer, SPAN_WARNING("\The [src]'s tag got removed while you were reprogramming it!")) + return FALSE + if(!programmer.Adjacent(xeno)) + to_chat(programmer, SPAN_WARNING("You need to stay close to the xenomorph to reprogram the tag!")) + return FALSE + switch(option) + if("Overwrite") + faction_groups = id_faction_groups + if("Add") + faction_groups |= id_faction_groups + if("Remove") + faction_groups = list() + to_chat(programmer, SPAN_NOTICE("You [option] the IFF group data, the IFF group on the tag now reads as: [english_list(faction_groups, "None")]")) + if(xeno?.hive.hivenumber == XENO_HIVE_RENEGADE) //it's important to know their IFF settings for renegade + to_chat(xeno, SPAN_NOTICE("Your instincts have changed, you seem compelled to protect [english_list(faction_groups, "no one")].")) + return TRUE + +/obj/item/iff_tag/pmc_handler + faction_groups = FACTION_LIST_MARINE_WY + + +/obj/item/storage/xeno_tag_case + name = "xenomorph tag case" + desc = "A sturdy case designed to store and charge xenomorph IFF tags. Provided by the Wey-Yu Research and Data(TM) Division." + icon = 'icons/obj/items/xeno_tag.dmi' + icon_state = "tag_box" + use_sound = "toolbox" + storage_slots = 8 + can_hold = list( + /obj/item/iff_tag, + /obj/item/device/multitool, + ) + black_market_value = 25 + +/obj/item/storage/xeno_tag_case/full/fill_preset_inventory() + for(var/i = 1 to storage_slots - 1) + new /obj/item/iff_tag(src) + new /obj/item/device/multitool(src) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index f3155e277b81..ada770c3444c 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -241,7 +241,7 @@ if(!GLOB.enter_allowed) to_chat(usr, SPAN_WARNING("There is an administrative lock on entering the game! (The dropship likely crashed into the Almayer. This should take at most 20 minutes.)")) return - if(!GLOB.RoleAuthority.assign_role(src, GET_MAPPED_ROLE(player_rank), 1)) + if(!GLOB.RoleAuthority.assign_role(src, player_rank, 1)) to_chat(src, alert("[rank] is not available. Please try another.")) return @@ -249,7 +249,7 @@ close_spawn_windows() var/mob/living/carbon/human/character = create_character(TRUE) //creates the human and transfers vars and mind - GLOB.RoleAuthority.equip_role(character, GET_MAPPED_ROLE(player_rank), late_join = TRUE) + GLOB.RoleAuthority.equip_role(character, player_rank, late_join = TRUE) EquipCustomItems(character) if((GLOB.security_level > SEC_LEVEL_BLUE || SShijack.hijack_status) && player_rank.gets_emergency_kit) @@ -257,8 +257,9 @@ character.put_in_hands(new /obj/item/storage/box/kit/cryo_self_defense(character.loc)) GLOB.data_core.manifest_inject(character) - SSticker.minds += character.mind + SSticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. //TODO!!!!! ~Carn SSticker.mode.latejoin_update(player_rank) + SSticker.mode.update_gear_scale() for(var/datum/squad/sq in GLOB.RoleAuthority.squads) if(sq) @@ -280,17 +281,16 @@ hive.stored_larva++ hive.hive_ui.update_burrowed_larva() - if(character.mind && character.client.player_data) - var/list/xeno_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_xeno_playtime") - var/list/marine_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_human_playtime") - if(!xeno_playtimes && !marine_playtimes) + if(character.mind && character.mind.player_entity) + var/datum/entity/player_entity/player = character.mind.player_entity + if(player.get_playtime(STATISTIC_HUMAN) == 0 && player.get_playtime(STATISTIC_XENO) == 0) msg_admin_niche("NEW JOIN: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") if(character.client) - var/client/C = character.client - if(C.player_data && C.player_data.playtime_loaded && length(C.player_data.playtimes) == 0) + var/client/client = character.client + if(client.player_data && client.player_data.playtime_loaded && length(client.player_data.playtimes) == 0) msg_admin_niche("NEW PLAYER: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") - if(C.player_data && C.player_data.playtime_loaded && ((round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= CONFIG_GET(number/notify_new_player_age))) - msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [character.job] - Current location: [get_area(character)]") + if(client.player_data && client.player_data.playtime_loaded && ((round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= CONFIG_GET(number/notify_new_player_age))) + msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") character.client.init_verbs() qdel(src) @@ -299,8 +299,8 @@ /mob/new_player/proc/LateChoices() var/list/faction_to_get_list = list() for(var/faction_to_get in SSticker.mode.factions_pool) - var/datum/faction/faction = GLOB.faction_datums[SSticker.mode.factions_pool[faction_to_get]] - if(!faction.spawning_enabled) + var/datum/faction/faction = GLOB.faction_datum[SSticker.mode.factions_pool[faction_to_get]] + if(!faction.spawning_enabled || (!faction.force_spawning && !faction.weight_act[SSticker.mode.name])) continue faction_to_get_list += faction_to_get @@ -308,7 +308,7 @@ if(!choice) return - GLOB.faction_datums[SSticker.mode.factions_pool[choice]].get_join_status(src) + GLOB.faction_datum[SSticker.mode.factions_pool[choice]].get_join_status(src) /mob/new_player/proc/create_character(is_late_join = FALSE) spawning = TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index 53fa8cd70797..52f36bda5a48 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -2098,6 +2098,7 @@ #include "code\modules\mob\living\carbon\xenomorph\castes\Sentinel.dm" #include "code\modules\mob\living\carbon\xenomorph\castes\Spitter.dm" #include "code\modules\mob\living\carbon\xenomorph\castes\Warrior.dm" +#include "code\modules\mob\living\carbon\xenomorph\items\iff_tag.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\behavior_delegate.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\xeno_strain.dm" #include "code\modules\mob\living\carbon\xenomorph\strains\castes\boiler\trapper.dm" From e61f019d14d67d253d8bbae0392fa6d41895ed10 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:19:41 +0500 Subject: [PATCH 16/69] Revert of factions 4 (CR3) --- code/datums/factions/_modules/relations.dm | 4 +- code/datums/factions/faction.dm | 69 +++++++++++++++++++--- code/game/gamemodes/game_mode.dm | 12 ---- code/modules/client/preferences.dm | 64 +++++++------------- 4 files changed, 83 insertions(+), 66 deletions(-) diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm index e59628b4aadf..3366c6a2af3a 100644 --- a/code/datums/factions/_modules/relations.dm +++ b/code/datums/factions/_modules/relations.dm @@ -30,9 +30,9 @@ relations[target_faction.faction_name] = clamp(relations[target_faction.faction_name] + opinion, RELATIONS_WAR[1], RELATIONS_MAX) /datum/faction_module/relations/tgui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) + ui = SStgui.try_update_ui(user, source, ui) if(!ui) - ui = new(user, src, "FactionRelations", "[faction] Relations") + ui = new(user, source, "FactionRelations", "[faction] Relations") ui.open() ui.set_autoupdate(TRUE) diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index 579c8b045204..7b21c0c86750 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -169,6 +169,10 @@ /datum/faction/proc/get_antag_guns_sorted_equipment() return list() +/datum/faction/proc/store_objective(datum/cm_objective/O) + if(objective_memory) + objective_memory.store_objective(O) + //FACTION INFO PANEL /datum/faction/ui_state(mob/user) return GLOB.not_incapacitated_state @@ -203,8 +207,19 @@ switch(action) if("relations") - var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] - module.tgui_interact(usr) + relations_datum.tgui_interact(usr) + if("tasks") + task_interface.tgui_interact(usr) + if("clues") + if(!skillcheck(usr, SKILL_INTEL, SKILL_INTEL_TRAINED)) + to_chat(usr, SPAN_WARNING("You have no access to the [name] intel network.")) + return + objective_interface.tgui_interact(usr) + if("researchs") + if(!skillcheck(usr, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED)) + to_chat(usr, SPAN_WARNING("You have no access to the [name] research network.")) + return + research_objective_interface.tgui_interact(usr) if("status") get_faction_info(usr) @@ -263,30 +278,66 @@ */ dat = "
" - dat += "Round Time: [DisplayTimeText(world.time)]
" - dat += "Chose from lower opened positions:
" + dat += "[user.client.auto_lang(LANGUAGE_LOBBY_ROUND_TIME)]: [DisplayTimeText(world.time, language = user.client.language)]
" + dat += "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CHOSE)]:
" dat += additional_join_status(user) if(!latejoin_enabled) - dat = "You can't right now join round for that faction:
" + dat = "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CLOSED)]:
" + + else if(!SSautobalancer.can_join(src)) + dat = "[user.client.auto_lang(LANGUAGE_JS_BALANCE_ISSUE)]:
" else var/list/roles = roles_list[SSticker.mode.name] for(var/role in roles) - var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role] - var/check_result = GLOB.RoleAuthority.check_role_entry(user, job, src, TRUE) + var/datum/job/job = SSticker.role_authority.roles_by_name[role] + var/check_result = SSticker.role_authority.check_role_entry(user, job, src, TRUE) var/active = 0 for(var/mob/mob in GLOB.player_list) if(mob.client && mob.job == job.title) active++ if(check_result) - dat += "[job.disp_title] ([job.current_positions]): [check_result] (Active: [active])
" + dat += "[job.disp_title] ([job.current_positions]): [check_result] ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" else - dat += "[job.disp_title] ([job.current_positions]) (Active: [active])
" + dat += "[job.disp_title] ([job.current_positions]) ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" dat += "
" show_browser(user, dat, "Late Join", "latechoices", "size=420x700") /datum/faction/proc/additional_join_status(mob/new_player/user, dat = "") return +/* + if(roles_show & FLAG_SHOW_CIC && ROLES_CIC & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_COM)]:
" + roles_show ^= FLAG_SHOW_CIC + + else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && ROLES_AUXIL_SUPPORT & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_SUP)]:
" + roles_show ^= FLAG_SHOW_AUXIL_SUPPORT + + else if(roles_show & FLAG_SHOW_MISC && ROLES_MISC & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_OTH)]:
" + roles_show ^= FLAG_SHOW_MISC + + else if(roles_show & FLAG_SHOW_POLICE && ROLES_POLICE & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_POL)]:
" + roles_show ^= FLAG_SHOW_POLICE + + else if(roles_show & FLAG_SHOW_ENGINEERING && ROLES_ENGINEERING & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ENG)]:
" + roles_show ^= FLAG_SHOW_ENGINEERING + + else if(roles_show & FLAG_SHOW_REQUISITION && ROLES_REQUISITION & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CAG)]:
" + roles_show ^= FLAG_SHOW_REQUISITION + + else if(roles_show & FLAG_SHOW_MEDICAL && ROLES_MEDICAL & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MED)]:
" + roles_show ^= FLAG_SHOW_MEDICAL + + else if(roles_show & FLAG_SHOW_MARINES && ROLES_MARINES & job.title) + dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MAR)]:
" + roles_show ^= FLAG_SHOW_MARINES +*/ diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index ef64e31ee9ec..5e02a475a42b 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -33,10 +33,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/static_comms_amount = 0 var/obj/structure/machinery/computer/shuttle/dropship/flight/active_lz = null - var/list/active_roles_mappings_pool = list() - var/list/active_roles_pool = list() - var/list/factions_pool = list() - var/list/roles_to_roll var/corpses_to_spawn = 0 @@ -48,14 +44,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t if(taskbar_icon) GLOB.available_taskbar_icons |= taskbar_icon - for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datum[faction_to_get] - if(length(faction.roles_list[name])) - factions_pool[faction.name] = faction.faction_name - active_roles_mappings_pool += faction.role_mappings[name] - for(var/i in faction.roles_list[name]) - active_roles_pool += i - /datum/game_mode/proc/announce() //to be calles when round starts to_world("Notice: [src] did not define announce()") diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3538bf12daff..b4ee572d8d2d 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -235,8 +235,6 @@ GLOBAL_LIST_INIT(bgstate_options, list( var/unlock_content = 0 - var/datum/faction/observing_faction - var/current_menu = MENU_MARINE /// if this client has custom cursors enabled @@ -669,26 +667,25 @@ GLOBAL_LIST_INIT(bgstate_options, list( * * width - Screen' width. * * height - Screen's height. */ -/datum/preferences/proc/set_choices(mob/user, list/roles_pool, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) +/datum/preferences/proc/SetChoices(mob/user, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) if(!GLOB.RoleAuthority) return - if(!observing_faction) - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] - - if(!length(roles_pool)) - roles_pool = observing_faction.roles_list[SSticker.mode.name] - var/HTML = "" HTML += "
" HTML += "Choose occupation chances
Unavailable occupations are crossed out.

" - HTML += "Selected faction: [observing_faction]

" HTML += "
Done

" // Easier to press up here. HTML += "
" // Table within a table for alignment, also allows you to easily add more colomns. HTML += "" var/index = -1 - for(var/role_name as anything in roles_pool) + //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows. + + var/list/active_role_names = GLOB.gamemode_roles[GLOB.master_mode] + if(!active_role_names) + active_role_names = GLOB.ROLES_DISTRESS_SIGNAL + + for(var/role_name as anything in active_role_names) var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role_name] if(!job) debug_log("Missing job for prefs: [role_name]") @@ -755,8 +752,6 @@ GLOBAL_LIST_INIT(bgstate_options, list( HTML += "
" HTML += "
" - HTML += "

Change faction

" - if(user.client?.prefs) //Just makin sure var/b_color = "green" var/msg = "Get random job if preferences unavailable" @@ -790,26 +785,25 @@ GLOBAL_LIST_INIT(bgstate_options, list( * * width - Screen' width. * * height - Screen's height. */ -/datum/preferences/proc/set_job_slots(mob/user, list/roles_pool, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) +/datum/preferences/proc/set_job_slots(mob/user, limit = 21, list/splitJobs = list(JOB_CHIEF_REQUISITION, JOB_WO_CMO), width = 950, height = 750) if(!GLOB.RoleAuthority) return - if(!observing_faction) - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[pick(SSticker.mode.factions_pool)]] - - if(!length(roles_pool)) - roles_pool = observing_faction.roles_list[SSticker.mode.name] - var/HTML = "" HTML += "
" HTML += "Assign character slots to jobs.
Unavailable occupations are crossed out.

" - HTML += "Selected faction: [observing_faction]

" HTML += "
Done

" // Easier to press up here. HTML += "
" // Table within a table for alignment, also allows you to easily add more colomns. HTML += "" var/index = -1 - for(var/role_name as anything in roles_pool) + //The job before the current job. I only use this to get the previous jobs color when I'm filling in blank rows. + + var/list/active_role_names = GLOB.gamemode_roles[GLOB.master_mode] + if(!active_role_names) + active_role_names = GLOB.ROLES_DISTRESS_SIGNAL + + for(var/role_name as anything in active_role_names) var/datum/job/job = GLOB.RoleAuthority.roles_by_name[role_name] if(!job) debug_log("Missing job for prefs: [role_name]") @@ -839,8 +833,6 @@ GLOBAL_LIST_INIT(bgstate_options, list( HTML += "
" HTML += "

" - HTML += "

Change faction

" - var/b_color var/msg if(toggle_prefs & TOGGLE_START_JOIN_CURRENT_SLOT) @@ -913,7 +905,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( SetJobDepartment(job, priority) - set_choices(user) + SetChoices(user) return 1 /datum/preferences/proc/ResetJobs() @@ -1001,7 +993,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( ShowChoices(user) if("reset") ResetJobs() - set_choices(user) + SetChoices(user) if("random") if(alternate_option == GET_RANDOM_JOB || alternate_option == BE_MARINE || alternate_option == RETURN_TO_LOBBY) alternate_option++ @@ -1009,19 +1001,12 @@ GLOBAL_LIST_INIT(bgstate_options, list( alternate_option = 0 else return 0 - set_choices(user) + SetChoices(user) if("input") var/priority = text2num(href_list["target_priority"]) SetJob(user, href_list["text"], priority) - if("faction") - var/choice = tgui_input_list(user, "Choose faction to observer roles:", "Factions", SSticker.mode.factions_pool) - if(!choice) - return - - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] - set_choices(user) else - set_choices(user) + SetChoices(user) return TRUE if("job_slot") switch(href_list["task"]) @@ -1039,13 +1024,6 @@ GLOBAL_LIST_INIT(bgstate_options, list( if("reset") reset_job_slots() set_job_slots(user) - if("faction") - var/choice = tgui_input_list(user, "Choose faction to observer roles:", "Factions", SSticker.mode.factions_pool) - if(!choice) - return - - observing_faction = GLOB.faction_datum[SSticker.mode.factions_pool[choice]] - set_job_slots(user) else set_job_slots(user) return TRUE @@ -1788,7 +1766,7 @@ GLOBAL_LIST_INIT(bgstate_options, list( return pref_special_job_options[job.title] = new_special_job_variant - set_choices(user) + SetChoices(user) return else switch(href_list["preference"]) From a95333de2c05baa7766ba81164d85cbe1e2b39d9 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:25:45 +0500 Subject: [PATCH 17/69] Revert of factions 5 (CR2) --- code/__DEFINES/factions.dm | 36 -- code/_globalvars/global_lists.dm | 22 + code/datums/event_info_text.dm | 40 +- code/datums/factions/_misc/helpers.dm | 29 -- code/datums/factions/_misc/iff_tag.dm | 121 ------ code/datums/factions/_modules/module.dm | 6 - code/datums/factions/_modules/relations.dm | 59 --- code/datums/factions/clf.dm | 157 ++++++- code/datums/factions/cmb.dm | 3 + code/datums/factions/colonists.dm | 28 -- code/datums/factions/contractor.dm | 7 +- code/datums/factions/dutch's_dozen.dm | 6 - code/datums/factions/faction.dm | 334 +-------------- code/datums/factions/freelancer.dm | 7 - code/datums/factions/gladiator.dm | 5 - code/datums/factions/hefa_order.dm | 8 - code/datums/factions/helpers.dm | 14 + code/datums/factions/mercenary.dm | 5 - code/datums/factions/pirate.dm | 5 - code/datums/factions/pizza_delivery.dm | 7 - code/datums/factions/pmc.dm | 95 +++++ code/datums/factions/ress.dm | 5 - .../commando.dm => royalmarinescommando.dm} | 22 +- code/datums/factions/souto.dm | 5 - code/datums/factions/threewe.dm | 9 - code/datums/factions/upp.dm | 46 +-- code/datums/factions/uscm.dm | 90 ++-- code/datums/factions/uscm/cmb.dm | 3 - code/datums/factions/uscm/marine.dm | 53 --- code/datums/factions/uscm/marsoc.dm | 5 - code/datums/factions/wy.dm | 34 -- code/datums/factions/wy/deathsquad.dm | 6 - code/datums/factions/wy/pmc.dm | 5 - code/datums/factions/xeno.dm | 386 ------------------ code/datums/factions/xeno/alpha.dm | 7 - code/datums/factions/xeno/bravo.dm | 7 - code/datums/factions/xeno/charlie.dm | 7 - code/datums/factions/xeno/corrupted.dm | 38 -- code/datums/factions/xeno/delta.dm | 7 - code/datums/factions/xeno/feral.dm | 13 - code/datums/factions/xeno/forsaken.dm | 13 - code/datums/factions/xeno/mutated.dm | 9 - code/datums/factions/xeno/normal.dm | 32 -- code/datums/factions/xeno/renegade.dm | 13 - code/datums/factions/xeno/yautja.dm | 13 - code/datums/factions/yautja.dm | 35 -- code/datums/factions/zombie.dm | 60 --- code/game/gamemodes/cm_process.dm | 5 +- code/game/objects/items/cards_ids.dm | 1 + .../cm_tech/implements/xeno_handler.dm | 6 +- .../modules/gear_presets/_select_equipment.dm | 21 +- code/modules/gear_presets/other.dm | 16 +- code/modules/mob/dead/observer/observer.dm | 50 ++- code/modules/mob/dead/observer/orbit.dm | 1 - code/modules/mob/living/carbon/carbon.dm | 4 - .../mob/living/carbon/xenomorph/Xenomorph.dm | 43 +- code/modules/mob/new_player/new_player.dm | 68 ++- colonialmarines.dme | 29 +- 58 files changed, 533 insertions(+), 1628 deletions(-) delete mode 100644 code/datums/factions/_misc/helpers.dm delete mode 100644 code/datums/factions/_misc/iff_tag.dm delete mode 100644 code/datums/factions/_modules/module.dm delete mode 100644 code/datums/factions/_modules/relations.dm create mode 100644 code/datums/factions/cmb.dm delete mode 100644 code/datums/factions/colonists.dm delete mode 100644 code/datums/factions/dutch's_dozen.dm delete mode 100644 code/datums/factions/freelancer.dm delete mode 100644 code/datums/factions/gladiator.dm delete mode 100644 code/datums/factions/hefa_order.dm create mode 100644 code/datums/factions/helpers.dm delete mode 100644 code/datums/factions/mercenary.dm delete mode 100644 code/datums/factions/pirate.dm delete mode 100644 code/datums/factions/pizza_delivery.dm create mode 100644 code/datums/factions/pmc.dm delete mode 100644 code/datums/factions/ress.dm rename code/datums/factions/{twe/commando.dm => royalmarinescommando.dm} (90%) delete mode 100644 code/datums/factions/souto.dm delete mode 100644 code/datums/factions/threewe.dm delete mode 100644 code/datums/factions/uscm/cmb.dm delete mode 100644 code/datums/factions/uscm/marine.dm delete mode 100644 code/datums/factions/uscm/marsoc.dm delete mode 100644 code/datums/factions/wy.dm delete mode 100644 code/datums/factions/wy/deathsquad.dm delete mode 100644 code/datums/factions/wy/pmc.dm delete mode 100644 code/datums/factions/xeno.dm delete mode 100644 code/datums/factions/xeno/alpha.dm delete mode 100644 code/datums/factions/xeno/bravo.dm delete mode 100644 code/datums/factions/xeno/charlie.dm delete mode 100644 code/datums/factions/xeno/corrupted.dm delete mode 100644 code/datums/factions/xeno/delta.dm delete mode 100644 code/datums/factions/xeno/feral.dm delete mode 100644 code/datums/factions/xeno/forsaken.dm delete mode 100644 code/datums/factions/xeno/mutated.dm delete mode 100644 code/datums/factions/xeno/normal.dm delete mode 100644 code/datums/factions/xeno/renegade.dm delete mode 100644 code/datums/factions/xeno/yautja.dm delete mode 100644 code/datums/factions/yautja.dm delete mode 100644 code/datums/factions/zombie.dm diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm index 65545ff6df44..8670b9d8df8a 100644 --- a/code/__DEFINES/factions.dm +++ b/code/__DEFINES/factions.dm @@ -112,45 +112,9 @@ #define NAME_FACTION_LIST_XENOMORPH list(NAME_FACTION_XENOMORPH_NORMAL, NAME_FACTION_XENOMORPH_CORRUPTED, NAME_FACTION_XENOMORPH_ALPHA, NAME_FACTION_XENOMORPH_BRAVO, NAME_FACTION_XENOMORPH_CHARLIE, NAME_FACTION_XENOMORPH_DELTA, NAME_FACTION_XENOMORPH_FERAL, NAME_FACTION_XENOMORPH_FORSAKEN, NAME_FACTION_XENOMORPH_TAMED, NAME_FACTION_XENOMORPH_MUTATED, NAME_FACTION_XENOMORPH_YAUTJA, NAME_FACTION_XENOMORPH_YAUTJA) #define NAME_FACTION_LIST_ALL NAME_FACTION_LIST_HUMANOID + NAME_FACTION_LIST_XENOMORPH -//FACTIONS RELATIONS -#define RELATIONS_FACTION_NEUTRAL list(FACTION_USCM = RELATIONS_NEUTRAL, FACTION_WY = RELATIONS_NEUTRAL, FACTION_UPP = RELATIONS_NEUTRAL, FACTION_CLF = RELATIONS_NEUTRAL, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_NEUTRAL, FACTION_TWE = RELATIONS_NEUTRAL, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_NEUTRAL) -#define RELATIONS_FACTION_USCM list(FACTION_WY = RELATIONS_FRIENDLY, FACTION_UPP = RELATIONS_HOSTILE, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_FRIENDLY, FACTION_TWE = RELATIONS_FRIENDLY, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_TENSE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) -#define RELATIONS_FACTION_WY list(FACTION_USCM = RELATIONS_FRIENDLY, FACTION_UPP = RELATIONS_NEUTRAL, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_FRIENDLY, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_NEUTRAL, FACTION_FREELANCER = RELATIONS_NEUTRAL, FACTION_THREEWE = RELATIONS_NEUTRAL, FACTION_NEUTRAL = RELATIONS_NEUTRAL) -#define RELATIONS_FACTION_CLF list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_NEUTRAL, FACTION_UPP = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) -#define RELATIONS_FACTION_UPP list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_FRIENDLY, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_NEUTRAL, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_FRIENDLY, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) -#define RELATIONS_FACTION_XENOMORPH list(FACTION_XENOMORPH_NORMAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_CORRUPTED = RELATIONS_HOSTILE, FACTION_XENOMORPH_ALPHA = RELATIONS_HOSTILE, FACTION_XENOMORPH_BRAVO = RELATIONS_HOSTILE, FACTION_XENOMORPH_CHARLIE = RELATIONS_HOSTILE, FACTION_XENOMORPH_DELTA = RELATIONS_HOSTILE, FACTION_XENOMORPH_FERAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_FORSAKEN = RELATIONS_HOSTILE, FACTION_XENOMORPH_TAMED = RELATIONS_HOSTILE, FACTION_XENOMORPH_MUTATED = RELATIONS_HOSTILE, FACTION_XENOMORPH_YAUTJA = RELATIONS_HOSTILE, FACTION_XENOMORPH_RENEGADE = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_NEUTRAL) - -#define RELATIONS_MAP list(FACTION_NEUTRAL = null, FACTION_USCM = null, FACTION_MARINE = null, FACTION_CMB = null, FACTION_MARSOC = null, FACTION_CONTRACTOR = null, FACTION_WY = null, FACTION_PMC = null, FACTION_WY_DEATHSQUAD = null, FACTION_CLF = null, FACTION_UPP = null, FACTION_FREELANCER = null, FACTION_COLONIST = null, FACTION_MERCENARY = null, FACTION_DUTCH = null, FACTION_HEFA = null, FACTION_GLADIATOR = null, FACTION_PIRATE = null, FACTION_PIZZA = null, FACTION_SOUTO = null, FACTION_YAUTJA = null, FACTION_XENOMORPH_NORMAL = null, FACTION_XENOMORPH_CORRUPTED = null, FACTION_XENOMORPH_ALPHA = null, FACTION_XENOMORPH_BRAVO = null, FACTION_XENOMORPH_CHARLIE = null, FACTION_XENOMORPH_DELTA = null, FACTION_XENOMORPH_FERAL = null, FACTION_XENOMORPH_FORSAKEN = null, FACTION_XENOMORPH_TAMED = null, FACTION_XENOMORPH_MUTATED = null, FACTION_XENOMORPH_YAUTJA = null) -#define RELATIONS_MAP_HOSTILE list(FACTION_USCM = RELATIONS_HOSTILE, FACTION_WY = RELATIONS_HOSTILE, FACTION_UPP = RELATIONS_HOSTILE, FACTION_CLF = RELATIONS_HOSTILE, FACTION_COLONIST = RELATIONS_HOSTILE, FACTION_RESS = RELATIONS_HOSTILE, FACTION_TWE = RELATIONS_HOSTILE, FACTION_MERCENARY = RELATIONS_HOSTILE, FACTION_FREELANCER = RELATIONS_HOSTILE, FACTION_THREEWE = RELATIONS_HOSTILE, FACTION_XENOMORPH_NORMAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_CORRUPTED = RELATIONS_HOSTILE, FACTION_XENOMORPH_ALPHA = RELATIONS_HOSTILE, FACTION_XENOMORPH_BRAVO = RELATIONS_HOSTILE, FACTION_XENOMORPH_CHARLIE = RELATIONS_HOSTILE, FACTION_XENOMORPH_DELTA = RELATIONS_HOSTILE, FACTION_XENOMORPH_FERAL = RELATIONS_HOSTILE, FACTION_XENOMORPH_FORSAKEN = RELATIONS_HOSTILE, FACTION_XENOMORPH_TAMED = RELATIONS_HOSTILE, FACTION_XENOMORPH_MUTATED = RELATIONS_HOSTILE, FACTION_XENOMORPH_YAUTJA = RELATIONS_HOSTILE, FACTION_NEUTRAL = RELATIONS_HOSTILE) - -#define RELATIONS_UNKNOWN null -#define RELATIONS_DISABLED list(0, 0) -#define RELATIONS_WAR list(1, 200) -#define RELATIONS_HOSTILE list(201, 400) -#define RELATIONS_TENSE list(401, 500) -#define RELATIONS_NEUTRAL list(501, 700) -#define RELATIONS_FRIENDLY list(701, 900) -#define RELATIONS_VERY_GOOD list(901, 1000) -#define RELATIONS_SELF 1100 -#define RELATIONS_MAX 1000 - -//FACTION TREES -#define SIDE_FACTION_NEUTRAL "NEUTRAL_T" -#define SIDE_FACTION_USCM "USCM_T" -#define SIDE_FACTION_WY "W-Y_T" -#define SIDE_FACTION_CLF "CLF_T" -#define SIDE_FACTION_UPP "UPP_T" -#define SIDE_FACTION_ZOMBIE "ZOMBIE_T" -#define SIDE_FACTION_YAUTJA "YAUTJA_T" -#define SIDE_FACTION_XENOMORPH "XENOMORPH_T" - -#define SIDE_ORGANICAL_DOM list(SIDE_FACTION_ZOMBIE, SIDE_FACTION_XENOMORPH) - // Faction allegiances within a certain faction. #define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") -#define MODULE_CODE_NAME_RELATIONS "relations_handler" - /* diff --git a/code/_globalvars/global_lists.dm b/code/_globalvars/global_lists.dm index ea1e07a7e39e..b6b8f0c16c9c 100644 --- a/code/_globalvars/global_lists.dm +++ b/code/_globalvars/global_lists.dm @@ -225,6 +225,8 @@ GLOBAL_LIST_INIT(xeno_evolve_times, setup_xeno_evolve_times()) for(var/datum/caste_datum/caste as anything in subtypesof(/datum/caste_datum)) LAZYADDASSOCLIST(., num2text(initial(caste.minimum_evolve_time)), caste) +GLOBAL_LIST_INIT(custom_event_info_list, setup_custom_event_info()) + // Posters GLOBAL_LIST_INIT(poster_designs, subtypesof(/datum/poster)) @@ -448,6 +450,26 @@ GLOBAL_LIST_INIT(hj_emotes, setup_hazard_joe_emotes()) mobtypes["[T]"] = typecacheof(T.target_mobtypes) return mobtypes +/proc/setup_custom_event_info() + //faction event messages + var/list/custom_event_info_list = list() + var/datum/custom_event_info/CEI = new /datum/custom_event_info + CEI.faction = "Global" //the old public one for whole server to see + custom_event_info_list[CEI.faction] = CEI + for(var/T in FACTION_LIST_HUMANOID) + CEI = new /datum/custom_event_info + CEI.faction = T + custom_event_info_list[T] = CEI + + var/datum/hive_status/hive + for(var/hivenumber in GLOB.hive_datum) + hive = GLOB.hive_datum[hivenumber] + CEI = new /datum/custom_event_info + CEI.faction = hive.internal_faction + custom_event_info_list[hive.name] = CEI + + return custom_event_info_list + /proc/setup_taskbar_icons() var/list/png_list = flist("icons/taskbar") for(var/png in png_list) diff --git a/code/datums/event_info_text.dm b/code/datums/event_info_text.dm index 9b433f6e1893..21469ed379cd 100644 --- a/code/datums/event_info_text.dm +++ b/code/datums/event_info_text.dm @@ -1,13 +1,18 @@ /datum/custom_event_info - var/name = "default" - var/faction_name = "default" - var/datum/faction/faction = null - var/msg = "" + var/faction = "default" //here category/faction/hive name stored + var/msg = "" //here is the message itself + //this shows event info to player. can pass clients and mobs -/datum/custom_event_info/proc/show_player_event_info(client/user) - if(!istype(user)) - return +/datum/custom_event_info/proc/show_player_event_info(user) + + if(!istype(user, /client)) + if(ismob(user)) + var/mob/M = user + if(!M.client) + return + else + return if(msg == "") return @@ -21,6 +26,7 @@ //this shows changed event info to everyone in the category /datum/custom_event_info/proc/handle_event_info_update() + if(!msg) return @@ -31,16 +37,26 @@ to_world(dat) return - else if(faction_name) - for(var/mob/M in faction.totalMobs) - show_player_event_info(M.client) + else if(faction in FACTION_LIST_HUMANOID) + for(var/mob/M in GLOB.human_mob_list) + if(M && M.faction == faction) + show_player_event_info(M) return + else + var/datum/hive_status/hive + for(var/hivenumber in GLOB.hive_datum) + hive = GLOB.hive_datum[hivenumber] + if(hive.name == faction) + for(var/mob/M in hive.totalXenos) + show_player_event_info(M) + return + message_admins("ERROR, ([faction ? faction : "name lost"]) faction is not found for event info.") return -/proc/check_event_info(category = "Global", client/user) +/mob/proc/check_event_info(category = "Global") if(GLOB.custom_event_info_list[category]) var/datum/custom_event_info/CEI = GLOB.custom_event_info_list[category] if(CEI.msg) - CEI.show_player_event_info(user) + CEI.show_player_event_info(src) diff --git a/code/datums/factions/_misc/helpers.dm b/code/datums/factions/_misc/helpers.dm deleted file mode 100644 index c3d715fef3b7..000000000000 --- a/code/datums/factions/_misc/helpers.dm +++ /dev/null @@ -1,29 +0,0 @@ -GLOBAL_LIST_INIT_TYPED(faction_datums, /datum/faction, setup_factions_list()) - -/proc/setup_factions_list() - . = list() - for(var/path in typesof(/datum/faction)) - var/datum/faction/faction = new path - .[faction.faction_name] = faction - -GLOBAL_LIST_INIT_TYPED(custom_event_info_list, /datum/custom_event_info, setup_custom_event_info()) - -/proc/setup_custom_event_info() - . = list() - var/datum/custom_event_info/CEI = new() - CEI.faction_name = "Global" - .[CEI.faction_name] = CEI - for(var/faction_to_get in FACTION_LIST_ALL) - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - CEI = new() - CEI.faction_name = faction.name - CEI.faction = faction - .[CEI.faction_name] = CEI - -GLOBAL_LIST_INIT_TYPED(faction_modules, /datum/faction_module, setup_faction_modules_list()) - -/proc/setup_faction_modules_list() - . = list() - for(var/path in typesof(/datum/faction_module)) - var/datum/faction_module/module = new path - .[module.module_name] = module diff --git a/code/datums/factions/_misc/iff_tag.dm b/code/datums/factions/_misc/iff_tag.dm deleted file mode 100644 index cdcd27fafea2..000000000000 --- a/code/datums/factions/_misc/iff_tag.dm +++ /dev/null @@ -1,121 +0,0 @@ -#define INJECTABLE_TAG (1<<0) -#define REPROGRAMMABLE_TAG (1<<1) -#define ORGAN_TAG (1<<2) - -DEFINE_BITFIELD(iff_flag_flags, list( - "INJECTABLE_TAG" = INJECTABLE_TAG, - "REPROGRAMMABLE_TAG" = REPROGRAMMABLE_TAG, - "ORGAN_TAG" = ORGAN_TAG, -)) - -/mob/living/carbon - var/obj/item/faction_tag/organ/organ_faction_tag = null - var/obj/item/faction_tag/faction_tag = null - -/obj/item/faction_tag - name = "Faction IFF tag" - desc = "A tag containing a small IFF computer that gets inserted into the body. You can modify the IFF groups by using an access tuner on it, or on the body of implanted if it's already implanted." - icon = 'icons/obj/items/iff_tag.dmi' - icon_state = "iff_tag" - var/tag_flags = INJECTABLE_TAG|REPROGRAMMABLE_TAG - var/list/datum/faction/factions = list() - -/obj/item/faction_tag/Initialize(mapload, faction_ref) - faction = faction_ref - - . = ..() - if(faction) - factions |= faction - if(faction.ally_factions_initialize) - for(var/datum/faction/faction_ally in faction.relations_datum.allies) - factions |= faction_ally - -/obj/item/faction_tag/attack(mob/living/carbon/mob, mob/living/carbon/injector) - if((isxeno(mob) || ishuman(mob)) && tag_flags & INJECTABLE_TAG) - if(mob.stat == DEAD) - to_chat(injector, SPAN_WARNING("\The [mob] is dead...")) - return - if(mob.faction_tag) - to_chat(injector, SPAN_WARNING("\The [mob] already has a tag inside it.")) - return - injector.visible_message(SPAN_NOTICE("[injector] starts forcing \the [src] into [mob]'s body..."), SPAN_NOTICE("You start forcing \the [src] into [mob]'s body...")) - if(!do_after(injector, 5 SECONDS, INTERRUPT_ALL, BUSY_ICON_GENERIC, mob, INTERRUPT_DIFF_LOC, BUSY_ICON_GENERIC)) - return - injector.visible_message(SPAN_NOTICE("[injector] forces \the [src] into [mob]'s body!"), SPAN_NOTICE("You force \the [src] into [mob]'s body!")) - mob.faction_tag = src - injector.drop_inv_item_to_loc(src, mob) - return - return ..() - -/obj/item/faction_tag/attackby(obj/item/W, mob/user) - if(HAS_TRAIT(W, TRAIT_TOOL_MULTITOOL) && ishuman(user) && tag_flags & REPROGRAMMABLE_TAG) - handle_reprogramming(user) - return - return ..() - -/obj/item/faction_tag/proc/handle_reprogramming(mob/living/carbon/human/programmer, mob/living/carbon/mob) - var/list/datum/faction/id_faction_groups = programmer.faction - var/option = tgui_alert(programmer, "Current Faction IFF reads as: [english_list(factions, "None")]\nYour ID's Faction IFF reads as: [english_list(id_faction_groups, "None")]", "Faction IFF Tag", list("Overwrite", "Add", "Remove")) - if(!option) - return FALSE - if(mob) - if(!mob.faction_tag) - to_chat(programmer, SPAN_WARNING("\The [src]'s tag got removed while you were reprogramming it!")) - return FALSE - if(!programmer.Adjacent(mob)) - to_chat(programmer, SPAN_WARNING("You need to stay close to the tag to reprogram the tag!")) - return FALSE - switch(option) - if("Overwrite") - factions = id_faction_groups - if("Add") - factions |= id_faction_groups - if("Remove") - factions = list() - to_chat(programmer, SPAN_NOTICE("You [option] the Faction IFF data, the Faction IFF on the tag now reads as: [english_list(factions, "None")]")) - return TRUE - -/obj/item/faction_tag/organ - name = "Sticky Gland" - desc = "Strange organic object, that somehow help to be indentificated." - icon_state = "gland_tag" - tag_flags = ORGAN_TAG - -/obj/item/faction_tag/organ/meshy_rooting_gland - faction_to_get = FACTION_ZOMBIE - -/obj/item/faction_tag/organ/pheromones_receptor - faction_to_get = FACTION_XENOMORPH - -//CASE FOR TAGS -/obj/item/storage/tag_case - name = "tag case" - desc = "A sturdy case designed to store IFF tags." - icon = 'icons/obj/items/iff_tag.dmi' - icon_state = "tag_box" - use_sound = "toolbox" - storage_slots = 8 - can_hold = list( - /obj/item/faction_tag, - /obj/item/device/multitool - ) - black_market_value = 25 - -/obj/item/storage/tag_case/full/fill_preset_inventory() - for(var/i = 1 to storage_slots - 1) - new /obj/item/faction_tag(src) - new /obj/item/device/multitool(src) - -/obj/item/storage/tag_case/uscm/marine - -/obj/item/storage/tag_case/uscm/marine/full/fill_preset_inventory() - for(var/i = 1 to storage_slots - 1) - new /obj/item/faction_tag(src, GLOB.faction_datums[FACTION_MARINE]) - new /obj/item/device/multitool(src) - -/obj/item/storage/tag_case/wy - -/obj/item/storage/tag_case/wy/full/fill_preset_inventory() - for(var/i = 1 to storage_slots - 1) - new /obj/item/faction_tag(src, GLOB.faction_datums[FACTION_WY]) - new /obj/item/device/multitool(src) diff --git a/code/datums/factions/_modules/module.dm b/code/datums/factions/_modules/module.dm deleted file mode 100644 index 74573bb99925..000000000000 --- a/code/datums/factions/_modules/module.dm +++ /dev/null @@ -1,6 +0,0 @@ -/datum/faction_module - var/module_name - var/datum/faction/faction - -/datum/faction_module/New(datum/faction/faction_to_set) - faction = faction_to_set diff --git a/code/datums/factions/_modules/relations.dm b/code/datums/factions/_modules/relations.dm deleted file mode 100644 index 3366c6a2af3a..000000000000 --- a/code/datums/factions/_modules/relations.dm +++ /dev/null @@ -1,59 +0,0 @@ -/datum/faction_module/relations - module_name = MODULE_CODE_NAME_RELATIONS - - var/relations[] = RELATIONS_MAP - var/list/allies = list() - -/datum/faction_module/relations/New(datum/faction/faction_to_set) - . = ..() - generate_relations_helper() - -/datum/faction_module/relations/proc/generate_relations_helper() - spawn(30 SECONDS) - for(var/i in FACTION_LIST_ALL) - if(i == faction.faction_name) - relations[i] = RELATIONS_SELF - continue - if(i in faction.relations_pregen) - relations[i] = rand(faction.relations_pregen[i][1], faction.relations_pregen[i][2]) - if(RELATIONS_FRIENDLY[2] < faction.relations_pregen[i]) - allies += GLOB.faction_datums[i] - continue - relations[i] = RELATIONS_UNKNOWN - -/datum/faction_module/relations/proc/can_acting(datum/faction/target_faction) - if(isnull(relations[target_faction.faction_name]) || relations[target_faction.faction_name] < RELATIONS_WAR[1] || relations[target_faction.faction_name] > RELATIONS_MAX) - return FALSE - return TRUE - -/datum/faction_module/relations/proc/gain_opinion(datum/faction/target_faction, opinion) - relations[target_faction.faction_name] = clamp(relations[target_faction.faction_name] + opinion, RELATIONS_WAR[1], RELATIONS_MAX) - -/datum/faction_module/relations/tgui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, source, ui) - if(!ui) - ui = new(user, source, "FactionRelations", "[faction] Relations") - ui.open() - ui.set_autoupdate(TRUE) - -/datum/faction_module/relations/ui_data(mob/user) - . = list() - var/list/relations_mapping = list() - for(var/i in relations) - if(relations[i] == null || relations[i] > 1000) - continue - relations_mapping += list(list("name" = GLOB.faction_datums[i].name, "desc" = GLOB.faction_datums[i].desc, "color" = GLOB.faction_datums[i].ui_color, "value" = relations[i])) - - .["actions"] = can_handle_action(user) - - .["faction_color"] = faction.ui_color - .["faction_relations"] = relations_mapping - -/datum/faction_module/relations/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) - . = ..() - -/datum/faction_module/relations/ui_status(mob/user, datum/ui_state/state) - return UI_INTERACTIVE - -/datum/faction_module/relations/proc/can_handle_action(mob/user) - return FALSE diff --git a/code/datums/factions/clf.dm b/code/datums/factions/clf.dm index c236f6cadd5d..ce53b505b352 100644 --- a/code/datums/factions/clf.dm +++ b/code/datums/factions/clf.dm @@ -1,21 +1,156 @@ /datum/faction/clf - name = NAME_FACTION_CLF - desc = "The Colonial Liberation Front is a paramilitary group primarily located in the Neroid sector of United Americas space. Their stated goal is to secure the independence of all of the colonies in the Neroid sector. They are the largest and most active militant group pushing for the independence of the colonies. \ - The United Americas government classifies the CLF as a terrorist organization, with membership in the organization or providing financial or material support for the CLF being prosecutable offenses. The CLF grew organically from several different groups that formed in the wake of the Slaughter of Xibou in 2164. Prior to the slaughter of Xibou the conflicts between the United Americas government and the colonists of the Neroid sector had remained mostly non-violent. \ - The sudden increase in tensions after Xibou, combined with the images of slaughtered fighters and civilians alike, greatly increased the willingness of the colonists to take up arms against the United Americas. Several different militant groups formed in the years following the Slaughter, and as they negotiated with one another and found common cause the CLF was formed from their union." - - faction_name = FACTION_CLF - faction_tag = SIDE_FACTION_CLF - relations_pregen = RELATIONS_FACTION_CLF + name = "Colonial Liberation Front" + faction_tag = FACTION_CLF /datum/faction/clf/modify_hud_holder(image/holder, mob/living/carbon/human/human) var/hud_icon_state - var/obj/item/card/id/id_card = human.get_idcard() + var/obj/item/card/id/ID = human.get_idcard() var/_role if(human.mind) _role = human.job - else if(id_card) - _role = id_card.rank + else if(ID) + _role = ID.rank switch(_role) if(JOB_CLF_ENGI) hud_icon_state = "engi" + if(JOB_CLF_MEDIC) + hud_icon_state = "med" + if(JOB_CLF_SPECIALIST) + hud_icon_state = "spec" + if(JOB_CLF_LEADER) + hud_icon_state = "sl" + if(JOB_CLF_SYNTH) + hud_icon_state = "synth" + if(JOB_CLF_COMMANDER) + hud_icon_state = "cellcom" + if(hud_icon_state) + holder.overlays += image('icons/mob/hud/marine_hud.dmi', human, "clf_[hud_icon_state]") + +/datum/faction/clf/get_antag_guns_snowflake_equipment() + return list( + list("PRIMARY FIREARMS", 0, null, null, null), + list("ABR-40 Hunting Rifle", 30, /obj/item/weapon/gun/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), + list("Basira-Armstrong Bolt-Action", 15, /obj/item/weapon/gun/boltaction, null, VENDOR_ITEM_REGULAR), + list("Double Barrel Shotgun", 30, /obj/item/weapon/gun/shotgun/double, null, VENDOR_ITEM_REGULAR), + list("HG 37-12 Pump Shotgun", 30, /obj/item/weapon/gun/shotgun/double/sawn, null, VENDOR_ITEM_REGULAR), + list("M16 Rifle", 30, /obj/item/weapon/gun/rifle/m16, null, VENDOR_ITEM_REGULAR), + list("MAR-30 Battle Carbine", 30, /obj/item/weapon/gun/rifle/mar40/carbine, null, VENDOR_ITEM_REGULAR), + list("MAR-40 Battle Rifle", 30, /obj/item/weapon/gun/rifle/mar40, null, VENDOR_ITEM_REGULAR), + list("Type-64 Submachinegun", 20, /obj/item/weapon/gun/smg/bizon, null, VENDOR_ITEM_REGULAR), + list("MAC-15 Submachinegun", 20, /obj/item/weapon/gun/smg/mac15, null, VENDOR_ITEM_REGULAR), + list("MP27 Submachinegun", 20, /obj/item/weapon/gun/smg/mp27, null, VENDOR_ITEM_REGULAR), + list("MP5 Submachinegun", 20, /obj/item/weapon/gun/smg/mp5, null, VENDOR_ITEM_REGULAR), + list("Sawn-Off Shotgun", 30, /obj/item/weapon/gun/shotgun/pump/dual_tube/cmb, null, VENDOR_ITEM_REGULAR), + + list("PRIMARY AMMUNITION", 0, null, null, null), + list("ABR-40 Magazine (10x24mm)", 20, /obj/item/ammo_magazine/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), + list("Basira-Armstrong Magazine (6.5mm)", 5, /obj/item/ammo_magazine/rifle/boltaction, null, VENDOR_ITEM_REGULAR), + list("Box Of Buckshot Shells", 10, /obj/item/ammo_magazine/shotgun/buckshot, null, VENDOR_ITEM_REGULAR), + list("Box Of Flechette Shells", 10, /obj/item/ammo_magazine/shotgun/flechette, null, VENDOR_ITEM_REGULAR), + list("Box Of Shotgun Slugs", 10, /obj/item/ammo_magazine/shotgun, null, VENDOR_ITEM_REGULAR), + list("M16 AP Magazine (5.56x45mm)", 15, /obj/item/ammo_magazine/rifle/m16/ap, null, VENDOR_ITEM_REGULAR), + list("M16 Magazine (5.56x45mm)", 5, /obj/item/ammo_magazine/rifle/m16, null, VENDOR_ITEM_REGULAR), + list("MAC-15 Magazine (9mm)", 5, /obj/item/ammo_magazine/smg/mac15, null, VENDOR_ITEM_REGULAR), + list("MAR Magazine (7.62x39mm)", 5, /obj/item/ammo_magazine/rifle/mar40, null, VENDOR_ITEM_REGULAR), + list("MAR Extended Magazine (7.62x39mm)", 15, /obj/item/ammo_magazine/rifle/mar40/extended, null, VENDOR_ITEM_REGULAR), + list("Type-64 Helical Magazine (.7.62x19mm)", 5, /obj/item/ammo_magazine/smg/bizon, null, VENDOR_ITEM_REGULAR), + list("MP27 Magazine (4.6x30mm)", 5, /obj/item/ammo_magazine/smg/mp27, null, VENDOR_ITEM_REGULAR), + list("MP5 Magazine (9mm)", 5, /obj/item/ammo_magazine/smg/mp5, null, VENDOR_ITEM_REGULAR), + + list("SIDEARMS", 0, null, null, null), + list("88 Mod 4 Combat Pistol", 15, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), + list("Beretta 92FS Pistol", 15, /obj/item/weapon/gun/pistol/b92fs, null, VENDOR_ITEM_REGULAR), + list("CMB Spearhead Autorevolver", 15, /obj/item/weapon/gun/revolver/cmb, null, VENDOR_ITEM_REGULAR), + list("Holdout Pistol", 10, /obj/item/weapon/gun/pistol/holdout, null, VENDOR_ITEM_REGULAR), + list("KT-42 Automag", 15, /obj/item/weapon/gun/pistol/kt42, null, VENDOR_ITEM_REGULAR), + list("S&W .357 Revolver", 15, /obj/item/weapon/gun/revolver/small, null, VENDOR_ITEM_REGULAR), + + list("SIDEARM AMMUNITION", 0, null, null, null), + list("88M4 AP Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), + list("Beretta 92FS Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/b92fs, null, VENDOR_ITEM_REGULAR), + list("KT-42 Magazine (.44)", 5, /obj/item/ammo_magazine/pistol/kt42, null, VENDOR_ITEM_REGULAR), + list("Spearhead Speed Loader (.357)", 10, /obj/item/ammo_magazine/revolver/cmb/normalpoint, VENDOR_ITEM_REGULAR), + list("Hollowpoint Spearhead Speed Loader (.357)", 5, /obj/item/ammo_magazine/revolver/cmb, VENDOR_ITEM_REGULAR), + list("S&W Speed Loader (.357)", 5, /obj/item/ammo_magazine/revolver/small, null, VENDOR_ITEM_REGULAR), + list("Tiny Pistol Magazine (.22)", 5, /obj/item/ammo_magazine/pistol/holdout, null, VENDOR_ITEM_REGULAR), + + list("ATTACHMENTS", 0, null, null, null), + list("2x Hunting Mini-Scope", 20, /obj/item/attachable/scope/mini/hunting, null, VENDOR_ITEM_REGULAR), + list("Angled Grip", 15, /obj/item/attachable/angledgrip, null, VENDOR_ITEM_REGULAR), + list("Burst Fire Assembly", 15, /obj/item/attachable/burstfire_assembly, null, VENDOR_ITEM_REGULAR), + list("Extended Barrel", 15, /obj/item/attachable/extended_barrel, null, VENDOR_ITEM_REGULAR), + list("Laser Sight", 15, /obj/item/attachable/lasersight, null, VENDOR_ITEM_REGULAR), + list("Rail Flashlight", 5, /obj/item/attachable/flashlight, null, VENDOR_ITEM_REGULAR), + list("Red-Dot Sight", 15, /obj/item/attachable/reddot, null, VENDOR_ITEM_REGULAR), + list("Reflex Sight", 15, /obj/item/attachable/reflex, null, VENDOR_ITEM_REGULAR), + list("Suppressor", 15, /obj/item/attachable/suppressor, null, VENDOR_ITEM_REGULAR), + list("Vertical Grip", 15, /obj/item/attachable/verticalgrip, null, VENDOR_ITEM_REGULAR), + + list("UTILITIES", 0, null, null, null), + list("Type 80 Bayonet", 3, /obj/item/attachable/bayonet/upp, null, VENDOR_ITEM_REGULAR), + list("Lunge Mine", 120, /obj/item/weapon/twohanded/lungemine, null, VENDOR_ITEM_REGULAR), + list("Melee Weapon (Random)", 7, /obj/effect/essentials_set/random/clf_melee, null, VENDOR_ITEM_REGULAR), + list("M94 Marking Flare Pack", 3, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), + list("Smoke Grenade", 7, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) + ) + +/datum/faction/clf/get_antag_guns_sorted_equipment() + return list( + list("PRIMARY FIREARMS", -1, null, null), + list("ABR-40 Hunting Rifle", 30, /obj/item/weapon/gun/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), + list("Basira-Armstrong Bolt-Action", 15, /obj/item/weapon/gun/boltaction, null, VENDOR_ITEM_REGULAR), + list("Double Barrel Shotgun", 20, /obj/item/weapon/gun/shotgun/double, VENDOR_ITEM_REGULAR), + list("HG 37-12 Pump Shotgun", 20, /obj/item/weapon/gun/shotgun/double/sawn, VENDOR_ITEM_REGULAR), + list("M16 Rifle", 20, /obj/item/weapon/gun/rifle/m16, VENDOR_ITEM_REGULAR), + list("MAC-15 Submachinegun", 20, /obj/item/weapon/gun/smg/mac15, VENDOR_ITEM_REGULAR), + list("MAR-30 Battle Carbine", 20, /obj/item/weapon/gun/rifle/mar40/carbine, VENDOR_ITEM_REGULAR), + list("MAR-40 Battle Rifle", 20, /obj/item/weapon/gun/rifle/mar40, VENDOR_ITEM_REGULAR), + list("Type 64 Submachinegun", 20, /obj/item/weapon/gun/smg/bizon, VENDOR_ITEM_REGULAR), + list("MP27 Submachinegun", 20, /obj/item/weapon/gun/smg/mp27, VENDOR_ITEM_REGULAR), + list("MP5 Submachinegun", 20, /obj/item/weapon/gun/smg/mp5, VENDOR_ITEM_REGULAR), + list("Sawn-Off Shotgun", 20, /obj/item/weapon/gun/shotgun/pump/dual_tube/cmb, VENDOR_ITEM_REGULAR), + + list("PRIMARY AMMUNITION", -1, null, null), + list("ABR-40 Magazine (10x24mm)", 20, /obj/item/ammo_magazine/rifle/l42a/abr40, null, VENDOR_ITEM_REGULAR), + list("Basira-Armstrong Magazine (6.5mm)", 5, /obj/item/ammo_magazine/rifle/boltaction, null, VENDOR_ITEM_REGULAR), + list("Box Of Buckshot Shells", 15, /obj/item/ammo_magazine/shotgun/buckshot, VENDOR_ITEM_REGULAR), + list("Box Of Flechette Shells", 15, /obj/item/ammo_magazine/shotgun/flechette, VENDOR_ITEM_REGULAR), + list("Box Of Shotgun Slugs", 15, /obj/item/ammo_magazine/shotgun, VENDOR_ITEM_REGULAR), + list("M16 AP Magazine (5.56x45mm)", 10, /obj/item/ammo_magazine/rifle/m16/ap, VENDOR_ITEM_REGULAR), + list("M16 Magazine (5.56x45mm)", 60, /obj/item/ammo_magazine/rifle/m16, VENDOR_ITEM_REGULAR), + list("MAC-15 Magazine (9mm)", 60, /obj/item/ammo_magazine/smg/mac15, VENDOR_ITEM_REGULAR), + list("MAR Magazine (7.62x39mm)", 60, /obj/item/ammo_magazine/rifle/mar40, VENDOR_ITEM_REGULAR), + list("MAR Extended Magazine (7.62x39mm)", 10, /obj/item/ammo_magazine/rifle/mar40/extended, VENDOR_ITEM_REGULAR), + list("Type 64 Helical Magazine (7.62x19mm)", 60, /obj/item/ammo_magazine/smg/bizon, VENDOR_ITEM_REGULAR), + list("MP27 Magazine (4.6x30mm)", 60, /obj/item/ammo_magazine/smg/mp27, VENDOR_ITEM_REGULAR), + list("MP5 Magazine (9mm)", 60, /obj/item/ammo_magazine/smg/mp5, VENDOR_ITEM_REGULAR), + + list("SIDEARMS", -1, null, null), + list("88 Mod 4 Combat Pistol", 20, /obj/item/weapon/gun/pistol/mod88, VENDOR_ITEM_REGULAR), + list("Beretta 92FS Pistol", 20, /obj/item/weapon/gun/pistol/b92fs, VENDOR_ITEM_REGULAR), + list("CMB Spearhead Autorevolver", 20, /obj/item/weapon/gun/revolver/cmb, VENDOR_ITEM_REGULAR), + list("Holdout Pistol", 20, /obj/item/weapon/gun/pistol/holdout, VENDOR_ITEM_REGULAR), + list("KT-42 Automag", 20, /obj/item/weapon/gun/pistol/kt42, VENDOR_ITEM_REGULAR), + list("S&W .357 Revolver", 20, /obj/item/weapon/gun/revolver/small, VENDOR_ITEM_REGULAR), + + list("SIDEARM AMMUNITION", -1, null, null), + list("88M4 AP Magazine (9mm)", 40, /obj/item/ammo_magazine/pistol/mod88, VENDOR_ITEM_REGULAR), + list("Beretta 92FS Magazine (9mm)", 40, /obj/item/ammo_magazine/pistol/b92fs, VENDOR_ITEM_REGULAR), + list("KT-42 Magazine (.44)", 40, /obj/item/ammo_magazine/pistol/kt42, VENDOR_ITEM_REGULAR), + list("Spearhead Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/cmb/normalpoint, VENDOR_ITEM_REGULAR), + list("Hollowpoint Spearhead Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/cmb, VENDOR_ITEM_REGULAR), + list("S&W Speed Loader (.357)", 40, /obj/item/ammo_magazine/revolver/small, VENDOR_ITEM_REGULAR), + list("Tiny Pistol Magazine (.22)", 40, /obj/item/ammo_magazine/pistol/holdout, VENDOR_ITEM_REGULAR), + + list("MELEE WEAPONS", -1, null, null), + list("Baseball Bat", 10, /obj/item/weapon/baseballbat, VENDOR_ITEM_REGULAR), + list("Baseball Bat (Metal)", 5, /obj/item/weapon/baseballbat/metal, VENDOR_ITEM_REGULAR), + list("Fireaxe", 5, /obj/item/weapon/twohanded/fireaxe, VENDOR_ITEM_REGULAR), + list("Hatchet", 15, /obj/item/tool/hatchet, VENDOR_ITEM_REGULAR), + list("Spear", 10, /obj/item/weapon/twohanded/spear, VENDOR_ITEM_REGULAR), + + list("UTILITIES", -1, null, null), + list("M94 Marking Flare Pack", 20, /obj/item/storage/box/m94, VENDOR_ITEM_REGULAR), + list("Smoke Grenade", 5, /obj/item/explosive/grenade/smokebomb, VENDOR_ITEM_REGULAR), + list("Type 80 Bayonet", 40, /obj/item/attachable/bayonet/upp, VENDOR_ITEM_REGULAR), + ) diff --git a/code/datums/factions/cmb.dm b/code/datums/factions/cmb.dm new file mode 100644 index 000000000000..6201d3467e0d --- /dev/null +++ b/code/datums/factions/cmb.dm @@ -0,0 +1,3 @@ +/datum/faction/cmb + name = "Colonial Marshal Bureau" + faction_tag = FACTION_MARINE diff --git a/code/datums/factions/colonists.dm b/code/datums/factions/colonists.dm deleted file mode 100644 index 9ba0557c1023..000000000000 --- a/code/datums/factions/colonists.dm +++ /dev/null @@ -1,28 +0,0 @@ -/datum/faction/colonist - name = NAME_FACTION_COLONIST - desc = "Colonists, the most ordinary citizens of the colonies, ADDITIONAL INFORMATION IS CHANGED" - - faction_name = FACTION_COLONIST - - role_mappings = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) - roles_list = list( - MODE_NAME_EXTENDED = ROLES_REGULAR_SURV, - MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_SURV, - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list( - JOB_SURVIVOR - ), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list( - JOB_SURVIVOR - ) - ) diff --git a/code/datums/factions/contractor.dm b/code/datums/factions/contractor.dm index a564ae5841ba..5e0f125b06b0 100644 --- a/code/datums/factions/contractor.dm +++ b/code/datums/factions/contractor.dm @@ -1,6 +1,3 @@ /datum/faction/contractor - name = NAME_FACTION_CONTRACTOR - desc = "There is no information" - - faction_name = FACTION_CONTRACTOR - faction_iff_tag_type = /obj/item/faction_tag + name = "Vanguard's Arrow Incorporated" + faction_tag = FACTION_CONTRACTOR diff --git a/code/datums/factions/dutch's_dozen.dm b/code/datums/factions/dutch's_dozen.dm deleted file mode 100644 index 455224371e13..000000000000 --- a/code/datums/factions/dutch's_dozen.dm +++ /dev/null @@ -1,6 +0,0 @@ -/datum/faction/dutchs_dozen - name = NAME_FACTION_DUTCH - desc = "Like the Colonial Liberation Front and the better-equipped Freelancer Mercenaries before them, the Dozens start with non-standard UA weaponry, employing equipment of the United Americas such as the M16A2 assault rifle and the minigun. While the weapons on their own are outdated and cannot take most attachments, their automatic weaponry is equally deadly, meant for hunting their targets. \ - The Dozens will also expect a guerrilla style of gameplay, as unlike most modern forces of this era, the Dozens use special techniques related to survival and can handle themselves on the ground without support. Whether it would take place in a jungle landscape or in urban grounds. One advantage of the Dutch's Mercenary Team is their speed and aggressiveness, which are primarily used to eliminate their target(s), due to the target's equal amount of speed, aggressiveness and robustness." - - faction_name = FACTION_DUTCH diff --git a/code/datums/factions/faction.dm b/code/datums/factions/faction.dm index 7b21c0c86750..a6201da70467 100644 --- a/code/datums/factions/faction.dm +++ b/code/datums/factions/faction.dm @@ -1,343 +1,13 @@ /datum/faction - var/name = NAME_FACTION_NEUTRAL - var/desc = "Neutral Faction" - - var/faction_name = FACTION_NEUTRAL - var/faction_tag = SIDE_FACTION_NEUTRAL - - var/organ_faction_iff_tag_type - var/faction_iff_tag_type - var/ally_factions_initialize = TRUE - - var/relations_pregen[] = RELATIONS_NEUTRAL - + var/name = "Neutral Faction" + var/faction_tag = FACTION_NEUTRAL var/hud_type = FACTION_HUD - var/orders = "Survive" - var/color = "#22888a" - var/ui_color = "#22888a" - var/prefix = "" - var/list/totalMobs = list() - var/list/totalDeadMobs = list() - var/list/faction_leaders = list() - var/list/late_join_landmarks = list() - var/mob/living/carbon/faction_leader - - var/need_round_end_check = FALSE - -//////////////// -//BALANCE DEFS// -//////////////// - var/list/role_mappings = list() - var/list/roles_list = list() - - var/spawning_enabled = TRUE - var/latejoin_enabled = TRUE - -/////////// -//MODULES// -/////////// - var/list/modules_to_add = list(MODULE_CODE_NAME_RELATIONS = list()) // list(MODULE_NAME = list(MODULE_VARS = VALUE, ...), ...) - var/list/datum/faction_module/modules = list() - -////////////// -/datum/faction/New() - for(var/module in modules_to_add) - if(!GLOB.faction_modules[module]) - return - modules[module] = new GLOB.faction_modules[module](src, ...modules_to_add[module]) - -/datum/faction/can_vv_modify() - return FALSE /datum/faction/proc/modify_hud_holder(image/holder, mob/living/carbon/human/H) return -/datum/faction/proc/add_mob(mob/living/carbon/carbon) - if(!carbon || !istype(carbon)) - return - - if(carbon.faction && carbon.faction != src) - carbon.faction.remove_mob(carbon, TRUE) - - if(carbon in totalMobs) - return - - carbon.faction = src - - if(carbon.hud_list) - carbon.hud_update() - - if(!carbon.statistic_exempt) - totalMobs += carbon - -/datum/faction/proc/remove_mob(mob/living/carbon/carbon, hard = FALSE) - if(!carbon || !istype(carbon)) - return - - if(!(carbon in totalMobs)) - return - - if(hard) - carbon.faction = null - else - totalDeadMobs += carbon - - totalMobs -= carbon - -/datum/faction/proc/can_delay_round_end(mob/living/carbon/carbon) - return TRUE - -//Ally procs -/atom/movable/proc/ally(datum/faction/ally_faction) - if(!ally_faction) - return FALSE - - var/list/factions = list() - factions += ally_faction - var/datum/faction_module/relations/module = ally_faction.modules[MODULE_CODE_NAME_RELATIONS] - for(var/datum/faction/allies in module.allies) - factions += allies - if(isnull(factions) || !faction) - return FALSE - - return faction in factions - -/mob/ally(datum/faction/ally_faction) - if(!ally_faction) - return FALSE - - var/list/factions = list() - factions += ally_faction - var/datum/faction_module/relations/module = ally_faction.modules[MODULE_CODE_NAME_RELATIONS] - for(var/datum/faction/allies in module.allies) - factions += allies - - if(isnull(factions) || !faction) - return FALSE - - return faction in factions - -/mob/living/carbon/ally(datum/faction/ally_faction) - if(!ally_faction) - return FALSE - - if((organ_faction_tag || (faction.faction_tag in SIDE_ORGANICAL_DOM)) && (ally_faction.faction_tag in SIDE_ORGANICAL_DOM)) - if(organ_faction_tag) - return ally_faction.organ_faction_tag_is_ally(organ_faction_tag) - else if(faction == ally_faction) - return TRUE - else if(faction_tag) - return ally_faction.faction_tag_is_ally(faction_tag) - - return FALSE - -/datum/faction/proc/organ_faction_tag_is_ally(obj/item/faction_tag/organ/organ_tag) - if(organ_tag.faction == src) - return TRUE - var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] - for(var/datum/faction/faction in organ_tag.factions + organ_tag.faction) - if(module.allies[faction.faction_name]) - return TRUE - - return FALSE - -/datum/faction/proc/faction_tag_is_ally(obj/item/faction_tag/object_tag) - if(object_tag.faction == src) - return TRUE - var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] - for(var/datum/faction/faction in object_tag.factions + object_tag.faction) - if(module.allies[faction.faction_name]) - return TRUE - else if(faction.faction_tag == faction_tag) - return TRUE - - return FALSE - -/datum/faction/proc/faction_is_ally(datum/faction/faction_to_check) - if(faction_to_check.faction_tag == faction_tag) - return TRUE - - var/datum/faction_module/relations/module = modules[MODULE_CODE_NAME_RELATIONS] - if(module.allies[faction_to_check.faction_name]) - return TRUE - - return FALSE - /datum/faction/proc/get_antag_guns_snowflake_equipment() return list() /datum/faction/proc/get_antag_guns_sorted_equipment() return list() - -/datum/faction/proc/store_objective(datum/cm_objective/O) - if(objective_memory) - objective_memory.store_objective(O) - -//FACTION INFO PANEL -/datum/faction/ui_state(mob/user) - return GLOB.not_incapacitated_state - -/datum/faction/ui_status(mob/user, datum/ui_state/state) - . = ..() - if(isobserver(user)) - return UI_INTERACTIVE - -/datum/faction/ui_data(mob/user) - . = list() - .["faction_orders"] = orders - -/datum/faction/ui_static_data(mob/user) - . = list() - .["faction_color"] = ui_color - .["faction_name"] = name - .["faction_desc"] = desc - .["actions"] = get_faction_actions() - -/datum/faction/tgui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "FactionStatus", "[name] Статус") - ui.set_autoupdate(FALSE) - ui.open() - -/datum/faction/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) - . = ..() - if(.) - return - - switch(action) - if("relations") - relations_datum.tgui_interact(usr) - if("tasks") - task_interface.tgui_interact(usr) - if("clues") - if(!skillcheck(usr, SKILL_INTEL, SKILL_INTEL_TRAINED)) - to_chat(usr, SPAN_WARNING("You have no access to the [name] intel network.")) - return - objective_interface.tgui_interact(usr) - if("researchs") - if(!skillcheck(usr, SKILL_RESEARCH, SKILL_RESEARCH_TRAINED)) - to_chat(usr, SPAN_WARNING("You have no access to the [name] research network.")) - return - research_objective_interface.tgui_interact(usr) - if("status") - get_faction_info(usr) - -/datum/faction/proc/get_faction_actions(mob/user) - . = list() - . += list(list("name" = "Faction Relations", "action" = "relations")) - . += list(list("name" = "Faction Tasks", "action" = "tasks")) - . += list(list("name" = "Faction Clues", "action" = "clues")) - . += list(list("name" = "Faction Researchs", "action" = "researchs")) - . += list(list("name" = "Faction Status", "action" = "status")) - return . - -/datum/faction/proc/get_faction_info(mob/user) - var/dat = GLOB.data_core.get_manifest(FALSE, src) - if(!dat) - return FALSE - show_browser(user, dat, "Список Экипажа [name]", "manifest", "size=450x750") - return TRUE - -/datum/faction/proc/get_join_status(mob/new_player/user, dat) - -/* Right now don't wanna mess around for one factions solution, if making this, this need to be working for ALL factions as well as for MARINES - if(roles_show & FLAG_SHOW_CIC && GLOB.ROLES_CIC.Find(J.title)) - dat += "Command:
" - roles_show ^= FLAG_SHOW_CIC - - else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && GLOB.ROLES_AUXIL_SUPPORT.Find(J.title)) - dat += "
Auxiliary Combat Support:
" - roles_show ^= FLAG_SHOW_AUXIL_SUPPORT - - else if(roles_show & FLAG_SHOW_MISC && GLOB.ROLES_MISC.Find(J.title)) - dat += "
Other:
" - roles_show ^= FLAG_SHOW_MISC - - else if(roles_show & FLAG_SHOW_POLICE && GLOB.ROLES_POLICE.Find(J.title)) - dat += "
Military Police:
" - roles_show ^= FLAG_SHOW_POLICE - - else if(roles_show & FLAG_SHOW_ENGINEERING && GLOB.ROLES_ENGINEERING.Find(J.title)) - dat += "
Engineering:
" - roles_show ^= FLAG_SHOW_ENGINEERING - - else if(roles_show & FLAG_SHOW_REQUISITION && GLOB.ROLES_REQUISITION.Find(J.title)) - dat += "
Requisitions:
" - roles_show ^= FLAG_SHOW_REQUISITION - - else if(roles_show & FLAG_SHOW_MEDICAL && GLOB.ROLES_MEDICAL.Find(J.title)) - dat += "
Medbay:
" - roles_show ^= FLAG_SHOW_MEDICAL - - else if(roles_show & FLAG_SHOW_MARINES && GLOB.ROLES_MARINES.Find(J.title)) - dat += "
Marines:
" - roles_show ^= FLAG_SHOW_MARINES - - dat += "[J.disp_title] ([J.current_positions]) (Active: [active])
" -*/ - - dat = "
" - dat += "[user.client.auto_lang(LANGUAGE_LOBBY_ROUND_TIME)]: [DisplayTimeText(world.time, language = user.client.language)]
" - dat += "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CHOSE)]:
" - dat += additional_join_status(user) - - if(!latejoin_enabled) - dat = "[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CLOSED)]:
" - - else if(!SSautobalancer.can_join(src)) - dat = "[user.client.auto_lang(LANGUAGE_JS_BALANCE_ISSUE)]:
" - - else - var/list/roles = roles_list[SSticker.mode.name] - for(var/role in roles) - var/datum/job/job = SSticker.role_authority.roles_by_name[role] - var/check_result = SSticker.role_authority.check_role_entry(user, job, src, TRUE) - var/active = 0 - for(var/mob/mob in GLOB.player_list) - if(mob.client && mob.job == job.title) - active++ - - if(check_result) - dat += "[job.disp_title] ([job.current_positions]): [check_result] ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" - else - dat += "[job.disp_title] ([job.current_positions]) ([user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ACTIVE)]: [active])
" - - dat += "
" - show_browser(user, dat, "Late Join", "latechoices", "size=420x700") - -/datum/faction/proc/additional_join_status(mob/new_player/user, dat = "") - return -/* - if(roles_show & FLAG_SHOW_CIC && ROLES_CIC & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_COM)]:
" - roles_show ^= FLAG_SHOW_CIC - - else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && ROLES_AUXIL_SUPPORT & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_SUP)]:
" - roles_show ^= FLAG_SHOW_AUXIL_SUPPORT - - else if(roles_show & FLAG_SHOW_MISC && ROLES_MISC & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_OTH)]:
" - roles_show ^= FLAG_SHOW_MISC - - else if(roles_show & FLAG_SHOW_POLICE && ROLES_POLICE & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_POL)]:
" - roles_show ^= FLAG_SHOW_POLICE - - else if(roles_show & FLAG_SHOW_ENGINEERING && ROLES_ENGINEERING & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_ENG)]:
" - roles_show ^= FLAG_SHOW_ENGINEERING - - else if(roles_show & FLAG_SHOW_REQUISITION && ROLES_REQUISITION & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_CAG)]:
" - roles_show ^= FLAG_SHOW_REQUISITION - - else if(roles_show & FLAG_SHOW_MEDICAL && ROLES_MEDICAL & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MED)]:
" - roles_show ^= FLAG_SHOW_MEDICAL - - else if(roles_show & FLAG_SHOW_MARINES && ROLES_MARINES & job.title) - dat += "
[user.client.auto_lang(LANGUAGE_LOBBY_LATE_JOIN_MAR)]:
" - roles_show ^= FLAG_SHOW_MARINES -*/ diff --git a/code/datums/factions/freelancer.dm b/code/datums/factions/freelancer.dm deleted file mode 100644 index 7d675f78e3a0..000000000000 --- a/code/datums/factions/freelancer.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/freelancers - name = NAME_FACTION_FREELANCER - desc = "The term Freelancers come in various forms. Whether one is an independent entrepreneur selling services or a Freelance worker offering their labour for cash. In the business of killing and protecting, the term Freelancers are usually associated with a group of mercenaries that bare such a moniker. \ - These Freelance Mercenaries have become a small but noticeable security firm that has grown somewhat popular in the outer rim of the galaxy. Yet many sovereign nations view them as a nuisance because of the many questionable activities they've conducted. \ - None the less they're the least hated group in the galaxy as they've usually kept out of any major incidents that would reflect poorly on the Freelancers. Their alignment in the grand scheme of things usually favour those who pay them, with or without ethics." - - faction_name = FACTION_FREELANCER diff --git a/code/datums/factions/gladiator.dm b/code/datums/factions/gladiator.dm deleted file mode 100644 index ad2c023bf7b1..000000000000 --- a/code/datums/factions/gladiator.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/gladiator - name = NAME_FACTION_GLADIATOR - desc = "Warning, something corrupted, this is row is not exist. Our story teller is SLEEPING, try again in some weeks." - - faction_name = FACTION_GLADIATOR diff --git a/code/datums/factions/hefa_order.dm b/code/datums/factions/hefa_order.dm deleted file mode 100644 index f6a5dbbc3fbd..000000000000 --- a/code/datums/factions/hefa_order.dm +++ /dev/null @@ -1,8 +0,0 @@ -/datum/faction/hefa - name = NAME_FACTION_HEFA - desc = "The Holy Order of the High-Explosive Fragmenting-Antipersonnel hand grenade (also known as the HEFA Knights, the Knights of HEFA, and or the HEFA Order), is a religious cult that is actively opposed to the United Americas and the Union of Progressive Peoples. \ - The Order's operations are loosely coordinated between two cell types, a 'temple' group, acting as a dispatch and administration center, and a 'shard' or more traditionally described splinter that actually carries out the strike. \ - It is believed that all HEFA Knight 'temple' cells operate out of the derelict Kerchner 2155 Horn Nebula mining expedition way-stations due to their proximity to supply lanes leading to the Neroid sector and other frontier sectors. The group is classified as an intergalactic terrorist organization by both the UPP, and UA. \ - HEFA Knight members or Shrapnelsworn, are devoted to the worship of the M40 High-Explosive Fragmenting-Antipersonnel hand grenade, viewing the object as a divine gift from an unknown benefactor that has influenced humanity. Order members are trained to have no regard for their personal safety. To die in battle is to die gloriously, and to solidify one's devotion to the HEFA hand grenade." - - faction_name = FACTION_HEFA diff --git a/code/datums/factions/helpers.dm b/code/datums/factions/helpers.dm new file mode 100644 index 000000000000..38cd6dd85d58 --- /dev/null +++ b/code/datums/factions/helpers.dm @@ -0,0 +1,14 @@ +GLOBAL_LIST_INIT_TYPED(faction_datums, /datum/faction, setup_faction_list()) + +/proc/setup_faction_list() + var/list/faction_datums_list = list() + for(var/T in typesof(/datum/faction)) + var/datum/faction/F = new T + faction_datums_list[F.faction_tag] = F + return faction_datums_list + +/proc/get_faction(faction = FACTION_MARINE) + var/datum/faction/F = GLOB.faction_datums[faction] + if(F) + return F + return GLOB.faction_datums[FACTION_NEUTRAL] diff --git a/code/datums/factions/mercenary.dm b/code/datums/factions/mercenary.dm deleted file mode 100644 index d2fb5c8e1ea0..000000000000 --- a/code/datums/factions/mercenary.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/mercenary - name = NAME_FACTION_MERCENARY - desc = "Warning, potential dead story teller." - - faction_name = FACTION_MERCENARY diff --git a/code/datums/factions/pirate.dm b/code/datums/factions/pirate.dm deleted file mode 100644 index 97db12664ab1..000000000000 --- a/code/datums/factions/pirate.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/pirate - name = NAME_FACTION_PIRATE - desc = "Pirates, all information encrupted." - - faction_name = FACTION_PIRATE diff --git a/code/datums/factions/pizza_delivery.dm b/code/datums/factions/pizza_delivery.dm deleted file mode 100644 index 24ccd82aa3c9..000000000000 --- a/code/datums/factions/pizza_delivery.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/pizza - name = NAME_FACTION_PIZZA - desc = "Pizza Galaxy is the galaxy's largest pizza chain, known for its incredible variety in pizzas, and pizza related products. Customers can get anything from a plain cheese pizza, to a pizza stuffed Mr. Pizza Man mascot, with ranch cups for eyes. \ - Most Pizza Galaxy stations also have a play room for kids, called \"Pizza Party\". Pizza Galaxy is a big employer, from 16 year olds trying to pay off space college, to 40 year olds who just got discharged from the USCM for thinking that the MP was a \"red communist\". \ - The current owner and CEO of Pizza Galaxy is Mr. James Kepplinger, a prestigious businessman with a knack for bargaining." - - faction_name = FACTION_PIZZA diff --git a/code/datums/factions/pmc.dm b/code/datums/factions/pmc.dm new file mode 100644 index 000000000000..c5b319a13c7b --- /dev/null +++ b/code/datums/factions/pmc.dm @@ -0,0 +1,95 @@ +/datum/faction/pmc + name = "Private Military Company" + faction_tag = FACTION_PMC + +/datum/faction/pmc/modify_hud_holder(image/holder, mob/living/carbon/human/H) + var/hud_icon_state + var/obj/item/card/id/ID = H.get_idcard() + var/_role + if(H.mind) + _role = H.job + else if(ID) + _role = ID.rank + switch(_role) + if(JOB_PMC_DIRECTOR) + hud_icon_state = "sd" + if(JOB_PMC_LEADER, JOB_PMC_LEAD_INVEST) + hud_icon_state = "ld" + if(JOB_PMC_DOCTOR) + hud_icon_state = "td" + if(JOB_PMC_ENGINEER) + hud_icon_state = "ct" + if(JOB_PMC_MEDIC, JOB_PMC_INVESTIGATOR) + hud_icon_state = "md" + if(JOB_PMC_SYNTH) + hud_icon_state = "syn" + if(hud_icon_state) + holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "pmc_[hud_icon_state]") + +/datum/faction/pmc/get_antag_guns_snowflake_equipment() + return list( + list("PRIMARY FIREARMS", 0, null, null, null), + list("M41A/2 Pulse Rifle", 30, /obj/item/weapon/gun/rifle/m41a/elite, null, VENDOR_ITEM_REGULAR), + list("M39B/2 submachinegun", 30, /obj/item/weapon/gun/smg/m39/elite, null, VENDOR_ITEM_REGULAR), + list("NSG23 assault rifle", 20, /obj/item/weapon/gun/rifle/nsg23, null, VENDOR_ITEM_REGULAR), + + list("PRIMARY AMMUNITION", 0, null, null, null), + list("M41A AP magazine (10x24mm)", 10, /obj/item/ammo_magazine/rifle/ap, null, VENDOR_ITEM_REGULAR), + list("M41A extended magazine (10x24mm)", 5, /obj/item/ammo_magazine/rifle/extended, null, VENDOR_ITEM_REGULAR), + list("M39 AP magazine (10x20mm)", 10, /obj/item/ammo_magazine/smg/m39/ap, null, VENDOR_ITEM_REGULAR), + list("M39 HV extended magazine (10x20mm)", 5, /obj/item/ammo_magazine/smg/m39/extended, null, VENDOR_ITEM_REGULAR), + list("NSG 23 armor-piercing magazine (10x24mm)", 10, /obj/item/ammo_magazine/rifle/nsg23/ap, null, VENDOR_ITEM_REGULAR), + list("NSG 23 extended magazine (10x24mm)", 5, /obj/item/ammo_magazine/rifle/nsg23/extended, null, VENDOR_ITEM_REGULAR), + + list("SIDEARMS", 0, null, null, null), + list("VP78 pistol", 20, /obj/item/weapon/gun/pistol/vp78, null, VENDOR_ITEM_REGULAR), + list("88 Mod 4 Combat Pistol", 15, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), + + list("SIDEARM AMMUNITION", 0, null, null, null), + list("VP78 magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/vp78, null, VENDOR_ITEM_REGULAR), + list("88M4 AP Magazine (9mm)", 5, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), + + list("ATTACHMENTS", 0, null, null, null), + list("Angled Grip", 15, /obj/item/attachable/angledgrip, null, VENDOR_ITEM_REGULAR), + list("Burst Fire Assembly", 15, /obj/item/attachable/burstfire_assembly, null, VENDOR_ITEM_REGULAR), + list("Extended Barrel", 15, /obj/item/attachable/extended_barrel, null, VENDOR_ITEM_REGULAR), + list("Advanced Underbarrel Flamethrower", 15, /obj/item/attachable/attached_gun/flamer/advanced, null, VENDOR_ITEM_REGULAR), + list("Laser Sight", 15, /obj/item/attachable/lasersight, null, VENDOR_ITEM_REGULAR), + list("Rail Flashlight", 5, /obj/item/attachable/flashlight, null, VENDOR_ITEM_REGULAR), + list("Red-Dot Sight", 15, /obj/item/attachable/reddot, null, VENDOR_ITEM_REGULAR), + list("Reflex Sight", 15, /obj/item/attachable/reflex, null, VENDOR_ITEM_REGULAR), + list("Suppressor", 15, /obj/item/attachable/suppressor, null, VENDOR_ITEM_REGULAR), + list("Vertical Grip", 15, /obj/item/attachable/verticalgrip, null, VENDOR_ITEM_REGULAR), + + list("UTILITIES", 0, null, null, null), + list("M94 Marking Flare Pack", 3, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), + list("Smoke Grenade", 7, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) + ) + +/datum/faction/pmc/get_antag_guns_sorted_equipment() + return list( + list("PRIMARY FIREARMS", 0, null, null, null), + list("M41A/2 Pulse Rifle", 30, /obj/item/weapon/gun/rifle/m41a/elite, null, VENDOR_ITEM_REGULAR), + list("M39B/2 submachinegun", 30, /obj/item/weapon/gun/smg/m39/elite, null, VENDOR_ITEM_REGULAR), + list("NSG23 assault rifle", 30, /obj/item/weapon/gun/rifle/nsg23, null, VENDOR_ITEM_REGULAR), + + list("PRIMARY AMMUNITION", 0, null, null, null), + list("M41A AP magazine (10x24mm)", 30, /obj/item/ammo_magazine/rifle/ap, null, VENDOR_ITEM_REGULAR), + list("M41A extended magazine (10x24mm)", 50, /obj/item/ammo_magazine/rifle/extended, null, VENDOR_ITEM_REGULAR), + list("M39 AP magazine (10x20mm)", 30, /obj/item/ammo_magazine/smg/m39/ap, null, VENDOR_ITEM_REGULAR), + list("M39 HV extended magazine (10x20mm)", 50, /obj/item/ammo_magazine/smg/m39/extended, null, VENDOR_ITEM_REGULAR), + list("NSG 23 armor-piercing magazine (10x24mm)", 30, /obj/item/ammo_magazine/rifle/nsg23/ap, null, VENDOR_ITEM_REGULAR), + list("NSG 23 extended magazine (10x24mm)", 50, /obj/item/ammo_magazine/rifle/nsg23/extended, null, VENDOR_ITEM_REGULAR), + + list("SIDEARMS", 0, null, null, null), + list("VP78 pistol", 20, /obj/item/weapon/gun/pistol/vp78, null, VENDOR_ITEM_REGULAR), + list("88 Mod 4 Combat Pistol", 30, /obj/item/weapon/gun/pistol/mod88, null, VENDOR_ITEM_REGULAR), + + list("SIDEARM AMMUNITION", 0, null, null, null), + list("VP78 magazine (9mm)", 50, /obj/item/ammo_magazine/pistol/vp78, null, VENDOR_ITEM_REGULAR), + list("88M4 AP Magazine (9mm)", 50, /obj/item/ammo_magazine/pistol/mod88, null, VENDOR_ITEM_REGULAR), + + list("UTILITIES", 0, null, null, null), + list("M94 Marking Flare Pack", 30, /obj/item/storage/box/m94, null, VENDOR_ITEM_RECOMMENDED), + list("Smoke Grenade", 30, /obj/item/explosive/grenade/smokebomb, null, VENDOR_ITEM_REGULAR) + ) diff --git a/code/datums/factions/ress.dm b/code/datums/factions/ress.dm deleted file mode 100644 index 70d6e9a05d9d..000000000000 --- a/code/datums/factions/ress.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/ress - name = NAME_FACTION_RESS - desc = "No information given, please update your local data." - - faction_name = FACTION_RESS diff --git a/code/datums/factions/twe/commando.dm b/code/datums/factions/royalmarinescommando.dm similarity index 90% rename from code/datums/factions/twe/commando.dm rename to code/datums/factions/royalmarinescommando.dm index c2da3242e072..2fab0348bcfa 100644 --- a/code/datums/factions/twe/commando.dm +++ b/code/datums/factions/royalmarinescommando.dm @@ -1,17 +1,15 @@ -/datum/faction/twe/royal_commando - name = NAME_FACTION_TWE - desc = "No information given, please update your local data." - +/datum/faction/royal_marines_commando + name = "Royal Marines Commando" faction_tag = FACTION_TWE -/datum/faction/twe/royal_commando/modify_hud_holder(image/holder, mob/living/carbon/human/human) +/datum/faction/royal_marines_commando/modify_hud_holder(image/holder, mob/living/carbon/human/H) var/hud_icon_state - var/obj/item/card/id/id_card = human.get_idcard() + var/obj/item/card/id/dogtag/ID = H.get_idcard() var/_role - if(human.mind) - _role = human.job - else if(id_card) - _role = id_card.rank + if(H.mind) + _role = H.job + else if(ID) + _role = ID.rank switch(_role) if(JOB_TWE_RMC_LIEUTENANT) hud_icon_state = "lieutenant" @@ -28,7 +26,7 @@ if(hud_icon_state) holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "rmc_[hud_icon_state]") -/datum/faction/twe/royal_commando/get_antag_guns_snowflake_equipment() +/datum/faction/royal_marines_commando/get_antag_guns_snowflake_equipment() return list( list("PRIMARY FIREARMS", 0, null, null, null), list("F903A1 Rifle", 20, /obj/item/weapon/gun/rifle/rmc_f90, null, VENDOR_ITEM_REGULAR), @@ -67,7 +65,7 @@ list("L5 bayonet", 3, /obj/item/attachable/bayonet/rmc, null, VENDOR_ITEM_REGULAR), ) -/datum/faction/twe/royal_commando/get_antag_guns_sorted_equipment() +/datum/faction/royal_marines_commando/get_antag_guns_sorted_equipment() return list( list("PRIMARY FIREARMS", -1, null, null), list("F903A1 Rifle", 20, /obj/item/weapon/gun/rifle/rmc_f90, null, VENDOR_ITEM_REGULAR), diff --git a/code/datums/factions/souto.dm b/code/datums/factions/souto.dm deleted file mode 100644 index 3e007da6ee0e..000000000000 --- a/code/datums/factions/souto.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/souto - name = NAME_FACTION_SOUTO - desc = "Souto delivery, information encrypted due to error." - - faction_name = FACTION_SOUTO diff --git a/code/datums/factions/threewe.dm b/code/datums/factions/threewe.dm deleted file mode 100644 index 119a47c2bf71..000000000000 --- a/code/datums/factions/threewe.dm +++ /dev/null @@ -1,9 +0,0 @@ -/datum/faction/threewe - name = NAME_FACTION_THREEWE - desc = "Formed in 2088, the Three World Empire (3WE) was a federation of nations created by the joining of the United Kingdom and Japan, as well as allied nations including India, Indonesia, and Australia. Following the formation of this federation, the Japanese Yutani Corporation purchased and merged with the British Weyland Corporation leading to the 3WE’s status as the most significant economic force in Sol. The name, Three World Empire, is drawn from the first three worlds colonized by humanity: Earth, Mars, and Titan. \ - Supported by the technological advances of the Weyland-Yutani Corporation, the Three World Empire quickly amassed the largest and most advanced naval fleet that humanity had ever seen. These advances in Starflight allowed members of the 3WE to be the first humans to leave the cradle of Sol in search of new homes among the stars. As a result, the 3WE has colonized a plurality of all known resource-rich and naturally habitable worlds. \ - These early colonies would come to be known as the Core Systems. Due to their heavy reliance on the navy, the Three World Empire can ill afford to field a large standing army like the United Americas (UA) or the Union of Progressive Peoples (UPP). The safety of its territories outside of Sol is primarily contracted to Weyland-Yutani Private Military Contractors (PMCs) as well as the UA’s United States Colonial Marine Corps (USCMC). \ - While the USCMC is exclusively tasked with patrol and rapid response, Wey-Yu PMCs fill a wide array of roles. While the contractors are primarily hired to patrol and garrison 3WE territory, it is not uncommon to see them filling the role of peacekeepers not dissimilar to beat cops on worlds without a strong Colonial Marshal presence. For its economic influence and role in the Three World Empire’s stability and prosperity, Weyland-Yutani was granted a permanent seat in the Empire’s Parliament. \ - So far, Weyland-Yutani is the only non-governmental entity to be bestowed this honour. While all governmental parties claim that Weyland-Yutani has remained unbiased in its governance, none can deny that since being invited into Parliament, the Corporation’s economic power has increased ten-fold. In contrast, the majority of its competition have floundered under strict economic regulation and bureaucratic red tape." - - faction_name = FACTION_THREEWE diff --git a/code/datums/factions/upp.dm b/code/datums/factions/upp.dm index f63e9d5e0cb0..90b04765cf85 100644 --- a/code/datums/factions/upp.dm +++ b/code/datums/factions/upp.dm @@ -1,32 +1,6 @@ /datum/faction/upp - name = NAME_FACTION_UPP - desc = "A wide-reaching and powerful socialist authoritarian state. The UPP acts as the political and ideological rival of the United States and the UA. Though they have a relatively large presence on Earth (particularly in the Eastern sphere), the UPP is also largely active in colonizing the frontier. \ - While the United Americas have never engaged the UPP in an official war, hostilities broke out between a USCM Task Force and a UPP Expeditionary Force during Operation Canton in mid 2165. The engagement ended in a ceasefire. The reason was fears that the conflict would spread to the more densely populated Sol System. \ - The incident greatly enraged many senior officials in the UPP, who viewed the battle of Canton as an attempt by the United States to annex UPP sovereign territory. “Such an insult (referring to Canton) can only be repaid in American blood. Mark my words, this will happen”, Kolonel Ganbaatar of the UPP Armed Forces was quoted saying in May 2168." - - faction_name = FACTION_UPP - faction_tag = SIDE_FACTION_UPP - relations_pregen = RELATIONS_FACTION_UPP - faction_iff_tag_type = /obj/item/faction_tag/upp - - role_mappings = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) - roles_list = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = UPP_JOB_LIST, - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) + name = "Union of Progressive Peoples" + faction_tag = FACTION_UPP /datum/faction/upp/modify_hud_holder(image/holder, mob/living/carbon/human/H) var/hud_icon_state @@ -51,12 +25,24 @@ hud_icon_state = "lt" if(JOB_UPP_SRLT_OFFICER) hud_icon_state = "slt" + if(JOB_UPP_KPT_OFFICER) + hud_icon_state = "xo" if(JOB_UPP_MAY_OFFICER) - hud_icon_state = "may" + hud_icon_state = "co" + if(JOB_UPP_LTKOL_OFFICER) + hud_icon_state = "co" if(JOB_UPP_KOL_OFFICER) - hud_icon_state = "kol" + hud_icon_state = "co" + if(JOB_UPP_MAY_GENERAL) + hud_icon_state = "co" + if(JOB_UPP_LT_GENERAL) + hud_icon_state = "co" + if(JOB_UPP_GENERAL) + hud_icon_state = "co" if(JOB_UPP_COMBAT_SYNTH) hud_icon_state = "synth" + if(JOB_UPP_SUPPORT_SYNTH) + hud_icon_state = "synth" if(JOB_UPP_COMMANDO) hud_icon_state = "com" if(JOB_UPP_COMMANDO_MEDIC) diff --git a/code/datums/factions/uscm.dm b/code/datums/factions/uscm.dm index bad4dc3cdb5f..f7c49321f305 100644 --- a/code/datums/factions/uscm.dm +++ b/code/datums/factions/uscm.dm @@ -1,13 +1,6 @@ /datum/faction/uscm - name = NAME_FACTION_USCM - desc = "The USCM is divided into three overarching branches, called the Marine Space Forces: Sol, overseeing the core colonies and earth, the largest of the three; Eridani, operating among the Chinese and American colonised arms; Herculis, going through the Anglo-Japanese arms and the outer fringes. Each branch operates independently, but all are responsible for protecting American space territory and working together in that goal. \ - There is also a fourth group, the Reserves, which is stationed mostly on earth and serves to reinforce the other branches. They have not seen any active use yet, but who knows what the future holds. Marine Space Force, Herculis, Chinook 91 GSO station is a military space station in geosynchronous orbit around the colony world Georgia 525 (70 Ophiuchi A V), and is the headquarters for the Herculis branch of the USCM. Under its control are the 4th Colonial Marine Division, 4th Colonial Marine Brigade, 4th Aerospace Wing, and 1st Colonial Support Group of the USCM. \ - Chinook 91 reports directly to O'Neill station in Earth-Lunar space. The O'Neill station is the main communication base between the three branches. Supervising orders from the homeworld, controlling the First Fleet and rare joint operations. It is an extremely vital station and well guarded by the First Fleet in all its might. Tithonis Mountain on Bernice 378 is another large garrison of USCM troops, such as the 1st Colonial Support Group, and there are more minor garrisons along the Anglo-Japanese arm. The 2nd Company of the 2nd Battalion of the 4th Brigade, the Falling Falcons, and the USS Almayer are stationed in Herculis." - - faction_name = FACTION_USCM - faction_tag = SIDE_FACTION_USCM - relations_pregen = RELATIONS_FACTION_USCM - faction_iff_tag_type = /obj/item/faction_tag/uscm + name = "United States Colonial Marines" + faction_tag = FACTION_MARINE /datum/faction/uscm/modify_hud_holder(image/holder, mob/living/carbon/human/current_human) var/datum/squad/squad = current_human.assigned_squad @@ -21,42 +14,26 @@ else if(I) _role = I.rank switch(GET_DEFAULT_ROLE(_role)) - if(JOB_SQUAD_ENGI) - marine_rk = "engi" - if(JOB_SQUAD_SPECIALIST) - marine_rk = "spec" - if(JOB_SQUAD_TEAM_LEADER) - marine_rk = "tl" - if(JOB_SQUAD_MEDIC) - marine_rk = "med" - if(JOB_SQUAD_SMARTGUN) - marine_rk = "gun" - if(JOB_XO) - marine_rk = "xo" - if(JOB_CO) - marine_rk = "co" - if(JOB_GENERAL) - marine_rk = "general" - if(JOB_PILOT) - marine_rk = "po" - if(JOB_INTEL) - marine_rk = "io" - if(JOB_DROPSHIP_CREW_CHIEF) - marine_rk = "dcc" - if(JOB_CREWMAN) - marine_rk = "tc" - if(JOB_MARINE_RAIDER) - marine_rk = "soc" - if(JOB_MARINE_RAIDER_SL) - marine_rk = "soctl" - if(JOB_MARINE_RAIDER_CMD) - marine_rk = "soccmd" + if(JOB_SQUAD_ENGI) marine_rk = "engi" + if(JOB_SQUAD_SPECIALIST) marine_rk = "spec" + if(JOB_SQUAD_TEAM_LEADER) marine_rk = "tl" + if(JOB_SQUAD_MEDIC) marine_rk = "med" + if(JOB_SQUAD_SMARTGUN) marine_rk = "gun" + if(JOB_XO) marine_rk = "xo" + if(JOB_CO) marine_rk = "co" + if(JOB_GENERAL) marine_rk = "general" + if(JOB_CAS_PILOT) marine_rk = "gp" + if(JOB_DROPSHIP_PILOT) marine_rk = "dp" + if(JOB_TANK_CREW) marine_rk = "tc" + if(JOB_INTEL) marine_rk = "io" + if(JOB_DROPSHIP_CREW_CHIEF) marine_rk = "dcc" + if(JOB_MARINE_RAIDER) marine_rk = "soc" + if(JOB_MARINE_RAIDER_SL) marine_rk = "soctl" + if(JOB_MARINE_RAIDER_CMD) marine_rk = "soccmd" if(squad.squad_leader == current_human) switch(squad.squad_type) - if("Squad") - marine_rk = "leader_a" - if("Team") - marine_rk = "soctl_a" + if("Squad") marine_rk = "leader_a" + if("Team") marine_rk = "soctl_a" current_human.langchat_styles = "langchat_bolded" // bold text for bold leaders else @@ -64,8 +41,7 @@ current_human.langchat_color = current_human.assigned_squad.chat_color - if(!marine_rk) - marine_rk = current_human.rank_fallback + if(!marine_rk) marine_rk = current_human.rank_fallback if(marine_rk) var/image/IMG = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad") if(squad_clr) @@ -99,6 +75,9 @@ if(JOB_CO) marine_rk = "co" border_rk = "command" + if(JOB_USCM_OBSV) + marine_rk = "vo" + border_rk = "command" if(JOB_SO) marine_rk = "so" border_rk = "command" @@ -110,8 +89,10 @@ border_rk = "command" if(JOB_INTEL) marine_rk = "io" - if(JOB_PILOT) - marine_rk = "po" + if(JOB_CAS_PILOT) + marine_rk = "gp" + if(JOB_DROPSHIP_PILOT) + marine_rk = "dp" if(JOB_DROPSHIP_CREW_CHIEF) marine_rk = "dcc" if(JOB_CHIEF_POLICE) @@ -119,6 +100,8 @@ border_rk = "command" if(JOB_POLICE) marine_rk = "mp" + if(JOB_TANK_CREW) + marine_rk = "tc" if(JOB_WARDEN) marine_rk = "warden" border_rk = "command" @@ -214,6 +197,19 @@ if(JOB_CMB_OBS) marine_rk = "obs" icon_prefix = "cmb_" + // Check squad marines here too, for the unique ones + if(JOB_SQUAD_ENGI) + marine_rk = "engi" + if(JOB_SQUAD_MEDIC) + marine_rk = "med" + if(JOB_SQUAD_SPECIALIST) + marine_rk = "spec" + if(JOB_SQUAD_SMARTGUN) + marine_rk = "gun" + if(JOB_SQUAD_TEAM_LEADER) + marine_rk = "tl" + if(JOB_SQUAD_LEADER) + marine_rk = "leader" if(marine_rk) var/image/I = image('icons/mob/hud/marine_hud.dmi', current_human, "hudsquad") diff --git a/code/datums/factions/uscm/cmb.dm b/code/datums/factions/uscm/cmb.dm deleted file mode 100644 index 0b11200ba0c1..000000000000 --- a/code/datums/factions/uscm/cmb.dm +++ /dev/null @@ -1,3 +0,0 @@ -/datum/faction/uscm/cmb - name = NAME_FACTION_CMB - faction_name = FACTION_CMB diff --git a/code/datums/factions/uscm/marine.dm b/code/datums/factions/uscm/marine.dm deleted file mode 100644 index 750fbb8a7be7..000000000000 --- a/code/datums/factions/uscm/marine.dm +++ /dev/null @@ -1,53 +0,0 @@ -/datum/faction/uscm/marine - name = NAME_FACTION_MARINE - faction_name = FACTION_MARINE - - role_mappings = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list( - /datum/job/command/commander/whiskey = JOB_CO, - /datum/job/command/executive/whiskey = JOB_XO, - /datum/job/civilian/synthetic/whiskey = JOB_SYNTH, - /datum/job/command/warrant/whiskey = JOB_CHIEF_POLICE, - /datum/job/command/bridge/whiskey = JOB_SO, - /datum/job/command/tank_crew/whiskey = JOB_CREWMAN, - /datum/job/command/police/whiskey = JOB_POLICE, - /datum/job/command/pilot/whiskey = JOB_PILOT, - /datum/job/logistics/requisition/whiskey = JOB_CHIEF_REQUISITION, - /datum/job/civilian/professor/whiskey = JOB_CMO, - /datum/job/civilian/doctor/whiskey = JOB_DOCTOR, - /datum/job/civilian/researcher/whiskey = JOB_RESEARCHER, - /datum/job/logistics/engineering/whiskey = JOB_CHIEF_ENGINEER, - /datum/job/logistics/otech/maint/whiskey = JOB_MAINT_TECH, - /datum/job/logistics/cargo/whiskey = JOB_CARGO_TECH, - /datum/job/uscm/squad/leader/whiskey = JOB_SQUAD_LEADER, - /datum/job/uscm/squad/specialist/whiskey = JOB_SQUAD_SPECIALIST, - /datum/job/uscm/squad/smartgunner/whiskey = JOB_SQUAD_SMARTGUN, - /datum/job/uscm/squad/medic/whiskey = JOB_SQUAD_MEDIC, - /datum/job/uscm/squad/engineer/whiskey = JOB_SQUAD_ENGI, - /datum/job/uscm/squad/standard/whiskey = JOB_SQUAD_MARINE - ), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) - roles_list = list( - MODE_NAME_EXTENDED = ROLES_REGULAR_USCM, - MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_USCM, - MODE_NAME_FACTION_CLASH = ROLES_REGULAR_USCM, - MODE_NAME_WISKEY_OUTPOST = ROLES_WO_USCM, - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = ROLES_REGULAR_USCM - ) - -/datum/faction/uscm/marine/additional_join_status(mob/new_player/user, dat = "") - if(SSevacuation) - switch(SSevacuation.evac_status) - if(EVACUATION_STATUS_INITIATING) - dat += "[replacetext(user.client.auto_lang(LANGUAGE_LOBBY_EVAC_STARTED), "###MAIN_SHIP###", "[MAIN_SHIP_NAME]")]
" - if(EVACUATION_STATUS_COMPLETE) - dat += "[replacetext(user.client.auto_lang(LANGUAGE_LOBBY_EVAC_FINISHED), "###MAIN_SHIP###", "[MAIN_SHIP_NAME]")]
" - . = ..() diff --git a/code/datums/factions/uscm/marsoc.dm b/code/datums/factions/uscm/marsoc.dm deleted file mode 100644 index 2614de5052bb..000000000000 --- a/code/datums/factions/uscm/marsoc.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/uscm/marsoc - name = NAME_FACTION_MARSOC - desc = "Decryption required" - - faction_name = FACTION_MARSOC diff --git a/code/datums/factions/wy.dm b/code/datums/factions/wy.dm deleted file mode 100644 index 53ddfd04ba80..000000000000 --- a/code/datums/factions/wy.dm +++ /dev/null @@ -1,34 +0,0 @@ -/datum/faction/wy - name = NAME_FACTION_WY - desc = "Weyland Yutani also known as \"the Company\", has a wide range of business. This includes dealing with high-tech armaments, synthetic humanoids, spaceships, computer parts, terraforming equipment, and household appliances. They also offers shipping and receiving services, among other ventures. Following an aggressive expansion into terraforming new colonial world, Weyland-Yutani secured rights and privileges from the United States government. One of those privileges is the close relationship with the USCM. \ - the Colonial Marines use corporate-supplied equipment in exchange for protecting and monitoring border colonies. This, however, does not mean that the interests of the company are aligned with the USCM. It is more accurate to say that Weyland-Yutani considers the USCM a valuable, but still disposable, asset. This has led to an increasing amount of hostility between the two factions. Weyland-Yutani has enough wealth and influence to hire private military contractors. These are highly trained mercenaries, generally ex-military veterans. \ - They do black site protection detail, undertaking dangerous assignments, and otherwise supply Weyland-Yutani with firepower in the absence of the USCM. They are compensated well for their services, and demand is always there. Rumors speak of even more well-equipped and well-selected military units within Weyland-Yutani's employment, but that is not officially verified. The Company has refused to comment on it." - - faction_name = FACTION_WY - faction_tag = SIDE_FACTION_WY - relations_pregen = RELATIONS_FACTION_WY - faction_iff_tag_type = /obj/item/faction_tag/wy - -/datum/faction/wy/modify_hud_holder(image/holder, mob/living/carbon/human/H) - var/hud_icon_state - var/obj/item/card/id/ID = H.get_idcard() - var/_role - if(H.mind) - _role = H.job - else if(ID) - _role = ID.rank - switch(_role) - if(JOB_PMC_DIRECTOR) - hud_icon_state = "sd" - if(JOB_PMC_LEADER, JOB_PMC_LEAD_INVEST) - hud_icon_state = "ld" - if(JOB_PMC_DOCTOR) - hud_icon_state = "td" - if(JOB_PMC_ENGINEER) - hud_icon_state = "ct" - if(JOB_PMC_MEDIC, JOB_PMC_INVESTIGATOR) - hud_icon_state = "md" - if(JOB_PMC_SYNTH) - hud_icon_state = "syn" - if(hud_icon_state) - holder.overlays += image('icons/mob/hud/marine_hud.dmi', H, "pmc_[hud_icon_state]") diff --git a/code/datums/factions/wy/deathsquad.dm b/code/datums/factions/wy/deathsquad.dm deleted file mode 100644 index 9a622aace662..000000000000 --- a/code/datums/factions/wy/deathsquad.dm +++ /dev/null @@ -1,6 +0,0 @@ -/datum/faction/wy/deathsquad - name = NAME_FACTION_WY_DEATHSQUAD - desc = "Decryption required" - - faction_name = FACTION_WY_DEATHSQUAD - ally_factions_initialize = FALSE diff --git a/code/datums/factions/wy/pmc.dm b/code/datums/factions/wy/pmc.dm deleted file mode 100644 index 0f1eb7d2ff42..000000000000 --- a/code/datums/factions/wy/pmc.dm +++ /dev/null @@ -1,5 +0,0 @@ -/datum/faction/wy/pmc - name = NAME_FACTION_PMC - desc = "Weyland-Yutani PMCs are military personnel owned and operated by the company. They are equipped with advanced modern military equipment and weaponry akin to the USCM and similar national militaries. The tasks of the PMCs are never limited to one specific job and they are often deployed on 'shadow missions'. Their deployment is often kept secret from the USCM to avoid conflict with the anti-corporate officers in the USCM. The recruitment process largely consists of those who have personal contacts with higher Weyland-Yutani employees, or those who have caught the eye of the superiors and been hand-picked. The superiors value abilities in the field and willingness to obey company directives, for a large sum of money, despite of their moral beliefs. Following the defeat of the Dust Raiders and the withdrawal of the United Americas of the Neroid sector, a group of employees became skilled mercenaries. They are part of Weyland-Yutani's Task Force Oberon that was stationed aboard the USCSS Royce, a powerful Weyland-Yutani cruiser that patrols the outer edges of the Neroid sector. Under the directive of Weyland-Yutani's board member Johan Almric, they act as private security for company science teams. The USCSS Royce contains a crew of roughly two hundred PMCs, and one hundred scientists and support personnel. Rumors say that a Weyland-Yutani Special Task Force known as \"Royal\" of the USCSS Lunalorne are part of a different specialization, designed to capture anomalies associated with alien and supernatural life." - - faction_name = FACTION_PMC diff --git a/code/datums/factions/xeno.dm b/code/datums/factions/xeno.dm deleted file mode 100644 index 70ce3eb79ca2..000000000000 --- a/code/datums/factions/xeno.dm +++ /dev/null @@ -1,386 +0,0 @@ -/datum/faction/xenomorph - name = NAME_FACTION_XENOMORPH - desc = "Xenomorph hive among the all other hives." - - faction_name = FACTION_XENOMORPH - faction_tag = SIDE_FACTION_XENOMORPH - organ_faction_iff_tag_type = /obj/item/faction_tag/organ/pheromones_receptor - relations_pregen = RELATIONS_FACTION_XENOMORPH - -/datum/faction/xenomorph/faction_is_ally(datum/faction/faction) - if(!living_xeno_queen) - return FALSE - . = ..() - -/datum/faction/xenomorph/New() - . = ..() - mutators = new(src) - mark_ui = new(src) - faction_ui = new(src) - -/datum/faction/xenomorph/can_delay_round_end(mob/living/carbon/carbon) - if(!faction_is_ally(GLOB.faction_datums[FACTION_MARINE])) - return TRUE - return FALSE - -// Adds a xeno to this hive -/datum/faction/xenomorph/add_mob(mob/living/carbon/xenomorph/xenomorph) - if(!xenomorph || !istype(xenomorph)) - return - - // If the xeno is part of another hive, they should be removed from that one first - if(xenomorph.faction && xenomorph.faction != src) - xenomorph.faction.remove_mob(xenomorph, TRUE) - - // Already in the hive - if(xenomorph in totalMobs) - return - - // Can only have one queen. - if(isqueen(xenomorph)) - if(!living_xeno_queen && !xenomorph.statistic_exempt) // Don't consider xenos in admin level - set_living_xeno_queen(xenomorph) - - xenomorph.faction = src - - if(xenomorph.hud_list) - xenomorph.hud_update() - - if(!xenomorph.statistic_exempt) - totalMobs += xenomorph - if(xenomorph.tier == 2) - tier_2_xenos += xenomorph - else if(xenomorph.tier == 3) - tier_3_xenos += xenomorph - - // Xenos are a fuckfest of cross-dependencies of different datums that are initialized at different times - // So don't even bother trying updating UI here without large refactors - -// Removes the xeno from the hive -/datum/faction/xenomorph/remove_mob(mob/living/carbon/xenomorph/xenomorph, hard = FALSE, light_mode = FALSE) - if(!xenomorph || !istype(xenomorph)) - return - - // Make sure the xeno was in the hive in the first place - if(!(xenomorph in totalMobs)) - return - - if(isqueen(xenomorph)) - if(living_xeno_queen == xenomorph) - var/mob/living/carbon/xenomorph/queen/next_queen - for(var/mob/living/carbon/xenomorph/queen/Q in totalMobs) - if(!Q.statistic_exempt) - continue - next_queen = Q - break - - set_living_xeno_queen(next_queen) // either null or a queen - - // We allow "soft" removals from the hive (the xeno still retains information about the hive) - // This is so that xenos can add themselves back to the hive if they should die or otherwise go "on leave" from the hive - if(hard) - xenomorph.faction = null - - totalMobs -= xenomorph - if(xenomorph.tier == 2) - tier_2_xenos -= xenomorph - else if(xenomorph.tier == 3) - tier_3_xenos -= xenomorph - - if(!light_mode) - faction_ui.update_xeno_counts() - faction_ui.xeno_removed(xenomorph) - -/datum/faction/xenomorph/get_faction_info(mob/user) - if(!user || !faction_ui) - return - - if(!faction_ui.data_initialized) - faction_ui.update_all_data() - - faction_ui.tgui_interact(user) - return TRUE - -/datum/faction/xenomorph/get_join_status(mob/new_player/user, dat) - if(SSticker.current_state != GAME_STATE_PLAYING || !SSticker.mode) - to_chat(user, SPAN_WARNING(user.client.auto_lang(LANGUAGE_LOBBY_ROUND_NO_JOIN))) - return - - if(alert(user, user.client.auto_lang(LANGUAGE_LOBBY_JOIN_XENOMORPH), user.client.auto_lang(LANGUAGE_CONFIRM), user.client.auto_lang(LANGUAGE_YES), user.client.auto_lang(LANGUAGE_NO)) == user.client.auto_lang(LANGUAGE_YES)) - if(SSticker.mode.check_xeno_late_join(user)) - var/mob/new_xeno = SSticker.mode.attempt_to_join_as_xeno(user, 0) - if(new_xeno && !istype(new_xeno, /mob/living/carbon/xenomorph/larva)) - SSticker.mode.transfer_xenomorph(user, new_xeno) - user.close_spawn_windows() - - -//LANDMARKS -/datum/xeno_mark_define - var/name = "xeno_declare" - var/icon_state = "empty" - var/desc = "Xenos make psychic markers with this meaning as positional lasting communication to eachother" - -/datum/xeno_mark_define/fortify - name = "Fortify" - desc = "Fortify this area!" - icon_state = "fortify" - -/datum/xeno_mark_define/weeds - name = "Need Weeds" - desc = "Need weeds here!" - icon_state = "weed" - -/datum/xeno_mark_define/nest - name = "Nest" - desc = "Nest enemies here!" - icon_state = "nest" - -/datum/xeno_mark_define/hosts - name = "Hosts" - desc = "Hosts here!" - icon_state = "hosts" - -/datum/xeno_mark_define/aide - name = "Aide" - desc = "Aide here!" - icon_state = "aide" - -/datum/xeno_mark_define/defend - name = "Defend" - desc = "Defend the hive here!" - icon_state = "defend" - -/datum/xeno_mark_define/danger - name = "Danger Warning" - desc = "Caution, danger here!" - icon_state = "danger" - -/datum/xeno_mark_define/rally - name = "Rally" - desc = "Group up here!" - icon_state = "rally" - -/datum/xeno_mark_define/hold - name = "Hold" - desc = "Hold this area!" - icon_state = "hold" - -/datum/xeno_mark_define/ambush - name = "Ambush" - desc = "Ambush the enemy here!" - icon_state = "ambush" - -/datum/xeno_mark_define/attack - name = "Attack" - desc = "Attack the enemy here!" - icon_state = "attack" - - -//HIVE STATUS -/datum/hive_status_ui - var/name = "Hive Status" - - // Data to pass when rendering the UI (not static) - var/total_xenos - var/list/xeno_counts - var/list/tier_slots - var/list/xeno_vitals - var/list/xeno_keys - var/list/xeno_info - var/faction_location - var/burrowed_larva - var/evolution_level - - var/data_initialized = FALSE - - var/datum/faction/assoc_hive = null - -/datum/hive_status_ui/New(datum/faction/faction) - assoc_hive = faction - update_all_data() - START_PROCESSING(SShive_status, src) - -/datum/hive_status_ui/process() - update_xeno_vitals() - update_xeno_info(FALSE) - SStgui.update_uis(src) - -// Updates the list tracking how many xenos there are in each tier, and how many there are in total -/datum/hive_status_ui/proc/update_xeno_counts(send_update = TRUE) - xeno_counts = assoc_hive.get_xeno_counts() - - total_xenos = 0 - for(var/counts in xeno_counts) - for(var/caste in counts) - total_xenos += counts[caste] - - if(send_update) - SStgui.update_uis(src) - - xeno_counts[1] -= "Queen" // don't show queen in the amount of xenos - - // Also update the amount of T2/T3 slots - tier_slots = assoc_hive.get_tier_slots() - -// Updates the hive location using the area name of the defined hive location turf -/datum/hive_status_ui/proc/update_faction_location(send_update = TRUE) - if(!assoc_hive.faction_location) - return - - faction_location = strip_improper(get_area_name(assoc_hive.faction_location)) - - if(send_update) - SStgui.update_uis(src) - -// Updates the sorted list of all xenos that we use as a key for all other information -/datum/hive_status_ui/proc/update_xeno_keys(send_update = TRUE) - xeno_keys = assoc_hive.get_xeno_keys() - - if(send_update) - SStgui.update_uis(src) - -// Mildly related to the above, but only for when xenos are removed from the hive -// If a xeno dies, we don't have to regenerate all xeno info and sort it again, just remove them from the data list -/datum/hive_status_ui/proc/xeno_removed(mob/living/carbon/xenomorph/xenomorph) - if(!xeno_keys) - return - - for(var/index in 1 to length(xeno_keys)) - var/list/info = xeno_keys[index] - if(info["nicknumber"] == xenomorph.nicknumber) - - // tried Remove(), didn't work. *shrug* - xeno_keys[index] = null - xeno_keys -= null - return - - SStgui.update_uis(src) - -// Updates the list of xeno names, strains and references -/datum/hive_status_ui/proc/update_xeno_info(send_update = TRUE) - xeno_info = assoc_hive.get_xeno_info() - - if(send_update) - SStgui.update_uis(src) - -// Updates vital information about xenos such as health and location. Only info that should be updated regularly -/datum/hive_status_ui/proc/update_xeno_vitals() - xeno_vitals = assoc_hive.get_xeno_vitals() - -// Updates how many buried larva there are -/datum/hive_status_ui/proc/update_burrowed_larva(send_update = TRUE) - burrowed_larva = assoc_hive.stored_larva - if(SSxevolution) - evolution_level = SSxevolution.get_evolution_boost_power(assoc_hive) - else - evolution_level = 1 - - if(send_update) - SStgui.update_uis(src) - -// Updates all data except pooled larva -/datum/hive_status_ui/proc/update_all_xeno_data(send_update = TRUE) - update_xeno_counts(FALSE) - update_xeno_vitals() - update_xeno_keys(FALSE) - update_xeno_info(FALSE) - - if(send_update) - SStgui.update_uis(src) - -// Updates all data, including pooled larva -/datum/hive_status_ui/proc/update_all_data() - data_initialized = TRUE - update_all_xeno_data(FALSE) - update_burrowed_larva(FALSE) - SStgui.update_uis(src) - -/datum/hive_status_ui/ui_state(mob/user) - return GLOB.hive_state[assoc_hive.faction_name] - -/datum/hive_status_ui/ui_status(mob/user, datum/ui_state/state) - . = ..() - if(isobserver(user)) - return UI_INTERACTIVE - -/datum/hive_status_ui/ui_data(mob/user) - . = list() - .["total_xenos"] = total_xenos - .["xeno_counts"] = xeno_counts - .["tier_slots"] = tier_slots - .["xeno_keys"] = xeno_keys - .["xeno_info"] = xeno_info - .["xeno_vitals"] = xeno_vitals - .["queen_location"] = get_area_name(assoc_hive.living_xeno_queen) - .["faction_location"] = faction_location - .["burrowed_larva"] = burrowed_larva - .["evolution_level"] = evolution_level - - var/mob/living/carbon/xenomorph/queen/Q = user - .["is_in_ovi"] = istype(Q) && Q.ovipositor - -/datum/hive_status_ui/ui_static_data(mob/user) - . = list() - .["user_ref"] = REF(user) - .["hive_color"] = assoc_hive.ui_color - .["hive_name"] = assoc_hive.name - -/datum/hive_status_ui/tgui_interact(mob/user, datum/tgui/ui) - if(!assoc_hive) - return - - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "HiveStatus", "[assoc_hive.name] Status") - ui.set_autoupdate(FALSE) - ui.open() - -/datum/hive_status_ui/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) - . = ..() - if(.) - return - - switch(action) - if("give_plasma") - var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list - var/mob/living/carbon/xenomorph/xenomorph = ui.user - - if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) - return - - if(xenomorph.stat == DEAD) - return - - var/datum/action/xeno_action/A = get_xeno_action_by_type(xenomorph, /datum/action/xeno_action/activable/queen_give_plasma) - A?.use_ability_wrapper(target_xenomorph) - - if("heal") - var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list - var/mob/living/carbon/xenomorph/xenomorph = ui.user - - if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) - return - - if(xenomorph.stat == DEAD) - return - - var/datum/action/xeno_action/A = get_xeno_action_by_type(xenomorph, /datum/action/xeno_action/activable/queen_heal) - A?.use_ability_wrapper(target_xenomorph, TRUE) - - if("overwatch") - var/mob/living/carbon/xenomorph/target_xenomorph = locate(params["target_ref"]) in GLOB.living_xeno_list - var/mob/living/carbon/xenomorph/xenomorph = ui.user - - if(QDELETED(target_xenomorph) || target_xenomorph.stat == DEAD || target_xenomorph.statistic_exempt) - return - - if(xenomorph.stat == DEAD) - if(isobserver(xenomorph)) - var/mob/dead/observer/O = xenomorph - O.ManualFollow(target_xenomorph) - return - - if(!xenomorph.check_state(TRUE)) - return - - xenomorph.overwatch(target_xenomorph) diff --git a/code/datums/factions/xeno/alpha.dm b/code/datums/factions/xeno/alpha.dm deleted file mode 100644 index 8672bfe6cc40..000000000000 --- a/code/datums/factions/xeno/alpha.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/xenomorph/alpha - name = NAME_FACTION_XENOMORPH_ALPHA - faction_name = FACTION_XENOMORPH_ALPHA - - prefix = "Alpha " - color = "#ff4040" - ui_color = "#992626" diff --git a/code/datums/factions/xeno/bravo.dm b/code/datums/factions/xeno/bravo.dm deleted file mode 100644 index ac3d4eb5de8a..000000000000 --- a/code/datums/factions/xeno/bravo.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/xenomorph/bravo - name = NAME_FACTION_XENOMORPH_BRAVO - faction_name = FACTION_XENOMORPH_BRAVO - - prefix = "Bravo " - color = "#ffff80" - ui_color = "#99994d" diff --git a/code/datums/factions/xeno/charlie.dm b/code/datums/factions/xeno/charlie.dm deleted file mode 100644 index 318007559c5b..000000000000 --- a/code/datums/factions/xeno/charlie.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/xenomorph/charlie - name = NAME_FACTION_XENOMORPH_CHARLIE - faction_name = FACTION_XENOMORPH_CHARLIE - - prefix = "Charlie " - color = "#bb40ff" - ui_color = "#702699" diff --git a/code/datums/factions/xeno/corrupted.dm b/code/datums/factions/xeno/corrupted.dm deleted file mode 100644 index d37ab89b82a9..000000000000 --- a/code/datums/factions/xeno/corrupted.dm +++ /dev/null @@ -1,38 +0,0 @@ -/datum/faction/xenomorph/corrupted - name = NAME_FACTION_XENOMORPH_CORRUPTED - faction_name = FACTION_XENOMORPH_CORRUPTED - - prefix = "Corrupted " - color = "#80ff80" - ui_color ="#4d994d" - -/datum/faction/xenomorph/corrupted/add_mob(mob/living/carbon/xenomorph/X) - . = ..() - X.add_language(LANGUAGE_ENGLISH) - -/datum/faction/xenomorph/corrupted/remove_mob(mob/living/carbon/xenomorph/X, hard) - . = ..() - X.remove_language(LANGUAGE_ENGLISH) - - -/datum/faction/xenomorph/corrupted/tamed - name = NAME_FACTION_XENOMORPH_TAMED - faction_name = FACTION_XENOMORPH_TAMED - - prefix = "Tamed " - color = "#80ff80" - - dynamic_evolution = FALSE - allow_no_queen_actions = TRUE - allow_queen_evolve = FALSE - ignore_slots = TRUE - -/datum/faction/xenomorph/corrupted/tamed/New() - . = ..() - faction_structures_limit[XENO_STRUCTURE_EGGMORPH] = 0 - faction_structures_limit[XENO_STRUCTURE_EVOPOD] = 0 - -/datum/faction/xenomorph/corrupted/tamed/add_mob(mob/living/carbon/xenomorph/xenomorph) - . = ..() - if(faction_leader) - xenomorph.faction = faction_leader.faction diff --git a/code/datums/factions/xeno/delta.dm b/code/datums/factions/xeno/delta.dm deleted file mode 100644 index 940a3ce5b1fd..000000000000 --- a/code/datums/factions/xeno/delta.dm +++ /dev/null @@ -1,7 +0,0 @@ -/datum/faction/xenomorph/delta - name = NAME_FACTION_XENOMORPH_DELTA - faction_name = FACTION_XENOMORPH_DELTA - - prefix = "Delta " - color = "#8080ff" - ui_color = "#4d4d99" diff --git a/code/datums/factions/xeno/feral.dm b/code/datums/factions/xeno/feral.dm deleted file mode 100644 index d463e75ac998..000000000000 --- a/code/datums/factions/xeno/feral.dm +++ /dev/null @@ -1,13 +0,0 @@ -/datum/faction/xenomorph/feral - name = NAME_FACTION_XENOMORPH_FERAL - faction_name = FACTION_XENOMORPH_FERAL - - prefix = "Feral " - color = "#828296" - ui_color = "#828296" - - construction_allowed = XENO_QUEEN - dynamic_evolution = FALSE - allow_no_queen_actions = TRUE - allow_queen_evolve = FALSE - ignore_slots = TRUE diff --git a/code/datums/factions/xeno/forsaken.dm b/code/datums/factions/xeno/forsaken.dm deleted file mode 100644 index b8d3e84e668e..000000000000 --- a/code/datums/factions/xeno/forsaken.dm +++ /dev/null @@ -1,13 +0,0 @@ -/datum/faction/xenomorph/forsaken - name = NAME_FACTION_XENOMORPH_FORSAKEN - faction_name = FACTION_XENOMORPH_FORSAKEN - - prefix = "Feral " - color = "#828296" - ui_color = "#828296" - - construction_allowed = XENO_QUEEN - dynamic_evolution = FALSE - allow_no_queen_actions = TRUE - allow_queen_evolve = FALSE - ignore_slots = TRUE diff --git a/code/datums/factions/xeno/mutated.dm b/code/datums/factions/xeno/mutated.dm deleted file mode 100644 index 399a032955a6..000000000000 --- a/code/datums/factions/xeno/mutated.dm +++ /dev/null @@ -1,9 +0,0 @@ -/datum/faction/xenomorph/mutated - name = NAME_FACTION_XENOMORPH_MUTATED - faction_name = FACTION_XENOMORPH_MUTATED - - prefix = "Mutated " - color = "#6abd99" - ui_color = "#6abd99" - - hive_inherant_traits = list(TRAIT_XENONID) diff --git a/code/datums/factions/xeno/normal.dm b/code/datums/factions/xeno/normal.dm deleted file mode 100644 index cb57762afd2c..000000000000 --- a/code/datums/factions/xeno/normal.dm +++ /dev/null @@ -1,32 +0,0 @@ -/datum/faction/xenomorph/normal - name = NAME_FACTION_XENOMORPH_NORMAL - faction_name = FACTION_XENOMORPH_NORMAL - - evolution_without_ovipositor = FALSE - color = null - ui_color = null - - role_mappings = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) - roles_list = list( - MODE_NAME_EXTENDED = ROLES_REGULAR_XENO, - MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_XENO, - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list( - JOB_XENOMORPH - ), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list( - JOB_XENOMORPH - ), - MODE_NAME_INFECTION = list( - JOB_XENOMORPH - ) - ) diff --git a/code/datums/factions/xeno/renegade.dm b/code/datums/factions/xeno/renegade.dm deleted file mode 100644 index 7bd620d8dad3..000000000000 --- a/code/datums/factions/xeno/renegade.dm +++ /dev/null @@ -1,13 +0,0 @@ -/datum/faction/xenomorph/renegade - name = NAME_FACTION_XENOMORPH_RENEGADE - faction_name = FACTION_XENOMORPH_RENEGADE - - dynamic_evolution = FALSE - allow_no_queen_actions = TRUE - allow_queen_evolve = FALSE - ignore_slots = TRUE - - need_round_end_check = TRUE - -/datum/faction/xenomorph/renegade/can_delay_round_end(mob/living/carbon/carbon) - return FALSE diff --git a/code/datums/factions/xeno/yautja.dm b/code/datums/factions/xeno/yautja.dm deleted file mode 100644 index 1e7ff5d55896..000000000000 --- a/code/datums/factions/xeno/yautja.dm +++ /dev/null @@ -1,13 +0,0 @@ -/datum/faction/xenomorph/yautja - name = NAME_FACTION_XENOMORPH_YAUTJA - faction_name = FACTION_XENOMORPH_YAUTJA - - dynamic_evolution = FALSE - allow_no_queen_actions = TRUE - allow_queen_evolve = FALSE - ignore_slots = TRUE - - need_round_end_check = TRUE - -/datum/faction/xenomorph/yautja/can_delay_round_end(mob/living/carbon/carbon) - return FALSE diff --git a/code/datums/factions/yautja.dm b/code/datums/factions/yautja.dm deleted file mode 100644 index b24935e42a72..000000000000 --- a/code/datums/factions/yautja.dm +++ /dev/null @@ -1,35 +0,0 @@ -/datum/faction/yautja - name = NAME_FACTION_YAUTJA - desc = "Unable to extract addition information." - - faction_name = FACTION_YAUTJA - faction_tag = SIDE_FACTION_YAUTJA - relations_pregen = RELATIONS_HOSTILE - - role_mappings = list( - MODE_NAME_EXTENDED = list(), - MODE_NAME_DISTRESS_SIGNAL = list(), - MODE_NAME_FACTION_CLASH = list(), - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = list(), - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = list() - ) - roles_list = list( - MODE_NAME_EXTENDED = ROLES_REGULAR_YAUT, - MODE_NAME_DISTRESS_SIGNAL = ROLES_REGULAR_YAUT, - MODE_NAME_FACTION_CLASH = ROLES_REGULAR_YAUT, - MODE_NAME_WISKEY_OUTPOST = list(), - MODE_NAME_HUNTER_GAMES = ROLES_REGULAR_YAUT, - MODE_NAME_HIVE_WARS = list(), - MODE_NAME_INFECTION = ROLES_REGULAR_YAUT - ) - -/datum/faction/yautja/get_join_status(mob/new_player/user, dat) - if(alert(user, user.client.auto_lang(LANGUAGE_LOBBY_JOIN_HUNT), user.client.auto_lang(LANGUAGE_CONFIRM), user.client.auto_lang(LANGUAGE_YES), user.client.auto_lang(LANGUAGE_NO)) == user.client.auto_lang(LANGUAGE_YES)) - if(SSticker.mode.check_predator_late_join(user, 0)) - user.close_spawn_windows() - SSticker.mode.attempt_to_join_as_predator(user) - else - to_chat(user, SPAN_WARNING(user.client.auto_lang(LANGUAGE_LOBBY_NO_JOIN_HUNT))) - user.new_player_panel() diff --git a/code/datums/factions/zombie.dm b/code/datums/factions/zombie.dm deleted file mode 100644 index b3e0778b7056..000000000000 --- a/code/datums/factions/zombie.dm +++ /dev/null @@ -1,60 +0,0 @@ -/datum/faction/zombie - name = NAME_FACTION_ZOMBIE - desc = "Unknow virus that makes all dead rise back and fight, for additional information required access 6X-X / XC-X or higher..." - - faction_name = FACTION_ZOMBIE - faction_tag = SIDE_FACTION_ZOMBIE - relations_pregen = RELATIONS_MAP_HOSTILE - organ_faction_iff_tag_type = /obj/item/faction_tag/organ/meshy_rooting_gland - -/datum/faction/zombie/get_join_status(mob/user, dat) - if(!user.client) - return - - if(SSticker.current_state < GAME_STATE_PLAYING || !SSticker.mode) - to_chat(src, SPAN_WARNING("The game hasn't started yet!")) - return - - var/list/zombie_list = list() - if(length(GLOB.zombie_landmarks)) - zombie_list += list("Underground Zombie" = "Underground Zombie") - - for(var/mob/living/carbon/human/A in GLOB.zombie_list) - if(!A.client && A.stat != DEAD) // Only living zombies - zombie_list += list(A.real_name = A) - - if(!length(zombie_list)) - to_chat(src, SPAN_DANGER("There are no available zombies.")) - return - - var/choice = tgui_input_list(usr, "Pick a Zombie:", "Join as Zombie", zombie_list) - if(!choice) - return - - if(!user.client || !user.mind) - return - - if(choice == "Underground Zombie") - if(!length(GLOB.zombie_landmarks)) - to_chat(src, SPAN_WARNING("Sorry, the last underground zombie just got taken.")) - return - - var/obj/effect/landmark/zombie/spawn_point = pick(GLOB.zombie_landmarks) - spawn_point.spawn_zombie(src) - return - - var/mob/living/carbon/human/zombie = zombie_list[choice] - - if(!zombie || QDELETED(zombie)) - return - - if(zombie.stat == DEAD) - to_chat(src, SPAN_WARNING("This zombie is dead!")) - return - - if(zombie.client) - to_chat(src, SPAN_WARNING("That player is still connected.")) - return - - user.mind.transfer_to(zombie, TRUE) - msg_admin_niche("[key_name(usr)] has joined as a [zombie].") diff --git a/code/game/gamemodes/cm_process.dm b/code/game/gamemodes/cm_process.dm index 8990ea14804c..c75f48c215f5 100644 --- a/code/game/gamemodes/cm_process.dm +++ b/code/game/gamemodes/cm_process.dm @@ -199,8 +199,6 @@ GLOBAL_VAR_INIT(next_admin_bioscan, 30 MINUTES) for(var/mob/M in GLOB.player_list) if(M.z && (M.z in z_levels) && M.stat != DEAD && !istype(M.loc, /turf/open/space)) //If they have a z var, they are on a turf. - if(!M.faction || (M.faction.need_round_end_check && !M.faction.can_delay_round_end(M))) - continue if(ishuman(M) && !isyautja(M) && !(M.status_flags & XENO_HOST) && !iszombie(M)) var/mob/living/carbon/human/H = M if(((H.species && H.species.name == "Human") || (H.is_important)) && !H.hivenumber) //only real humans count, or those we have set to also be included @@ -211,6 +209,9 @@ GLOBAL_VAR_INIT(next_admin_bioscan, 30 MINUTES) var/mob/living/carbon/xenomorph/xeno = M if(!xeno.counts_for_roundend) continue + var/datum/hive_status/xeno_hive = GLOB.hive_datum[xeno.hivenumber] + if(!xeno_hive || (xeno_hive.need_round_end_check && !xeno_hive.can_delay_round_end(xeno))) + continue if (A.flags_area & AREA_AVOID_BIOSCAN) continue num_xenos++ diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 823ea9259385..80044e2fab3e 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -62,6 +62,7 @@ icon_state = "id" item_state = "card-id" var/access = list() + var/faction = FACTION_NEUTRAL var/list/faction_group /// The name registered_name on the card diff --git a/code/modules/cm_tech/implements/xeno_handler.dm b/code/modules/cm_tech/implements/xeno_handler.dm index 7c35bf9def84..cbafec7499ee 100644 --- a/code/modules/cm_tech/implements/xeno_handler.dm +++ b/code/modules/cm_tech/implements/xeno_handler.dm @@ -38,9 +38,9 @@ else var/picked = pick(/mob/living/carbon/xenomorph/drone, /mob/living/carbon/xenomorph/spitter, /mob/living/carbon/xenomorph/lurker) - new_mob = new picked(spawn_loc, null, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) - new_mob.faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_USCM]) - new_mob.organ_faction_tag = new /obj/item/faction_tag/wy/pmc_handler(X, GLOB.faction_datum[FACTION_XENOMORPH_TAMED]) + new_mob = new picked(spawn_loc, null, XENO_HIVE_TAMED) + var/mob/living/carbon/xenomorph/X = new_mob + X.iff_tag = new /obj/item/iff_tag/pmc_handler(X) if(M) M.transfer_to(new_mob, TRUE) else diff --git a/code/modules/gear_presets/_select_equipment.dm b/code/modules/gear_presets/_select_equipment.dm index 2fd1ebaced4f..138e091ad5a4 100644 --- a/code/modules/gear_presets/_select_equipment.dm +++ b/code/modules/gear_presets/_select_equipment.dm @@ -115,6 +115,7 @@ if(assignment) ID.name += " ([assignment])" ID.access = access.Copy(1, 0) + ID.faction = faction ID.faction_group = faction_group.Copy() ID.assignment = assignment ID.rank = rank @@ -125,6 +126,7 @@ ID.paygrade = load_rank(new_human) || ID.paygrade ID.uniform_sets = uniform_sets new_human.equip_to_slot_or_del(ID, WEAR_ID) + new_human.faction = faction new_human.faction_group = faction_group.Copy() if(new_human.mind) new_human.mind.name = new_human.real_name @@ -136,25 +138,6 @@ new_human.set_languages(languages) /datum/equipment_preset/proc/load_preset(mob/living/carbon/human/new_human, randomise = FALSE, count_participant = FALSE, client/mob_client, show_job_gear = TRUE) - if(!istype(new_human, /mob/living/carbon/human/dummy)) - var/datum/faction/mob_faction - if(!faction) - mob_faction = GLOB.faction_datums[FACTION_NEUTRAL] - else - mob_faction = GLOB.faction_datums[faction] - - if(mob_faction && (!new_human.faction || force_update_faction)) - mob_faction.add_mob(new_human) - if(mob_faction.organ_faction_iff_tag_type) - if(new_human.organ_faction_tag) - QDEL_NULL(new_human.organ_faction_tag) - new_human.organ_faction_tag = new mob_faction.organ_faction_iff_tag_type(new_human, mob_faction) - - if(mob_faction.faction_iff_tag_type) - if(new_human.faction_tag) - QDEL_NULL(new_human.faction_tag) - new_human.faction_tag = new mob_faction.faction_iff_tag_type(new_human, mob_faction) - if(!new_human.hud_used) new_human.create_hud() diff --git a/code/modules/gear_presets/other.dm b/code/modules/gear_presets/other.dm index 876beedf5fe4..4d7ef9bda559 100644 --- a/code/modules/gear_presets/other.dm +++ b/code/modules/gear_presets/other.dm @@ -602,12 +602,6 @@ //Overloading the function to be able to spawn gear first /datum/equipment_preset/other/zombie/load_preset(mob/living/carbon/human/new_human, randomise = FALSE) - GLOB.faction_datum[faction].add_mob(new_human) - if(new_human.faction?.organ_faction_iff_tag_type) - if(new_human.organ_faction_tag) - QDEL_NULL(new_human.organ_faction_tag) - new_human.organ_faction_tag = new new_human.faction.organ_faction_iff_tag_type(new_human, new_human.faction) - if(randomise) load_name(new_human) load_skills(new_human) //skills are set before equipment because of skill restrictions on certain clothes. @@ -634,6 +628,7 @@ uniform.has_sensor = UNIFORM_HAS_SENSORS uniform.sensor_faction = FACTION_COLONIST new_human.job = "Zombie" + new_human.faction = faction return ..() /datum/equipment_preset/other/zombie/load_race(mob/living/carbon/human/new_human) @@ -772,10 +767,17 @@ new_human.equip_to_slot_or_del(new /obj/item/clothing/gloves/marine/veteran(new_human), WEAR_HANDS) //*****************************************************************************************************/ -/datum/equipment_preset/other/xeno_cultist/load_status(mob/living/carbon/human/new_human) +/datum/equipment_preset/other/xeno_cultist/load_status(mob/living/carbon/human/new_human, hivenumber = XENO_HIVE_NORMAL) if(SSticker.mode && new_human.mind) SSticker.mode.xenomorphs += new_human.mind + var/datum/hive_status/hive = GLOB.hive_datum[hivenumber] + if(hive) + new_human.faction = hive.internal_faction + if(hive.leading_cult_sl == new_human) + hive.leading_cult_sl = null + new_human.hivenumber = hivenumber + GLOB.xeno_cultists += new_human var/list/huds_to_add = list(MOB_HUD_XENO_INFECTION, MOB_HUD_XENO_STATUS) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 442967bdd063..d9d0e22411eb 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -960,7 +960,55 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp set name = "Join as Zombie" set desc = "Select an alive but logged-out Zombie to rejoin the game." - GLOB.faction_datum[FACTION_ZOMBIE]?.get_join_status(src) + if (!client) + return + + if(SSticker.current_state < GAME_STATE_PLAYING || !SSticker.mode) + to_chat(src, SPAN_WARNING("The game hasn't started yet!")) + return + + var/list/zombie_list = list() + if(length(GLOB.zombie_landmarks)) + zombie_list += list("Underground Zombie" = "Underground Zombie") + for(var/mob/living/carbon/human/A in GLOB.zombie_list) + if(!A.client && A.stat != DEAD) // Only living zombies + zombie_list += list(A.real_name = A) + + if(!length(zombie_list)) + to_chat(src, SPAN_DANGER("There are no available zombies.")) + return + + var/choice = tgui_input_list(usr, "Pick a Zombie:", "Join as Zombie", zombie_list) + if(!choice) + return + + if(!client || !mind) + return + + if(choice == "Underground Zombie") + if(!length(GLOB.zombie_landmarks)) + to_chat(src, SPAN_WARNING("Sorry, the last underground zombie just got taken.")) + return + var/obj/effect/landmark/zombie/spawn_point = pick(GLOB.zombie_landmarks) + spawn_point.spawn_zombie(src) + return + + var/mob/living/carbon/human/Z = zombie_list[choice] + + if(!Z || QDELETED(Z)) + return + + if(Z.stat == DEAD) + to_chat(src, SPAN_WARNING("This zombie is dead!")) + return + + if(Z.client) + to_chat(src, SPAN_WARNING("That player is still connected.")) + return + + mind.transfer_to(Z, TRUE) + msg_admin_niche("[key_name(usr)] has joined as a [Z].") + /mob/dead/verb/join_as_freed_mob() set category = "Ghost.Join" diff --git a/code/modules/mob/dead/observer/orbit.dm b/code/modules/mob/dead/observer/orbit.dm index 58c78574a819..4bc4abf7036c 100644 --- a/code/modules/mob/dead/observer/orbit.dm +++ b/code/modules/mob/dead/observer/orbit.dm @@ -146,7 +146,6 @@ if(SSticker.mode.is_in_endgame == TRUE && !is_mainship_level(M.z) && !(human.faction in FACTION_LIST_ERT)) escaped += list(serialized) -// I will KRILL you, HOW DARE YOU DID THIS WAY... I need to do one more shit around or just put some sticks and leave it for somebody ELSE, thanks!!! else if(human.faction in FACTION_LIST_WY) wy += list(serialized) else if(issynth(human) && !isinfiltratorsynthetic(human)) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index becfdf97f7f7..f95d389ed76b 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -3,10 +3,6 @@ hunter_data = new /datum/huntdata hunter_data.name = "[src.real_name]'s Hunter Data" hunter_data.owner = src - if(faction?.organ_faction_iff_tag_type && !organ_faction_tag) - organ_faction_tag = new faction.organ_faction_iff_tag_type(src, faction) - if(faction?.faction_iff_tag_type && !faction_tag) - faction_tag = new faction.faction_iff_tag_type(src, faction) /mob/living/carbon/Life(delta_time) ..() diff --git a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm index 36de59cdd868..eed2dce5f7a8 100644 --- a/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm +++ b/code/modules/mob/living/carbon/xenomorph/Xenomorph.dm @@ -346,11 +346,12 @@ /// If TRUE, the xeno cannot slash anything var/cannot_slash = FALSE -/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/old_xeno, datum/faction/faction_to_set) - var/area/A = get_area(src) - if(A && A.statistic_exempt || SSticker.mode?.round_finished) - statistic_exempt = TRUE +/mob/living/carbon/xenomorph/Initialize(mapload, mob/living/carbon/xenomorph/old_xeno, hivenumber) + if(old_xeno && old_xeno.hivenumber) + src.hivenumber = old_xeno.hivenumber + else if(hivenumber) + src.hivenumber = hivenumber //putting the organ in for research if(organ_value != 0) var/obj/item/organ/xeno/organ = new() //give @@ -359,6 +360,11 @@ organ.caste_origin = caste_type organ.icon_state = get_organ_icon() + var/datum/hive_status/hive = GLOB.hive_datum[src.hivenumber] + + if(hive) + hive.add_xeno(src) + wound_icon_holder = new(null, src) vis_contents += wound_icon_holder @@ -366,21 +372,10 @@ ///Handle transferring things from the old Xeno if we have one in the case of evolve, devolve etc. if(old_xeno) - old_xeno.faction.add_mob(src) - faction.remove_mob(old_xeno) - nicknumber = old_xeno.nicknumber - life_kills_total = old_xeno.life_kills_total - life_damage_taken_total = old_xeno.life_damage_taken_total - evolution_stored = old_xeno.evolution_stored - if(old_xeno.organ_faction_tag) - organ_faction_tag = old_xeno.organ_faction_tag - organ_faction_tag.forceMove(src) - old_xeno.faction_tag = null - - if(old_xeno.faction_tag) - faction_tag = old_xeno.faction_tag - faction_tag.forceMove(src) - old_xeno.faction_tag = null + src.nicknumber = old_xeno.nicknumber + src.life_kills_total = old_xeno.life_kills_total + src.life_damage_taken_total = old_xeno.life_damage_taken_total + src.evolution_stored = old_xeno.evolution_stored for(var/datum/language/language as anything in old_xeno.languages) add_language(language.name)//Make sure to keep languages (mostly for event Queens that know English) @@ -400,8 +395,10 @@ old_xeno.drop_inv_item_on_ground(item) old_xeno.empty_gut() - else if(faction_to_set) - faction_to_set.add_mob(src) + if(old_xeno.iff_tag) + iff_tag = old_xeno.iff_tag + iff_tag.forceMove(src) + old_xeno.iff_tag = null if(hive) for(var/trait in hive.hive_inherant_traits) @@ -495,6 +492,10 @@ var/selected_caste = GLOB.xeno_datum_list[caste_type]?.type hive.used_slots[selected_caste]++ + //Statistics + var/area/current_area = get_area(src) + if(current_area && current_area.statistic_exempt) + statistic_exempt = TRUE if(GLOB.round_statistics && !statistic_exempt) GLOB.round_statistics.track_new_participant(faction, 1) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ada770c3444c..d09343ba5ed4 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -297,18 +297,68 @@ /mob/new_player/proc/LateChoices() - var/list/faction_to_get_list = list() - for(var/faction_to_get in SSticker.mode.factions_pool) - var/datum/faction/faction = GLOB.faction_datum[SSticker.mode.factions_pool[faction_to_get]] - if(!faction.spawning_enabled || (!faction.force_spawning && !faction.weight_act[SSticker.mode.name])) + var/mills = world.time // 1/10 of a second, not real milliseconds but whatever + //var/secs = ((mills % 36000) % 600) / 10 //Not really needed, but I'll leave it here for refrence... or something + var/mins = (mills % 36000) / 600 + var/hours = mills / 36000 + + var/dat = "
" + dat += "Round Duration: [floor(hours)]h [floor(mins)]m
" + + if(SShijack) + switch(SShijack.evac_status) + if(EVACUATION_STATUS_INITIATED) + dat += "The [MAIN_SHIP_NAME] is being evacuated.
" + + dat += "Choose from the following open positions:
" + var/roles_show = FLAG_SHOW_ALL_JOBS + + for(var/i in GLOB.RoleAuthority.roles_for_mode) + var/datum/job/J = GLOB.RoleAuthority.roles_for_mode[i] + if(!GLOB.RoleAuthority.check_role_entry(src, J, TRUE)) continue - faction_to_get_list += faction_to_get + var/active = 0 + // Only players with the job assigned and AFK for less than 10 minutes count as active + for(var/mob/M in GLOB.player_list) + if(M.client && M.job == J.title) + active++ + if(roles_show & FLAG_SHOW_CIC && GLOB.ROLES_CIC.Find(J.title)) + dat += "Command:
" + roles_show ^= FLAG_SHOW_CIC - var/choice = tgui_input_list(src, "Choose faction to join:", "Factions", faction_to_get_list) - if(!choice) - return + else if(roles_show & FLAG_SHOW_AUXIL_SUPPORT && GLOB.ROLES_AUXIL_SUPPORT.Find(J.title)) + dat += "
Auxiliary Combat Support:
" + roles_show ^= FLAG_SHOW_AUXIL_SUPPORT + + else if(roles_show & FLAG_SHOW_MISC && GLOB.ROLES_MISC.Find(J.title)) + dat += "
Other:
" + roles_show ^= FLAG_SHOW_MISC + + else if(roles_show & FLAG_SHOW_POLICE && GLOB.ROLES_POLICE.Find(J.title)) + dat += "
Military Police:
" + roles_show ^= FLAG_SHOW_POLICE + + else if(roles_show & FLAG_SHOW_ENGINEERING && GLOB.ROLES_ENGINEERING.Find(J.title)) + dat += "
Engineering:
" + roles_show ^= FLAG_SHOW_ENGINEERING + + else if(roles_show & FLAG_SHOW_REQUISITION && GLOB.ROLES_REQUISITION.Find(J.title)) + dat += "
Requisitions:
" + roles_show ^= FLAG_SHOW_REQUISITION + + else if(roles_show & FLAG_SHOW_MEDICAL && GLOB.ROLES_MEDICAL.Find(J.title)) + dat += "
Medbay:
" + roles_show ^= FLAG_SHOW_MEDICAL + + else if(roles_show & FLAG_SHOW_MARINES && GLOB.ROLES_MARINES.Find(J.title)) + dat += "
Marines:
" + roles_show ^= FLAG_SHOW_MARINES + + dat += "[J.disp_title] ([J.current_positions]) (Active: [active])
" + + dat += "
" + show_browser(src, dat, "Late Join", "latechoices", "size=420x700") - GLOB.faction_datum[SSticker.mode.factions_pool[choice]].get_join_status(src) /mob/new_player/proc/create_character(is_late_join = FALSE) spawning = TRUE diff --git a/colonialmarines.dme b/colonialmarines.dme index 52f36bda5a48..b612ac349685 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -564,37 +564,16 @@ #include "code\datums\entities\ticket.dm" #include "code\datums\entities\logs\player_times_log.dm" #include "code\datums\factions\clf.dm" -#include "code\datums\factions\colonists.dm" +#include "code\datums\factions\cmb.dm" #include "code\datums\factions\contractor.dm" -#include "code\datums\factions\dutch's_dozen.dm" #include "code\datums\factions\faction.dm" -#include "code\datums\factions\freelancer.dm" -#include "code\datums\factions\gladiator.dm" -#include "code\datums\factions\hefa_order.dm" -#include "code\datums\factions\mercenary.dm" -#include "code\datums\factions\pirate.dm" -#include "code\datums\factions\pizza_delivery.dm" -#include "code\datums\factions\ress.dm" -#include "code\datums\factions\souto.dm" -#include "code\datums\factions\threewe.dm" +#include "code\datums\factions\helpers.dm" +#include "code\datums\factions\pmc.dm" +#include "code\datums\factions\royalmarinescommando.dm" #include "code\datums\factions\upp.dm" #include "code\datums\factions\uscm.dm" -#include "code\datums\factions\wy.dm" -#include "code\datums\factions\xeno.dm" -#include "code\datums\factions\yautja.dm" -#include "code\datums\factions\zombie.dm" -#include "code\datums\factions\_misc\helpers.dm" -#include "code\datums\factions\_modules\module.dm" -#include "code\datums\factions\_modules\relations.dm" -#include "code\datums\factions\twe\commando.dm" -#include "code\datums\factions\uscm\cmb.dm" -#include "code\datums\factions\uscm\marine.dm" -#include "code\datums\factions\uscm\marsoc.dm" -#include "code\datums\factions\wy\pmc.dm" #include "code\datums\helper_datums\getrev.dm" -#include "code\datums\factions\wy\deathsquad.dm" #include "code\datums\helper_datums\stack_end_detector.dm" -#include "code\datums\factions\_misc\iff_tag.dm" #include "code\datums\helper_datums\teleport.dm" #include "code\datums\helper_datums\topic_input.dm" #include "code\datums\keybinding\_keybindings.dm" From a8d24d88c2439c7f6c9231af3502c5e267beab13 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:26:52 +0500 Subject: [PATCH 18/69] Revert of factions 6 (CR1) --- code/controllers/subsystem/influxstats.dm | 2 +- code/game/machinery/nuclearbomb.dm | 4 ++-- code/game/machinery/telecomms/presets.dm | 2 +- code/modules/clothing/glasses/hud.dm | 4 ++-- code/modules/defenses/sentry.dm | 4 ++-- code/modules/gear_presets/corpses.dm | 2 +- .../riot_in_progress_insert_fiorina_nightmare.dm | 2 +- .../gear_presets/survivors/lv_522/forcon_survivors.dm | 4 ++-- .../survivors/lv_624/clfship_insert_lv624.dm | 2 +- .../survivors/lv_624/corporate_dome_insert_lv624.dm | 2 +- .../shivas_snowball/panic_room_insert_shivas.dm | 2 +- .../solaris/crashlanding-offices_insert_bigred.dm | 10 +++++----- code/modules/gear_presets/survivors/survivors.dm | 4 ++-- .../trijent/crashlanding_upp_bar_insert_trijent.dm | 4 ++-- code/modules/gear_presets/synths.dm | 4 ++-- 15 files changed, 26 insertions(+), 26 deletions(-) diff --git a/code/controllers/subsystem/influxstats.dm b/code/controllers/subsystem/influxstats.dm index ae7f70e00357..0362a689704b 100644 --- a/code/controllers/subsystem/influxstats.dm +++ b/code/controllers/subsystem/influxstats.dm @@ -123,7 +123,7 @@ SUBSYSTEM_DEF(influxstats) team = "observers" else if(!job) continue - else if(mob.faction == FACTION_MARINE || mob.faction == FACTION_COLONIST) + else if(mob.faction == FACTION_MARINE || mob.faction == FACTION_SURVIVOR) team = "humans" var/mob/living/carbon/human/employed_human = mob if(istype(employed_human)) diff --git a/code/game/machinery/nuclearbomb.dm b/code/game/machinery/nuclearbomb.dm index e31b2a82cc65..42b5d95694cb 100644 --- a/code/game/machinery/nuclearbomb.dm +++ b/code/game/machinery/nuclearbomb.dm @@ -324,7 +324,7 @@ GLOBAL_VAR_INIT(bomb_set, FALSE) if(current_mob.stat != CONSCIOUS || isyautja(current_mob)) humans_other -= current_mob continue - if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_COLONIST) //separating marines from other factions. Survs go here too + if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_SURVIVOR) //separating marines from other factions. Survs go here too humans_uscm += current_mob humans_other -= current_mob @@ -560,7 +560,7 @@ GLOBAL_VAR_INIT(bomb_set, FALSE) if(current_human.stat != CONSCIOUS || isyautja(current_human)) humans_other -= current_mob continue - if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_COLONIST) + if(current_mob.faction == FACTION_MARINE || current_mob.faction == FACTION_SURVIVOR) humans_uscm += current_mob humans_other -= current_mob diff --git a/code/game/machinery/telecomms/presets.dm b/code/game/machinery/telecomms/presets.dm index c276d855cdd1..0c9e875534da 100644 --- a/code/game/machinery/telecomms/presets.dm +++ b/code/game/machinery/telecomms/presets.dm @@ -275,7 +275,7 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers) if(!do_after(user, 10, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD)) return switch(user.faction) - if(FACTION_COLONIST) + if(FACTION_SURVIVOR) freq_listening |= COLONY_FREQ if(FACTION_MARINE in user.faction_group) //FORECON survivors freq_listening |= SOF_FREQ diff --git a/code/modules/clothing/glasses/hud.dm b/code/modules/clothing/glasses/hud.dm index 8072074f0e0b..6e086e651a10 100644 --- a/code/modules/clothing/glasses/hud.dm +++ b/code/modules/clothing/glasses/hud.dm @@ -36,7 +36,7 @@ return /datum/action/item_action/view_publications/can_use_action() - if(owner && !owner.is_mob_incapacitated() && owner.faction != FACTION_COLONIST) + if(owner && !owner.is_mob_incapacitated() && owner.faction != FACTION_SURVIVOR) return TRUE /datum/action/item_action/view_publications/action_activate() @@ -85,7 +85,7 @@ set name = "View Research Publications" set src in usr - if(!usr.stat && !usr.is_mob_restrained() && usr.faction != FACTION_COLONIST) + if(!usr.stat && !usr.is_mob_restrained() && usr.faction != FACTION_SURVIVOR) tgui_interact(usr) /obj/item/clothing/glasses/hud/health/Topic(href, href_list) diff --git a/code/modules/defenses/sentry.dm b/code/modules/defenses/sentry.dm index 5a5f8ea1f313..8ad4cd407e75 100644 --- a/code/modules/defenses/sentry.dm +++ b/code/modules/defenses/sentry.dm @@ -519,7 +519,7 @@ . = ..() /obj/structure/machinery/defenses/sentry/premade/deployable/colony - faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_COLONIST) + faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_SURVIVOR) /obj/structure/machinery/defenses/sentry/premade/deployable/colony/Initialize() . = ..() @@ -534,7 +534,7 @@ sentry_type = "wy_sentry" health = 350 health_max = 350 - faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_COLONIST, FACTION_WY) + faction_group = list(FACTION_MARINE, FACTION_COLONIST, FACTION_SURVIVOR, FACTION_WY) fire_delay = 0.6 SECONDS damage_mult = 2 diff --git a/code/modules/gear_presets/corpses.dm b/code/modules/gear_presets/corpses.dm index 54c480ffd77b..7bf9592a6209 100644 --- a/code/modules/gear_presets/corpses.dm +++ b/code/modules/gear_presets/corpses.dm @@ -968,7 +968,7 @@ paygrade = PAY_SHORT_ME5 idtype = /obj/item/card/id/dogtag role_comm_title = "FORECON" - faction_group = list(FACTION_MARINE, FACTION_COLONIST) + faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) access = list( ACCESS_CIVILIAN_PUBLIC, ACCESS_CIVILIAN_ENGINEERING, diff --git a/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm b/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm index b77624f91519..c09e6eee9385 100644 --- a/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm +++ b/code/modules/gear_presets/survivors/fiorina_sciannex/riot_in_progress_insert_fiorina_nightmare.dm @@ -3,7 +3,7 @@ /datum/equipment_preset/survivor/cmb name = "Survivor - Colonial Marshal" faction = FACTION_MARSHAL - faction_group = list(FACTION_MARSHAL, FACTION_MARINE, FACTION_COLONIST) + faction_group = list(FACTION_MARSHAL, FACTION_MARINE, FACTION_SURVIVOR) languages = list(LANGUAGE_ENGLISH, LANGUAGE_JAPANESE) var/human_versus_human = FALSE access = list( diff --git a/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm b/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm index 29673d418449..4e9ab770fb2f 100644 --- a/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm +++ b/code/modules/gear_presets/survivors/lv_522/forcon_survivors.dm @@ -5,7 +5,7 @@ idtype = /obj/item/card/id/dogtag role_comm_title = "FORECON" rank = JOB_SURVIVOR - faction_group = list(FACTION_MARINE, FACTION_COLONIST) + faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) flags = EQUIPMENT_PRESET_START_OF_ROUND access = list( ACCESS_CIVILIAN_PUBLIC, @@ -280,7 +280,7 @@ /datum/equipment_preset/synth/survivor/forecon name = "Survivor - Synthetic - FORECON Synth" assignment = JOB_FORECON_SYN - faction_group = list(FACTION_MARINE, FACTION_COLONIST) + faction_group = list(FACTION_MARINE, FACTION_SURVIVOR) idtype = /obj/item/card/id/gold /datum/equipment_preset/synth/survivor/forecon/load_gear(mob/living/carbon/human/preset_human) //Bishop from Aliens diff --git a/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm b/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm index 0db4a118beb4..1bfeaaad9c43 100644 --- a/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm +++ b/code/modules/gear_presets/survivors/lv_624/clfship_insert_lv624.dm @@ -6,7 +6,7 @@ skills = /datum/skills/civilian/survivor/clf languages = list(LANGUAGE_ENGLISH, LANGUAGE_JAPANESE) faction = FACTION_CLF - faction_group = list(FACTION_CLF, FACTION_COLONIST) + faction_group = list(FACTION_CLF, FACTION_SURVIVOR) access = list(ACCESS_CIVILIAN_PUBLIC) survivor_variant = HOSTILE_SURVIVOR diff --git a/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm b/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm index 0de6f4bbbb7f..2c8ec04594ad 100644 --- a/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm +++ b/code/modules/gear_presets/survivors/lv_624/corporate_dome_insert_lv624.dm @@ -8,7 +8,7 @@ skills = /datum/skills/civilian/survivor/manager assignment = "LV-624 Corporate Liaison" idtype = /obj/item/card/id/silver/clearance_badge/cl - faction_group = list(FACTION_WY, FACTION_COLONIST) + faction_group = list(FACTION_WY, FACTION_SURVIVOR) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm b/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm index cf074663202d..9f1e2c705efb 100644 --- a/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm +++ b/code/modules/gear_presets/survivors/shivas_snowball/panic_room_insert_shivas.dm @@ -8,7 +8,7 @@ skills = /datum/skills/civilian/survivor/manager assignment = "Assistant Operations Manager" idtype = /obj/item/card/id/silver/clearance_badge/manager - faction_group = list(FACTION_WY, FACTION_COLONIST) + faction_group = list(FACTION_WY, FACTION_SURVIVOR) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm b/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm index a4cb118e2b28..124bf2772be5 100644 --- a/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm +++ b/code/modules/gear_presets/survivors/solaris/crashlanding-offices_insert_bigred.dm @@ -5,8 +5,8 @@ name = "Survivor - PMC" flags = EQUIPMENT_PRESET_START_OF_ROUND assignment = "Weyland-Yutani PMC" - faction = FACTION_COLONIST - faction_group = list(FACTION_WY, FACTION_COLONIST) + faction = FACTION_SURVIVOR + faction_group = list(FACTION_WY, FACTION_SURVIVOR) paygrade = PAY_SHORT_PMC_OP idtype = /obj/item/card/id/pmc skills = /datum/skills/civilian/survivor/pmc @@ -85,7 +85,7 @@ assignment = "Colony Supervisor" role_comm_title = "Supervisor" idtype = /obj/item/card/id/silver/clearance_badge/manager - faction_group = list(FACTION_WY, FACTION_COLONIST) + faction_group = list(FACTION_WY, FACTION_SURVIVOR) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, @@ -127,8 +127,8 @@ // only used on the spawner of all of those above... /datum/equipment_preset/synth/survivor/pmc name = "Survivor - Synthetic - PMC Support Synth" - faction = FACTION_COLONIST - faction_group = list(FACTION_WY, FACTION_COLONIST) + faction = FACTION_SURVIVOR + faction_group = list(FACTION_WY, FACTION_SURVIVOR) access = list( ACCESS_WY_GENERAL, ACCESS_WY_COLONIAL, diff --git a/code/modules/gear_presets/survivors/survivors.dm b/code/modules/gear_presets/survivors/survivors.dm index 0551c2c79bd2..71a2aaa94b7f 100644 --- a/code/modules/gear_presets/survivors/survivors.dm +++ b/code/modules/gear_presets/survivors/survivors.dm @@ -7,8 +7,8 @@ languages = list(LANGUAGE_ENGLISH) paygrade = PAY_SHORT_CIV idtype = /obj/item/card/id/lanyard - faction = FACTION_COLONIST - faction_group = list(FACTION_COLONIST) + faction = FACTION_SURVIVOR + faction_group = list(FACTION_SURVIVOR) origin_override = ORIGIN_CIVILIAN access = list(ACCESS_CIVILIAN_PUBLIC) diff --git a/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm b/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm index f631b4b3c186..cfb3dee1dc47 100644 --- a/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm +++ b/code/modules/gear_presets/survivors/trijent/crashlanding_upp_bar_insert_trijent.dm @@ -8,7 +8,7 @@ skills = /datum/skills/military/survivor/upp_private languages = list(LANGUAGE_RUSSIAN, LANGUAGE_GERMAN, LANGUAGE_CHINESE) faction = FACTION_UPP - faction_group = list(FACTION_UPP, FACTION_COLONIST) + faction_group = list(FACTION_UPP, FACTION_SURVIVOR) role_comm_title = "173/RECON" idtype = /obj/item/card/id/dogtag flags = EQUIPMENT_PRESET_EXTRA @@ -177,7 +177,7 @@ assignment = JOB_UPP_SUPPORT_SYNTH rank = JOB_UPP_SUPPORT_SYNTH faction = FACTION_UPP - faction_group = list(FACTION_UPP, FACTION_COLONIST) + faction_group = list(FACTION_UPP, FACTION_SURVIVOR) skills = /datum/skills/colonial_synthetic paygrade = PAY_SHORT_SYN idtype = /obj/item/card/id/dogtag diff --git a/code/modules/gear_presets/synths.dm b/code/modules/gear_presets/synths.dm index 8d1d5a9ea3a8..2fde67e931b9 100644 --- a/code/modules/gear_presets/synths.dm +++ b/code/modules/gear_presets/synths.dm @@ -105,8 +105,8 @@ /datum/equipment_preset/synth/survivor name = "Survivor - Synthetic - Classic Joe" flags = EQUIPMENT_PRESET_EXTRA - faction = FACTION_COLONIST - faction_group = list(FACTION_COLONIST) + faction = FACTION_SURVIVOR + faction_group = list(FACTION_SURVIVOR) idtype = /obj/item/card/id/lanyard assignment = JOB_SYNTH rank = JOB_SYNTH_SURVIVOR From 6d8f47ecd3d3a78d51cc558025d0a9a14b1b6d54 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 02:28:26 +0500 Subject: [PATCH 19/69] Revert of factions 7 (a1) --- code/__DEFINES/factions.dm | 175 ------------------------------------- code/__DEFINES/mode.dm | 60 +++++++++++++ colonialmarines.dme | 1 - 3 files changed, 60 insertions(+), 176 deletions(-) delete mode 100644 code/__DEFINES/factions.dm diff --git a/code/__DEFINES/factions.dm b/code/__DEFINES/factions.dm deleted file mode 100644 index 8670b9d8df8a..000000000000 --- a/code/__DEFINES/factions.dm +++ /dev/null @@ -1,175 +0,0 @@ -//WARNING, IF YOU WISH TO RENAME SOMETHING REMEMBER TO UPDATE IT IN STATISTIC, DEATHS AND MEDALS DB TABLES OR I WILL HUNT YOU DOWN AND Bzz5%2 bzz%( pssssssss ---Transmition ended, error accured in main relay - -//FACTION NAMES -#define FACTION_NEUTRAL "neutral" -//USCM -#define FACTION_USCM "uscm" -#define FACTION_MARINE "cm" -#define FACTION_CMB "cmb" -#define FACTION_MARSOC "msoc" -//CONTRACTOR -#define FACTION_CONTRACTOR "contractor" -//WY -#define FACTION_WY "wey_yu" -#define FACTION_PMC "pmc" -#define FACTION_WY_DEATHSQUAD "wy_death_sqaud" -//UPP -#define FACTION_UPP "upp" -//CLF -#define FACTION_CLF "clf" -//COLON -#define FACTION_COLONIST "colonist" -//OTHER -#define FACTION_RESS "ress" -#define FACTION_TWE "twe" -#define FACTION_MERCENARY "mercenary" -#define FACTION_FREELANCER "freelancer" -#define FACTION_HEFA "hefa_order" -#define FACTION_DUTCH "dutch's_dozen" -#define FACTION_PIRATE "pirate" -#define FACTION_GLADIATOR "gladiator" -#define FACTION_PIZZA "pizza_delivery" -#define FACTION_SOUTO "souto" -#define FACTION_THREEWE "threewe" -//ZOMBIE -#define FACTION_ZOMBIE "zombie" -//YAUTJA -#define FACTION_YAUTJA "yautja" -//XENOS -#define FACTION_XENOMORPH "xeno" -#define FACTION_XENOMORPH_NORMAL "xenomorph" -#define FACTION_XENOMORPH_CORRUPTED "corrupted_xenomoprh" -#define FACTION_XENOMORPH_ALPHA "alpha_xenomorph" -#define FACTION_XENOMORPH_BRAVO "bravo_xenomorph" -#define FACTION_XENOMORPH_CHARLIE "charlie_xenomorph" -#define FACTION_XENOMORPH_DELTA "delta_xenomorph" -#define FACTION_XENOMORPH_FERAL "feral_xenomorph" -#define FACTION_XENOMORPH_FORSAKEN "forsaken_xenomorph" -#define FACTION_XENOMORPH_TAMED "tamed_xenomorph" -#define FACTION_XENOMORPH_MUTATED "mutated_xenomorph" -#define FACTION_XENOMORPH_YAUTJA "yautja_xenomorph" -#define FACTION_XENOMORPH_RENEGADE "renegade_xenomorph" - -#define FACTION_LIST_MARINE list(FACTION_USCM, FACTION_MARINE, FACTION_CMB, FACTION_MARSOC) -#define FACTION_LIST_WY list(FACTION_WY, FACTION_PMC, FACTION_WY_DEATHSQUAD) -#define FACTION_LIST_HUMANOID list(FACTION_NEUTRAL, FACTION_CONTRACTOR, FACTION_CLF, FACTION_UPP, FACTION_FREELANCER, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA) + FACTION_LIST_MARINE + FACTION_LIST_WY -#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH_NORMAL, FACTION_XENOMORPH_CORRUPTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA, FACTION_XENOMORPH_FERAL, FACTION_XENOMORPH_FORSAKEN, FACTION_XENOMORPH_TAMED, FACTION_XENOMORPH_MUTATED, FACTION_XENOMORPH_YAUTJA, FACTION_XENOMORPH_RENEGADE) -#define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH - -//NAMES -#define NAME_FACTION_NEUTRAL "Neutral Faction" -//USCM -#define NAME_FACTION_USCM "United States Colonial Marines" -#define NAME_FACTION_MARINE "Colonial Marines" -#define NAME_FACTION_CMB "Colonial Marshal Bureau" -#define NAME_FACTION_MARSOC "Marine Special Operations Command" -//CONTRACTOR -#define NAME_FACTION_CONTRACTOR "Vanguard's Arrow Incorporated" -//WY -#define NAME_FACTION_WY "Weyland-Yutani" -#define NAME_FACTION_PMC "Private Military Company" -#define NAME_FACTION_WY_DEATHSQUAD "Corporate Commandos" -//UPP -#define NAME_FACTION_UPP "Union of Progressive Peoples" -//CLF -#define NAME_FACTION_CLF "Colonial Liberation Front" -//COLON -#define NAME_FACTION_COLONIST "Colonists" -//OTHER -#define NAME_FACTION_RESS "Royal Empire of the Shining Sun" -#define NAME_FACTION_TWE "Royal Marines Commando" -#define NAME_FACTION_MERCENARY "Mercenary Group" -#define NAME_FACTION_FREELANCER "Freelancer Mercenaries" -#define NAME_FACTION_HEFA "HEFA Knights" -#define NAME_FACTION_DUTCH "Dutch's Dozen" -#define NAME_FACTION_PIRATE "Pirates of Free Space" -#define NAME_FACTION_GLADIATOR "Gladiators" -#define NAME_FACTION_PIZZA "Pizza Galaxy" -#define NAME_FACTION_SOUTO "Souto Space" -#define NAME_FACTION_THREEWE "Three World Empire" -//ZOMBIE -#define NAME_FACTION_ZOMBIE "Zombie Horde" -//YAUTJA -#define NAME_FACTION_YAUTJA "Yautja Hunting Groop" -//XENOS -#define NAME_FACTION_XENOMORPH "Xenomorphs" -#define NAME_FACTION_XENOMORPH_NORMAL "Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_CORRUPTED "Corrupted Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_ALPHA "Alpha Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_BRAVO "Bravo Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_DELTA "Delta Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_FERAL "Feral Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_FORSAKEN "Forsaken Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_TAMED "Tamed Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_MUTATED "Mutated Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_YAUTJA "Yautja Xenomorph Hive" -#define NAME_FACTION_XENOMORPH_RENEGADE "Renegade Xenomorph Hive" - -#define NAME_FACTION_LIST_MARINE list(NAME_FACTION_USCM, NAME_FACTION_MARINE, NAME_FACTION_MARSOC) -#define NAME_FACTION_LIST_WY list(NAME_FACTION_WY, NAME_FACTION_PMC, NAME_FACTION_WY_DEATHSQUAD) -#define NAME_FACTION_LIST_HUMANOID list(NAME_FACTION_NEUTRAL, NAME_FACTION_CLF, NAME_FACTION_UPP, NAME_FACTION_FREELANCER, NAME_FACTION_COLONIST, NAME_FACTION_MERCENARY, NAME_FACTION_DUTCH, NAME_FACTION_HEFA, NAME_FACTION_GLADIATOR, NAME_FACTION_PIRATE, NAME_FACTION_PIZZA, NAME_FACTION_SOUTO, NAME_FACTION_ZOMBIE, NAME_FACTION_YAUTJA) + NAME_FACTION_LIST_MARINE + NAME_FACTION_LIST_WY -#define NAME_FACTION_LIST_XENOMORPH list(NAME_FACTION_XENOMORPH_NORMAL, NAME_FACTION_XENOMORPH_CORRUPTED, NAME_FACTION_XENOMORPH_ALPHA, NAME_FACTION_XENOMORPH_BRAVO, NAME_FACTION_XENOMORPH_CHARLIE, NAME_FACTION_XENOMORPH_DELTA, NAME_FACTION_XENOMORPH_FERAL, NAME_FACTION_XENOMORPH_FORSAKEN, NAME_FACTION_XENOMORPH_TAMED, NAME_FACTION_XENOMORPH_MUTATED, NAME_FACTION_XENOMORPH_YAUTJA, NAME_FACTION_XENOMORPH_YAUTJA) -#define NAME_FACTION_LIST_ALL NAME_FACTION_LIST_HUMANOID + NAME_FACTION_LIST_XENOMORPH - -// Faction allegiances within a certain faction. -#define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") - -/* - - -// Faction names -#define FACTION_NEUTRAL "Neutral" -#define FACTION_MARINE "USCM" -#define FACTION_SURVIVOR "Survivor" -#define FACTION_UPP "UPP" -#define FACTION_TWE "TWE" -#define FACTION_WY "Wey-Yu" -#define FACTION_CLF "CLF" -#define FACTION_PMC "PMC" -#define FACTION_CONTRACTOR "VAI" -#define FACTION_MARSHAL "Colonial Marshal" -#define FACTION_WY_DEATHSQUAD "WY Death Squad" -#define FACTION_MERCENARY "Mercenary" -#define FACTION_FREELANCER "Freelancer" -#define FACTION_HEFA "HEFA Order" -#define FACTION_DUTCH "Dutch's Dozen" -#define FACTION_PIRATE "Pirate" -#define FACTION_GLADIATOR "Gladiator" -#define FACTION_PIZZA "Pizza Delivery" -#define FACTION_SOUTO "Souto Man" -#define FACTION_COLONIST "Colonist" -#define FACTION_YAUTJA "Yautja" -#define FACTION_ZOMBIE "Zombie" -#define FACTION_MONKEY "Monkey" // Nanu - -#define FACTION_LIST_MARINE list(FACTION_MARINE) -#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE) -#define FACTION_LIST_ERT list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO) -#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_UPP list(FACTION_UPP) -#define FACTION_LIST_CLF list(FACTION_CLF) -#define FACTION_LIST_TWE list(FACTION_TWE) -#define FACTION_LIST_FREELANCER list(FACTION_FREELANCER) -#define FACTION_LIST_CONTRACTOR list(FACTION_CONTRACTOR) -#define FACTION_LIST_MERCENARY list(FACTION_MERCENARY) -#define FACTION_LIST_MARSHAL list(FACTION_MARSHAL) -#define FACTION_LIST_DUTCH list(FACTION_DUTCH) -#define FACTION_LIST_SURVIVOR_WY list(FACTION_SURVIVOR, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_MARINE_WY list(FACTION_MARINE, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) -#define FACTION_LIST_MARINE_UPP list(FACTION_MARINE, FACTION_UPP) -#define FACTION_LIST_MARINE_TWE list(FACTION_MARINE, FACTION_TWE) - -// Xenomorphs -#define FACTION_PREDALIEN "Predalien" - -#define FACTION_XENOMORPH "Xenomorph" -#define FACTION_XENOMORPH_CORRPUTED "Corrupted Xenomoprh" -#define FACTION_XENOMORPH_ALPHA "Alpha Xenomorph" -#define FACTION_XENOMORPH_BRAVO "Bravo Xenomorph" -#define FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph" -#define FACTION_XENOMORPH_DELTA "Delta Xenomorph" - -#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) - -*/ diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index c38727979800..4c3a658ff421 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -251,6 +251,66 @@ DEFINE_BITFIELD(whitelist_status, list( /// Misc. defines for objectives #define APC_SCORE_INTERVAL 10 MINUTES +//================================================= + +// Faction names +#define FACTION_NEUTRAL "Neutral" +#define FACTION_MARINE "USCM" +#define FACTION_SURVIVOR "Survivor" +#define FACTION_UPP "UPP" +#define FACTION_TWE "TWE" +#define FACTION_WY "Wey-Yu" +#define FACTION_CLF "CLF" +#define FACTION_PMC "PMC" +#define FACTION_CONTRACTOR "VAI" +#define FACTION_MARSHAL "Colonial Marshal" +#define FACTION_WY_DEATHSQUAD "WY Death Squad" +#define FACTION_MERCENARY "Mercenary" +#define FACTION_FREELANCER "Freelancer" +#define FACTION_HEFA "HEFA Order" +#define FACTION_DUTCH "Dutch's Dozen" +#define FACTION_PIRATE "Pirate" +#define FACTION_GLADIATOR "Gladiator" +#define FACTION_PIZZA "Pizza Delivery" +#define FACTION_SOUTO "Souto Man" +#define FACTION_COLONIST "Colonist" +#define FACTION_YAUTJA "Yautja" +#define FACTION_ZOMBIE "Zombie" +#define FACTION_MONKEY "Monkey" // Nanu + +#define FACTION_LIST_MARINE list(FACTION_MARINE) +#define FACTION_LIST_HUMANOID list(FACTION_MARINE, FACTION_PMC, FACTION_WY, FACTION_WY_DEATHSQUAD, FACTION_CLF, FACTION_CONTRACTOR, FACTION_MARSHAL, FACTION_UPP, FACTION_FREELANCER, FACTION_SURVIVOR, FACTION_NEUTRAL, FACTION_COLONIST, FACTION_MERCENARY, FACTION_DUTCH, FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO, FACTION_YAUTJA, FACTION_ZOMBIE, FACTION_TWE) +#define FACTION_LIST_ERT list(FACTION_HEFA, FACTION_GLADIATOR, FACTION_PIRATE, FACTION_PIZZA, FACTION_SOUTO) +#define FACTION_LIST_WY list(FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_UPP list(FACTION_UPP) +#define FACTION_LIST_CLF list(FACTION_CLF) +#define FACTION_LIST_TWE list(FACTION_TWE) +#define FACTION_LIST_FREELANCER list(FACTION_FREELANCER) +#define FACTION_LIST_CONTRACTOR list(FACTION_CONTRACTOR) +#define FACTION_LIST_MERCENARY list(FACTION_MERCENARY) +#define FACTION_LIST_MARSHAL list(FACTION_MARSHAL) +#define FACTION_LIST_DUTCH list(FACTION_DUTCH) +#define FACTION_LIST_SURVIVOR_WY list(FACTION_SURVIVOR, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_MARINE_WY list(FACTION_MARINE, FACTION_PMC, FACTION_WY_DEATHSQUAD, FACTION_WY) +#define FACTION_LIST_MARINE_UPP list(FACTION_MARINE, FACTION_UPP) +#define FACTION_LIST_MARINE_TWE list(FACTION_MARINE, FACTION_TWE) + +// Xenomorphs +#define FACTION_PREDALIEN "Predalien" + +#define FACTION_XENOMORPH "Xenomorph" +#define FACTION_XENOMORPH_CORRPUTED "Corrupted Xenomoprh" +#define FACTION_XENOMORPH_ALPHA "Alpha Xenomorph" +#define FACTION_XENOMORPH_BRAVO "Bravo Xenomorph" +#define FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph" +#define FACTION_XENOMORPH_DELTA "Delta Xenomorph" + +#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) + +// Faction allegiances within a certain faction. + +#define FACTION_ALLEGIANCE_USCM_COMMANDER list("Doves", "Hawks", "Magpies", "Unaligned") + // global vars to prevent spam of the "one xyz alive" messages GLOBAL_VAR(last_ares_callout) diff --git a/colonialmarines.dme b/colonialmarines.dme index b612ac349685..4c604a325d15 100644 --- a/colonialmarines.dme +++ b/colonialmarines.dme @@ -57,7 +57,6 @@ #include "code\__DEFINES\emote_panels.dm" #include "code\__DEFINES\equipment.dm" #include "code\__DEFINES\events.dm" -#include "code\__DEFINES\factions.dm" #include "code\__DEFINES\fire.dm" #include "code\__DEFINES\flags.dm" #include "code\__DEFINES\fonts.dm" From 781e1913d3a878b4a88c76a7d6543d06a11a6805 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:20:16 +0500 Subject: [PATCH 20/69] Fix of shitty shit around --- code/__DEFINES/mode.dm | 1 + code/__DEFINES/statistic.dm | 5 +- .../datums/statistics/entities/death_stats.dm | 2 +- .../datums/statistics/entities/medal_stats.dm | 4 +- .../datums/statistics/entities/panel_stats.dm | 8 +- .../statistics/entities/player_entity.dm | 5 + .../statistics/entities/player_stats.dm | 98 ++--- .../datums/statistics/entities/round_stats.dm | 8 +- .../statistics/random_facts/damage_fact.dm | 2 +- .../statistics/random_facts/kills_fact.dm | 2 +- .../statistics/random_facts/random_fact.dm | 10 +- .../statistics/random_facts/revives_fact.dm | 2 +- code/datums/tutorial/ss13/_ss13.dm | 1 - code/game/gamemodes/cm_initialize.dm | 3 - .../colonialmarines/colonialmarines.dm | 64 ++- .../colonialmarines/whiskey_outpost.dm | 33 +- .../gamemodes/colonialmarines/xenovsxeno.dm | 30 +- code/game/gamemodes/game_mode.dm | 58 +-- code/game/jobs/job/antag/xeno/xenomorph.dm | 2 - code/game/objects/structures/window.dm | 2 +- code/game/verbs/records.dm | 2 +- code/modules/client/client_procs.dm | 13 +- code/modules/cm_tech/implements/implants.dm | 2 +- .../carbon/xenomorph/castes/Facehugger.dm | 2 +- code/modules/mob/mob_verbs.dm | 4 +- code/modules/mob/new_player/new_player.dm | 15 +- tgui/packages/tgui/interfaces/KillPanel.jsx | 62 --- tgui/packages/tgui/interfaces/Statistic.jsx | 393 ++++++++++++++++++ 28 files changed, 571 insertions(+), 262 deletions(-) delete mode 100644 tgui/packages/tgui/interfaces/KillPanel.jsx create mode 100644 tgui/packages/tgui/interfaces/Statistic.jsx diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index 4c3a658ff421..71f3c5c29ec6 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -306,6 +306,7 @@ DEFINE_BITFIELD(whitelist_status, list( #define FACTION_XENOMORPH_DELTA "Delta Xenomorph" #define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) +#define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH // Faction allegiances within a certain faction. diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index c03b768fa431..d4a5af540555 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -5,6 +5,8 @@ #define FACEHUG_TIER_3 100 #define FACEHUG_TIER_4 1000 +// OOD mean Out Of Date (not used, please keep this list up to date, and remember sync in db changes) + // Statistics defines #define STATISTIC_TYPE_MISC "Misc" #define STATISTIC_TYPE_CASTE "Caste" @@ -66,8 +68,9 @@ #define STATISTICS_UPGRADE_CADES "Barricades Upgraded" #define STATISTICS_REPAIR_CADES "Barricades Repaired" #define STATISTICS_REPAIR_GENERATOR "Generators Repaired" -#define STATISTICS_UPGRADE_TURRETS "Defenses Upgraded" +#define STATISTICS_REPAIR_SENSORTOWER "Sensor Towers Repaired" #define STATISTICS_REPAIR_APC "APCs Repaired" +#define STATISTICS_UPGRADE_TURRETS "Defenses Upgraded" #define STATISTICS_DEFENSES_BUILT "Defenses Built" // OOD #define STATISTICS_CORGI "Corgis Murdered" diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index aeb7d0a67eab..3de22b57dbcb 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -158,7 +158,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) new_death.role_name = get_role_name() new_death.mob_name = real_name - new_death.faction_name = faction?.name + new_death.faction_name = faction new_death.area_name = area.name diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index cdd7f3ed32aa..bb07c897e942 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -73,7 +73,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) if(giver_player) new_medal.giver_player_id = giver_player.id - track_statistic_earned(new_recipient.faction.faction_name, STATISTICS_MEDALS, 1, new_recipient.client.player_data) + track_statistic_earned(new_recipient.faction, STATISTICS_MEDALS, 1, new_recipient.client.player_data) medals += new_medal new_medal.save() new_medal.detach() @@ -86,7 +86,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) return FALSE var/round_id = SSperf_logging.round?.id - track_statistic_earned(recipient.faction.faction_name, STATISTICS_MEDALS, -1, recipient.client.player_data) + track_statistic_earned(recipient.faction, STATISTICS_MEDALS, -1, recipient.client.player_data) for(var/datum/entity/statistic/medal/new_medal as anything in medals) if(new_medal.round_id == round_id && new_medal.recipient_name == recipient.real_name && new_medal.medal_type == medal_type && new_medal.citation == citation) medals -= new_medal diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index a1b51f31d93a..08b011dfd880 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -8,11 +8,11 @@ /datum/player_entity/ui_state(mob/user) return GLOB.always_state -/datum/player_entity/ui_data(mob/user, datum/entity/statistic_round/viewing_round = SSticker?.mode?.round_statistics ) +/datum/player_entity/ui_data(mob/user, datum/entity/statistic_round/viewing_round = GLOB.round_statistics) var/list/data = list() data["data_tabs"] = list() if(viewing_round) - data["round"] = viewing_round.update_panel_data() + data["round"] = viewing_round.cached_tgui_data data["data_tabs"] += "Round" if(length(medals)) @@ -127,7 +127,7 @@ ) return data -/datum/entity/statistic_round/proc/update_panel_data() +/datum/entity/statistic_round/process() var/map_name if(current_map) map_name = current_map.map_name @@ -183,7 +183,7 @@ "z" = statistic_death.z, )) - return list( + cached_tgui_data = list( "name" = round_name, "game_mode" = game_mode, "map_name" = map_name, diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index de14c0ee7c30..3cbdc93e21c9 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -26,6 +26,11 @@ if(!player || !faction || !statistic_type || !general_name || !statistic_name) return + // Just in case, because here factions system is litteraly FUCKED UP I need set this check here for **NOW**, **UNITL** faction rework to datum is done + if(!(faction in FACTION_LIST_ALL)) + return + // This is done, because if somebody start FUN around with faction names, then his STATISTIC pannel will be fucked up with a lot of faction names... just imagine, open it and see 200+ names, cool? 200% + var/datum/entity/statistic/statistic = player.player_entity?.get_statistic(faction, statistic_type, general_name, statistic_name) if(statistic) statistic.value += value diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index 59a86388eec4..f0c5e72d3577 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -106,116 +106,116 @@ if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) /mob/living/carbon/human/count_statistic_stat(statistic_name, amount = 1, weapon) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/human/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/human/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_JOB, get_role_name(), statistic_name, amount, client.player_data) ///////////////////////////////////////////////////////////////////////////////////// //Xenomorph @@ -225,128 +225,128 @@ if(!. || !faction) return - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), STATISTICS_ROUNDS_PLAYED, 1, client.player_data) /mob/living/carbon/xenomorph/count_statistic_stat(statistic_name, amount = 1, weapon) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_steps_walked(amount = 1, statistic_name = STATISTICS_STEPS_WALKED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, caste_type, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) if(weapon) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_WEAPON, weapon, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, get_role_name(), statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, statistic_name, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, caste, statistic_name, amount, client.player_data) /mob/living/carbon/xenomorph/track_ability_usage(ability, caste, amount = 1) . = ..() if(!.) return FALSE - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste, ability, amount, client.player_data) - track_statistic_earned(faction.faction_name, STATISTIC_TYPE_CASTE, caste, STATISTICS_ABILITES, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE_ABILITIES, caste, ability, amount, client.player_data) + track_statistic_earned(faction, STATISTIC_TYPE_CASTE, caste, STATISTICS_ABILITES, amount, client.player_data) diff --git a/code/datums/statistics/entities/round_stats.dm b/code/datums/statistics/entities/round_stats.dm index 195a89cfc3c8..9b96e6383755 100644 --- a/code/datums/statistics/entities/round_stats.dm +++ b/code/datums/statistics/entities/round_stats.dm @@ -24,6 +24,7 @@ var/total_slashes = 0 // untracked data + var/list/cached_tgui_data var/datum/entity/statistic_map/current_map = null // reference to current map var/list/datum/entity/statistic_death/death_stats_list = list() @@ -87,6 +88,7 @@ round_statistics.game_mode = name round_statistics.real_time_start = world.realtime round_statistics.save() + START_PROCESSING(SSobj, round_statistics) GLOB.round_statistics = round_statistics /datum/entity/statistic_round/proc/setup_faction(faction) @@ -128,7 +130,7 @@ for(var/i in GLOB.alive_mob_list) var/mob/M = i if(M.mind && M.faction) - track_final_participant(M.faction?.name) + track_final_participant(M.faction) if(current_map) current_map.total_rounds++ @@ -149,7 +151,7 @@ for(var/i in GLOB.alive_mob_list) var/mob/M = i if(M.mind) - track_hijack_participant(M.faction?.name) + track_hijack_participant(M.faction) round_hijack_time = duration2text(world.time) save() @@ -250,6 +252,8 @@ return TRUE /datum/action/show_round_statistics/action_activate() + . = ..() + if(!can_use_action()) return diff --git a/code/datums/statistics/random_facts/damage_fact.dm b/code/datums/statistics/random_facts/damage_fact.dm index 2fa8a5d06491..c1be9f6d713f 100644 --- a/code/datums/statistics/random_facts/damage_fact.dm +++ b/code/datums/statistics/random_facts/damage_fact.dm @@ -5,5 +5,5 @@ /datum/random_fact/damage/life_grab_stat(mob/fact_mob) return fact_mob.life_damage_taken_total -/datum/random_fact/damage/death_grab_stat(datum/entity/statistic/death/fact_death) +/datum/random_fact/damage/death_grab_stat(datum/entity/statistic_death/fact_death) return fact_death.total_damage_taken diff --git a/code/datums/statistics/random_facts/kills_fact.dm b/code/datums/statistics/random_facts/kills_fact.dm index 7ef1c2b238de..e6752c48b55a 100644 --- a/code/datums/statistics/random_facts/kills_fact.dm +++ b/code/datums/statistics/random_facts/kills_fact.dm @@ -5,5 +5,5 @@ /datum/random_fact/kills/life_grab_stat(mob/fact_mob) return fact_mob.life_kills_total -/datum/random_fact/kills/death_grab_stat(datum/entity/statistic/death/fact_death) +/datum/random_fact/kills/death_grab_stat(datum/entity/statistic_death/fact_death) return fact_death.total_kills diff --git a/code/datums/statistics/random_facts/random_fact.dm b/code/datums/statistics/random_facts/random_fact.dm index d327bd36f4f6..099aed876a23 100644 --- a/code/datums/statistics/random_facts/random_fact.dm +++ b/code/datums/statistics/random_facts/random_fact.dm @@ -21,14 +21,12 @@ /datum/random_fact/proc/calculate_announcement_message() var/death_stat_gotten = 0 var/living_stat_gotten = 0 - var/datum/entity/statistic/death/death_to_report = null + var/datum/entity/statistic_death/death_to_report = null var/mob/mob_to_report = null if(GLOB.round_statistics && length(GLOB.round_statistics.death_stats_list)) - for(var/datum/entity/statistic/death/death in GLOB.round_statistics.death_stats_list) - if(!check_human && !death.is_xeno) - continue - if(!check_xeno && death.is_xeno) + for(var/datum/entity/statistic_death/death in GLOB.round_statistics.death_stats_list) + if(check_human && (death.faction_name in FACTION_LIST_XENOMORPH && check_xeno)) continue if(death_stat_gotten < death_grab_stat(death)) death_to_report = death @@ -82,5 +80,5 @@ /datum/random_fact/proc/life_grab_stat(mob/fact_mob) return 0 -/datum/random_fact/proc/death_grab_stat(datum/entity/statistic/death/fact_death) +/datum/random_fact/proc/death_grab_stat(datum/entity/statistic_death/fact_death) return 0 diff --git a/code/datums/statistics/random_facts/revives_fact.dm b/code/datums/statistics/random_facts/revives_fact.dm index 60b6daa896d2..0430ef3598d0 100644 --- a/code/datums/statistics/random_facts/revives_fact.dm +++ b/code/datums/statistics/random_facts/revives_fact.dm @@ -5,5 +5,5 @@ /datum/random_fact/revives/life_grab_stat(mob/fact_mob) return fact_mob.life_revives_total -/datum/random_fact/revives/death_grab_stat(datum/entity/statistic/death/fact_death) +/datum/random_fact/revives/death_grab_stat(datum/entity/statistic_death/fact_death) return fact_death.total_revives_done diff --git a/code/datums/tutorial/ss13/_ss13.dm b/code/datums/tutorial/ss13/_ss13.dm index 53cf5c918ee9..91a6b7c612b8 100644 --- a/code/datums/tutorial/ss13/_ss13.dm +++ b/code/datums/tutorial/ss13/_ss13.dm @@ -27,7 +27,6 @@ if(tutorial_mob.mind) tutorial_mob.mind_initialize() tutorial_mob.mind.transfer_to(new_character, TRUE) - tutorial_mob.mind.setup_human_stats() INVOKE_ASYNC(new_character, TYPE_PROC_REF(/mob/living/carbon/human, regenerate_icons)) INVOKE_ASYNC(new_character, TYPE_PROC_REF(/mob/living/carbon/human, update_body), 1, 0) diff --git a/code/game/gamemodes/cm_initialize.dm b/code/game/gamemodes/cm_initialize.dm index 0914b4fa6b1f..b8b303f243a5 100644 --- a/code/game/gamemodes/cm_initialize.dm +++ b/code/game/gamemodes/cm_initialize.dm @@ -163,7 +163,6 @@ Additional game mode variables. if(player.client.prefs.get_job_priority(JOB_PREDATOR) > 0) //Are their prefs turned on? if(!player.mind) //They have to have a key if they have a client. player.mind_initialize() //Will work on ghosts too, but won't add them to active minds. - player.mind.setup_human_stats() player.faction = FACTION_YAUTJA players += player.mind return players @@ -338,7 +337,6 @@ Additional game mode variables. // Helper proc to set some constants /proc/setup_new_xeno(datum/mind/new_xeno) new_xeno.roundstart_picked = TRUE - new_xeno.setup_xeno_stats() /datum/game_mode/proc/check_xeno_late_join(mob/xeno_candidate) if(jobban_isbanned(xeno_candidate, JOB_XENOMORPH)) // User is jobbanned @@ -674,7 +672,6 @@ Additional game mode variables. new_xeno.SetSleeping(0) // ghosting sleeps, but they got a new mind! wake up! (/mob/living/verb/ghost()) new_xeno.mind_initialize() - new_xeno.mind.player_entity = setup_player_entity(xeno_candidate_mind.ckey) new_xeno.statistic_tracked = FALSE // Let the round recorder know that the key has changed diff --git a/code/game/gamemodes/colonialmarines/colonialmarines.dm b/code/game/gamemodes/colonialmarines/colonialmarines.dm index 9eac36f7970c..2cf394fa3346 100644 --- a/code/game/gamemodes/colonialmarines/colonialmarines.dm +++ b/code/game/gamemodes/colonialmarines/colonialmarines.dm @@ -12,24 +12,6 @@ flags_round_type = MODE_INFESTATION|MODE_FOG_ACTIVATED|MODE_NEW_SPAWN static_comms_amount = 1 var/round_status_flags - round_end_states = list(MODE_INFESTATION_X_MAJOR, MODE_INFESTATION_M_MAJOR, MODE_INFESTATION_X_MINOR, MODE_INFESTATION_M_MINOR, MODE_INFESTATION_DRAW_DEATH) - - faction_result_end_state = list( - FACTION_MARINE = list( - MODE_INFESTATION_M_MAJOR = list("marine_major", list('sound/music/round_end/winning_triumph1.ogg', 'sound/music/round_end/winning_triumph2.ogg'), list('sound/music/round_end/issomebodysinging.ogg')), - MODE_INFESTATION_M_MINOR = list("marine_major", list('sound/music/round_end/neutral_hopeful1.ogg', 'sound/music/round_end/neutral_hopeful2.ogg'), list()), - MODE_INFESTATION_X_MINOR = list("marine_minor", list('sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), list('sound/music/round_end/bluespace.ogg')), - MODE_INFESTATION_X_MAJOR = list("marine_minor", list('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg'), list('sound/music/round_end/end.ogg')), - MODE_GENERIC_DRAW_NUKE = list("draw", list('sound/music/round_end/nuclear_detonation1.ogg', 'sound/music/round_end/nuclear_detonation2.ogg'), list()), - ), - FACTION_XENOMORPH_NORMAL = list( - MODE_INFESTATION_X_MAJOR = list("xeno_major", list('sound/music/round_end/winning_triumph1.ogg', 'sound/music/round_end/winning_triumph2.ogg'), list()), - MODE_INFESTATION_X_MINOR = list("xeno_major", list('sound/music/round_end/neutral_hopeful1.ogg', 'sound/music/round_end/neutral_hopeful2.ogg'), list()), - MODE_INFESTATION_M_MINOR = list("xeno_minor", list('sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), list('sound/music/round_end/bluespace.ogg')), - MODE_INFESTATION_M_MAJOR = list("xeno_minor", list('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg'), list('sound/music/round_end/end.ogg')), - MODE_GENERIC_DRAW_NUKE = list("draw", list('sound/music/round_end/nuclear_detonation1.ogg', 'sound/music/round_end/nuclear_detonation2.ogg'), list()), - ) - ) var/research_allocation_interval = 10 MINUTES var/next_research_allocation = 0 @@ -481,7 +463,7 @@ //Announces the end of the game with all relevant information stated// ////////////////////////////////////////////////////////////////////// -/* TODO: PUT IT SOMEWHERE LATER +/* TODO: PUT IT SOMEWHERE LATER (faction rework PR) #define MAJORITY 0.5 // What percent do we consider a 'majority?' if(MODE_INFESTATION_X_MINOR) var/list/living_player_list = count_humans_and_xenos(get_affected_zlevels()) @@ -522,6 +504,50 @@ if(MODE_INFESTATION_X_MINOR) add_current_round_status_to_end_results("Round End") handle_round_results_statistics_output() +/datum/game_mode/colonialmarines/get_winners_states() + var/majority = 0.5 + var/end_icon = "draw" + var/musical_track + switch(round_finished) + if(MODE_INFESTATION_X_MAJOR) + musical_track = pick('sound/theme/sad_loss1.ogg','sound/theme/sad_loss2.ogg') + end_icon = "xeno_major" + if(MODE_INFESTATION_M_MAJOR) + musical_track = pick('sound/theme/winning_triumph1.ogg','sound/theme/winning_triumph2.ogg') + end_icon = "marine_major" + if(MODE_INFESTATION_X_MINOR) + var/list/living_player_list = count_humans_and_xenos(get_affected_zlevels()) + if(living_player_list[1] && !living_player_list[2]) // If Xeno Minor but Xenos are dead and Humans are alive, see which faction is the last standing + var/headcount = count_per_faction() + var/living = headcount["total_headcount"] + if ((headcount["WY_headcount"] / living) > majority) + musical_track = pick('sound/theme/lastmanstanding_wy.ogg') + log_game("3rd party victory: Weyland-Yutani") + message_admins("3rd party victory: Weyland-Yutani") + else if ((headcount["UPP_headcount"] / living) > majority) + musical_track = pick('sound/theme/lastmanstanding_upp.ogg') + log_game("3rd party victory: Union of Progressive Peoples") + message_admins("3rd party victory: Union of Progressive Peoples") + else if ((headcount["CLF_headcount"] / living) > majority) + musical_track = pick('sound/theme/lastmanstanding_clf.ogg') + log_game("3rd party victory: Colonial Liberation Front") + message_admins("3rd party victory: Colonial Liberation Front") + else if ((headcount["marine_headcount"] / living) > majority) + musical_track = pick('sound/theme/neutral_melancholy2.ogg') //This is the theme song for Colonial Marines the game, fitting + else + musical_track = pick('sound/theme/neutral_melancholy1.ogg') + end_icon = "xeno_minor" + if(MODE_INFESTATION_M_MINOR) + musical_track = pick('sound/theme/neutral_hopeful1.ogg','sound/theme/neutral_hopeful2.ogg') + end_icon = "marine_minor" + if(MODE_INFESTATION_DRAW_DEATH) + end_icon = "draw" + musical_track = 'sound/theme/neutral_hopeful2.ogg' + var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY) + S.status = SOUND_STREAM + sound_to(world, S) + return list(end_icon) + /datum/game_mode/colonialmarines/proc/add_current_round_status_to_end_results(special_round_status as text) var/players = GLOB.clients var/list/counted_humans = list( diff --git a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm index 25866d5ead33..31e6635bfa43 100644 --- a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm +++ b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm @@ -37,19 +37,6 @@ /datum/job/marine/standard/whiskey = JOB_SQUAD_MARINE, ) - round_end_states = list(MODE_WISKEY_OUTPOST_X_MAJOR, MODE_WISKEY_OUTPOST_M_MAJOR) - - faction_result_end_state = list( - FACTION_MARINE = list( - MODE_WISKEY_OUTPOST_M_MAJOR = list("marine_major", list('sound/misc/hell_march.ogg'), list('sound/music/round_end/issomebodysinging.ogg')), - MODE_WISKEY_OUTPOST_X_MAJOR = list("marine_minor", list('sound/misc/Game_Over_Man.ogg'), list('sound/music/round_end/end.ogg')), - ), - FACTION_XENOMORPH_NORMAL = list( - MODE_WISKEY_OUTPOST_X_MAJOR = list("xeno_major", list('sound/misc/hell_march.ogg'), list('sound/music/round_end/bluespace.ogg')), - MODE_WISKEY_OUTPOST_M_MAJOR = list("xeno_minor", list('sound/misc/Game_Over_Man.ogg'), list('sound/music/round_end/end.ogg')), - ) - ) - latejoin_larva_drop = 0 //You never know //var/mob/living/carbon/human/Commander //If there is no Commander, marines wont get any supplies @@ -283,6 +270,26 @@ to_world(SPAN_ROUNDBODY("It will be another five years before the USCM returns to the Neroid Sector, with the arrival of the 2nd 'Falling Falcons' Battalion and the USS Almayer.")) to_world(SPAN_ROUNDBODY("The xenomorph hive on LV-624 remains unthreatened until then...")) +/datum/game_mode/xenovs/get_winners_states() + var/end_icon = "draw" + var/musical_track + switch(round_finished) + if(MODE_WISKEY_OUTPOST_M_MAJOR) + musical_track = 'sound/misc/hell_march.ogg' + end_icon = "marine_major" + if(MODE_WISKEY_OUTPOST_X_MAJOR) + musical_track = 'sound/misc/Game_Over_Man.ogg' + end_icon = "xeno_major" + else + musical_track = 'sound/misc/sadtrombone.ogg' + if(GLOB.round_statistics) + GLOB.round_statistics.round_result = MODE_INFESTATION_DRAW_DEATH + + var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY) + S.status = SOUND_STREAM + sound_to(world, S) + return list(end_icon) + /////////////////////////////// //Other WO things to simulate// /////////////////////////////// diff --git a/code/game/gamemodes/colonialmarines/xenovsxeno.dm b/code/game/gamemodes/colonialmarines/xenovsxeno.dm index e2e4547fc9a8..9d71cf3cae01 100644 --- a/code/game/gamemodes/colonialmarines/xenovsxeno.dm +++ b/code/game/gamemodes/colonialmarines/xenovsxeno.dm @@ -257,31 +257,21 @@ . = ..() declare_completion_announce_xenomorphs() - calculate_end_statistics() declare_fun_facts() +/datum/game_mode/xenovs/get_winners_states() + var/end_icon = "xeno_major" + var/musical_track + musical_track = pick('sound/theme/neutral_melancholy1.ogg', 'sound/theme/neutral_melancholy2.ogg') + + var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY) + S.status = SOUND_STREAM + sound_to(world, S) + return list(end_icon) + /datum/game_mode/xenovs/announce_ending() if(GLOB.round_statistics) GLOB.round_statistics.track_round_end() log_game("Round end result: [round_finished]") to_chat_spaced(world, margin_top = 2, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDHEADER("|Round Complete|")) to_chat_spaced(world, type = MESSAGE_TYPE_SYSTEM, html = SPAN_ROUNDBODY("Thus ends the story of the battling hives on [SSmapping.configs[GROUND_MAP].map_name]. [round_finished]\nThe game-mode was: [GLOB.master_mode]!\n[CONFIG_GET(string/endofroundblurb)]")) - -/datum/game_mode/xenovs/get_winners_states() - var/list/icon_states = list() - var/list/musical_tracks = list() - var/sound/sound - for(var/faction_name in factions_pool) - var/pick = 2 - if(faction_won.faction_name == faction_name) - pick = 1 - - icon_states[faction_name] = faction_result_end_state[pick][1] - sound = sound(pick(faction_result_end_state[pick][2]), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - musical_tracks[faction_name] = sound - sound = sound(pick(faction_result_end_state[pick][3]), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - musical_tracks[faction_name] += sound - - return list(icon_states, musical_tracks) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 5e02a475a42b..ed013a208b26 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -18,9 +18,6 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/votable = TRUE var/vote_cycle = null var/probability = 0 - var/list/round_end_states = list() - var/list/faction_round_end_state = list() - var/list/faction_result_end_state = list() var/list/datum/mind/modePlayer = new var/required_players = 0 var/required_players_secret = 0 //Minimum number of players for that game mode to be chose in Secret @@ -163,6 +160,7 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t announce_ending() var/list/winners_info = get_winners_states() + if(GLOB.round_statistics) GLOB.round_statistics.game_mode = name GLOB.round_statistics.round_length = world.time @@ -176,34 +174,10 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t GLOB.round_statistics.track_round_end() calculate_end_statistics() - show_end_statistics(winners_info[1], winners_info[2], winners_info[3]) + show_end_statistics(winners_info[1]) /datum/game_mode/proc/get_winners_states() - var/list/icon_states = list() - var/list/musical_tracks = list() - var/list/standart_payload = list() - standart_payload += "draw" - var/sound/sound = sound(pick('sound/music/round_end/sad_loss1.ogg', 'sound/music/round_end/sad_loss2.ogg', 'sound/music/round_end/neutral_melancholy1.ogg', 'sound/music/round_end/neutral_melancholy2.ogg'), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - standart_payload += sound - sound = sound(pick('sound/music/round_end/end.ogg'), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - standart_payload += sound - for(var/faction_name in factions_pool) - if(faction_result_end_state[faction_name]) - icon_states[faction_name] = faction_result_end_state[faction_name][round_finished][1] - sound = sound(pick(faction_result_end_state[faction_name][round_finished][2]), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - musical_tracks[faction_name] = list(sound) - sound = sound(pick(faction_result_end_state[faction_name][round_finished][3]), channel = SOUND_CHANNEL_LOBBY) - sound.status = SOUND_STREAM - musical_tracks[faction_name] += sound - else - icon_states[faction_name] = standart_payload[1] - musical_tracks[faction_name] = list(standart_payload[2], standart_payload[3]) - - - return list(icon_states, musical_tracks, standart_payload) + return list("draw") /datum/game_mode/proc/calculate_end_statistics() for(var/i in GLOB.alive_mob_list) @@ -218,27 +192,11 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t else record_playtime(M.client.player_data, M.job, type) -/datum/game_mode/proc/show_end_statistics(icon_states, musical_tracks, standart_payload) - var/list/mobs = list() - for(var/faction_name in factions_pool) - var/faction_to_get = factions_pool[faction_name] - var/datum/faction/faction = GLOB.faction_datums[faction_to_get] - for(var/mob/mob in faction.totalMobs) - if(mob.client) - mobs += mob - give_action(mob, /datum/action/show_round_statistics, null, icon_states[faction_to_get]) - sound_to(mob, musical_tracks[faction.name][1]) - if(length(musical_tracks[faction_to_get]) > 1) - spawn(20 SECONDS) - sound_to(mob, musical_tracks[faction_to_get][2]) - - for(var/mob/mob in GLOB.player_list - mobs) - if(mob.client) - give_action(mob, /datum/action/show_round_statistics, null, standart_payload[1]) - sound_to(mob, standart_payload[2]) - if(length(standart_payload) > 2) - spawn(20 SECONDS) - sound_to(mob, standart_payload[3]) +/datum/game_mode/proc/show_end_statistics(icon_state) + GLOB.round_statistics.process() + for(var/mob/M in GLOB.player_list) + if(M.client) + give_action(M, /datum/action/show_round_statistics, null, icon_state) /datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. return FALSE diff --git a/code/game/jobs/job/antag/xeno/xenomorph.dm b/code/game/jobs/job/antag/xeno/xenomorph.dm index eeca16bc7f90..25bfad7387c5 100644 --- a/code/game/jobs/job/antag/xeno/xenomorph.dm +++ b/code/game/jobs/job/antag/xeno/xenomorph.dm @@ -26,8 +26,6 @@ transform_to_xeno(H, XENO_HIVE_NORMAL) /datum/job/antag/xenos/proc/transform_to_xeno(mob/living/carbon/human/human_to_transform, hive_index) - var/datum/mind/new_xeno = human_to_transform.mind - new_xeno.setup_xeno_stats() var/datum/hive_status/hive = GLOB.hive_datum[hive_index] human_to_transform.first_xeno = TRUE diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 16e7c19bbbad..9c71df9f4aa8 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -155,7 +155,7 @@ create_shrapnel(location, rand(1,5), explosion_direction, shrapnel_type = /datum/ammo/bullet/shrapnel/light/glass, cause_data = cause_data) if(M) - mob.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) + M.count_statistic_stat(STATISTICS_DESTRUCTION_WINDOWS) SEND_SIGNAL(M, COMSIG_MOB_WINDOW_EXPLODED, src) handle_debris(severity, explosion_direction) diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index 750e0dafed79..b14a92192e81 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -201,7 +201,7 @@ GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_tgui/given_medals, /datum/medals_view_tgui/given_medals/get_medals(mob/user) - return DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id)) + return DB_VIEW(/datum/view_record/statistic_medal, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id)) /datum/medals_view_tgui/given_medals/tgui_interact(mob/user, datum/tgui/ui) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 4d0ef56b9fdd..59cbf3b1c90e 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -300,8 +300,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( next_external_rsc = WRAP(next_external_rsc+1, 1, length(external_rsc_urls)+1) preload_rsc = external_rsc_urls[next_external_rsc] - player_entity = setup_player_entity(ckey) - if(check_localhost_status()) var/datum/admins/admin = new("!localhost!", RL_HOST, ckey) admin.associate(src) @@ -535,11 +533,10 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( return if(GLOB.player_entities["[ckey]"]) return GLOB.player_entities["[ckey]"] - var/datum/entity/player_entity/P = new() + var/datum/player_entity/P = new() P.ckey = ckey - P.name = ckey + P.entity_name = ckey GLOB.player_entities["[ckey]"] = P - // P.setup_save(ckey) return P /proc/save_player_entities() @@ -811,12 +808,6 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list( total_xeno_playtime += get_job_playtime(src, JOB_XENOMORPH) - if(player_entity) - var/past_xeno_playtime = player_entity.get_playtime(STATISTIC_XENO) - if(past_xeno_playtime) - total_xeno_playtime += past_xeno_playtime - - cached_xeno_playtime = total_xeno_playtime return total_xeno_playtime diff --git a/code/modules/cm_tech/implements/implants.dm b/code/modules/cm_tech/implements/implants.dm index e008512138b9..131bd925cdfa 100644 --- a/code/modules/cm_tech/implements/implants.dm +++ b/code/modules/cm_tech/implements/implants.dm @@ -105,7 +105,7 @@ if(uses <= 0) return - user.count_statistic_stat(STATISTICS_IMPLANTS_IMPLANTED) + M.count_statistic_stat(STATISTICS_IMPLANTS_IMPLANTED) if(LAZYISIN(M.implants, implant_type)) QDEL_NULL(M.implants[implant_type]) diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm index dd9a111a2874..2b3590d6be47 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm @@ -169,7 +169,7 @@ age = XENO_NORMAL - var/datum/entity/statistic/statistic = client?.player_data?.player_entity?.get_statistic(faction.faction_name, STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) + var/datum/entity/statistic/statistic = client?.player_data?.player_entity?.get_statistic(faction, STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) total_facehugs = statistic.value switch(total_facehugs) if(FACEHUG_TIER_1 to FACEHUG_TIER_2) diff --git a/code/modules/mob/mob_verbs.dm b/code/modules/mob/mob_verbs.dm index 180882a00528..ea5a37506e4e 100644 --- a/code/modules/mob/mob_verbs.dm +++ b/code/modules/mob/mob_verbs.dm @@ -31,14 +31,14 @@ to_chat(usr, SPAN_DANGER("This mob type cannot throw items.")) return -/mob/verb/view_stats() +/mob/verb/view_playtimes() set category = "OOC.Records" set name = "View Playtimes" set desc = "View your playtimes." if(!SSentity_manager.ready) to_chat(src, "DB is still starting up, please wait") return - if(client && client.player_entity) + if(client?.player_data) client.player_data.tgui_interact(src) /mob/verb/toggle_high_toss() diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index d09343ba5ed4..70b733ceb752 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -281,16 +281,17 @@ hive.stored_larva++ hive.hive_ui.update_burrowed_larva() - if(character.mind && character.mind.player_entity) - var/datum/entity/player_entity/player = character.mind.player_entity - if(player.get_playtime(STATISTIC_HUMAN) == 0 && player.get_playtime(STATISTIC_XENO) == 0) + if(character.mind && character.client.player_data) + var/list/xeno_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_xeno_playtime") + var/list/marine_playtimes = LAZYACCESS(character.client.player_data.playtime_data, "stored_human_playtime") + if(!xeno_playtimes && !marine_playtimes) msg_admin_niche("NEW JOIN: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") if(character.client) - var/client/client = character.client - if(client.player_data && client.player_data.playtime_loaded && length(client.player_data.playtimes) == 0) + var/client/C = character.client + if(C.player_data && C.player_data.playtime_loaded && length(C.player_data.playtimes) == 0) msg_admin_niche("NEW PLAYER: [key_name(character, 1, 1, 0)]. IP: [character.lastKnownIP], CID: [character.computer_id]") - if(client.player_data && client.player_data.playtime_loaded && ((round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= CONFIG_GET(number/notify_new_player_age))) - msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(client.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [get_actual_job_name(character)] - Current location: [get_area(character)]") + if(C.player_data && C.player_data.playtime_loaded && ((round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1)) <= 5)) + msg_sea("NEW PLAYER: [key_name(character, 0, 1, 0)] only has [(round(C.get_total_human_playtime() DECISECONDS_TO_HOURS, 0.1))] hours as a human. Current role: [character.job] - Current location: [get_area(character)]") character.client.init_verbs() qdel(src) diff --git a/tgui/packages/tgui/interfaces/KillPanel.jsx b/tgui/packages/tgui/interfaces/KillPanel.jsx deleted file mode 100644 index 535c7eda4b78..000000000000 --- a/tgui/packages/tgui/interfaces/KillPanel.jsx +++ /dev/null @@ -1,62 +0,0 @@ -import { Fragment } from 'react'; - -import { useBackend } from '../backend'; -import { Box, Collapsible, NoticeBox, Section } from '../components'; -import { Window } from '../layouts'; - -export const KillPanel = (props) => { - const { act, data } = useBackend(); - const { death_data } = data; - - const real_data = death_data['death_stats_list']; - - return ( - - -
- {death_data ? ( - - ) : ( - No recorded kills! - )} -
-
-
- ); -}; - -const KillView = (props) => { - const { act, data } = useBackend(); - const { death_data } = data; - - const real_data = death_data['death_stats_list']; - - return real_data.map((entry, index) => ( - - Mob: {entry.mob_name} - {entry.job_name ? ( - <> - - Job: {entry.job_name} - - ) : null} - - Area: {entry.area_name} - - Cause: {entry.cause_name} - - Time: {entry.time_of_death} - - Lifespan: {entry.total_time_alive} - - Damage taken: {entry.total_damage_taken} - - - Coords: {entry.x}, {entry.y}, {entry.z} - - - )); -}; diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx new file mode 100644 index 000000000000..ddb56b1e8de2 --- /dev/null +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -0,0 +1,393 @@ +import { Fragment } from 'react'; + +import { useBackend, useLocalState } from '../backend'; +import { + Box, + Collapsible, + Flex, + NoticeBox, + Section, + Tabs, +} from '../components'; +import { Window } from '../layouts'; + +export const Statistic = (props, context) => { + const { act, data } = useBackend(context); + const [selectedTab, setSelectedTab] = useLocalState( + context, + 'selectedTab', + 0, + ); + + const { data_tabs, round, medals } = data; + + return ( + + + + + + act('update')} + > + Update + + {data_tabs.map((tab) => ( + setSelectedTab(tab)} + > + {tab} + + ))} + + + + + + + + + + + + + + + + + ); +}; + +const GetTab = (props, context) => { + const { act, data } = useBackend(context); + const { factions } = data; + const { selectedTab, round, medals } = props; + + switch (selectedTab) { + case 'Round': + return ( + +
+ + Name: {round.name} + Gamemode: {round.game_mode} + Map: {round.map_name} + Result: {round.round_result} + Round Start: {round.real_time_start} + Round Time End: {round.real_time_end} + Round Length: {round.round_length} + {round.round_hijack_time ? ( + Hijack Time: {round.round_hijack_time} + ) : null} + Total Shots Fired: {round.total_projectiles_fired} + Total Shots Hit: {round.total_projectiles_hit} + + Total Shots Hit (Human): {round.total_projectiles_hit_human} + + + Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} + + Total Slashes: {round.total_slashes} + + Total Shots Hit (FF): {round.total_friendly_fire_instances} + + Total FF Kills: {round.total_friendly_kills} + Total Huggers Applied: {round.total_huggers_applied} + Total Larva Burst: {round.total_larva_burst} + {round.end_round_player_population ? ( + Final Population: {round.end_round_player_population} + ) : null} + Total Deaths: {round.total_deaths} + {round.Participants ? ( + <> + + + Participants: + {round.Participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + + + + + ))} + + + ) : null} + {round.hijack_participants ? ( + <> + + + Hijack Participants: + {round.hijack_participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + + + + + ))} + + + ) : null} + {round.final_participants ? ( + <> + + + Final Participants: + {round.final_participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + + + + + ))} + + + ) : null} + +
+ {round.death_list ? ( + + ) : ( + No recorded kills! + )} +
+ ); + case 'Medals': + return ( +
+ {medals.map((entry, index) => ( + + + Round ID: {entry.round_id} + Medal Type: {entry.medal_type} + Recipient: {entry.recipient} + Recipient Job: {entry.recipient_job} + Citation: {entry.citation} + Giver: {entry.giver} + + + + ))} +
+ ); + default: + if (!factions[selectedTab]) return; + return ; + } +}; + +const StatTab = (props, context) => { + const { faction } = props; + return ( + + {faction.statistics.length ? ( + <> +
+ {faction.statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + + ))} +
+ + + ) : null} + {faction.top_statistics.length ? ( + <> +
+ {faction.top_statistics.map((entry, index) => ( + + + {entry.name} + {entry.statistics.length ? ( + <> + + {entry.statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + + ))} + + ) : null} + + + + ))} +
+ + + ) : null} + {faction.nemesis.length ? ( + <> +
+ + {faction.nemesis.name}: {faction.nemesis.value} + +
+ + + ) : null} + {faction.death_list.length ? ( + + ) : ( + No recorded deaths! + )} + +
+ {faction.statistics_list.length ? ( + + {faction.statistics_list.map((entry, index) => ( + + {entry.value.length ? ( + <> + + {entry.value.map((entry, index) => ( + + + {entry.name} + {entry.statistics.length ? ( + + Statistics + + {entry.statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + ))} + + ) : null} + + {entry.top_statistics.length ? ( + + Top Statistics + + {entry.top_statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + ))} + + ) : null} + + + + ))} + + ) : null} + + ))} + + ) : null} +
+
+ ); +}; + +const KillView = (props, context) => { + const { real_data } = props; + return ( +
+ + {real_data.map((entry, index) => ( + + Mob: {entry.mob_name} + {entry.job_name ? ( + <> + + Job: {entry.job_name} + + ) : null} + + Area: {entry.area_name} + + Cause: {entry.cause_name} + + Time: {entry.time_of_death} + + Lifespan: {entry.total_time_alive} + + Damage taken: {entry.total_damage_taken} + + + Coords: {entry.x}, {entry.y}, {entry.z} + + + ))} + +
+ ); +}; From d06188772b71ea90d2f053c8c3a898da89c2d936 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:26:43 +0500 Subject: [PATCH 21/69] remaining shit --- code/modules/admin/player_panel/actions/general.dm | 12 +++++++++++- code/modules/mob/new_player/new_player.dm | 13 +++++++++++++ tgui/packages/tgui/interfaces/PlayerPanel.jsx | 9 +++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/player_panel/actions/general.dm b/code/modules/admin/player_panel/actions/general.dm index e4ebc9fb85dd..07b648cf0510 100644 --- a/code/modules/admin/player_panel/actions/general.dm +++ b/code/modules/admin/player_panel/actions/general.dm @@ -209,11 +209,11 @@ action_tag = "access_variables" name = "Access Variables" - /datum/player_action/access_variables/act(client/user, mob/target, list/params) user.debug_variables(target) return TRUE + /datum/player_action/access_playtimes action_tag = "access_playtimes" name = "Access Playtimes" @@ -224,6 +224,16 @@ return TRUE +/datum/player_action/access_statistics + action_tag = "access_statistics" + name = "Access Statistics" + +/datum/player_action/access_statistics/act(client/user, mob/target, list/params) + target?.client?.player_data?.player_entity.tgui_interact(user.mob) + + return TRUE + + /datum/player_action/access_admin_datum action_tag = "access_admin_datum" name = "Access Admin Datum" diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 70b733ceb752..ebb58f9d5cc1 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -46,6 +46,8 @@ output += "

View Playtimes

" + output += "

View Statistic

" + if(round_start) output += "

\[ [ready? "Ready":"Ready"] | [ready? "Not Ready":"Not Ready"] \]

" output += "Be Xenomorph: [(client.prefs && (client.prefs.get_job_priority(JOB_XENOMORPH))) ? "Yes" : "No"]" @@ -94,6 +96,17 @@ client.player_data.tgui_interact(src) return 1 + if("show_statistics") + if(SSticker.current_state < GAME_STATE_PREGAME) + to_chat(src, SPAN_WARNING(client.auto_lang(LANGUAGE_LOBBY_WAIT))) + return + if(!SSentity_manager.initialized) + to_chat(src, SPAN_WARNING(client.auto_lang(LANGUAGE_LOBBY_WAIT_DB))) + return + if(client?.player_data?.player_entity) + client.player_data.player_entity.tgui_interact(src) + return 1 + if("ready") if( (SSticker.current_state <= GAME_STATE_PREGAME) && !ready) // Make sure we don't ready up after the round has started ready = TRUE diff --git a/tgui/packages/tgui/interfaces/PlayerPanel.jsx b/tgui/packages/tgui/interfaces/PlayerPanel.jsx index 099c0950a3bc..d760dcc79943 100644 --- a/tgui/packages/tgui/interfaces/PlayerPanel.jsx +++ b/tgui/packages/tgui/interfaces/PlayerPanel.jsx @@ -131,6 +131,15 @@ export const PlayerPanel = (props) => { View Playtimes + + + From 48fd9ad5a5639002f0fe7bb68d22dd9dab81e88d Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:27:08 +0500 Subject: [PATCH 22/69] f --- code/modules/mob/new_player/new_player.dm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index ebb58f9d5cc1..9405e77c668f 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -97,11 +97,8 @@ return 1 if("show_statistics") - if(SSticker.current_state < GAME_STATE_PREGAME) - to_chat(src, SPAN_WARNING(client.auto_lang(LANGUAGE_LOBBY_WAIT))) - return - if(!SSentity_manager.initialized) - to_chat(src, SPAN_WARNING(client.auto_lang(LANGUAGE_LOBBY_WAIT_DB))) + if(!SSentity_manager.ready) + to_chat(src, "DB is still starting up, please wait") return if(client?.player_data?.player_entity) client.player_data.player_entity.tgui_interact(src) From b65b86159ea0fdf0f5058674acb6a59c4a693415 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:27:32 +0500 Subject: [PATCH 23/69] krill yourself IB --- code/datums/statistics/random_facts/ib_fact.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/statistics/random_facts/ib_fact.dm b/code/datums/statistics/random_facts/ib_fact.dm index dca8c303b744..8d93bc755ef0 100644 --- a/code/datums/statistics/random_facts/ib_fact.dm +++ b/code/datums/statistics/random_facts/ib_fact.dm @@ -5,5 +5,5 @@ /datum/random_fact/ib/life_grab_stat(mob/fact_mob) return fact_mob.life_ib_total -/datum/random_fact/ib/death_grab_stat(datum/entity/statistic/death/fact_death) +/datum/random_fact/ib/death_grab_stat(datum/entity/statistic_death/fact_death) return fact_death.total_ib_fixed From fc5e6ea5eee0ff5ed29a43814205e4c231705690 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:31:46 +0500 Subject: [PATCH 24/69] WOW! slow down, wtf this doing here... probably somewhere I messed up --- code/controllers/subsystem/playtime.dm | 37 +----- code/datums/entities/player_times.dm | 2 +- tgui/packages/tgui/interfaces/Playtime.tsx | 138 +++++---------------- 3 files changed, 31 insertions(+), 146 deletions(-) diff --git a/code/controllers/subsystem/playtime.dm b/code/controllers/subsystem/playtime.dm index cc470c5f00b2..6813c4fabd78 100644 --- a/code/controllers/subsystem/playtime.dm +++ b/code/controllers/subsystem/playtime.dm @@ -1,46 +1,11 @@ SUBSYSTEM_DEF(playtime) name = "Playtime" wait = 1 MINUTES - init_order = SS_INIT_PLAYTIME priority = SS_PRIORITY_PLAYTIME - flags = SS_KEEP_TIMING + flags = SS_NO_INIT | SS_KEEP_TIMING - var/list/best_playtimes = list() var/list/currentrun = list() -/datum/controller/subsystem/playtime/Initialize() - get_best_playtimes() - return SS_INIT_SUCCESS - -/datum/controller/subsystem/playtime/proc/get_best_playtimes() - set waitfor = FALSE - set background = TRUE - - WAIT_DB_READY - - var/list/datum/view_record/playtime/PTs = DB_VIEW(/datum/view_record/playtime) - var/list/real_best_playtimes = list() - for(var/datum/view_record/playtime/PT as anything in PTs) - CHECK_TICK - if(!(PT.role_id in real_best_playtimes)) - real_best_playtimes[PT.role_id] = list(PT.total_minutes, PT) - continue - if(real_best_playtimes[PT.role_id][1] > PT.total_minutes) - continue - real_best_playtimes[PT.role_id] = list(PT.total_minutes, PT) - - for(var/role_name in real_best_playtimes) - CHECK_TICK - var/list/info_list = real_best_playtimes[role_name] - var/datum/view_record/playtime/PT = info_list[2] - if(!PT) - continue - var/datum/view_record/players/player = SAFEPICK(DB_VIEW(/datum/view_record/players, DB_COMP("id", DB_EQUALS, PT.player_id))) - if(!player) - stack_trace("[PT.player_id] not found for [PT.role_id] (tell a dev, db fucked up).") - continue - best_playtimes += list(list("ckey" = player.ckey) + PT.get_nanoui_data()) - /datum/controller/subsystem/playtime/fire(resumed = FALSE) if (!resumed) src.currentrun = GLOB.clients.Copy() diff --git a/code/datums/entities/player_times.dm b/code/datums/entities/player_times.dm index b8343b657b72..4fc28ba2fa5e 100644 --- a/code/datums/entities/player_times.dm +++ b/code/datums/entities/player_times.dm @@ -78,7 +78,7 @@ BSQL_PROTECT_DATUM(/datum/entity/player_time) /datum/entity/player/ui_data(mob/user) if(!LAZYACCESS(playtime_data, "loaded")) load_timestat_data() - return list("playtime" = playtime_data, "playtimeglob" = SSplaytime.best_playtimes) + return playtime_data /datum/entity/player/ui_state(mob/user) return GLOB.always_state diff --git a/tgui/packages/tgui/interfaces/Playtime.tsx b/tgui/packages/tgui/interfaces/Playtime.tsx index c1f1d116efd5..d09726a0c415 100644 --- a/tgui/packages/tgui/interfaces/Playtime.tsx +++ b/tgui/packages/tgui/interfaces/Playtime.tsx @@ -14,26 +14,12 @@ interface PlaytimeRecord { icondisplay: string | undefined; } -interface PlaytimeRecordGlob { - ckey: string; - job: string; - playtime: number; - bgcolor: string; - textcolor: string; - icondisplay: string | undefined; -} - -interface PlaytimeRowsPrivate { +interface PlaytimeData { stored_human_playtime: PlaytimeRecord[]; stored_xeno_playtime: PlaytimeRecord[]; stored_other_playtime: PlaytimeRecord[]; } -interface PlaytimeRows { - playtime: PlaytimeRowsPrivate; - playtimeglob: PlaytimeRecordGlob[]; -} - const PlaytimeRow = (props: { readonly data: PlaytimeRecord }) => { return ( <> @@ -58,33 +44,6 @@ const PlaytimeRow = (props: { readonly data: PlaytimeRecord }) => { ); }; -const PlaytimeRowGlob = (props: { readonly data: PlaytimeRecordGlob }) => { - return ( - <> - - {props.data.icondisplay && ( - - )} - - - {props.data.job} - - - {props.data.ckey} - - - {props.data.playtime.toFixed(1)} hr - - - ); -}; - const PlaytimeTable = (props: { readonly data: PlaytimeRecord[] }) => { return ( @@ -100,91 +59,52 @@ const PlaytimeTable = (props: { readonly data: PlaytimeRecord[] }) => { ); }; -const PlaytimeTableGlob = (props: { readonly data: PlaytimeRecordGlob[] }) => { - return ( -
- {props.data - .filter((x) => x.playtime !== 0) - .map((x) => ( - - - - ))} -
- ); -}; - export const Playtime = (props) => { - const { data } = useBackend(); - const { playtime, playtimeglob } = data; - const [selected, setSelected] = useState('private'); - const [selectedplaytime, setSelectedplaytime] = useState('human'); + const { data } = useBackend(); + const [selected, setSelected] = useState('human'); const humanTime = - playtime.stored_human_playtime.length > 0 - ? playtime.stored_human_playtime[0].playtime + data.stored_human_playtime.length > 0 + ? data.stored_human_playtime[0].playtime : 0; const xenoTime = - playtime.stored_xeno_playtime.length > 0 - ? playtime.stored_xeno_playtime[0].playtime + data.stored_xeno_playtime.length > 0 + ? data.stored_xeno_playtime[0].playtime : 0; const otherTime = - playtime.stored_other_playtime.length > 0 - ? playtime.stored_other_playtime[0].playtime + data.stored_other_playtime.length > 0 + ? data.stored_other_playtime[0].playtime : 0; - return ( setSelected('global')} + selected={selected === 'human'} + onClick={() => setSelected('human')} + > + Human ({humanTime} hr) + + setSelected('xeno')} > - Global + Xeno ({xenoTime} hr) setSelected('private')} + selected={selected === 'other'} + onClick={() => setSelected('other')} > - Private + Other ({otherTime} hr) - {selected === 'global' ? ( - - -
- ) : ( - - - setSelectedplaytime('human')} - > - Human ({humanTime} hr) - - setSelectedplaytime('xeno')} - > - Xeno ({xenoTime} hr) - - setSelectedplaytime('other')} - > - Other ({otherTime} hr) - - - {selectedplaytime === 'human' && ( - - )} - {selectedplaytime === 'xeno' && ( - - )} - {selectedplaytime === 'other' && ( - - )} -
+ {selected === 'human' && ( + + )} + {selected === 'xeno' && ( + + )} + {selected === 'other' && ( + )}
From 8cc34f1ce3748875f7aabe03a2660148c8309d62 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:32:57 +0500 Subject: [PATCH 25/69] messed up --- .../statistics/entities/player_entity.dm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 3cbdc93e21c9..fefe59e475f5 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -11,16 +11,16 @@ var/value /datum/entity_meta/statistic - entity_type = /datum/entity/statistic - table_name = "player_statistic" - field_types = list( - "player_id" = DB_FIELDTYPE_BIGINT, + entity_type = /datum/entity/statistic + table_name = "player_statistic" + field_types = list( + "player_id" = DB_FIELDTYPE_BIGINT, "faction" = DB_FIELDTYPE_STRING_LARGE, - "statistic_type" = DB_FIELDTYPE_STRING_LARGE, - "general_name" = DB_FIELDTYPE_STRING_LARGE, - "statistic_name" = DB_FIELDTYPE_STRING_LARGE, - "value" = DB_FIELDTYPE_INT, - ) + "statistic_type" = DB_FIELDTYPE_STRING_LARGE, + "general_name" = DB_FIELDTYPE_STRING_LARGE, + "statistic_name" = DB_FIELDTYPE_STRING_LARGE, + "value" = DB_FIELDTYPE_INT, + ) /proc/track_statistic_earned(faction, statistic_type, general_name, statistic_name, value, datum/entity/player/player) if(!player || !faction || !statistic_type || !general_name || !statistic_name) From e306f7783d8e456051072da455131fd539167eb4 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:38:19 +0500 Subject: [PATCH 26/69] gadsfbgsaduddfibds --- code/datums/statistics/entities/player_entity.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index fefe59e475f5..f10712adcae9 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -26,10 +26,8 @@ if(!player || !faction || !statistic_type || !general_name || !statistic_name) return - // Just in case, because here factions system is litteraly FUCKED UP I need set this check here for **NOW**, **UNITL** faction rework to datum is done if(!(faction in FACTION_LIST_ALL)) - return - // This is done, because if somebody start FUN around with faction names, then his STATISTIC pannel will be fucked up with a lot of faction names... just imagine, open it and see 200+ names, cool? 200% + faction = FACTION_NEUTRAL var/datum/entity/statistic/statistic = player.player_entity?.get_statistic(faction, statistic_type, general_name, statistic_name) if(statistic) @@ -211,7 +209,9 @@ var/datum/statistic_groups/new_group = statistics[faction_to_get] if(!new_group) new_group = new() - new_group.group_name = GLOB.faction_datums[faction_to_get].name +// new_group.group_name = GLOB.faction_datums[faction_to_get].name // FUCK YOU + // FUCK YOU x2 + new_group.group_name = faction_to_get new_group.group_parameter = faction_to_get new_group.player = src statistics[faction_to_get] = new_group From e65ca95e9832c677f75fbe85203ae45021b90fac Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:49:36 +0500 Subject: [PATCH 27/69] krill yourself now... hard to port something from --- code/__DEFINES/__game.dm | 3 --- code/__DEFINES/mode.dm | 10 +++++++++ code/_globalvars/misc.dm | 2 +- .../configuration/entries/general.dm | 2 +- code/controllers/subsystem/ticker.dm | 21 +++++++++---------- code/datums/map_config.dm | 4 ++-- .../colonialmarines/colonialmarines.dm | 4 ++-- .../gamemodes/colonialmarines/huntergames.dm | 4 ++-- .../colonialmarines/whiskey_outpost.dm | 6 +++--- .../gamemodes/colonialmarines/xenovsxeno.dm | 4 ++-- code/game/gamemodes/extended/extended.dm | 4 ++-- .../game/gamemodes/extended/extended_clash.dm | 4 ++-- .../gamemodes/extended/extended_nospawn.dm | 4 ++-- code/game/gamemodes/extended/infection.dm | 4 ++-- code/game/world.dm | 2 +- .../cm_tech/droppod/gear_access_point.dm | 4 ++-- code/modules/events/inflation.dm | 2 +- code/modules/vehicles/apc/apc_command.dm | 4 ++-- 18 files changed, 47 insertions(+), 41 deletions(-) diff --git a/code/__DEFINES/__game.dm b/code/__DEFINES/__game.dm index e667ccf6db3f..dcc9323ab0b4 100644 --- a/code/__DEFINES/__game.dm +++ b/code/__DEFINES/__game.dm @@ -35,9 +35,6 @@ #define MAP_NEW_VARADERO "New Varadero"//ice colony underground but as its own map #define MAP_CHINOOK "Chinook 91 GSO" //admin level -#define GAMEMODE_WHISKEY_OUTPOST "Whiskey Outpost" -#define GAMEMODE_HIVE_WARS "Hive Wars" - /// Number of players before we switch to lowpop maps only (LV, BR, Prison). #define PLAYERCOUNT_LOWPOP_MAP_LIMIT 130 /// Time before the round starts. diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index 7a03b03146c5..fcede20ddb33 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -36,6 +36,16 @@ //================================================= +#define MODE_NAME_EXTENDED "Extended" +#define MODE_NAME_EXTENDED_NO_SPAWN "Extended - No Spawn" +#define MODE_NAME_DISTRESS_SIGNAL "Distress Signal" +#define MODE_NAME_FACTION_CLASH "Faction Clash" +#define MODE_NAME_WISKEY_OUTPOST "Whiskey Outpost" +#define MODE_NAME_HUNTER_GAMES "Hunter Games" +#define MODE_NAME_HIVE_WARS "Hive Wars" +#define MODE_NAME_INFECTION "Infection" + +//================================================= #define IS_MODE_COMPILED(MODE) (ispath(text2path("/datum/game_mode/"+(MODE)))) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index 5d7955d85013..01f226c66548 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -87,7 +87,7 @@ GLOBAL_VAR_INIT(perf_flags, NO_FLAGS) GLOBAL_LIST_INIT(bitflags, list((1<<0), (1<<1), (1<<2), (1<<3), (1<<4), (1<<5), (1<<6), (1<<7), (1<<8), (1<<9), (1<<10), (1<<11), (1<<12), (1<<13), (1<<14), (1<<15), (1<<16), (1<<17), (1<<18), (1<<19), (1<<20), (1<<21), (1<<22), (1<<23))) -GLOBAL_VAR_INIT(master_mode, "Distress Signal") +GLOBAL_VAR_INIT(master_mode, MODE_NAME_DISTRESS_SIGNAL) GLOBAL_VAR_INIT(timezoneOffset, 0) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 627859369231..7d51cc769ed2 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -271,7 +271,7 @@ Voting // Gamemode to auto-switch to at the start of the round /datum/config_entry/string/gamemode_default - config_entry_value = "Extended" + config_entry_value = MODE_NAME_EXTENDED /datum/config_entry/number/rounds_until_hard_restart config_entry_value = -1 // -1 is disabled by default, 0 is every round, x is after so many rounds diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index c3648df6ba29..44138d6ee2fe 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -176,8 +176,6 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/proc/setup() to_chat(world, SPAN_BOLDNOTICE("Enjoy the game!")) var/init_start = world.timeofday - //Create and announce mode - mode = config.pick_mode(GLOB.master_mode) CHECK_TICK if(!mode.can_start(bypass_checks)) @@ -202,13 +200,11 @@ SUBSYSTEM_DEF(ticker) handle_map_reboot() else to_chat(world, "Attempting again...") - QDEL_NULL(mode) GLOB.RoleAuthority.reset_roles() return FALSE CHECK_TICK if(!mode.pre_setup() && !bypass_checks) - QDEL_NULL(mode) to_chat(world, "Error in pre-setup for [GLOB.master_mode]. Reverting to pre-game lobby.") GLOB.RoleAuthority.reset_roles() return FALSE @@ -235,9 +231,6 @@ SUBSYSTEM_DEF(ticker) LAZYCLEARLIST(round_start_events) CHECK_TICK - // We need stats to track roundstart role distribution. - mode.setup_round_stats() - //Configure mode and assign player to special mode stuff if (!(mode.flags_round_type & MODE_NO_SPAWN)) var/roles_to_roll = null @@ -359,11 +352,17 @@ SUBSYSTEM_DEF(ticker) /datum/controller/subsystem/ticker/proc/load_mode() - var/mode = trim(file2text("data/mode.txt")) - if(mode) - GLOB.master_mode = SSmapping.configs[GROUND_MAP].force_mode ? SSmapping.configs[GROUND_MAP].force_mode : mode + var/cfg_mode = trim(file2text("data/mode.txt")) + if(SSmapping?.configs?[GROUND_MAP].force_mode) + GLOB.master_mode = SSmapping.configs[GROUND_MAP].force_mode + else if(cfg_mode) + GLOB.master_mode = cfg_mode else - GLOB.master_mode = "Extended" + GLOB.master_mode = MODE_NAME_EXTENDED + + mode = config.pick_mode(GLOB.master_mode) + mode.setup_round_stats() + log_game("Saved mode is '[GLOB.master_mode]'") diff --git a/code/datums/map_config.dm b/code/datums/map_config.dm index fc527f07a9e0..2a8745e1e35a 100644 --- a/code/datums/map_config.dm +++ b/code/datums/map_config.dm @@ -378,10 +378,10 @@ if(!(g in gamemode_names)) log_world("map_config has an invalid gamemode name!") return - if(g == "Extended") // always allow extended + if(g == MODE_NAME_EXTENDED) // always allow extended continue gamemodes += g - gamemodes += "Extended" + gamemodes += MODE_NAME_EXTENDED else if(!isnull(json["gamemodes"])) log_world("map_config gamemodes is not a list!") return diff --git a/code/game/gamemodes/colonialmarines/colonialmarines.dm b/code/game/gamemodes/colonialmarines/colonialmarines.dm index 2cf394fa3346..c3b34e129422 100644 --- a/code/game/gamemodes/colonialmarines/colonialmarines.dm +++ b/code/game/gamemodes/colonialmarines/colonialmarines.dm @@ -3,8 +3,8 @@ #define LZ_HAZARD_START (3 MINUTES) /datum/game_mode/colonialmarines - name = "Distress Signal" - config_tag = "Distress Signal" + name = MODE_NAME_DISTRESS_SIGNAL + config_tag = MODE_NAME_DISTRESS_SIGNAL required_players = 1 //Need at least one player, but really we need 2. xeno_required_num = 1 //Need at least one xeno. monkey_amount = 5 diff --git a/code/game/gamemodes/colonialmarines/huntergames.dm b/code/game/gamemodes/colonialmarines/huntergames.dm index 3fb6d902aa43..55ea45eba32b 100644 --- a/code/game/gamemodes/colonialmarines/huntergames.dm +++ b/code/game/gamemodes/colonialmarines/huntergames.dm @@ -86,8 +86,8 @@ //Digging through this is a pain. I'm leaving it mostly alone until a full rework takes place. /datum/game_mode/huntergames - name = "Hunter Games" - config_tag = "Hunter Games" + name = MODE_NAME_HUNTER_GAMES + config_tag = MODE_NAME_HUNTER_GAMES required_players = 1 flags_round_type = MODE_NO_LATEJOIN latejoin_larva_drop = 0 //You never know diff --git a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm index 31e6635bfa43..e74922e19b29 100644 --- a/code/game/gamemodes/colonialmarines/whiskey_outpost.dm +++ b/code/game/gamemodes/colonialmarines/whiskey_outpost.dm @@ -2,13 +2,13 @@ //Global proc for checking if the game is whiskey outpost so I dont need to type if(gamemode == whiskey outpost) 50000 times /proc/Check_WO() - if(SSticker.mode == GAMEMODE_WHISKEY_OUTPOST || GLOB.master_mode == GAMEMODE_WHISKEY_OUTPOST) + if(SSticker.mode == MODE_NAME_WISKEY_OUTPOST || GLOB.master_mode == MODE_NAME_WISKEY_OUTPOST) return 1 return 0 /datum/game_mode/whiskey_outpost - name = GAMEMODE_WHISKEY_OUTPOST - config_tag = GAMEMODE_WHISKEY_OUTPOST + name = MODE_NAME_WISKEY_OUTPOST + config_tag = MODE_NAME_WISKEY_OUTPOST required_players = 140 xeno_bypass_timer = 1 flags_round_type = MODE_NEW_SPAWN diff --git a/code/game/gamemodes/colonialmarines/xenovsxeno.dm b/code/game/gamemodes/colonialmarines/xenovsxeno.dm index 9d71cf3cae01..6be119736459 100644 --- a/code/game/gamemodes/colonialmarines/xenovsxeno.dm +++ b/code/game/gamemodes/colonialmarines/xenovsxeno.dm @@ -1,8 +1,8 @@ #define is_hive_living(hive) (!hive.hardcore || hive.living_xeno_queen) /datum/game_mode/xenovs - name = GAMEMODE_HIVE_WARS - config_tag = GAMEMODE_HIVE_WARS + name = MODE_NAME_HIVE_WARS + config_tag = MODE_NAME_HIVE_WARS required_players = 4 //Need at least 4 players xeno_required_num = 4 //Need at least four xenos. monkey_amount = 0.2 // Amount of monkeys per player diff --git a/code/game/gamemodes/extended/extended.dm b/code/game/gamemodes/extended/extended.dm index f5b64571f98c..c04b147b05a9 100644 --- a/code/game/gamemodes/extended/extended.dm +++ b/code/game/gamemodes/extended/extended.dm @@ -1,6 +1,6 @@ /datum/game_mode/extended - name = "Extended" - config_tag = "Extended" + name = MODE_NAME_EXTENDED + config_tag = MODE_NAME_EXTENDED required_players = 0 latejoin_larva_drop = 0 votable = FALSE diff --git a/code/game/gamemodes/extended/extended_clash.dm b/code/game/gamemodes/extended/extended_clash.dm index e0e526d91afa..733d4e4d0a87 100644 --- a/code/game/gamemodes/extended/extended_clash.dm +++ b/code/game/gamemodes/extended/extended_clash.dm @@ -1,6 +1,6 @@ /datum/game_mode/extended/faction_clash - name = "Faction Clash" - config_tag = "Faction Clash" + name = MODE_NAME_FACTION_CLASH + config_tag = MODE_NAME_FACTION_CLASH flags_round_type = MODE_THUNDERSTORM|MODE_FACTION_CLASH toggleable_flags = MODE_NO_SNIPER_SENTRY|MODE_NO_ATTACK_DEAD|MODE_NO_STRIPDRAG_ENEMY|MODE_STRONG_DEFIBS|MODE_BLOOD_OPTIMIZATION|MODE_NO_COMBAT_CAS taskbar_icon = 'icons/taskbar/gml_hvh.png' diff --git a/code/game/gamemodes/extended/extended_nospawn.dm b/code/game/gamemodes/extended/extended_nospawn.dm index 6835671ace85..2349c39655a3 100644 --- a/code/game/gamemodes/extended/extended_nospawn.dm +++ b/code/game/gamemodes/extended/extended_nospawn.dm @@ -1,6 +1,6 @@ /datum/game_mode/extended/nospawn - name = "Extended - No Spawn" - config_tag = "Extended - No Spawn" + name = MODE_NAME_EXTENDED_NO_SPAWN + config_tag = MODE_NAME_EXTENDED_NO_SPAWN flags_round_type = MODE_NO_LATEJOIN|MODE_NO_SPAWN votable = FALSE diff --git a/code/game/gamemodes/extended/infection.dm b/code/game/gamemodes/extended/infection.dm index 1f641917d53f..8cb2d07aa23d 100644 --- a/code/game/gamemodes/extended/infection.dm +++ b/code/game/gamemodes/extended/infection.dm @@ -1,7 +1,7 @@ //THIS IS A BLANK LABEL ONLY SO PEOPLE CAN SEE WHEN WE RUNNIN DIS BITCH. Should probably write a real one one day. Maybe. /datum/game_mode/infection - name = "Infection" - config_tag = "Infection" + name = MODE_NAME_INFECTION + config_tag = MODE_NAME_INFECTION required_players = 0 //otherwise... no zambies latejoin_larva_drop = 0 flags_round_type = MODE_INFECTION //Apparently without this, the game mode checker ignores this as a potential legit game mode. diff --git a/code/game/world.dm b/code/game/world.dm index 101066c21cdb..db049dae9208 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -93,7 +93,7 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt")) // If the server's configured for local testing, get everything set up ASAP. // Shamelessly stolen from the test manager's host_tests() proc if(testing_locally) - GLOB.master_mode = "Extended" + GLOB.master_mode = MODE_NAME_EXTENDED // Wait for the game ticker to initialize while(!SSticker.initialized) diff --git a/code/modules/cm_tech/droppod/gear_access_point.dm b/code/modules/cm_tech/droppod/gear_access_point.dm index 608fd33e18f4..bc6470e50a41 100644 --- a/code/modules/cm_tech/droppod/gear_access_point.dm +++ b/code/modules/cm_tech/droppod/gear_access_point.dm @@ -43,9 +43,9 @@ return /obj/structure/techpod_vendor/proc/get_access_permission(mob/living/carbon/human/user) - if(SSticker.mode == GAMEMODE_WHISKEY_OUTPOST || GLOB.master_mode == GAMEMODE_WHISKEY_OUTPOST) //all WO has lifted access restrictions + if(SSticker.mode == MODE_NAME_WISKEY_OUTPOST || GLOB.master_mode == MODE_NAME_WISKEY_OUTPOST) //all WO has lifted access restrictions return TRUE - else if(SSticker.mode == "Distress Signal" || GLOB.master_mode == "Distress Signal") + else if(SSticker.mode.name == MODE_NAME_DISTRESS_SIGNAL || GLOB.master_mode == MODE_NAME_DISTRESS_SIGNAL) if(access_settings_override) //everyone allowed to grab stuff return TRUE else if(user.get_target_lock(faction_requirement)) //only it's faction group allowed diff --git a/code/modules/events/inflation.dm b/code/modules/events/inflation.dm index b410d9795838..2ebdfc17d084 100644 --- a/code/modules/events/inflation.dm +++ b/code/modules/events/inflation.dm @@ -6,7 +6,7 @@ min_players = 1 max_occurrences = 1 // we can increase the number once there's more random events around - 3 is a good number alert_observers = FALSE - gamemode_blacklist = list(GAMEMODE_WHISKEY_OUTPOST, GAMEMODE_HIVE_WARS) + gamemode_blacklist = list(MODE_NAME_WISKEY_OUTPOST, MODE_NAME_HIVE_WARS) /datum/round_event/economy_inflation announce_when = 1 diff --git a/code/modules/vehicles/apc/apc_command.dm b/code/modules/vehicles/apc/apc_command.dm index 8d056daec2ea..493692241c83 100644 --- a/code/modules/vehicles/apc/apc_command.dm +++ b/code/modules/vehicles/apc/apc_command.dm @@ -182,9 +182,9 @@ //stole my own code from techpod_vendor /obj/vehicle/multitile/apc/command/proc/get_access_permission(mob/living/carbon/human/user) - if(SSticker.mode == GAMEMODE_WHISKEY_OUTPOST || GLOB.master_mode == GAMEMODE_WHISKEY_OUTPOST) + if(SSticker.mode == MODE_NAME_WISKEY_OUTPOST || GLOB.master_mode == MODE_NAME_WISKEY_OUTPOST) return TRUE - else if(SSticker.mode == "Distress Signal" || GLOB.master_mode == "Distress Signal") + else if(SSticker.mode.name == MODE_NAME_DISTRESS_SIGNAL || GLOB.master_mode == MODE_NAME_DISTRESS_SIGNAL) if(techpod_access_settings_override) return TRUE else if(user.get_target_lock(techpod_faction_requirement)) From f104fbf079f93cbb0fd44122dada9ce938fb1b4c Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 03:50:39 +0500 Subject: [PATCH 28/69] krill? --- code/datums/statistics/entities/map_stats.dm | 6 ++-- .../datums/statistics/entities/medal_stats.dm | 28 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/code/datums/statistics/entities/map_stats.dm b/code/datums/statistics/entities/map_stats.dm index ac46cb41a2fa..bc73b54852d0 100644 --- a/code/datums/statistics/entities/map_stats.dm +++ b/code/datums/statistics/entities/map_stats.dm @@ -18,9 +18,9 @@ ) /datum/entity_meta/statistic_map/map(datum/entity/statistic_map/map_entity, list/values) - ..() - if(values["total_victories"]) - map_entity.victories = json_decode(values["total_victories"]) + ..() + if(values["total_victories"]) + map_entity.victories = json_decode(values["total_victories"]) /datum/entity_meta/statistic_map/unmap(datum/entity/statistic_map/map_entity) . = ..() diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index bb07c897e942..bc7be3863025 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -10,20 +10,20 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) /datum/entity_meta/statistic_medal - entity_type = /datum/entity/statistic/medal - table_name = "player_statistic_medal" - field_types = list( - "player_id" = DB_FIELDTYPE_BIGINT, - "round_id" = DB_FIELDTYPE_BIGINT, - - "medal_type" = DB_FIELDTYPE_STRING_LARGE, - "recipient_name" = DB_FIELDTYPE_STRING_LARGE, - "recipient_role" = DB_FIELDTYPE_STRING_LARGE, - "citation" = DB_FIELDTYPE_STRING_MAX, - - "giver_name" = DB_FIELDTYPE_STRING_LARGE, - "giver_player_id" = DB_FIELDTYPE_BIGINT, - ) + entity_type = /datum/entity/statistic/medal + table_name = "player_statistic_medal" + field_types = list( + "player_id" = DB_FIELDTYPE_BIGINT, + "round_id" = DB_FIELDTYPE_BIGINT, + + "medal_type" = DB_FIELDTYPE_STRING_LARGE, + "recipient_name" = DB_FIELDTYPE_STRING_LARGE, + "recipient_role" = DB_FIELDTYPE_STRING_LARGE, + "citation" = DB_FIELDTYPE_STRING_MAX, + + "giver_name" = DB_FIELDTYPE_STRING_LARGE, + "giver_player_id" = DB_FIELDTYPE_BIGINT, + ) /datum/view_record/statistic_medal var/player_id From 683348217d8ca504b458a9426ad5514ae13e1c61 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:02:55 +0500 Subject: [PATCH 29/69] Ehhh, old code... --- code/__DEFINES/subsystems.dm | 6 +++--- code/controllers/subsystem/ticker.dm | 3 +++ code/datums/statistics/entities/player_entity.dm | 10 +++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index 4e8c18ce42f6..9476ffa83586 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -117,8 +117,9 @@ // Do not break this braket #define SS_INIT_DATABASE 27.9 #define SS_INIT_ENTITYMANAGER 27.8 -#define SS_INIT_PREF_LOGGING 27.7 -#define SS_INIT_PLAYTIME 27.6 +#define SS_INIT_TICKER 27.7 +#define SS_INIT_PREF_LOGGING 27.6 +#define SS_INIT_PLAYTIME 27.5 // Do not break this braket #define SS_INIT_GARBAGE 24 #define SS_INIT_EVENTS 23.5 @@ -148,7 +149,6 @@ #define SS_INIT_TIMER 100 #define SS_INIT_UNSPECIFIED 0 #define SS_INIT_ASSETS -20 -#define SS_INIT_TICKER -21 #define SS_INIT_VOTE -23 #define SS_INIT_STICKY -30 #define SS_INIT_PREDSHIPS -31 diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 44138d6ee2fe..47f2e92f2f16 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -53,6 +53,9 @@ SUBSYSTEM_DEF(ticker) var/tutorial_disabled = FALSE /datum/controller/subsystem/ticker/Initialize(timeofday) + if(!SSmapping.configs) + SSmapping.HACK_LoadMapConfig() + load_mode() var/all_music = CONFIG_GET(keyed_list/lobby_music) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index f10712adcae9..472842ed4ef0 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -196,7 +196,15 @@ if(!match_statistic) return FALSE - var/datum/entity/statistic/statistic = match_statistic.statistic_info[statistic_type][general_name][statistic_name] + var/datum/player_statistic/match_statistic_type = match_statistic.statistic_info[statistic_type] + if(!match_statistic_type) + return FALSE + + var/datum/player_statistic_detail/match_detail_statistic = match_statistic_type.statistics[general_name] + if(!match_detail_statistic) + return FALSE + + var/datum/entity/statistic/statistic = match_detail_statistic.statistics[statistic_name] if(!statistic) return FALSE return statistic From 81ff79c881c196cf207910e9f5577f63c3e6674d Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:03:29 +0500 Subject: [PATCH 30/69] space... --- code/datums/statistics/entities/medal_stats.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index bc7be3863025..4940a76c7909 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -49,7 +49,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) "giver_name", "giver_player_id", "id", - ) + ) /datum/player_entity/proc/track_medal_earned(new_medal_type, mob/new_recipient, new_recipient_role, new_citation, mob/giver) From aae267984d1478a49a5758a4e2b8fb954f643ebb Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:25:05 +0500 Subject: [PATCH 31/69] no more useles update tab --- tgui/packages/tgui/interfaces/Statistic.jsx | 241 ++++++++++---------- 1 file changed, 117 insertions(+), 124 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index ddb56b1e8de2..842c2c3d193e 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -27,14 +27,6 @@ export const Statistic = (props, context) => { - act('update')} - > - Update - {data_tabs.map((tab) => ( { case 'Round': return ( -
- - Name: {round.name} - Gamemode: {round.game_mode} - Map: {round.map_name} - Result: {round.round_result} - Round Start: {round.real_time_start} - Round Time End: {round.real_time_end} - Round Length: {round.round_length} - {round.round_hijack_time ? ( - Hijack Time: {round.round_hijack_time} - ) : null} - Total Shots Fired: {round.total_projectiles_fired} - Total Shots Hit: {round.total_projectiles_hit} - - Total Shots Hit (Human): {round.total_projectiles_hit_human} - - - Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} - - Total Slashes: {round.total_slashes} - - Total Shots Hit (FF): {round.total_friendly_fire_instances} - - Total FF Kills: {round.total_friendly_kills} - Total Huggers Applied: {round.total_huggers_applied} - Total Larva Burst: {round.total_larva_burst} - {round.end_round_player_population ? ( - Final Population: {round.end_round_player_population} - ) : null} - Total Deaths: {round.total_deaths} - {round.Participants ? ( - <> - + {round ? ( +
+ + Name: {round.name} + Gamemode: {round.game_mode} + Map: {round.map_name} + Result: {round.round_result} + Round Start: {round.real_time_start} + Round Time End: {round.real_time_end} + Round Length: {round.round_length} + {round.round_hijack_time ? ( + Hijack Time: {round.round_hijack_time} + ) : null} + Total Shots Fired: {round.total_projectiles_fired} + Total Shots Hit: {round.total_projectiles_hit} + + Total Shots Hit (Human): {round.total_projectiles_hit_human} + + + Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} + + Total Slashes: {round.total_slashes} + + Total Shots Hit (FF): {round.total_friendly_fire_instances} + + Total FF Kills: {round.total_friendly_kills} + Total Huggers Applied: {round.total_huggers_applied} + Total Larva Burst: {round.total_larva_burst} + {round.end_round_player_population ? ( - Participants: - {round.Participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} - - - - - ))} + Final Population: {round.end_round_player_population} - - ) : null} - {round.hijack_participants ? ( - <> - - - Hijack Participants: - {round.hijack_participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} + ) : null} + Total Deaths: {round.total_deaths} + {round.Participants ? ( + <> + + + Participants: + {round.Participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + - - - - ))} - - - ) : null} - {round.final_participants ? ( - <> - - - Final Participants: - {round.final_participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} + + + ))} + + + ) : null} + {round.hijack_participants ? ( + <> + + + Hijack Participants: + {round.hijack_participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + - - - - ))} - - - ) : null} - -
- {round.death_list ? ( + + + ))} + + + ) : null} + {round.final_participants ? ( + <> + + + Final Participants: + {round.final_participants.map((entry, index) => ( + + + + {entry.name}: {entry.value} + + + + + ))} + + + ) : null} + +
+ ) : ( + Round statistic prepairing! + )} + {round?.death_list ? ( ) : ( No recorded kills! @@ -288,20 +286,13 @@ const StatTab = (props, context) => { No recorded deaths! )} -
+ <> {faction.statistics_list.length ? ( - +
{faction.statistics_list.map((entry, index) => ( {entry.value.length ? ( <> - {entry.value.map((entry, index) => ( { ))} + ) : null} ))} - +
) : null} -
+ + ); }; From 483fd054399d52c601c470ad151afd3aa79b22a1 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:26:52 +0500 Subject: [PATCH 32/69] some QoL --- code/datums/statistics/entities/panel_stats.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index 08b011dfd880..d57b06410404 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -187,8 +187,8 @@ "name" = round_name, "game_mode" = game_mode, "map_name" = map_name, - "round_result" = round_result, - "real_time_start" = real_time_start, + "round_result" = round_result ? round_result : "In Progress", + "real_time_start" = time2text(real_time_start), "real_time_end" = real_time_end, "round_length" = round_length, "round_hijack_time" = round_hijack_time, From 006f940027ee666113a73bb3a93baf7cd6f5744d Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:32:29 +0500 Subject: [PATCH 33/69] stop runtiming here now --- code/datums/statistics/entities/panel_stats.dm | 8 ++++---- code/game/turfs/space.dm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index d57b06410404..47d5e521edce 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -188,10 +188,10 @@ "game_mode" = game_mode, "map_name" = map_name, "round_result" = round_result ? round_result : "In Progress", - "real_time_start" = time2text(real_time_start), - "real_time_end" = real_time_end, - "round_length" = round_length, - "round_hijack_time" = round_hijack_time, + "real_time_start" = real_time_start ? time2text(real_time_start) : "Not Started", + "real_time_end" = real_time_end ? time2text(real_time_end) : "Not Ended", + "round_length" = round_length ? duration2text(round_length) : "Not Ended", + "round_hijack_time" = round_hijack_time ? time2text(round_hijack_time) : 0, "end_round_player_population" = end_round_player_population, "total_projectiles_fired" = total_projectiles_fired, "total_projectiles_hit" = total_projectiles_hit, diff --git a/code/game/turfs/space.dm b/code/game/turfs/space.dm index 85d406e9f8ed..1da0faa1cedd 100644 --- a/code/game/turfs/space.dm +++ b/code/game/turfs/space.dm @@ -81,7 +81,7 @@ inertial_drift(A) - if(SSticker.mode) + if(SSticker.mode && SSmapping.levels_by_trait(ZTRAIT_GROUND)) // Okay, so let's make it so that people can travel z levels but not nuke disks! From 5fb33bb203a9fc90edb2a1cb92dea298586d2d63 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:40:07 +0500 Subject: [PATCH 34/69] a little bit more qol --- .../datums/statistics/entities/panel_stats.dm | 8 +- tgui/packages/tgui/interfaces/Statistic.jsx | 74 ++++++++++--------- 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index 47d5e521edce..fa292eb4595b 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -187,10 +187,10 @@ "name" = round_name, "game_mode" = game_mode, "map_name" = map_name, - "round_result" = round_result ? round_result : "In Progress", - "real_time_start" = real_time_start ? time2text(real_time_start) : "Not Started", - "real_time_end" = real_time_end ? time2text(real_time_end) : "Not Ended", - "round_length" = round_length ? duration2text(round_length) : "Not Ended", + "round_result" = round_result, + "real_time_start" = real_time_start ? time2text(real_time_start) : 0, + "real_time_end" = real_time_end ? time2text(real_time_end) : 0, + "round_length" = round_length ? duration2text(round_length) : 0, "round_hijack_time" = round_hijack_time ? time2text(round_hijack_time) : 0, "end_round_player_population" = end_round_player_population, "total_projectiles_fired" = total_projectiles_fired, diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 842c2c3d193e..f7f577c2eaf7 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -80,13 +80,19 @@ const GetTab = (props, context) => { Name: {round.name} Gamemode: {round.game_mode} Map: {round.map_name} - Result: {round.round_result} - Round Start: {round.real_time_start} - Round Time End: {round.real_time_end} - Round Length: {round.round_length} - {round.round_hijack_time ? ( + {round.round_result && Result: {round.round_result}} + {round.real_time_start && ( + Round Start: {round.real_time_start} + )} + {round.real_time_end && ( + Round Time End: {round.real_time_end} + )} + {round.round_length && ( + Round Length: {round.round_length} + )} + {round.round_hijack_time && ( Hijack Time: {round.round_hijack_time} - ) : null} + )} Total Shots Fired: {round.total_projectiles_fired} Total Shots Hit: {round.total_projectiles_hit} @@ -102,13 +108,13 @@ const GetTab = (props, context) => { Total FF Kills: {round.total_friendly_kills} Total Huggers Applied: {round.total_huggers_applied} Total Larva Burst: {round.total_larva_burst} - {round.end_round_player_population ? ( + {round.end_round_player_population && ( Final Population: {round.end_round_player_population} - ) : null} + )} Total Deaths: {round.total_deaths} - {round.Participants ? ( + {round.Participants && ( <> @@ -130,8 +136,8 @@ const GetTab = (props, context) => { ))} - ) : null} - {round.hijack_participants ? ( + )} + {round.hijack_participants && ( <> @@ -153,8 +159,8 @@ const GetTab = (props, context) => { ))} - ) : null} - {round.final_participants ? ( + )} + {round.final_participants && ( <> @@ -176,13 +182,13 @@ const GetTab = (props, context) => { ))} - ) : null} + )} ) : ( Round statistic prepairing! )} - {round?.death_list ? ( + {round && round.death_list ? ( ) : ( No recorded kills! @@ -222,7 +228,7 @@ const StatTab = (props, context) => { const { faction } = props; return ( - {faction.statistics.length ? ( + {faction.statistics.length && ( <>
{faction.statistics.map((entry, index) => ( @@ -236,8 +242,8 @@ const StatTab = (props, context) => {
- ) : null} - {faction.top_statistics.length ? ( + )} + {faction.top_statistics.length && ( <>
{faction.top_statistics.map((entry, index) => ( @@ -249,7 +255,7 @@ const StatTab = (props, context) => { }} > {entry.name} - {entry.statistics.length ? ( + {entry.statistics.length && ( <> {entry.statistics.map((entry, index) => ( @@ -261,7 +267,7 @@ const StatTab = (props, context) => { ))} - ) : null} + )} @@ -269,7 +275,7 @@ const StatTab = (props, context) => {
- ) : null} + )} {faction.nemesis.length ? ( <>
@@ -279,7 +285,9 @@ const StatTab = (props, context) => {
- ) : null} + ) : ( + No recorded nemesis! + )} {faction.death_list.length ? ( ) : ( @@ -287,11 +295,11 @@ const StatTab = (props, context) => { )} <> - {faction.statistics_list.length ? ( + {faction.statistics_list.length && (
{faction.statistics_list.map((entry, index) => ( - {entry.value.length ? ( + {entry.value.length && ( <> {entry.value.map((entry, index) => ( @@ -303,7 +311,7 @@ const StatTab = (props, context) => { }} > {entry.name} - {entry.statistics.length ? ( + {entry.statistics.length && ( Statistics @@ -315,9 +323,9 @@ const StatTab = (props, context) => { ))} - ) : null} + )} - {entry.top_statistics.length ? ( + {entry.top_statistics.length && ( Top Statistics @@ -329,19 +337,19 @@ const StatTab = (props, context) => { ))} - ) : null} + )} ))} - ) : null} + )} ))}
- ) : null} - + )} + ); @@ -358,12 +366,12 @@ const KillView = (props, context) => { title={entry.mob_name + ' (' + entry.time_of_death + ')'} > Mob: {entry.mob_name} - {entry.job_name ? ( + {entry.job_name && ( <> Job: {entry.job_name} - ) : null} + )} Area: {entry.area_name} From 29d2ff3a0a0bb83f60fc00efb457e8a607670aed Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:41:40 +0500 Subject: [PATCH 35/69] thanks for returning empty list, then now stop runtiming! --- code/game/turfs/space.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/turfs/space.dm b/code/game/turfs/space.dm index 1da0faa1cedd..5c50e544e495 100644 --- a/code/game/turfs/space.dm +++ b/code/game/turfs/space.dm @@ -81,7 +81,7 @@ inertial_drift(A) - if(SSticker.mode && SSmapping.levels_by_trait(ZTRAIT_GROUND)) + if(SSticker.mode && length(SSmapping.levels_by_trait(ZTRAIT_GROUND))) // Okay, so let's make it so that people can travel z levels but not nuke disks! From a0eb530be06b36f74d3d986b250eb42701e8b7f6 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:44:28 +0500 Subject: [PATCH 36/69] a little bit of explnt for type global and how to use it in future --- code/__DEFINES/statistic.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index d4a5af540555..26b3db4035eb 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -14,7 +14,8 @@ #define STATISTIC_TYPE_JOB "Role" #define STATISTIC_TYPE_WEAPON "Weapon" -#define STATISTIC_TYPE_GLOBAL "global" // Don't have link to a faction +// Used to replace faction name +#define STATISTIC_TYPE_GLOBAL "Global Statistic" // Don't have link to a faction #define STATISTICS_DEATH_LIST_LEN 20 From fa7ef7b79864965a4ab84aea28dd290421e406e3 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:50:35 +0500 Subject: [PATCH 37/69] fun around and tea --- code/datums/statistics/entities/player_entity.dm | 4 ++-- tgui/packages/tgui/interfaces/Statistic.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 472842ed4ef0..db2bea119c47 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -26,7 +26,7 @@ if(!player || !faction || !statistic_type || !general_name || !statistic_name) return - if(!(faction in FACTION_LIST_ALL)) + if(!(faction in FACTION_LIST_ALL + list(STATISTIC_TYPE_GLOBAL))) faction = FACTION_NEUTRAL var/datum/entity/statistic/statistic = player.player_entity?.get_statistic(faction, statistic_type, general_name, statistic_name) @@ -213,7 +213,7 @@ set waitfor = FALSE WAIT_DB_READY if(player) - for(var/faction_to_get in FACTION_LIST_ALL) + for(var/faction_to_get in FACTION_LIST_ALL + list(STATISTIC_TYPE_GLOBAL)) var/datum/statistic_groups/new_group = statistics[faction_to_get] if(!new_group) new_group = new() diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index f7f577c2eaf7..8d9aa0464748 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -188,7 +188,7 @@ const GetTab = (props, context) => { ) : ( Round statistic prepairing! )} - {round && round.death_list ? ( + {round?.death_list.length ? ( ) : ( No recorded kills! From f673c9ca978fd932b236bf5bcd4cf254f105402f Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:54:30 +0500 Subject: [PATCH 38/69] strange issue with zeroes fix --- tgui/packages/tgui/interfaces/Statistic.jsx | 36 +++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 8d9aa0464748..419d7c9f8fbe 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -80,19 +80,21 @@ const GetTab = (props, context) => { Name: {round.name} Gamemode: {round.game_mode} Map: {round.map_name} - {round.round_result && Result: {round.round_result}} - {round.real_time_start && ( + {round.round_result ? ( + Result: {round.round_result} + ) : null} + {round.real_time_start ? ( Round Start: {round.real_time_start} - )} - {round.real_time_end && ( + ) : null} + {round.real_time_end ? ( Round Time End: {round.real_time_end} - )} - {round.round_length && ( + ) : null} + {round.round_length ? ( Round Length: {round.round_length} - )} - {round.round_hijack_time && ( + ) : null} + {round.round_hijack_time ? ( Hijack Time: {round.round_hijack_time} - )} + ) : null} Total Shots Fired: {round.total_projectiles_fired} Total Shots Hit: {round.total_projectiles_hit} @@ -108,11 +110,11 @@ const GetTab = (props, context) => { Total FF Kills: {round.total_friendly_kills} Total Huggers Applied: {round.total_huggers_applied} Total Larva Burst: {round.total_larva_burst} - {round.end_round_player_population && ( + {round.end_round_player_population ? ( Final Population: {round.end_round_player_population} - )} + ) : null} Total Deaths: {round.total_deaths} {round.Participants && ( <> @@ -295,7 +297,7 @@ const StatTab = (props, context) => { )} <> - {faction.statistics_list.length && ( + {faction.statistics_list.length ? (
{faction.statistics_list.map((entry, index) => ( @@ -311,7 +313,7 @@ const StatTab = (props, context) => { }} > {entry.name} - {entry.statistics.length && ( + {entry.statistics.length ? ( Statistics @@ -323,9 +325,9 @@ const StatTab = (props, context) => { ))} - )} + ) : null} - {entry.top_statistics.length && ( + {entry.top_statistics.length ? ( Top Statistics @@ -337,7 +339,7 @@ const StatTab = (props, context) => { ))} - )} + ) : null} @@ -348,7 +350,7 @@ const StatTab = (props, context) => { ))}
- )} + ) : null} From 81bc920820a3755f2a12bdb3865c9cff573b0b11 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:56:30 +0500 Subject: [PATCH 39/69] some depricatedddddddd fun around --- tgui/packages/tgui/interfaces/Statistic.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 419d7c9f8fbe..a84e7389d31e 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -1,6 +1,6 @@ -import { Fragment } from 'react'; +import { Fragment, useState } from 'react'; -import { useBackend, useLocalState } from '../backend'; +import { useBackend } from '../backend'; import { Box, Collapsible, @@ -13,11 +13,7 @@ import { Window } from '../layouts'; export const Statistic = (props, context) => { const { act, data } = useBackend(context); - const [selectedTab, setSelectedTab] = useLocalState( - context, - 'selectedTab', - 0, - ); + const [selectedTab, setSelectedTab] = useState('Round'); const { data_tabs, round, medals } = data; From 68c5ba66532ed614d77c854edb4f0d2c7730dd3b Mon Sep 17 00:00:00 2001 From: Deleted user Date: Wed, 14 Aug 2024 04:57:04 +0500 Subject: [PATCH 40/69] no context for useBackend --- tgui/packages/tgui/interfaces/Statistic.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index a84e7389d31e..1c21bb99bba6 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -12,7 +12,7 @@ import { import { Window } from '../layouts'; export const Statistic = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(); const [selectedTab, setSelectedTab] = useState('Round'); const { data_tabs, round, medals } = data; @@ -56,7 +56,7 @@ export const Statistic = (props, context) => { }; const GetTab = (props, context) => { - const { act, data } = useBackend(context); + const { act, data } = useBackend(); const { factions } = data; const { selectedTab, round, medals } = props; From 2cdb36d25b46bfbebcb887ab703fb291bf7c15c4 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Fri, 16 Aug 2024 02:53:05 +0500 Subject: [PATCH 41/69] fix, stupid check on mind failing all fun around --- code/datums/statistics/entities/death_stats.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 9dfb95849a87..bc76051cab88 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -145,14 +145,14 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) attack_log += "[log_message]." - if(!mind || statistic_exempt) + if(statistic_exempt) return var/area/area = get_area(death_loc) handle_observer_message(cause_data, cause_mob, death_loc, area) var/datum/entity/statistic_death/new_death = DB_ENTITY(/datum/entity/statistic_death) - var/datum/entity/player/player_entity = get_player_from_key(mind.ckey) + var/datum/entity/player/player_entity = get_player_from_key(mind ? mind.ckey : ckey) if(player_entity) new_death.player_id = player_entity.id From f90d840696c02260f6b0b7ce9f6230cabea8afd8 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Fri, 16 Aug 2024 06:24:58 +0500 Subject: [PATCH 42/69] Krill unit test... I'll fuck you up, if you one more time do stupid thing and try to delete fucking ENTITY of DB request!!! --- code/datums/statistics/entities/death_stats.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index bc76051cab88..a00cae55a4ba 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -218,8 +218,10 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(new_death.cause_name) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) +#if !defined(UNIT_TESTS) if(SSticker.mode && GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death +#endif new_death.save() new_death.detach() From cc240693b8f0d57085096748c1723e3736f8efdb Mon Sep 17 00:00:00 2001 From: Deleted user Date: Fri, 16 Aug 2024 06:33:56 +0500 Subject: [PATCH 43/69] for normal pods count escapes too --- .../shuttle/shuttles/crashable/escape_shuttle.dm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/modules/shuttle/shuttles/crashable/escape_shuttle.dm b/code/modules/shuttle/shuttles/crashable/escape_shuttle.dm index c2c6b818b37b..5c346df30af9 100644 --- a/code/modules/shuttle/shuttles/crashable/escape_shuttle.dm +++ b/code/modules/shuttle/shuttles/crashable/escape_shuttle.dm @@ -102,6 +102,17 @@ air.indestructible = TRUE air.unacidable = TRUE + for(var/mob/living/carbon/human/survived_human as anything in GLOB.alive_human_list) //check for lifeboats survivors + var/area/area = get_area(survived_human) + if(!survived_human) + continue + if(survived_human.stat != DEAD && (area in shuttle_areas)) + var/turf/turf = get_turf(survived_human) + if(!turf || is_mainship_level(turf.z)) + continue + to_chat(survived_human, "

[SPAN_CENTERBOLD("You have successfully left the [MAIN_SHIP_NAME]. You may now ghost and observe the rest of the round.")]
") + survived_human.count_statistic_stat(STATISTICS_ESCAPE) + /obj/docking_port/mobile/crashable/escape_shuttle/crash_check() . = ..() From afa49c5f431b61d418a8e3977dbeb03cd1822283 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 19 Aug 2024 09:21:15 +0500 Subject: [PATCH 44/69] f --- code/__DEFINES/mode.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index fcede20ddb33..1674b6961b30 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -317,7 +317,7 @@ DEFINE_BITFIELD(whitelist_status, list( #define FACTION_XENOMORPH_DELTA "Delta Xenomorph" #define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) -#define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH +#define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH + FACTION_PREDALIEN // Faction allegiances within a certain faction. From 30ac0769a8f3855ca3b95b5a95a580e3df4953af Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 19 Aug 2024 09:22:24 +0500 Subject: [PATCH 45/69] fix --- code/datums/statistics/entities/death_stats.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index a00cae55a4ba..63e2b4ee1f3b 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -212,7 +212,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(player_entity) if(isxeno(src)) - track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) + track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_CASTE, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) else if(ishuman(src)) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) if(new_death.cause_name) From ca05d3f2a1e8b0331bab950029fdfbc8b4d5744f Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 19 Aug 2024 09:24:11 +0500 Subject: [PATCH 46/69] right way check --- code/datums/statistics/entities/death_stats.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 63e2b4ee1f3b..750f53e05535 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -218,7 +218,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(new_death.cause_name) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) -#if !defined(UNIT_TESTS) +#ifndef UNIT_TESTS if(SSticker.mode && GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death #endif From c5aaf14962a155f6aab57ededded7c1f9a23af95 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 19 Aug 2024 09:31:52 +0500 Subject: [PATCH 47/69] protectiond around, for funny admins, no calls and edits --- code/datums/statistics/entities/player_entity.dm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index db2bea119c47..6b85a307250e 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -10,6 +10,8 @@ var/statistic_name var/value +BSQL_PROTECT_DATUM(/datum/entity/statistic) + /datum/entity_meta/statistic entity_type = /datum/entity/statistic table_name = "player_statistic" @@ -80,6 +82,8 @@ var/list/statistic_info = list() var/list/statistic_all = list() +BSQL_PROTECT_DATUM(/datum/statistic_groups) + /datum/statistic_groups/proc/load_statistic_deaths(list/datum/entity/statistic_death/statistics) nemesis.nemesis_name = "" nemesis.value = 0 @@ -133,6 +137,8 @@ var/list/statistic_all = list() var/list/total = list() +BSQL_PROTECT_DATUM(/datum/player_statistic) + /datum/player_statistic/proc/load_statistic() for(var/subtype in statistic_all) var/datum/player_statistic_detail/statistic = statistics[subtype] @@ -177,10 +183,14 @@ var/list/top_values_statistics = list() var/list/statistics = list() +BSQL_PROTECT_DATUM(/datum/player_statistic_detail) + /datum/player_statistic_nemesis var/nemesis_name var/value +BSQL_PROTECT_DATUM(/datum/player_statistic_nemesis) + ///////////////////////////////////////////////////////////////////////////////////// //Player Entity @@ -191,6 +201,8 @@ var/list/datum/entity/statistic/medal/medals = list() var/list/statistics = list() +BSQL_PROTECT_DATUM(/datum/player_entity) + /datum/player_entity/proc/get_statistic(faction, statistic_type, general_name, statistic_name) var/datum/statistic_groups/match_statistic = statistics[faction] if(!match_statistic) @@ -226,7 +238,7 @@ DB_FILTER(/datum/entity/statistic_death, DB_AND( DB_COMP("player_id", DB_EQUALS, player.id), - DB_COMP("faction_name", DB_EQUALS, new_group.group_name)), + DB_COMP("faction_name", DB_EQUALS, faction_to_get)), CALLBACK(new_group, TYPE_PROC_REF(/datum/statistic_groups, load_statistic_deaths))) DB_FILTER(/datum/entity/statistic, DB_AND( From 34d73026ddce1c325d04f5a22775e0b1f2cc0e9c Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 19 Aug 2024 09:35:41 +0500 Subject: [PATCH 48/69] some minor cachnges + old ui remove --- .../datums/statistics/entities/panel_stats.dm | 4 +- nano/templates/cm_stat_panel.tmpl | 966 ------------------ 2 files changed, 2 insertions(+), 968 deletions(-) delete mode 100644 nano/templates/cm_stat_panel.tmpl diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index fa292eb4595b..f2c06b42daa5 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -66,8 +66,8 @@ "cause_name" = sanitize(statistic_death.cause_name), "total_kills" = statistic_death.total_kills, "total_damage" = damage_list, - "time_of_death" = statistic_death.time_of_death, - "total_time_alive" = statistic_death.total_time_alive, + "time_of_death" = duration2text(statistic_death.time_of_death), + "total_time_alive" = duration2text(statistic_death.total_time_alive), "total_damage_taken" = statistic_death.total_damage_taken, "x" = statistic_death.x, "y" = statistic_death.y, diff --git a/nano/templates/cm_stat_panel.tmpl b/nano/templates/cm_stat_panel.tmpl deleted file mode 100644 index 26de08f17054..000000000000 --- a/nano/templates/cm_stat_panel.tmpl +++ /dev/null @@ -1,966 +0,0 @@ - -
- {{if data.round}} - {{:helper.link('Global', 'home', {'menu' : 0, 'subMenu' : 0, 'dataMenu': 0}, data.menu == 0 ? 'selected' : null)}} - {{/if}} -
-
- {{if data.menu == 0}} - {{:helper.link('General', null, {'subMenu' : 0, 'dataMenu': 0}, data.subMenu == 0 ? 'selected' : null)}} - {{:helper.link('Participants', null, {'subMenu' : 1, 'dataMenu': 0}, data.subMenu == 1 ? 'selected' : null)}} - {{:helper.link('Deaths', null, {'subMenu' : 2, 'dataMenu': 0}, data.subMenu == 2 ? 'selected' : null)}} - {{:helper.link('Jobs', null, {'subMenu' : 3, 'dataMenu': 0}, data.subMenu == 3 ? 'selected' : null)}} - {{:helper.link('Castes', null, {'subMenu' : 4, 'dataMenu': 0}, data.subMenu == 4 ? 'selected' : null)}} - {{:helper.link('Weapons', null, {'subMenu' : 5, 'dataMenu': 0}, data.subMenu == 5 ? 'selected' : null)}} - {{else data.menu == 1}} - {{if data.human}} - {{:helper.link('Human', null, {'subMenu' : 0, 'dataMenu' : 0}, data.subMenu == 0 ? 'selected' : null)}} - {{/if}} - {{if data.xeno}} - {{:helper.link('Xeno', null, {'subMenu' : 1, 'dataMenu' : 0}, data.subMenu == 1 ? 'selected' : null)}} - {{/if}} - {{/if}} -
-{{if data.menu == 1 && data.subMenu != 2}} -
- {{:helper.link('General', null, {'dataMenu' : 0}, data.dataMenu == 0 ? 'selected' : null)}} - {{:helper.link('Deaths', null, {'dataMenu' : 2}, data.dataMenu == 2 ? 'selected' : null)}} - {{if data.subMenu == 0}} - {{:helper.link('Weapons', null, {'dataMenu' : 3}, data.dataMenu == 3 ? 'selected' : null)}} - {{:helper.link('Roles', null, {'dataMenu' : 4}, data.dataMenu == 4 ? 'selected' : null)}} - {{:helper.link('Medals', null, {'dataMenu' : 5}, data.dataMenu == 5 ? 'selected' : null)}} - {{else data.subMenu == 1}} - {{:helper.link('Castes', null, {'dataMenu' : 3}, data.dataMenu == 3 ? 'selected' : null)}} - {{:helper.link('Jellies', null, {'dataMenu' : 5}, data.dataMenu == 5 ? 'selected' : null)}} - {{/if}} -
-{{/if}} -
- Updated {{:data.current_time}} -
-
- {{if data.menu == 0}} - {{if data.round}} - {{if data.subMenu == 0}} -
- {{:data.round.name}} -
-
- Map: -
-
- {{:data.round.map_name}} -
-
- Gamemode: -
-
- {{:data.round.game_mode}} -
- {{if data.round.round_result}} -
- Result: -
-
- {{:data.round.round_result}} -
- {{/if}} -
- Round Start: -
-
- {{:data.round.real_time_start}} -
- {{if data.round.real_time_end}} -
- Round End: -
-
- {{:data.round.real_time_end}} -
- {{/if}} - {{if data.round.round_length}} -
- Round Length: -
-
- {{:data.round.round_length}} -
- {{/if}} - {{if data.round.round_hijack_time}} -
- Hijack Time: -
-
- {{:data.round.round_hijack_time}} -
- {{/if}} - {{if data.round.end_round_player_population}} -
- Final Population: -
-
- {{:data.round.end_round_player_population}} -
- {{/if}} -
- DEFCON Level: -
-
- {{:data.round.defcon_level}} -
- {{if data.round.total_objective_points}} -
- Objective Points: -
-
- {{:data.round.objective_points}} -
-
- Total Objective Points: -
-
- {{:data.round.total_objective_points}} -
- {{/if}} -
- Total Shots Fired: -
-
- {{:data.round.total_projectiles_fired}} -
-
- Total Shots Hit: -
-
- {{:data.round.total_projectiles_hit}} -
-
- Total Shots Hit (Human): -
-
- {{:data.round.total_projectiles_hit_human}} -
-
- Total Shots Hit (Xeno): -
-
- {{:data.round.total_projectiles_hit_xeno}} -
-
- Total FF Instances: -
-
- {{:data.round.total_friendly_fire_instances}} -
-
- Total Friendly Fire Kills: -
-
- Total Slashes: -
-
- {{:data.round.total_slashes}} -
-
- Total Facehuggers Applied: -
-
- {{:data.round.total_huggers_applied}} -
-
- Total Larva Bursts: -
-
- {{:data.round.total_larva_burst}} -
- {{else data.subMenu == 1}} -
- Total Participants: -
-
- {{props data.round.participants}} -
- {{:value.name}}: -
-
- {{:value.value}} -
- {{/props}} -
-
- Total Deaths: -
-
- {{props data.round.total_deaths}} -
- {{:value.name}}: -
-
- {{:value.value}} -
- {{/props}} -
- {{if data.round.round_hijack_time}} -
- Hijack Participants: -
-
- {{props data.round.hijack_participants}} -
- {{:value.name}}: -
-
- {{:value.value}} -
- {{/props}} -
- {{/if}} - {{if data.round.real_time_end}} -
- Final Participants: -
-
-
- {{props data.round.final_participants}} -
- {{:value.name}}: -
-
- {{:value.value}} -
- {{/props}} -
-
- {{/if}} - {{else data.subMenu == 2}} - {{props data.round.death_stats_list :death_value:death_index}} -
-
- {{:death_value.mob_name}} -
- {{if death_value.job_name}} -
- Role: -
-
- {{:death_value.job_name}} -
- {{/if}} -
- Area: -
-
- {{:death_value.area_name}} -
-
- Cause: -
-
- {{:death_value.cause_name}} -
-
- Time of Death: -
-
- {{:death_value.time_of_death}} -
-
- Lifespan: -
-
- {{:death_value.total_time_alive}} -
-
- Damage Taken: -
-
- {{:death_value.total_damage_taken}} -
-
- Location: -
-
- ({{:death_value.x}}, {{:death_value.y}}, {{:death_value.z}}) -
-
- {{/props}} - {{else data.subMenu == 3}} - {{props data.round.job_stats_list :job_value:job_index}} -
-
- {{:job_value.name}} -
- {{if job_value.total_shots}} -
- Total Shots: -
-
- {{:job_value.total_shots}} -
- {{/if}} - {{if job_value.total_shots_hit}} -
- Total Shots Hit: -
-
- {{:job_value.total_shots_hit}} -
- {{/if}} - {{if job_value.total_friendly_fire}} -
- Total FF Instances: -
-
- {{:job_value.total_friendly_fire}} -
- {{/if}} - {{if job_value.total_revives}} -
- Total Times Revived: -
-
- {{:job_value.total_revives}} -
- {{/if}} - {{if job_value.total_lives_saved}} -
- Total Lives Saved: -
-
- {{:job_value.total_lives_saved}} -
- {{/if}} - {{if job_value.total_screams}} -
- Total Screams: -
-
- {{:job_value.total_screams}} -
- {{/if}} - {{props job_value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} - {{if job_value.nemesis}} -
- Nemesis: -
-
-
- {{:job_value.nemesis.name}} -
-
- {{/if}} -
- {{/props}} - {{else data.subMenu == 4}} - {{props data.round.caste_stats_list :caste_value:caste_index}} -
-
- {{:caste_value.name}} -
- {{props caste_value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} -
-
- Abilities Used: -
- {{props caste_value.abilities_used :ability_value:ability_index}} -
- {{:ability_value.name}}: -
-
- {{:ability_value.value}} -
- {{/props}} - {{if caste_value.nemesis}} -
- Nemesis: -
-
-
- {{:caste_value.nemesis.name}} -
-
- {{/if}} -
- {{/props}} - {{else data.subMenu == 5}} - {{props data.round.weapon_stats_list}} -
-
-
- {{:value.name}} -
- {{if value.total_hits}} -
- Total Hits: -
-
- {{:value.total_hits}} -
- {{/if}} - {{if value.total_shots}} -
- Total Shots: -
-
- {{:value.total_shots}} -
- {{/if}} - {{if value.total_shots_hit}} -
- Total Shots Hit: -
-
- {{:value.total_shots_hit}} -
- {{/if}} - {{if value.total_friendly_fire}} -
- Total FF Instances: -
-
- {{:value.total_friendly_fire}} -
- {{/if}} - {{props value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} -
-
- {{/props}} - {{/if}} - {{/if}} - {{else data.menu == 1}} - {{if data.subMenu == 0}} - {{if data.human}} - {{if data.dataMenu == 0}} -
- Total Playtime: -
-
- {{:data.human.total_playtime}} -
-
- Total Rounds Played: -
-
- {{:data.human.total_rounds_played}} -
-
- Total Shots: -
-
- {{:data.human.total_shots}} -
-
- Total Shots Hit: -
-
- {{:data.human.total_shots_hit}} -
- {{if data.human.total_lives_saved}} -
- Total FF Instances: -
-
- {{:data.human.total_friendly_fire}} -
- {{/if}} - {{if data.human.total_revives}} -
- Total Times Revived: -
-
- {{:data.human.total_revives}} -
- {{/if}} - {{if data.human.total_lives_saved}} -
- Total Lives Saved: -
-
- {{:data.human.total_lives_saved}} -
- {{/if}} - {{if data.human.total_lives_saved}} -
- Total Screams: -
-
- {{:data.human.total_screams}} -
- {{/if}} - {{props data.human.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} - {{if data.human.top_weapon}} -
- Top Weapon: -
-
-
- {{:data.human.top_weapon.name}} -
- {{if data.human.top_weapon.total_shots}} -
- Total Shots: -
-
- {{:data.human.top_weapon.total_shots}} -
- {{/if}} - {{if data.human.top_weapon.total_shots_hit}} -
- Total Shots Hit: -
-
- {{:data.human.top_weapon.total_shots_hit}} -
- {{/if}} - {{if data.human.top_weapon.total_hits}} -
- Total Hits: -
-
- {{:data.human.top_weapon.total_hits}} -
- {{/if}} - {{if data.human.top_weapon.total_friendly_fire}} -
- Total FF Instances: -
-
- {{:data.human.top_weapon.total_friendly_fire}} -
- {{/if}} -
- {{/if}} - {{if data.human.nemesis}} -
- Nemesis: -
-
-
- {{:data.human.nemesis.name}} -
-
- {{/if}} - {{else data.dataMenu == 2}} - {{props data.human.death_list :death_value:death_index}} -
-
- {{:death_value.mob_name}} -
- {{if death_value.job_name}} -
- Role: -
-
- {{:death_value.job_name}} -
- {{/if}} -
- Area: -
-
- {{:death_value.area_name}} -
-
- Cause: -
-
- {{:death_value.cause_name}} -
-
- Time of Death: -
-
- {{:death_value.time_of_death}} -
-
- Lifespan: -
-
- {{:death_value.total_time_alive}} -
-
- Damage Taken: -
-
- {{:death_value.total_damage_taken}} -
-
- Location: -
-
- ({{:death_value.x}}, {{:death_value.y}}, {{:death_value.z}}) -
-
- {{/props}} - {{else data.dataMenu == 3}} - {{props data.human.weapon_stats_list}} -
-
-
- {{:value.name}} -
- {{if value.total_hits}} -
- Total Hits: -
-
- {{:value.total_hits}} -
- {{/if}} - {{if value.total_shots}} -
- Total Shots: -
-
- {{:value.total_shots}} -
- {{/if}} - {{if value.total_shots_hit}} -
- Total Shots Hit: -
-
- {{:value.total_shots_hit}} -
- {{/if}} - {{if value.total_friendly_fire}} -
- Total FF Instances: -
-
- {{:value.total_friendly_fire}} -
- {{/if}} - {{props value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} -
-
- {{/props}} - {{else data.dataMenu == 4}} - {{props data.human.job_stats_list :job_value:job_index}} -
-
- {{:job_value.name}} -
-
- Total Playtime: -
-
- {{:job_value.total_playtime}} -
-
- Total Rounds Played: -
-
- {{:job_value.total_rounds_played}} -
- {{if job_value.total_shots}} -
- Total Shots: -
-
- {{:job_value.total_shots}} -
- {{/if}} - {{if job_value.total_shots_hit}} -
- Total Shots Hit: -
-
- {{:job_value.total_shots_hit}} -
- {{/if}} - {{if job_value.total_friendly_fire}} -
- Total FF Instances: -
-
- {{:job_value.total_friendly_fire}} -
- {{/if}} - {{if job_value.total_revives}} -
- Total Times Revived: -
-
- {{:job_value.total_revives}} -
- {{/if}} - {{if job_value.total_lives_saved}} -
- Total Lives Saved: -
-
- {{:job_value.total_lives_saved}} -
- {{/if}} - {{if job_value.total_screams}} -
- Total Screams: -
-
- {{:job_value.total_screams}} -
- {{/if}} - {{props job_value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} -
- {{if job_value.nemesis}} -
- Nemesis: -
-
-
- {{:job_value.nemesis.name}} -
-
- {{/if}} -
- {{/props}} - {{else data.dataMenu == 5}} - {{props data.human.medal_list :medal_value:medal_index}} -
-
- {{:medal_value.medal_type}} -
-
- {{:medal_value.recipient}} -
-
- {{:medal_value.recipient_job}} -
-
-
- {{:medal_value.citation}} -
-
- {{/props}} - {{/if}} - {{/if}} - {{else data.subMenu == 1}} - {{if data.xeno}} - {{if data.dataMenu == 0}} -
- Total Playtime: -
-
- {{:data.xeno.total_playtime}} -
-
- Total Rounds Played: -
-
- {{:data.xeno.total_rounds_played}} -
-
- Total Slashes: -
-
- {{:data.xeno.total_hits}} -
- {{props data.xeno.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} - {{if data.xeno.top_caste}} -
- Top Caste: -
-
-
- {{:data.xeno.top_caste.name}} -
-
- Total Playtime: -
-
- {{:data.xeno.top_caste.total_playtime}} -
-
- Total Rounds Played: -
-
- {{:data.xeno.top_caste.total_rounds_played}} -
-
- {{/if}} - {{if data.xeno.nemesis}} -
- Nemesis: -
-
-
- {{:data.xeno.nemesis.name}} -
-
- {{/if}} - {{else data.dataMenu == 2}} - {{props data.xeno.death_list :death_value:death_index}} -
-
- {{:death_value.mob_name}} -
- {{if death_value.job_name}} -
- Caste: -
-
- {{:death_value.job_name}} -
- {{/if}} -
- Area: -
-
- {{:death_value.area_name}} -
-
- Cause: -
-
- {{:death_value.cause_name}} -
-
- Time of Death: -
-
- {{:death_value.time_of_death}} -
-
- Lifespan: -
-
- {{:death_value.total_time_alive}} -
-
- Damage Taken: -
-
- {{:death_value.total_damage_taken}} -
-
- Location: -
-
- ({{:death_value.x}}, {{:death_value.y}}, {{:death_value.z}}) -
-
- {{/props}} - {{else data.dataMenu == 3}} - {{props data.xeno.caste_stats_list :caste_value:caste_index}} -
-
- {{:caste_value.name}} -
-
- Total Playtime: -
-
- {{:caste_value.total_playtime}} -
-
- Total Rounds Played: -
-
- {{:caste_value.total_rounds_played}} -
- {{props caste_value.niche_stats :niche_value:niche_index}} -
- {{:niche_value.name}}: -
-
- {{:niche_value.value}} -
- {{/props}} -
-
- Abilities Used: -
- {{props caste_value.abilities_used :ability_value:ability_index}} -
- {{:ability_value.name}}: -
-
- {{:ability_value.value}} -
- {{/props}} - {{if caste_value.nemesis}} -
- Nemesis: -
-
-
- {{:caste_value.nemesis.name}} -
-
- {{/if}} -
- {{/props}} - {{else data.dataMenu == 5}} - {{props data.xeno.medal_list :medal_value:medal_index}} -
-
- {{:medal_value.medal_type}} -
-
- {{:medal_value.recipient}} -
-
-
- {{:medal_value.citation}} -
-
- {{/props}} - {{/if}} - {{/if}} - {{/if}} - {{/if}} -
From c89d087b5997c5340092ce7a74dc13be457c5004 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 29 Aug 2024 23:46:02 +0500 Subject: [PATCH 49/69] f --- tgui/packages/tgui/interfaces/PlayerPanel.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/PlayerPanel.jsx b/tgui/packages/tgui/interfaces/PlayerPanel.jsx index d760dcc79943..a4a7d45cef08 100644 --- a/tgui/packages/tgui/interfaces/PlayerPanel.jsx +++ b/tgui/packages/tgui/interfaces/PlayerPanel.jsx @@ -137,7 +137,7 @@ export const PlayerPanel = (props) => { disabled={!hasPermission(data, 'show_notes')} onClick={() => act('access_statistics')} > - View Playtimes + View Statistic
From 48d82f71985c678ac4c0bbd8d2ff9523d4b859a5 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Fri, 30 Aug 2024 23:26:21 +0500 Subject: [PATCH 50/69] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=B9=20=D0=B4=D0=BD=D0=B5=D0=B2=D0=BD=D0=B8=D0=BA,=20=D1=83?= =?UTF-8?q?=20=D0=BC=D0=B5=D0=BD=D1=8F=20=D0=BD=D0=B5=D1=82=D1=83=20=D1=81?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=20=D1=87=D1=82=D0=BE=20=D0=B1=D1=8B=20=D0=BE?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=B0=D1=82=D1=8C=20remote=20tracking=20bran?= =?UTF-8?q?ch=20(origin)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/__DEFINES/mode.dm | 4 +++- code/modules/mob/living/carbon/xenomorph/hive_status.dm | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/mode.dm b/code/__DEFINES/mode.dm index 1674b6961b30..022274d7e6c3 100644 --- a/code/__DEFINES/mode.dm +++ b/code/__DEFINES/mode.dm @@ -315,8 +315,10 @@ DEFINE_BITFIELD(whitelist_status, list( #define FACTION_XENOMORPH_BRAVO "Bravo Xenomorph" #define FACTION_XENOMORPH_CHARLIE "Charlie Xenomorph" #define FACTION_XENOMORPH_DELTA "Delta Xenomorph" +#define FACTION_XENOMORPH_FERAL "Feral Xenomorph" +#define FACTION_XENOMORPH_FORSAKEN "Forsaken Xenomorph" -#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA) +#define FACTION_LIST_XENOMORPH list(FACTION_XENOMORPH, FACTION_XENOMORPH_CORRPUTED, FACTION_XENOMORPH_ALPHA, FACTION_XENOMORPH_BRAVO, FACTION_XENOMORPH_CHARLIE, FACTION_XENOMORPH_DELTA, FACTION_XENOMORPH_FERAL, FACTION_XENOMORPH_FORSAKEN) #define FACTION_LIST_ALL FACTION_LIST_HUMANOID + FACTION_LIST_XENOMORPH + FACTION_PREDALIEN // Faction allegiances within a certain faction. diff --git a/code/modules/mob/living/carbon/xenomorph/hive_status.dm b/code/modules/mob/living/carbon/xenomorph/hive_status.dm index 9c8b54dad483..593e13b11cd7 100644 --- a/code/modules/mob/living/carbon/xenomorph/hive_status.dm +++ b/code/modules/mob/living/carbon/xenomorph/hive_status.dm @@ -2,7 +2,7 @@ var/name = "Normal Hive" // Used for the faction of the xenomorph. Not recommended to modify. - var/internal_faction + var/internal_faction = FACTION_XENOMORPH /// Short Hive ID as string used in stats reporting var/reporting_id = "normal" @@ -978,6 +978,7 @@ name = "Corrupted Hive" reporting_id = "corrupted" hivenumber = XENO_HIVE_CORRUPTED + internal_faction = FACTION_XENOMORPH_CORRPUTED prefix = "Corrupted " color = "#80ff80" ui_color ="#4d994d" @@ -1005,6 +1006,7 @@ name = "Alpha Hive" reporting_id = "alpha" hivenumber = XENO_HIVE_ALPHA + internal_faction = FACTION_XENOMORPH_ALPHA prefix = "Alpha " color = "#ff4040" ui_color = "#992626" @@ -1016,6 +1018,7 @@ name = "Bravo Hive" reporting_id = "bravo" hivenumber = XENO_HIVE_BRAVO + internal_faction = FACTION_XENOMORPH_BRAVO prefix = "Bravo " color = "#ffff80" ui_color = "#99994d" @@ -1027,6 +1030,7 @@ name = "Charlie Hive" reporting_id = "charlie" hivenumber = XENO_HIVE_CHARLIE + internal_faction = FACTION_XENOMORPH_CHARLIE prefix = "Charlie " color = "#bb40ff" ui_color = "#702699" @@ -1038,6 +1042,7 @@ name = "Delta Hive" reporting_id = "delta" hivenumber = XENO_HIVE_DELTA + internal_faction = FACTION_XENOMORPH_DELTA prefix = "Delta " color = "#8080ff" ui_color = "#4d4d99" @@ -1049,6 +1054,7 @@ name = "Feral Hive" reporting_id = "feral" hivenumber = XENO_HIVE_FERAL + internal_faction = FACTION_XENOMORPH_FERAL prefix = "Feral " color = "#828296" ui_color = "#828296" @@ -1065,6 +1071,7 @@ name = "Forsaken Hive" reporting_id = "forsaken" hivenumber = XENO_HIVE_FORSAKEN + internal_faction = FACTION_XENOMORPH_FORSAKEN prefix = "Forsaken " color = "#cc8ec4" ui_color = "#cc8ec4" From 433d70435cb191733d9e07d633616f22e4d7a186 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Mon, 2 Sep 2024 01:11:33 +0500 Subject: [PATCH 51/69] statistic count fix --- code/datums/statistics/entities/player_entity.dm | 9 +++++---- .../mob/living/carbon/xenomorph/castes/Facehugger.dm | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 6b85a307250e..8c98c18f5b57 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -216,10 +216,11 @@ BSQL_PROTECT_DATUM(/datum/player_entity) if(!match_detail_statistic) return FALSE - var/datum/entity/statistic/statistic = match_detail_statistic.statistics[statistic_name] - if(!statistic) - return FALSE - return statistic + for(var/datum/entity/statistic/statistic as anything in match_detail_statistic.statistics) + if(statistic.statistic_name != statistic_name) + continue + return statistic + return FALSE /datum/player_entity/proc/setup_entity() set waitfor = FALSE diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm index 2b3590d6be47..bed12a70591a 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Facehugger.dm @@ -170,7 +170,8 @@ age = XENO_NORMAL var/datum/entity/statistic/statistic = client?.player_data?.player_entity?.get_statistic(faction, STATISTIC_TYPE_CASTE_ABILITIES, caste_type, STATISTICS_FACEHUGGE) - total_facehugs = statistic.value + if(statistic) + total_facehugs = statistic.value switch(total_facehugs) if(FACEHUG_TIER_1 to FACEHUG_TIER_2) age = XENO_MATURE From bac1e8e6b3f5782f1f5dd87640641e3e47738e77 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Fri, 13 Sep 2024 19:29:19 +0500 Subject: [PATCH 52/69] fix of issue --- code/datums/statistics/entities/panel_stats.dm | 6 +++--- code/datums/statistics/entities/round_stats.dm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index f2c06b42daa5..4eaee5f6ab2d 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -188,10 +188,10 @@ "game_mode" = game_mode, "map_name" = map_name, "round_result" = round_result, - "real_time_start" = real_time_start ? time2text(real_time_start) : 0, - "real_time_end" = real_time_end ? time2text(real_time_end) : 0, + "real_time_start" = real_time_start ? duration2text(real_time_start) : 0, + "real_time_end" = real_time_end ? duration2text(real_time_end) : 0, "round_length" = round_length ? duration2text(round_length) : 0, - "round_hijack_time" = round_hijack_time ? time2text(round_hijack_time) : 0, + "round_hijack_time" = round_hijack_time ? duration2text(round_hijack_time) : 0, "end_round_player_population" = end_round_player_population, "total_projectiles_fired" = total_projectiles_fired, "total_projectiles_hit" = total_projectiles_hit, diff --git a/code/datums/statistics/entities/round_stats.dm b/code/datums/statistics/entities/round_stats.dm index 9b96e6383755..8ae215b97e92 100644 --- a/code/datums/statistics/entities/round_stats.dm +++ b/code/datums/statistics/entities/round_stats.dm @@ -126,7 +126,7 @@ final_participants[faction]++ /datum/entity/statistic_round/proc/track_round_end() - real_time_end = time2text(world.realtime) + real_time_end = world.realtime for(var/i in GLOB.alive_mob_list) var/mob/M = i if(M.mind && M.faction) @@ -153,7 +153,7 @@ if(M.mind) track_hijack_participant(M.faction) - round_hijack_time = duration2text(world.time) + round_hijack_time = world.time save() if(current_map) current_map.total_hijacks++ From 0c0c727edb158a1a6bf02a3eabec182182a0512a Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 8 Oct 2024 06:45:25 +0500 Subject: [PATCH 53/69] DON'T SPAM WITH THAT AAAAAAAAAAAAAAAAAAAAAAA --- code/datums/statistics/entities/player_stats.dm | 1 - code/modules/admin/verbs/debug.dm | 1 - code/modules/mob/dead/observer/observer.dm | 6 ++++-- code/modules/mob/living/brain/brain.dm | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index f0c5e72d3577..02192ad103f2 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -7,7 +7,6 @@ /mob/proc/track_death_calculations() if(statistic_exempt || statistic_tracked || !client || !client.player_data || !faction) return FALSE - client.player_data.setup_statistics() statistic_tracked = TRUE return TRUE diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 1ec5d6f10f0f..60b0c2343dac 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -304,7 +304,6 @@ if(M.mind) M.track_death_calculations() - M.client.player_data.setup_statistics() M.statistic_tracked = FALSE usr.mind.transfer_to(M, TRUE) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 35d8fe9f8e53..0edfc823eb08 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -436,9 +436,13 @@ Works together with spawning an observer, noted above. /mob/proc/ghostize(can_reenter_corpse = TRUE, aghosted = FALSE) if(isaghost(src) || !key) return + if(aghosted) src.aghosted = TRUE + if(client && client.player_data) + client.player_data.setup_statistics() + SEND_SIGNAL(src, COMSIG_MOB_GHOSTIZE) var/mob/dead/observer/ghost = new(loc, src) //Transfer safety to observer spawning proc. @@ -514,8 +518,6 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/living/proc/do_ghost() if(stat == DEAD) - if(client && client.player_data) - client.player_data.setup_statistics() ghostize(TRUE) else var/list/options = list("Ghost", "Stay in body") diff --git a/code/modules/mob/living/brain/brain.dm b/code/modules/mob/living/brain/brain.dm index 3c4cd66f35d5..b91aa0f59446 100644 --- a/code/modules/mob/living/brain/brain.dm +++ b/code/modules/mob/living/brain/brain.dm @@ -56,6 +56,4 @@ /mob/living/brain/synth/ghost() set desc = "Relinquish your sentience and visit the land of the past." - if(client && client.player_data) - client.player_data.setup_statistics() ghostize(TRUE) From c2f35a8914d0356efc918eb45cad98fb0850f8ef Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 8 Oct 2024 07:03:25 +0500 Subject: [PATCH 54/69] some funny fckery around --- .../datums/statistics/entities/panel_stats.dm | 1 - .../statistics/entities/player_stats.dm | 49 ++++++++++++------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index 4eaee5f6ab2d..fd8d6a373cb0 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -78,7 +78,6 @@ var/list/statistic_info = list() var/datum/player_statistic/player_statistic = group.statistic_info[group_subtype] if(player_statistic.statistic_name == STATISTIC_TYPE_CASTE || player_statistic.statistic_name == STATISTIC_TYPE_JOB) - total_statistics += list(list("name" = player_statistic.statistic_name, "value" = "TOTAL")) for(var/subtype in player_statistic.total) total_statistics += list(list("name" = subtype, "value" = player_statistic.total[subtype])) diff --git a/code/datums/statistics/entities/player_stats.dm b/code/datums/statistics/entities/player_stats.dm index 02192ad103f2..d89ee4ca3668 100644 --- a/code/datums/statistics/entities/player_stats.dm +++ b/code/datums/statistics/entities/player_stats.dm @@ -1,43 +1,52 @@ -// TODO: Some day do custom count effect on stats updated, so don't copy this is procs and also do it flexible like right now (I don't wanna change it, because on next merge upstream in this is rep it will fuck up all calls on that and fixing more flexible shit will be harder) -// Also, make it wait and count like every +-30 minutes, so our DB not fuck up in INF!, funny... +// TODO: Some day do custom count effect on stats updated, so don't copy this procs and also do it flexible like right now (I don't wanna change it, because on next merge upstream in this rep it will fuck up all calls on that and fixing more flexible shit will be harder) +// Also, make it wait and count like every +-30 minutes, so our DB don't fuck up in INF!, funny... (Right now if you tru to update that very often it will fuck up all, so better make it affect already taken rows, in case if no rows, just make new) + +// Ignore above TODO and funny comment, I'll leave it remain here, until it's merged and I'll do new pr with creating finnal touchs (originaly this comment from mine offstream, but I forgot to remove it, plus this contain really useful information about what to do next with this to increase it realability and prettyisdajghhfh) ///////////////////////////////////////////////////////////////////////////////////// //Mob +/mob/proc/can_track_statistic() + if(statistic_exempt || statistic_tracked || !client?.player_data || !faction) + return FALSE + return TRUE + /mob/proc/track_death_calculations() - if(statistic_exempt || statistic_tracked || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE + statistic_tracked = TRUE return TRUE /mob/proc/count_statistic_stat(statistic_name, amount = 1, weapon) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_steps_walked() - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_hit(weapon, amount = 1, statistic_name = STATISTICS_HIT) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_friendly_hit(weapon, amount = 1, statistic_name = STATISTICS_FF_HIT) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_shot(weapon, amount = 1, statistic_name = STATISTICS_SHOT) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_shot_hit(weapon, mob/shot_mob, amount = 1, statistic_name = STATISTICS_SHOT_HIT) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE + if(GLOB.round_statistics) GLOB.round_statistics.total_projectiles_hit += amount if(shot_mob) @@ -48,51 +57,55 @@ return TRUE /mob/proc/track_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_DAMAGE) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_friendly_damage(weapon, mob/damaged_mob, amount = 1, statistic_name = STATISTICS_FF_DAMAGE) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_heal_damage(weapon, mob/healed_mob, amount = 1, statistic_name = STATISTICS_HEALED_DAMAGE) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_friendly_fire(weapon, amount = 1, statistic_name = STATISTICS_FF_SHOT_HIT) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE + if(GLOB.round_statistics) GLOB.round_statistics.total_friendly_fire_instances += amount + return TRUE /mob/proc/track_revive(amount = 1, statistic_name = STATISTICS_REVIVED) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_life_saved(amount = 1, statistic_name = STATISTICS_REVIVE) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_scream(amount = 1, statistic_name = STATISTICS_SCREAM) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE /mob/proc/track_slashes(caste, amount = 1, statistic_name = STATISTICS_SLASH) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE + if(GLOB.round_statistics) GLOB.round_statistics.total_slashes += amount + return TRUE /mob/proc/track_ability_usage(ability, caste, amount = 1) - if(statistic_exempt || !client || !client.player_data || !faction) + if(!can_track_statistic()) return FALSE return TRUE From 65b226d901754f39ac29a2eaf5f88d1ba5501298 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 8 Oct 2024 08:45:25 +0500 Subject: [PATCH 55/69] some playing around and fixing --- code/__DEFINES/statistic.dm | 20 +- .../datums/statistics/entities/death_stats.dm | 1 + .../datums/statistics/entities/panel_stats.dm | 46 +- tgui/packages/tgui/interfaces/Statistic.jsx | 558 +++++++++--------- 4 files changed, 293 insertions(+), 332 deletions(-) diff --git a/code/__DEFINES/statistic.dm b/code/__DEFINES/statistic.dm index 26b3db4035eb..ce025cbfb8ca 100644 --- a/code/__DEFINES/statistic.dm +++ b/code/__DEFINES/statistic.dm @@ -1,11 +1,9 @@ -#define get_client_stat(client, stat) (client.player_data ? LAZYACCESS(client.player_data.stats, stat) ? client.player_data.stats[stat].stat_number : 0 : 0) - #define FACEHUG_TIER_1 5 #define FACEHUG_TIER_2 25 #define FACEHUG_TIER_3 100 #define FACEHUG_TIER_4 1000 -// OOD mean Out Of Date (not used, please keep this list up to date, and remember sync in db changes) +// OOD mean Out Of Date (not used, please keep this list up to date, and remember sync in db changes, I'm hard against db wipe after every big change) // Statistics defines #define STATISTIC_TYPE_MISC "Misc" @@ -15,7 +13,7 @@ #define STATISTIC_TYPE_WEAPON "Weapon" // Used to replace faction name -#define STATISTIC_TYPE_GLOBAL "Global Statistic" // Don't have link to a faction +#define STATISTIC_TYPE_GLOBAL "Global Statistic"// Don't have link to a faction #define STATISTICS_DEATH_LIST_LEN 20 @@ -28,7 +26,7 @@ #define STATISTICS_SCREAM "Scream" #define STATISTICS_HIT "Hit" #define STATISTICS_FF_HIT "FF Hit" -#define STATISTICS_EXPLODED_MOBS "Blowjobs Done" // :clueless_face: +#define STATISTICS_EXPLODED_MOBS "Blowjobs Done"// :clueless_face: #define STATISTICS_SLASH "Slash" #define STATISTICS_REVIVE "Revive" #define STATISTICS_REVIVED "Revived" @@ -61,8 +59,8 @@ #define STATISTICS_AMMO_CONVERTED "Ammo Converted" #define STATISTICS_IMPLANTS_IMPLANTED "Implants Implanted" #define STATISTICS_REVIVED_BY_IMPLANT "Revive Implant Saved Lifes" -#define STATISTICS_SD_ACTIVATION "SD Activated" // OOD -#define STATISTICS_SACRIFICE "Sacrificed" // OOD +#define STATISTICS_SD_ACTIVATION "SD Activated"// OOD +#define STATISTICS_SACRIFICE "Sacrificed"// OOD #define STATISTICS_ESCAPE "Escaped" #define STATISTICS_CADES "Barricades Built" @@ -72,7 +70,7 @@ #define STATISTICS_REPAIR_SENSORTOWER "Sensor Towers Repaired" #define STATISTICS_REPAIR_APC "APCs Repaired" #define STATISTICS_UPGRADE_TURRETS "Defenses Upgraded" -#define STATISTICS_DEFENSES_BUILT "Defenses Built" // OOD +#define STATISTICS_DEFENSES_BUILT "Defenses Built"// OOD #define STATISTICS_CORGI "Corgis Murdered" #define STATISTICS_CAT "Cats Murdered" @@ -84,12 +82,12 @@ #define STATISTICS_SURGERY_BRAIN "Brains Mended" #define STATISTICS_SURGERY_EYE "Eyes Mended" #define STATISTICS_SURGERY_LARVA "Larvae Removed" -#define STATISTICS_SURGERY_NECRO "Necro Limbs Fixed" // OOD +#define STATISTICS_SURGERY_NECRO "Necro Limbs Fixed"// OOD #define STATISTICS_SURGERY_SHRAPNEL "Shrapnel Removed" #define STATISTICS_SURGERY_AMPUTATE "Limbs Amputated" #define STATISTICS_SURGERY_ORGAN_REPAIR "Organs Repaired" -#define STATISTICS_SURGERY_ORGAN_ATTACH "Organs Implanted" // OOD -#define STATISTICS_SURGERY_ORGAN_REMOVE "Organs Harvested" // OOD +#define STATISTICS_SURGERY_ORGAN_ATTACH "Organs Implanted"// OOD +#define STATISTICS_SURGERY_ORGAN_REMOVE "Organs Harvested"// OOD #define STATISTICS_DESTRUCTION_WALLS "Walls Destroyed" #define STATISTICS_DESTRUCTION_DOORS "Doors Destroyed" diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 750f53e05535..bf473f31fbee 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -218,6 +218,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) if(new_death.cause_name) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) +// On unit test something going horrybly wrong with testing humans for entire game, and this part exploding with errors #ifndef UNIT_TESTS if(SSticker.mode && GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index fd8d6a373cb0..9e7e6762e97b 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -119,43 +119,39 @@ data["factions"][group.group_name] = list( "name" = group.group_name, "nemesis" = nemesis, + "total_deaths" = length(group.statistic_deaths), "death_list" = death_list, - "statistics" = total_statistics, + "total_statistics" = total_statistics, "top_statistics" = top_statistics, + "statistics_list_tabs" = statistics_list_tabs, "statistics_list" = statistics_list, ) return data /datum/entity/statistic_round/process() - var/map_name - if(current_map) - map_name = current_map.map_name - - var/list/participants_list = null - var/list/hijack_participants_list = null - var/list/final_participants_list = null - var/list/total_deaths_list = list() - var/list/new_death_stats_list = list() + var/list/all_participants_list = list() + var/list/last_deaths_list = list() if(length(participants)) - participants_list = list() + var/list/participants_list = list() + all_participants_list += list(list("name" = "Participants", "value" = participants_list)) for(var/stat_name in participants) participants_list += list(list("name" = stat_name, "value" = participants[stat_name])) if(length(hijack_participants)) - hijack_participants_list = list() + var/list/hijack_participants_list = list() + all_participants_list += list(list("name" = "Hijack Participants", "value" = hijack_participants_list)) for(var/stat_name in hijack_participants) hijack_participants_list += list(list("name" = stat_name, "value" = hijack_participants[stat_name])) if(length(final_participants)) - final_participants_list = list() + var/list/final_participants_list = list() + all_participants_list += list(list("name" = "Final Participants", "value" = final_participants_list)) for(var/stat_name in final_participants) final_participants_list += list(list("name" = stat_name, "value" = final_participants[stat_name])) - total_deaths_list = length(total_deaths) - for(var/datum/entity/statistic_death/statistic_death as anything in death_stats_list) - if(new_death_stats_list.len >= STATISTICS_DEATH_LIST_LEN) + if(length(last_deaths_list) >= STATISTICS_DEATH_LIST_LEN) break var/list/damage_list = list() if(statistic_death.total_brute) @@ -167,7 +163,7 @@ if(statistic_death.total_tox) damage_list += list(list("name" = "tox", "value" = statistic_death.total_tox)) - new_death_stats_list += list(list( + last_deaths_list += list(list( "mob_name" = sanitize(statistic_death.mob_name), "job_name" = statistic_death.role_name, "area_name" = sanitize_area(statistic_death.area_name), @@ -185,11 +181,11 @@ cached_tgui_data = list( "name" = round_name, "game_mode" = game_mode, - "map_name" = map_name, + "map_name" = current_map?.map_name, "round_result" = round_result, - "real_time_start" = real_time_start ? duration2text(real_time_start) : 0, - "real_time_end" = real_time_end ? duration2text(real_time_end) : 0, - "round_length" = round_length ? duration2text(round_length) : 0, + "real_time_start" = real_time_start ? time2text(real_time_start, "YYYY-MM-DD hh:mm:ss") : 0, + "real_time_end" = real_time_end ? time2text(real_time_end, "YYYY-MM-DD hh:mm:ss") : 0, + "round_length" = round_length ? time2text(round_length, "YYYY-MM-DD hh:mm:ss") : 0, "round_hijack_time" = round_hijack_time ? duration2text(round_hijack_time) : 0, "end_round_player_population" = end_round_player_population, "total_projectiles_fired" = total_projectiles_fired, @@ -201,9 +197,7 @@ "total_friendly_kills" = total_friendly_kills, "total_huggers_applied" = total_huggers_applied, "total_larva_burst" = total_larva_burst, - "participants" = participants_list, - "hijack_participants" = hijack_participants_list, - "final_participants" = final_participants_list, - "total_deaths" = total_deaths_list, - "death_list" = new_death_stats_list, + "participants_list" = all_participants_list, + "total_deaths" = length(death_stats_list), + "death_list" = last_deaths_list, ) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 1c21bb99bba6..6e31e9340897 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -11,8 +11,8 @@ import { } from '../components'; import { Window } from '../layouts'; -export const Statistic = (props, context) => { - const { act, data } = useBackend(); +export const Statistic = () => { + const { data } = useBackend(); const [selectedTab, setSelectedTab] = useState('Round'); const { data_tabs, round, medals } = data; @@ -36,16 +36,12 @@ export const Statistic = (props, context) => { - - - - - - + + @@ -55,217 +51,174 @@ export const Statistic = (props, context) => { ); }; -const GetTab = (props, context) => { - const { act, data } = useBackend(); +const GetTab = (props) => { + const { data } = useBackend(); const { factions } = data; const { selectedTab, round, medals } = props; switch (selectedTab) { case 'Round': - return ( - - {round ? ( -
- - Name: {round.name} - Gamemode: {round.game_mode} - Map: {round.map_name} - {round.round_result ? ( - Result: {round.round_result} - ) : null} - {round.real_time_start ? ( - Round Start: {round.real_time_start} - ) : null} - {round.real_time_end ? ( - Round Time End: {round.real_time_end} - ) : null} - {round.round_length ? ( - Round Length: {round.round_length} - ) : null} - {round.round_hijack_time ? ( - Hijack Time: {round.round_hijack_time} - ) : null} - Total Shots Fired: {round.total_projectiles_fired} - Total Shots Hit: {round.total_projectiles_hit} - - Total Shots Hit (Human): {round.total_projectiles_hit_human} - - - Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} - - Total Slashes: {round.total_slashes} - - Total Shots Hit (FF): {round.total_friendly_fire_instances} - - Total FF Kills: {round.total_friendly_kills} - Total Huggers Applied: {round.total_huggers_applied} - Total Larva Burst: {round.total_larva_burst} - {round.end_round_player_population ? ( - - Final Population: {round.end_round_player_population} - - ) : null} - Total Deaths: {round.total_deaths} - {round.Participants && ( - <> - - - Participants: - {round.Participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} - - - - - ))} - - - )} - {round.hijack_participants && ( - <> - - - Hijack Participants: - {round.hijack_participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} - - - - - ))} - - - )} - {round.final_participants && ( - <> - - - Final Participants: - {round.final_participants.map((entry, index) => ( - - - - {entry.name}: {entry.value} - - - - - ))} - - - )} - -
- ) : ( - Round statistic prepairing! - )} - {round?.death_list.length ? ( - - ) : ( - No recorded kills! - )} -
- ); + return ; case 'Medals': - return ( -
- {medals.map((entry, index) => ( - - - Round ID: {entry.round_id} - Medal Type: {entry.medal_type} - Recipient: {entry.recipient} - Recipient Job: {entry.recipient_job} - Citation: {entry.citation} - Giver: {entry.giver} - - - - ))} -
- ); + return ; default: if (!factions[selectedTab]) return; return ; } }; -const StatTab = (props, context) => { - const { faction } = props; +const RoundTab = (props) => { + const { round } = props; + if (!round) return Round statistic prepairing!; return ( - - {faction.statistics.length && ( - <> -
- {faction.statistics.map((entry, index) => ( - - + <> +
+ + Name: {round.name} + Gamemode: {round.game_mode} + Map: {round.map_name} + {round.round_result ? Result: {round.round_result} : null} + {round.real_time_start ? ( + Round Start: {round.real_time_start} + ) : null} + {round.real_time_end ? ( + Round Time End: {round.real_time_end} + ) : null} + {round.round_length ? ( + Round Length: {round.round_length} + ) : null} + {round.round_hijack_time ? ( + Hijack Time: {round.round_hijack_time} + ) : null} + Total Shots Fired: {round.total_projectiles_fired} + Total Shots Hit: {round.total_projectiles_hit} + + Total Shots Hit (Human): {round.total_projectiles_hit_human} + + Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} + Total Slashes: {round.total_slashes} + Total Shots Hit (FF): {round.total_friendly_fire_instances} + Total FF Kills: {round.total_friendly_kills} + Total Huggers Applied: {round.total_huggers_applied} + Total Larva Burst: {round.total_larva_burst} + {round.end_round_player_population ? ( + Final Population: {round.end_round_player_population} + ) : null} + {round.participants_list.map((entry, index) => ( + + {entry.name}: + {entry.value.map((entry, index) => ( + {entry.name}: {entry.value} - - + ))} + + ))} + +
+ {round.death_list.length ? ( + + ) : ( + No recorded kills! + )} + + ); +}; + +const MedalTab = (props) => { + const { medals } = props; + + return ( +
+ {medals.map((entry, index) => ( + + + Round ID: {entry.round_id} + Medal Type: {entry.medal_type} + Recipient: {entry.recipient} + Recipient Job: {entry.recipient_job} + Citation: {entry.citation} + Giver: {entry.giver} + + + + ))} +
+ ); +}; + +const StatTab = (props) => { + const { faction } = props; + const { + total_statistics, + top_statistics, + nemesis, + total_deaths, + death_list, + statistics_list_tabs, + statistics_list, + } = faction; + + return ( + + {total_statistics.length ? ( +
+ + {total_statistics.map((entry, index) => ( + + {entry.name}: {entry.value} + ))} -
- - + +
+ ) : ( + No recorded statistic! )} - {faction.top_statistics.length && ( + + {top_statistics.length ? ( <>
- {faction.top_statistics.map((entry, index) => ( + {top_statistics.map((entry, index) => ( - {entry.name} - {entry.statistics.length && ( - <> - - {entry.statistics.map((entry, index) => ( - - - {entry.name}: {entry.value} - - - - ))} - - )} + {entry.name} + {entry.statistics.length + ? entry.statistics.map((entry, index) => ( + + {entry.name}: {entry.value} + + )) + : null} @@ -273,118 +226,133 @@ const StatTab = (props, context) => {
- )} - {faction.nemesis.length ? ( - <> -
- - {faction.nemesis.name}: {faction.nemesis.value} - -
- - + ) : null} + {nemesis.name ? ( +
+ + + {nemesis.name}: {nemesis.value} + + +
) : ( No recorded nemesis! )} - {faction.death_list.length ? ( - + + {death_list.length ? ( + ) : ( No recorded deaths! )} - <> - {faction.statistics_list.length ? ( -
- {faction.statistics_list.map((entry, index) => ( - - {entry.value.length && ( - <> - {entry.value.map((entry, index) => ( - - - {entry.name} - {entry.statistics.length ? ( - - Statistics - - {entry.statistics.map((entry, index) => ( - - - {entry.name}: {entry.value} - - - ))} - - ) : null} - - {entry.top_statistics.length ? ( - - Top Statistics - - {entry.top_statistics.map((entry, index) => ( - - - {entry.name}: {entry.value} - - - ))} - - ) : null} - - - - ))} - - - )} - - ))} -
- ) : null} - - + {statistics_list.length ? ( +
+ {statistics_list.map((entry, index) => ( + + {entry.value.length ? ( + <> + {entry.value.map((entry, index) => ( + + + {entry.name} + {entry.statistics.length ? ( + + + Statistics + + {entry.statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + ))} + + ) : null} + + {entry.top_statistics.length ? ( + + + Top Statistics + + {entry.top_statistics.map((entry, index) => ( + + + {entry.name}: {entry.value} + + + ))} + + ) : null} + + + + ))} + + + ) : null} + + ))} +
+ ) : null}
); }; -const KillView = (props, context) => { - const { real_data } = props; +const KillView = (props) => { + const { death_log_data, total_deaths } = props; return (
- - {real_data.map((entry, index) => ( - + {death_log_data.map((entry, index) => ( + - Mob: {entry.mob_name} - {entry.job_name && ( - <> - - Job: {entry.job_name} - - )} - - Area: {entry.area_name} - - Cause: {entry.cause_name} - - Time: {entry.time_of_death} - - Lifespan: {entry.total_time_alive} - - Damage taken: {entry.total_damage_taken} - - - Coords: {entry.x}, {entry.y}, {entry.z} - - + + + Mob: {entry.mob_name} + {entry.job_name ? ( + <> + + Job: {entry.job_name} + + ) : null} + + Area: {entry.area_name} + + Cause: {entry.cause_name} + + Time: {entry.time_of_death} + + Lifespan: {entry.total_time_alive} + + Damage taken: {entry.total_damage_taken} + + + Coords: {entry.x}, {entry.y}, {entry.z} + + + + ))}
From 716e0c7d0cc37d54a39addcd75dd5ac3daf46fe6 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Tue, 8 Oct 2024 08:51:23 +0500 Subject: [PATCH 56/69] no button size increase --- tgui/packages/tgui/interfaces/Statistic.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 6e31e9340897..744da22afc5c 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -309,12 +309,7 @@ const KillView = (props) => { const { death_log_data, total_deaths } = props; return (
- + {death_log_data.map((entry, index) => ( Date: Wed, 9 Oct 2024 05:50:05 +0500 Subject: [PATCH 57/69] funny --- tgui/packages/tgui/interfaces/Statistic.jsx | 500 +++++++++--------- .../tgui/styles/interfaces/Statistic.scss | 113 ++++ tgui/packages/tgui/styles/main.scss | 5 +- 3 files changed, 363 insertions(+), 255 deletions(-) create mode 100644 tgui/packages/tgui/styles/interfaces/Statistic.scss diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index 744da22afc5c..fbf81850144e 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -18,11 +18,11 @@ export const Statistic = () => { const { data_tabs, round, medals } = data; return ( - - + + - + {data_tabs.map((tab) => ( { - - - - - +
+ +
@@ -51,124 +45,139 @@ export const Statistic = () => { ); }; -const GetTab = (props) => { +const GetTab = ({ selectedTab, round, medals }) => { const { data } = useBackend(); const { factions } = data; - const { selectedTab, round, medals } = props; switch (selectedTab) { case 'Round': - return ; + return round ? ( + + ) : ( + Round statistic preparing! + ); case 'Medals': return ; default: - if (!factions[selectedTab]) return; - return ; + return factions[selectedTab] ? ( + + ) : null; } }; -const RoundTab = (props) => { - const { round } = props; - if (!round) return Round statistic prepairing!; - return ( - <> -
- - Name: {round.name} - Gamemode: {round.game_mode} - Map: {round.map_name} - {round.round_result ? Result: {round.round_result} : null} - {round.real_time_start ? ( - Round Start: {round.real_time_start} - ) : null} - {round.real_time_end ? ( - Round Time End: {round.real_time_end} - ) : null} - {round.round_length ? ( - Round Length: {round.round_length} - ) : null} - {round.round_hijack_time ? ( - Hijack Time: {round.round_hijack_time} - ) : null} - Total Shots Fired: {round.total_projectiles_fired} - Total Shots Hit: {round.total_projectiles_hit} - - Total Shots Hit (Human): {round.total_projectiles_hit_human} - - Total Shots Hit (Xeno): {round.total_projectiles_hit_xeno} - Total Slashes: {round.total_slashes} - Total Shots Hit (FF): {round.total_friendly_fire_instances} - Total FF Kills: {round.total_friendly_kills} - Total Huggers Applied: {round.total_huggers_applied} - Total Larva Burst: {round.total_larva_burst} - {round.end_round_player_population ? ( - Final Population: {round.end_round_player_population} - ) : null} +const RoundTab = ({ round }) => ( + <> + +
+ +
+ + + + {round.round_result ? ( + + ) : null} + {round.real_time_start ? ( + + ) : null} + {round.real_time_end ? ( + + ) : null} + {round.round_length ? ( + + ) : null} + {round.round_hijack_time ? ( + + ) : null} + + + + + + + + + + {round.end_round_player_population ? ( + + ) : null} +
{round.participants_list.map((entry, index) => ( - - {entry.name}: - {entry.value.map((entry, index) => ( - - {entry.name}: {entry.value} - - ))} - + +
+
+ {entry.value.map((sub_entry, sub_index) => ( + + ))} +
+
+
))}
-
- {round.death_list.length ? ( - - ) : ( - No recorded kills! - )} - - ); -}; - -const MedalTab = (props) => { - const { medals } = props; + + + {round.death_list.length ? ( + + ) : ( + No recorded kills! + )} + +); - return ( -
- {medals.map((entry, index) => ( - - - Round ID: {entry.round_id} - Medal Type: {entry.medal_type} - Recipient: {entry.recipient} - Recipient Job: {entry.recipient_job} - Citation: {entry.citation} - Giver: {entry.giver} +const MedalTab = ({ medals }) => ( + +
+ + {medals.map((entry, index) => ( + + + + + + + - - - ))} -
- ); -}; + ))} +
+ + +); -const StatTab = (props) => { - const { faction } = props; +const StatTab = ({ faction }) => { const { total_statistics, top_statistics, @@ -180,176 +189,161 @@ const StatTab = (props) => { } = faction; return ( - + <> {total_statistics.length ? ( -
- - {total_statistics.map((entry, index) => ( - - {entry.name}: {entry.value} - - ))} - -
+ +
+ +
+ {total_statistics.map((entry, stat_idx) => ( + + ))} +
+
+
+
) : ( No recorded statistic! )} - {top_statistics.length ? ( - <> -
+ +
{top_statistics.map((entry, index) => ( - - - {entry.name} + +
+ {entry.name} {entry.statistics.length - ? entry.statistics.map((entry, index) => ( - - {entry.name}: {entry.value} - + ? entry.statistics.map((stat, statIndex) => ( + )) : null} - - - +
+
))} -
- - + + ) : null} {nemesis.name ? ( -
- - - {nemesis.name}: {nemesis.value} - - -
+ +
+ +
+ +
+
+
+
) : ( No recorded nemesis! )} - {death_list.length ? ( - + ) : ( No recorded deaths! )} - {statistics_list.length ? ( -
- {statistics_list.map((entry, index) => ( - - {entry.value.length ? ( - <> - {entry.value.map((entry, index) => ( - - - {entry.name} - {entry.statistics.length ? ( - - - Statistics - - {entry.statistics.map((entry, index) => ( - - - {entry.name}: {entry.value} - - + +
+ {statistics_list.map((entry, index) => ( + + {entry.value.length ? ( +
+ {entry.value.map((sub_entry, sub_index) => ( + + {sub_entry.name} + {sub_entry.statistics.length ? ( +
+ Statistics + {sub_entry.statistics.map((stat, stat_idx) => ( + ))} - +
) : null} - - {entry.top_statistics.length ? ( - - - Top Statistics - - {entry.top_statistics.map((entry, index) => ( - - - {entry.name}: {entry.value} - - + {sub_entry.top_statistics.length ? ( +
+ Top Statistics + {sub_entry.top_statistics.map((stat, stat_idx) => ( + ))} - +
) : null}
- - - ))} - - - ) : null} - - ))} -
+ ))} + + ) : null} +
+ ))} + + ) : null} - + ); }; -const KillView = (props) => { - const { death_log_data, total_deaths } = props; - return ( -
+const DeathsView = ({ death_log_data, total_deaths }) => ( + +
- {death_log_data.map((entry, index) => ( - - - - Mob: {entry.mob_name} - {entry.job_name ? ( - <> - - Job: {entry.job_name} - - ) : null} - - Area: {entry.area_name} - - Cause: {entry.cause_name} - - Time: {entry.time_of_death} - - Lifespan: {entry.total_time_alive} - - Damage taken: {entry.total_damage_taken} - - - Coords: {entry.x}, {entry.y}, {entry.z} - +
+ {death_log_data.map((entry, index) => ( + + +
+
+ + {entry.job_name ? ( + + ) : null} + + + + + + +
+
- - ))} + ))} +
-
- ); -}; + + +); + +const StatItem = ({ label, value }) => ( + + {label}: {value} + +); + +const SectionContainer = ({ title, children }) => ( +
+
{children}
+
+); diff --git a/tgui/packages/tgui/styles/interfaces/Statistic.scss b/tgui/packages/tgui/styles/interfaces/Statistic.scss new file mode 100644 index 000000000000..832a56593653 --- /dev/null +++ b/tgui/packages/tgui/styles/interfaces/Statistic.scss @@ -0,0 +1,113 @@ +@use '../colors.scss'; +$separator-color: colors.$primary !default; + +.Statistic { + padding: 20px; + background-color: #1a1a1a; + height: 100%; + + .tabs-horizontal { + margin-bottom: 20px; + display: flex; + justify-content: center; + + .tab { + background-color: #333; + color: #fff; + padding: 10px 20px; + border-radius: 4px; + margin-right: 10px; + cursor: pointer; + transition: background-color 0.3s; + + &.selected { + background-color: #555; + } + + &:hover { + background-color: #444; + } + + &:last-child { + margin-right: 0; + } + } + } + + .tiles-container { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + gap: 20px; + width: 100%; + padding: 10px; + box-sizing: border-box; + } + + .tile { + background-color: #2a2a2a; + border: 1px solid #4a4a4a; + border-radius: 8px; + padding: 15px; + box-sizing: border-box; + transition: + transform 0.2s, + box-shadow 0.2s; + color: #ccc; + + &:hover { + transform: translateY(-5px); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); + } + + .tile-title { + font-size: 1.2em; + font-weight: bold; + margin-bottom: 10px; + color: #fff; + display: block; + } + + .inner-title { + font-size: 1em; + font-weight: bold; + margin-top: 10px; + color: #ddd; + display: block; + } + + .inner-statistics { + margin-top: 5px; + padding-left: 10px; + border-left: 2px solid #555; + } + } + + .statistic-styled-padding { + padding: 12px 10px; + border: 0.5px solid #4a4a4a; + background-color: #2a2a2a; + border-radius: 8px; + box-sizing: border-box; + } + + .collapsible-box { + padding: 12px 10px; + box-sizing: border-box; + } + + .section-content { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + gap: 20px; + } + + .stat-item { + margin-bottom: 6px; + color: #ccc; + + .stat-label { + color: $separator-color; + font-weight: bold; + } + } +} diff --git a/tgui/packages/tgui/styles/main.scss b/tgui/packages/tgui/styles/main.scss index 7c1c65a324cc..d19336f6da8b 100644 --- a/tgui/packages/tgui/styles/main.scss +++ b/tgui/packages/tgui/styles/main.scss @@ -74,15 +74,16 @@ @include meta.load-css('./interfaces/SidePanel.scss'); @include meta.load-css('./interfaces/SmartFridge.scss'); @include meta.load-css('./interfaces/SquadInfo.scss'); +@include meta.load-css('./interfaces/Statistic.scss'); +@include meta.load-css('./interfaces/StripMenu.scss'); @include meta.load-css('./interfaces/TachyonArray.scss'); +@include meta.load-css('./interfaces/TacticalMap.scss'); @include meta.load-css('./interfaces/Techweb.scss'); @include meta.load-css('./interfaces/TechNode.scss'); @include meta.load-css('./interfaces/Vending.scss'); @include meta.load-css('./interfaces/VendingSorted.scss'); @include meta.load-css('./interfaces/common/Dpad.scss'); @include meta.load-css('./interfaces/common/ElectricalPanel.scss'); -@include meta.load-css('./interfaces/TacticalMap.scss'); -@include meta.load-css('./interfaces/StripMenu.scss'); // Layouts @include meta.load-css('./layouts/Layout.scss'); From 09620a830a74989ed40e7332ef452001d36e2e3a Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 10 Oct 2024 14:14:59 +0500 Subject: [PATCH 58/69] I have no idea what i done, and it's don't working as supposed, but working in cool way. so... nuh uh! IT'S WORKING AS PLANED! --- .../datums/statistics/entities/death_stats.dm | 2 - .../datums/statistics/entities/medal_stats.dm | 11 +- .../datums/statistics/entities/panel_stats.dm | 2 - tgui/packages/tgui/interfaces/Statistic.jsx | 438 ++++++++---------- .../tgui/styles/interfaces/Statistic.scss | 117 +---- 5 files changed, 229 insertions(+), 341 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index bf473f31fbee..736b226d8e0b 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -215,8 +215,6 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_CASTE, new_death.role_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) else if(ishuman(src)) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) - if(new_death.cause_name) - track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_WEAPON, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) // On unit test something going horrybly wrong with testing humans for entire game, and this part exploding with errors #ifndef UNIT_TESTS diff --git a/code/datums/statistics/entities/medal_stats.dm b/code/datums/statistics/entities/medal_stats.dm index 4940a76c7909..2630a6161eae 100644 --- a/code/datums/statistics/entities/medal_stats.dm +++ b/code/datums/statistics/entities/medal_stats.dm @@ -73,7 +73,10 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) if(giver_player) new_medal.giver_player_id = giver_player.id - track_statistic_earned(new_recipient.faction, STATISTICS_MEDALS, 1, new_recipient.client.player_data) + var/datum/entity/player/recipient_player = get_player_from_key(new_recipient.ckey) + if(recipient_player) + track_statistic_earned(new_recipient.faction, STATISTICS_MEDALS, 1, recipient_player) + medals += new_medal new_medal.save() new_medal.detach() @@ -85,8 +88,12 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic/medal) if(!check_rights(R_MOD)) return FALSE + + var/datum/entity/player/recipient_player = get_player_from_key(recipient.ckey) + if(recipient_player) + track_statistic_earned(recipient.faction, STATISTICS_MEDALS, 1, recipient_player) + var/round_id = SSperf_logging.round?.id - track_statistic_earned(recipient.faction, STATISTICS_MEDALS, -1, recipient.client.player_data) for(var/datum/entity/statistic/medal/new_medal as anything in medals) if(new_medal.round_id == round_id && new_medal.recipient_name == recipient.real_name && new_medal.medal_type == medal_type && new_medal.citation == citation) medals -= new_medal diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index 9e7e6762e97b..c5546c0e6fc7 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -108,7 +108,6 @@ "top_statistics" = subtype_top_statistics, )) - statistics_list_tabs += player_statistic.statistic_name statistics_list += list(list( "name" = player_statistic.statistic_name, "value" = statistic_info, @@ -123,7 +122,6 @@ "death_list" = death_list, "total_statistics" = total_statistics, "top_statistics" = top_statistics, - "statistics_list_tabs" = statistics_list_tabs, "statistics_list" = statistics_list, ) return data diff --git a/tgui/packages/tgui/interfaces/Statistic.jsx b/tgui/packages/tgui/interfaces/Statistic.jsx index fbf81850144e..fdb76bd8965b 100644 --- a/tgui/packages/tgui/interfaces/Statistic.jsx +++ b/tgui/packages/tgui/interfaces/Statistic.jsx @@ -1,4 +1,4 @@ -import { Fragment, useState } from 'react'; +import { useState } from 'react'; import { useBackend } from '../backend'; import { @@ -18,8 +18,16 @@ export const Statistic = () => { const { data_tabs, round, medals } = data; return ( - - + + @@ -34,11 +42,9 @@ export const Statistic = () => { ))} - -
- -
-
+ + +
@@ -54,7 +60,9 @@ const GetTab = ({ selectedTab, round, medals }) => { return round ? ( ) : ( - Round statistic preparing! + + Round statistic preparing! + ); case 'Medals': return ; @@ -67,115 +75,94 @@ const GetTab = ({ selectedTab, round, medals }) => { const RoundTab = ({ round }) => ( <> - -
- -
- - - - {round.round_result ? ( - - ) : null} - {round.real_time_start ? ( - - ) : null} - {round.real_time_end ? ( - - ) : null} - {round.round_length ? ( - - ) : null} - {round.round_hijack_time ? ( - - ) : null} - - - - - - - - +
+ + + + {round.round_result ? ( + + ) : null} + {round.real_time_start ? ( + + ) : null} + {round.real_time_end ? ( + + ) : null} + {round.round_length ? ( + + ) : null} + {round.round_hijack_time ? ( + + ) : null} + + + + + + + + + + + {round.end_round_player_population ? ( + + ) : null} + {round.participants_list.map((entry, index) => ( + + {entry.value.map((sub_entry, sub_index) => ( - {round.end_round_player_population ? ( - - ) : null} -
- {round.participants_list.map((entry, index) => ( - -
-
- {entry.value.map((sub_entry, sub_index) => ( - - ))} -
-
-
))} -
-
-
+
+ ))} +
{round.death_list.length ? ( ) : ( - No recorded kills! + + No recorded kills! + )} ); -const MedalTab = ({ medals }) => ( - -
- - {medals.map((entry, index) => ( - - - - - - - - - ))} - -
-
-); +const MedalTab = ({ medals }) => + medals.map((entry, index) => ( +
+ + + + +
+ )); const StatTab = ({ faction }) => { const { @@ -184,166 +171,131 @@ const StatTab = ({ faction }) => { nemesis, total_deaths, death_list, - statistics_list_tabs, statistics_list, } = faction; return ( <> {total_statistics.length ? ( - -
- -
- {total_statistics.map((entry, stat_idx) => ( - - ))} -
-
-
-
+
+ {total_statistics.map((entry, stat_idx) => ( + + ))} +
) : ( - No recorded statistic! + + No recorded statistic! + )} - {top_statistics.length ? ( - -
- {top_statistics.map((entry, index) => ( - -
- {entry.name} - {entry.statistics.length - ? entry.statistics.map((stat, statIndex) => ( - - )) - : null} -
-
- ))} -
-
- ) : null} + + {top_statistics.length + ? top_statistics.map((entry, index) => ( +
+ {entry.statistics.length + ? entry.statistics.map((stat, statIndex) => ( + + )) + : null} +
+ )) + : null} + {nemesis.name ? ( - -
- -
- -
-
-
-
+
+ +
) : ( - No recorded nemesis! + + No recorded nemesis! + )} + {death_list.length ? ( ) : ( - No recorded deaths! + + No recorded deaths! + )} - {statistics_list.length ? ( - -
- {statistics_list.map((entry, index) => ( - - {entry.value.length ? ( -
- {entry.value.map((sub_entry, sub_index) => ( - - {sub_entry.name} - {sub_entry.statistics.length ? ( -
- Statistics - {sub_entry.statistics.map((stat, stat_idx) => ( - - ))} -
- ) : null} - {sub_entry.top_statistics.length ? ( -
- Top Statistics - {sub_entry.top_statistics.map((stat, stat_idx) => ( - - ))} -
- ) : null} -
- ))} -
- ) : null} -
- ))} -
-
- ) : null} + + {statistics_list.length + ? statistics_list.map((entry, index) => + entry.value.length + ? entry.value.map((sub_entry, sub_index) => ( +
+ {sub_entry.statistics.length ? ( + <> + Statistics + {sub_entry.statistics.map((stat, stat_idx) => ( + + ))} + + ) : null} + {sub_entry.top_statistics.length ? ( + <> + Top Statistics + {sub_entry.top_statistics.map((stat, stat_idx) => ( + + ))} + + ) : null} +
+ )) + : null, + ) + : null} ); }; const DeathsView = ({ death_log_data, total_deaths }) => ( - -
- -
- {death_log_data.map((entry, index) => ( - - -
-
- - {entry.job_name ? ( - - ) : null} - - - - - - -
-
-
-
- ))} -
-
-
-
+
+ + {death_log_data.map((entry, index) => ( +
+ + {entry.job_name && } + + + + + + +
+ ))} +
+
); const StatItem = ({ label, value }) => ( - - {label}: {value} + + {label}: {value} ); - -const SectionContainer = ({ title, children }) => ( -
-
{children}
-
-); diff --git a/tgui/packages/tgui/styles/interfaces/Statistic.scss b/tgui/packages/tgui/styles/interfaces/Statistic.scss index 832a56593653..80d4929d3544 100644 --- a/tgui/packages/tgui/styles/interfaces/Statistic.scss +++ b/tgui/packages/tgui/styles/interfaces/Statistic.scss @@ -1,111 +1,44 @@ @use '../colors.scss'; $separator-color: colors.$primary !default; -.Statistic { - padding: 20px; - background-color: #1a1a1a; - height: 100%; +.StatisticMenu { + margin: auto; - .tabs-horizontal { - margin-bottom: 20px; - display: flex; - justify-content: center; - - .tab { - background-color: #333; - color: #fff; - padding: 10px 20px; - border-radius: 4px; - margin-right: 10px; - cursor: pointer; - transition: background-color 0.3s; - - &.selected { - background-color: #555; - } - - &:hover { - background-color: #444; - } - - &:last-child { - margin-right: 0; - } - } - } - - .tiles-container { + .TilesInititalizator { display: grid; - grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); - gap: 20px; - width: 100%; - padding: 10px; - box-sizing: border-box; - } - - .tile { - background-color: #2a2a2a; - border: 1px solid #4a4a4a; - border-radius: 8px; - padding: 15px; - box-sizing: border-box; - transition: - transform 0.2s, - box-shadow 0.2s; - color: #ccc; - - &:hover { - transform: translateY(-5px); - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); + grid-template-columns: repeat(auto-fill, minmax(200px, auto)); + gap: 10px; + overflow: hidden; + flex-grow: 1; + + .TilesSmallItem { + padding: 15px; + aspect-ratio: 1 / 1; } - .tile-title { - font-size: 1.2em; - font-weight: bold; - margin-bottom: 10px; - color: #fff; - display: block; + .TilesMediumItem { + padding: 10px; + aspect-ratio: 1 / 1; } - .inner-title { - font-size: 1em; - font-weight: bold; - margin-top: 10px; - color: #ddd; - display: block; - } - - .inner-statistics { - margin-top: 5px; - padding-left: 10px; - border-left: 2px solid #555; + .TilesBigItem { + padding: 10px; + grid-column: span 2; + aspect-ratio: 2 / 1; + width: 100%; + box-sizing: border-box; } } - .statistic-styled-padding { - padding: 12px 10px; - border: 0.5px solid #4a4a4a; - background-color: #2a2a2a; - border-radius: 8px; - box-sizing: border-box; - } - - .collapsible-box { - padding: 12px 10px; - box-sizing: border-box; - } - - .section-content { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); - gap: 20px; + .TilesTitleItem { + font-size: 1em; + font-weight: bold; } - .stat-item { + .TilesStatItem { margin-bottom: 6px; - color: #ccc; - .stat-label { + .TilesStatLabel { color: $separator-color; font-weight: bold; } From 735fa40275cf8f71b13e80ed615a9acee3ec7b70 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 10 Oct 2024 14:41:17 +0500 Subject: [PATCH 59/69] unused var --- code/datums/statistics/entities/panel_stats.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index c5546c0e6fc7..4eb4b6f88d76 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -37,7 +37,6 @@ var/list/death_list = list() var/list/top_statistics = list() var/list/total_statistics = list() - var/list/statistics_list_tabs = list() var/list/statistics_list = list() if(group.nemesis) nemesis = list("name" = group.nemesis.nemesis_name, "value" = group.nemesis.value) From 88a9d4d83cf0cec429530c1b49b2a6b52bcbe4ba Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:17:41 +0500 Subject: [PATCH 60/69] unitests fix? (without stick in, for ignore) --- code/datums/statistics/entities/death_stats.dm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 736b226d8e0b..7803efb9fe37 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -127,6 +127,11 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) ) order_by = list("round_id" = DB_ORDER_BY_DESC) +/datum/entity_meta/statistic_death/Destroy() + . = ..() + if(GLOB.round_statistics) + GLOB.round_statistics.death_stats_list -= src + /mob/proc/track_mob_death(datum/cause_data/cause_data, turf/death_loc) if(cause_data && !istype(cause_data)) stack_trace("track_mob_death called with string cause ([cause_data]) instead of datum") @@ -216,11 +221,8 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) else if(ishuman(src)) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) -// On unit test something going horrybly wrong with testing humans for entire game, and this part exploding with errors -#ifndef UNIT_TESTS - if(SSticker.mode && GLOB.round_statistics) + if(GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death -#endif new_death.save() new_death.detach() From 8382b385eb9a1b8ee1ba71872c5b850ee4afe9c2 Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:53:15 +0500 Subject: [PATCH 61/69] didn't working out, so just ignore it --- code/datums/statistics/entities/death_stats.dm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index 7803efb9fe37..b465e0a9ddb5 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -127,11 +127,6 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) ) order_by = list("round_id" = DB_ORDER_BY_DESC) -/datum/entity_meta/statistic_death/Destroy() - . = ..() - if(GLOB.round_statistics) - GLOB.round_statistics.death_stats_list -= src - /mob/proc/track_mob_death(datum/cause_data/cause_data, turf/death_loc) if(cause_data && !istype(cause_data)) stack_trace("track_mob_death called with string cause ([cause_data]) instead of datum") @@ -221,8 +216,11 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) else if(ishuman(src)) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) +// On unit test something going horrybly wrong with testing humans for entire game, and this part exploding with errors +#ifndef UNIT_TESTS if(GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death +#endif new_death.save() new_death.detach() From 4ec892ea1c8e20a7c37bcae423a6f2de57c4dcd6 Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:56:13 +0500 Subject: [PATCH 62/69] some qol and fixes --- .../datums/statistics/entities/death_stats.dm | 9 ++++-- .../datums/statistics/entities/panel_stats.dm | 2 +- .../datums/statistics/entities/round_stats.dm | 31 ++++++++++++------- code/game/gamemodes/game_mode.dm | 22 +++++++------ 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index b465e0a9ddb5..efc86e8b7566 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -31,6 +31,12 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) +/datum/entity/statistic_death/Destroy() + if(GLOB.round_statistics) + GLOB.round_statistics.death_stats_list -= new_death + + . = ..() + /datum/entity_meta/statistic_death entity_type = /datum/entity/statistic_death table_name = "player_statistic_death" @@ -216,11 +222,8 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) else if(ishuman(src)) track_statistic_earned(new_death.faction_name, STATISTIC_TYPE_JOB, new_death.cause_name, ff_type ? STATISTICS_DEATH_FF : STATISTICS_DEATH, 1, player_entity) -// On unit test something going horrybly wrong with testing humans for entire game, and this part exploding with errors -#ifndef UNIT_TESTS if(GLOB.round_statistics) GLOB.round_statistics.death_stats_list += new_death -#endif new_death.save() new_death.detach() diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index 4eb4b6f88d76..add6c2426684 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -147,7 +147,7 @@ for(var/stat_name in final_participants) final_participants_list += list(list("name" = stat_name, "value" = final_participants[stat_name])) - for(var/datum/entity/statistic_death/statistic_death as anything in death_stats_list) + for(var/datum/view_record/statistic_death/statistic_death as anything in death_stats_list) if(length(last_deaths_list) >= STATISTICS_DEATH_LIST_LEN) break var/list/damage_list = list() diff --git a/code/datums/statistics/entities/round_stats.dm b/code/datums/statistics/entities/round_stats.dm index 8ae215b97e92..1f911eea627e 100644 --- a/code/datums/statistics/entities/round_stats.dm +++ b/code/datums/statistics/entities/round_stats.dm @@ -78,18 +78,24 @@ operation_name += " [pick(GLOB.operation_prefixes)]" operation_name += "-[pick(GLOB.operation_postfixes)]" // Round stats - var/datum/entity/statistic_round/round_statistics = DB_ENTITY(/datum/entity/statistic_round) - round_statistics.round_name = operation_name - round_statistics.map_name = SSmapping.configs[GROUND_MAP].map_name - var/datum/entity/statistic_map/new_map = DB_EKEY(/datum/entity/statistic_map, round_statistics.map_name) - round_statistics.current_map = new_map - round_statistics.current_map.save() - round_statistics.round_id = SSperf_logging.round?.id - round_statistics.game_mode = name - round_statistics.real_time_start = world.realtime - round_statistics.save() - START_PROCESSING(SSobj, round_statistics) - GLOB.round_statistics = round_statistics + var/datum/entity/statistic_round/round = DB_ENTITY(/datum/entity/statistic_round) + round.round_name = operation_name + round.map_name = SSmapping.configs[GROUND_MAP].map_name + var/datum/entity/statistic_map/new_map = DB_EKEY(/datum/entity/statistic_map, round.map_name) + round.current_map = new_map + round.current_map.save() + round.round_id = SSperf_logging.round?.id + round.game_mode = name + round.real_time_start = world.realtime + round.save() + START_PROCESSING(SSobj, round) + GLOB.round_statistics = round + +/datum/entity/statistic_round/Destroy() + QDEL_NULL_LIST(death_stats_list) + QDEL_NULL(current_map) + + . = ..() /datum/entity/statistic_round/proc/setup_faction(faction) if(!faction) @@ -169,6 +175,7 @@ total_deaths[faction]++ /datum/entity/statistic_round/proc/log_round_statistics() + save() if(!GLOB.round_stats) return diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index ed013a208b26..648d84b38cb7 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -162,16 +162,18 @@ GLOBAL_VAR_INIT(cas_tracking_id_increment, 0) //this var used to assign unique t var/list/winners_info = get_winners_states() if(GLOB.round_statistics) - GLOB.round_statistics.game_mode = name - GLOB.round_statistics.round_length = world.time - GLOB.round_statistics.round_result = round_finished - if(!length(GLOB.round_statistics.current_map.victories)) - GLOB.round_statistics.current_map.victories = list() - GLOB.round_statistics.current_map.victories[round_finished]++ - GLOB.round_statistics.end_round_player_population = length(GLOB.clients) - - GLOB.round_statistics.log_round_statistics() - GLOB.round_statistics.track_round_end() + var/datum/entity/statistic_round/round = GLOB.round_statistics + round.game_mode = name + round.round_length = world.time + round.round_result = round_finished + if(!length(round.current_map.victories)) + round.current_map.victories = list() + round.current_map.victories[round_finished]++ + round.current_map.save() + round.end_round_player_population = length(GLOB.clients) + + round.log_round_statistics() + round.track_round_end() calculate_end_statistics() show_end_statistics(winners_info[1]) From 53d441885932ec1551e50635f138523b9061ac5d Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:59:53 +0500 Subject: [PATCH 63/69] lolz --- code/datums/statistics/entities/death_stats.dm | 2 +- code/datums/statistics/entities/panel_stats.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/statistics/entities/death_stats.dm b/code/datums/statistics/entities/death_stats.dm index efc86e8b7566..3b7870844f33 100644 --- a/code/datums/statistics/entities/death_stats.dm +++ b/code/datums/statistics/entities/death_stats.dm @@ -33,7 +33,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic_death) /datum/entity/statistic_death/Destroy() if(GLOB.round_statistics) - GLOB.round_statistics.death_stats_list -= new_death + GLOB.round_statistics.death_stats_list -= src . = ..() diff --git a/code/datums/statistics/entities/panel_stats.dm b/code/datums/statistics/entities/panel_stats.dm index add6c2426684..4eb4b6f88d76 100644 --- a/code/datums/statistics/entities/panel_stats.dm +++ b/code/datums/statistics/entities/panel_stats.dm @@ -147,7 +147,7 @@ for(var/stat_name in final_participants) final_participants_list += list(list("name" = stat_name, "value" = final_participants[stat_name])) - for(var/datum/view_record/statistic_death/statistic_death as anything in death_stats_list) + for(var/datum/entity/statistic_death/statistic_death as anything in death_stats_list) if(length(last_deaths_list) >= STATISTICS_DEATH_LIST_LEN) break var/list/damage_list = list() From 807065a12b6139a8fc834ad0b6fdb223e080cb7e Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 19 Oct 2024 05:37:40 +0500 Subject: [PATCH 64/69] Fun --- code/modules/projectiles/projectile.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index f0b3f9e66147..fd9fc52b2e5a 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -1053,7 +1053,7 @@ emote("scream") to_chat(src, SPAN_HIGHDANGER("You scream in pain as the impact sends shrapnel into the wound!")) - var/mob/shoot_mob = P.weapon_cause_data.resolve_mob() + var/mob/shoot_mob = P.weapon_cause_data?.resolve_mob() if(shoot_mob) if(shoot_mob.faction == faction) shoot_mob.track_friendly_damage(P.weapon_cause_data.cause_name, src, damage) @@ -1128,7 +1128,7 @@ return if(damage) - var/mob/shoot_mob = P.weapon_cause_data.resolve_mob() + var/mob/shoot_mob = P.weapon_cause_data?.resolve_mob() //only apply the blood splatter if we do damage if(shoot_mob) if(shoot_mob.faction == faction) From 100832864407a013dc9b4aa6fc0fc01e14843987 Mon Sep 17 00:00:00 2001 From: Crystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 19 Oct 2024 05:49:07 +0500 Subject: [PATCH 65/69] Update code/modules/projectiles/guns/flamer/flamer.dm Co-authored-by: y7o4ka <56449763+4310V343k@users.noreply.github.com> --- code/modules/projectiles/guns/flamer/flamer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/projectiles/guns/flamer/flamer.dm b/code/modules/projectiles/guns/flamer/flamer.dm index 691c8fd68c59..de15a4908674 100644 --- a/code/modules/projectiles/guns/flamer/flamer.dm +++ b/code/modules/projectiles/guns/flamer/flamer.dm @@ -664,7 +664,7 @@ else to_chat(ignited_morb, SPAN_HIGHDANGER(msg)) - var/mob/shoot_mob = cause_data.resolve_mob() + var/mob/shoot_mob = weapon_cause_data.cause_data.resolve_mob() if(shoot_mob) if(shoot_mob.faction == ignited_morb.faction) shoot_mob.track_friendly_damage(weapon_cause_data.cause_name, ignited_morb, firedamage) From 945be4b4d8606ad8773938c3517b6319b4300936 Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 19 Oct 2024 05:52:25 +0500 Subject: [PATCH 66/69] some another --- code/modules/projectiles/guns/flamer/flamer.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/projectiles/guns/flamer/flamer.dm b/code/modules/projectiles/guns/flamer/flamer.dm index de15a4908674..439cf0d6c104 100644 --- a/code/modules/projectiles/guns/flamer/flamer.dm +++ b/code/modules/projectiles/guns/flamer/flamer.dm @@ -664,7 +664,7 @@ else to_chat(ignited_morb, SPAN_HIGHDANGER(msg)) - var/mob/shoot_mob = weapon_cause_data.cause_data.resolve_mob() + var/mob/shoot_mob = weapon_cause_data?.resolve_mob() if(shoot_mob) if(shoot_mob.faction == ignited_morb.faction) shoot_mob.track_friendly_damage(weapon_cause_data.cause_name, ignited_morb, firedamage) From 3263120b035b735181cf2467a9308f1f5b2339e0 Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:23:38 +0500 Subject: [PATCH 67/69] AAAAAAAAAAAAAAAAAAAAA CONFLICTS, KYS --- .../mob/living/carbon/xenomorph/abilities/xeno_action.dm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm index a6d29df5d9d7..24d543c948af 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm @@ -61,12 +61,10 @@ /datum/action/xeno_action/proc/track_xeno_ability_stats() if(!owner) return - var/mob/living/carbon/xenomorph/xeno = owner - if(ability_name) - if(GLOB.round_statistics) - GLOB.round_statistics.track_ability_usage(name) - xeno.track_ability_usage(ability_name, xeno.caste_type) + var/mob/living/carbon/xenomorph/xeno = owner + if(name) + xeno.track_ability_usage(name, xeno.caste_type) /datum/action/xeno_action/can_use_action() if(!owner) From 689575ee89076895796a36b10144dc31bb009466 Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:26:04 +0500 Subject: [PATCH 68/69] fuck off linters --- code/datums/statistics/entities/player_entity.dm | 2 +- code/datums/statistics/random_facts/random_fact.dm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/datums/statistics/entities/player_entity.dm b/code/datums/statistics/entities/player_entity.dm index 8c98c18f5b57..1763393bf71e 100644 --- a/code/datums/statistics/entities/player_entity.dm +++ b/code/datums/statistics/entities/player_entity.dm @@ -28,7 +28,7 @@ BSQL_PROTECT_DATUM(/datum/entity/statistic) if(!player || !faction || !statistic_type || !general_name || !statistic_name) return - if(!(faction in FACTION_LIST_ALL + list(STATISTIC_TYPE_GLOBAL))) + if(!(faction in (FACTION_LIST_ALL + list(STATISTIC_TYPE_GLOBAL)))) faction = FACTION_NEUTRAL var/datum/entity/statistic/statistic = player.player_entity?.get_statistic(faction, statistic_type, general_name, statistic_name) diff --git a/code/datums/statistics/random_facts/random_fact.dm b/code/datums/statistics/random_facts/random_fact.dm index 099aed876a23..f0ad15147b83 100644 --- a/code/datums/statistics/random_facts/random_fact.dm +++ b/code/datums/statistics/random_facts/random_fact.dm @@ -26,7 +26,7 @@ if(GLOB.round_statistics && length(GLOB.round_statistics.death_stats_list)) for(var/datum/entity/statistic_death/death in GLOB.round_statistics.death_stats_list) - if(check_human && (death.faction_name in FACTION_LIST_XENOMORPH && check_xeno)) + if(check_human && (death.faction_name in FACTION_LIST_XENOMORPH) && check_xeno) continue if(death_stat_gotten < death_grab_stat(death)) death_to_report = death From e77ec5ad3ae7ce1aaea324f691dcd41e4b00770e Mon Sep 17 00:00:00 2001 From: BlackCrystalic <39885003+blackcrystall@users.noreply.github.com> Date: Sat, 9 Nov 2024 22:02:21 +0500 Subject: [PATCH 69/69] this is funny one, that I totally messed up first time, don't let me code... wait I'm fixing it at night, okay fine --- code/datums/statistics/random_facts/random_fact.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/datums/statistics/random_facts/random_fact.dm b/code/datums/statistics/random_facts/random_fact.dm index f0ad15147b83..ae265a2155f0 100644 --- a/code/datums/statistics/random_facts/random_fact.dm +++ b/code/datums/statistics/random_facts/random_fact.dm @@ -26,7 +26,10 @@ if(GLOB.round_statistics && length(GLOB.round_statistics.death_stats_list)) for(var/datum/entity/statistic_death/death in GLOB.round_statistics.death_stats_list) - if(check_human && (death.faction_name in FACTION_LIST_XENOMORPH) && check_xeno) + var/xeno_checked = death.faction_name in FACTION_LIST_XENOMORPH + if(!check_human && !xeno_checked) + continue + if(!check_xeno && xeno_checked) continue if(death_stat_gotten < death_grab_stat(death)) death_to_report = death