Skip to content

Commit

Permalink
Fix of shitty shit around
Browse files Browse the repository at this point in the history
  • Loading branch information
Deleted user committed Aug 13, 2024
1 parent 6d8f47e commit 781e191
Show file tree
Hide file tree
Showing 28 changed files with 571 additions and 262 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
5 changes: 4 additions & 1 deletion code/__DEFINES/statistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/statistics/entities/death_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions code/datums/statistics/entities/medal_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions code/datums/statistics/entities/panel_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions code/datums/statistics/entities/player_entity.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
98 changes: 49 additions & 49 deletions code/datums/statistics/entities/player_stats.dm

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions code/datums/statistics/entities/round_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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++
Expand All @@ -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()
Expand Down Expand Up @@ -250,6 +252,8 @@
return TRUE

/datum/action/show_round_statistics/action_activate()
. = ..()

if(!can_use_action())
return

Expand Down
2 changes: 1 addition & 1 deletion code/datums/statistics/random_facts/damage_fact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion code/datums/statistics/random_facts/kills_fact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions code/datums/statistics/random_facts/random_fact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion code/datums/statistics/random_facts/revives_fact.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion code/datums/tutorial/ss13/_ss13.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
64 changes: 45 additions & 19 deletions code/game/gamemodes/colonialmarines/colonialmarines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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(
Expand Down
33 changes: 20 additions & 13 deletions code/game/gamemodes/colonialmarines/whiskey_outpost.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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//
///////////////////////////////
Expand Down
30 changes: 10 additions & 20 deletions code/game/gamemodes/colonialmarines/xenovsxeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading

0 comments on commit 781e191

Please sign in to comment.