Skip to content

Commit

Permalink
TGS Test Merge (#6060)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Apr 3, 2024
2 parents 7247b76 + 5f0fe55 commit 018cf35
Show file tree
Hide file tree
Showing 97 changed files with 2,583 additions and 8 deletions.
14 changes: 14 additions & 0 deletions code/__DEFINES/battlepass.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#define CHALLENGE_NONE "none"
#define CHALLENGE_XENO "Xeno Challenge"
#define CHALLENGE_HUMAN "Human Challenge"

#define REWARD_CATEGORY_ARMOR "armor"
#define REWARD_CATEGORY_HELMET_FIRE "helmet_fire"
#define REWARD_CATEGORY_PARTICLE "particle"
#define REWARD_CATEGORY_TOY "toy"
#define REWARD_CATEGORY_OVERLAY "overlay"
#define REWARD_CATEGORY_SHOTGUN_RESKIN "shotgun_reskin"
#define REWARD_CATEGORY_M41A_RESKIN "m41a_reskin"

/// How long do you need to play/stay alive for to earn the game-end points
#define BATTLEPASS_TIME_TO_EARN_REWARD (0.1 MINUTES)
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,5 @@

/// From /obj/item/proc/dig_out_shrapnel() : ()
#define COMSIG_HUMAN_SHRAPNEL_REMOVED "human_shrapnel_removed"

#define COMSIG_HUMAN_USED_DEFIB "human_used_defib"
10 changes: 10 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@
/// From /mob/living/carbon/xenomorph/proc/hivemind_talk(): (message)
#define COMSIG_XENO_TRY_HIVEMIND_TALK "xeno_try_hivemind_talk"
#define COMPONENT_OVERRIDE_HIVEMIND_TALK (1<<0)

#define COMSIG_XENO_RAGE_MAX "xeno_rage_max"

#define COMSIG_XENO_PLANTED_FRUIT "xeno_planted_fruit"

#define COMSIG_XENO_FACEHUGGED_HUMAN "xeno_facehugged_human"

#define COMSIG_XENO_FTH_MAX_ACID "xeno_fth_max_acid"

#define COMSIG_FIRER_PROJECTILE_DIRECT_HIT "firer_projectile_direct_hit"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/mob/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,5 @@
#define COMSIG_MOB_END_TUTORIAL "mob_end_tutorial"

#define COMSIG_MOB_NESTED "mob_nested"

#define COMSIG_MOB_KILL_TOTAL_INCREASED "mob_kill_total_increased"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@

/// Fired on the lazy template datum when the template is finished loading. (list/loaded_atom_movables, list/loaded_turfs, list/loaded_areas)
#define COMSIG_LAZY_TEMPLATE_LOADED "lazy_template_loaded"

#define COMSIG_BATTLEPASS_CHALLENGE_COMPLETED "battlepass_challenge_completed"
2 changes: 2 additions & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
#define FULLSCREEN_VULTURE_SCOPE_LAYER 17.21
/// in critical
#define FULLSCREEN_CRIT_LAYER 17.25
/// tier-up battlepass
#define FULLSCREEN_BATTLEPASS_TIERUP 18

#define HUD_LAYER 19
#define ABOVE_HUD_LAYER 20
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/particle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// /obj/effect/abstract/particle_holder/var/particle_flags
// Flags that effect how a particle holder displays something

/// If we're inside something inside a mob, display off that mob too
#define PARTICLE_ATTACH_MOB (1<<0)
1 change: 1 addition & 0 deletions code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
#define SS_INIT_STICKY -30
#define SS_INIT_PREDSHIPS -31
#define SS_INIT_OBJECTIVES -32
#define SS_INIT_BATTLEPASS -33
#define SS_INIT_MINIMAP -34
#define SS_INIT_STATPANELS -98
#define SS_INIT_CHAT -100 //Should be last to ensure chat remains smooth during init.
Expand Down
1 change: 1 addition & 0 deletions code/__HELPERS/string_lists.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GLOBAL_LIST_EMPTY(string_lists)
#define json_load(FILE) (json_decode(file2text(FILE)))

/**
* Caches lists with non-numeric stringify-able values (text or typepath).
Expand Down
5 changes: 5 additions & 0 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@
icon_state = "vulture_scope_overlay_spotter"
should_resize = FALSE

/atom/movable/screen/fullscreen/battlepass
icon_state = "battlepass_tierup"
layer = FULLSCREEN_BATTLEPASS_TIERUP
show_when_dead = TRUE

//Weather overlays//

/atom/movable/screen/fullscreen/weather
Expand Down
160 changes: 160 additions & 0 deletions code/controllers/subsystem/battlepass.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
SUBSYSTEM_DEF(battlepass)
name = "Battlepass"
flags = SS_NO_FIRE
init_order = SS_INIT_BATTLEPASS
/// The maximum tier the battlepass goes to
var/maximum_tier = 20
/// What season we're currently in
var/season = 1
/// Dict of all marine challenges to their pick weight
var/list/marine_challenges = list()
/// Dict of all xeno challenges to their pick weight
var/list/xeno_challenges = list()
/// List of paths of all battlepass rewards for the current season, in order
var/list/season_rewards = list()
/// List of all paths of all premium battlepass rewards for the current season, in order
var/list/premium_season_rewards = list()
var/list/marine_battlepass_earners = list()
var/list/xeno_battlepass_earners = list()

/datum/controller/subsystem/battlepass/Initialize()
if(!fexists("config/battlepass.json"))
return

var/list/battlepass_data = json_load("config/battlepass.json")

maximum_tier = battlepass_data["maximum_tier"]
season = battlepass_data["season"]

for(var/reward_path in battlepass_data["reward_data"])
season_rewards += text2path(reward_path)

for(var/reward_path in battlepass_data["premium_reward_data"])
premium_season_rewards += text2path(reward_path)

for(var/datum/battlepass_challenge/challenge_path as anything in subtypesof(/datum/battlepass_challenge))
switch(initial(challenge_path.challenge_category))
if(CHALLENGE_NONE)
continue

if(CHALLENGE_HUMAN)
marine_challenges[challenge_path] = initial(challenge_path.pick_weight)

if(CHALLENGE_XENO)
xeno_challenges[challenge_path] = initial(challenge_path.pick_weight)

RegisterSignal(src, COMSIG_SUBSYSTEM_POST_INITIALIZE, PROC_REF(do_postinit))

for(var/client/client as anything in GLOB.clients)
if(!client.owned_battlepass)
continue

client.owned_battlepass.verify_rewards()

return SS_INIT_SUCCESS

/datum/controller/subsystem/battlepass/proc/do_postinit(datum/source)
SIGNAL_HANDLER

UnregisterSignal(src, COMSIG_SUBSYSTEM_POST_INITIALIZE)

for(var/client/client as anything in GLOB.clients)
client.owned_battlepass?.check_daily_challenge_reset()

/// Returns a typepath of a challenge of the given category
/datum/controller/subsystem/battlepass/proc/get_challenge(challenge_type = CHALLENGE_NONE)
switch(challenge_type)
if(CHALLENGE_NONE)
return

if(CHALLENGE_HUMAN)
return pick_weight(marine_challenges)

if(CHALLENGE_XENO)
return pick_weight(xeno_challenges)


/datum/controller/subsystem/battlepass/proc/give_sides_points(marine_points = 0, xeno_points = 0)
if(marine_points)
give_side_points(marine_points, marine_battlepass_earners)

if(xeno_points)
give_side_points(xeno_points, xeno_battlepass_earners)

/datum/controller/subsystem/battlepass/proc/save_battlepasses()
for(var/client/player as anything in GLOB.clients)
player.save_battlepass()

/datum/controller/subsystem/battlepass/proc/give_side_points(point_amount = 0, ckey_list)
if(!islist(ckey_list))
CRASH("give_side_points in SSbattlepass called without giving a list of ckeys")

for(var/ckey in ckey_list)
if(ckey in GLOB.directory)
var/client/ckey_client = GLOB.directory[ckey]
if(ckey_client.owned_battlepass)
ckey_client.owned_battlepass.add_xp(point_amount)
else
if(!fexists("data/player_saves/[copytext(ckey,1,2)]/[ckey]/battlepass.sav"))
continue

var/savefile/ckey_save = new("data/player_saves/[copytext(ckey,1,2)]/[ckey]/battlepass.sav")

ckey_save["xp"] += point_amount // if they're >=10 XP, it'll get sorted next time they log on

/// Proc meant for admin calling to see BP levels of all online players
/datum/controller/subsystem/battlepass/proc/output_bp_levels(mob/caller)
var/list/levels = list(
"1" = 0,
"2" = 0,
"3" = 0,
"4" = 0,
"5" = 0,
"6" = 0,
"7" = 0,
"8" = 0,
"9" = 0,
"10" = 0,
"11" = 0,
"12" = 0,
"13" = 0,
"14" = 0,
"15" = 0,
"16" = 0,
"17" = 0,
"18" = 0,
"19" = 0,
"20" = 0,
)
for(var/client/player_client as anything in GLOB.clients)
if(!player_client.owned_battlepass)
continue

levels["[player_client.owned_battlepass.tier]"] += 1

to_chat(caller, SPAN_NOTICE(json_encode(levels)))


/datum/controller/subsystem/battlepass/proc/get_bp_ge_to_tier(mob/caller, tiernum = 1)
var/i = 0
for(var/a in flist("data/player_saves/"))
for(var/ckey_str in flist("data/player_saves/[a]/"))
if(!fexists("data/player_saves/[a]/[ckey_str]/battlepass.sav"))
continue

var/savefile/save_obj = new("data/player_saves/[a]/[ckey_str]/battlepass.sav")
if(save_obj["tier"] >= tiernum)
i++
to_chat(caller, SPAN_NOTICE("[i]"))


/datum/controller/subsystem/battlepass/proc/get_bp_xp_total(mob/caller)
var/xp = 0
for(var/a in flist("data/player_saves/"))
for(var/ckey_str in flist("data/player_saves/[a]/"))
if(!fexists("data/player_saves/[a]/[ckey_str]/battlepass.sav"))
continue

var/savefile/save_obj = new("data/player_saves/[a]/[ckey_str]/battlepass.sav")
xp += (((save_obj["tier"] - 1) * 10) + save_obj["xp"])
to_chat(caller, SPAN_NOTICE("[xp]"))
1 change: 1 addition & 0 deletions code/datums/statistics/entities/death_stats.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@

if(cause_mob)
cause_mob.life_kills_total += life_value
SEND_SIGNAL(cause_mob, COMSIG_MOB_KILL_TOTAL_INCREASED, src, cause_data)

if(getBruteLoss())
new_death.total_brute = round(getBruteLoss())
Expand Down
1 change: 1 addition & 0 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ Additional game mode variables.
to_chat(xeno_candidate, SPAN_WARNING("You are banished from this hive, You may not rejoin unless the Queen re-admits you or dies."))
return FALSE
if(transfer_xeno(xeno_candidate, new_xeno))
SSbattlepass.xeno_battlepass_earners |= new_xeno?.client?.ckey
return TRUE
to_chat(xeno_candidate, "JAS01: Something went wrong, tell a coder.")

Expand Down
6 changes: 6 additions & 0 deletions code/game/gamemodes/colonialmarines/colonialmarines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,14 @@
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++
SSbattlepass.give_sides_points(3, 5)
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++
SSbattlepass.give_sides_points(5, 3)
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
Expand All @@ -389,16 +391,19 @@
end_icon = "xeno_minor"
if(GLOB.round_statistics && GLOB.round_statistics.current_map)
GLOB.round_statistics.current_map.total_xeno_victories++
SSbattlepass.give_sides_points(3, 4)
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++
SSbattlepass.give_sides_points(4, 3)
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++
SSbattlepass.give_sides_points(3, 3)
var/sound/S = sound(musical_track, channel = SOUND_CHANNEL_LOBBY)
S.status = SOUND_STREAM
sound_to(world, S)
Expand All @@ -418,6 +423,7 @@
declare_completion_announce_predators()
declare_completion_announce_medal_awards()
declare_fun_facts()
SSbattlepass.save_battlepasses()


add_current_round_status_to_end_results("Round End")
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/antag/xeno/xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// a proper limit.
spawn_positions = -1
total_positions = -1
xeno_sided = TRUE

/datum/job/antag/xenos/proc/calculate_extra_spawn_positions(count)
return max((round(count * XENO_TO_TOTAL_SPAWN_RATIO)), 0)
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/civilians/civilian.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/datum/job/civilian
gear_preset = /datum/equipment_preset/colonist
marine_sided = TRUE

/datum/timelock/medic
name = "Medical Roles"
Expand Down
5 changes: 3 additions & 2 deletions code/game/jobs/job/command/command.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
supervisors = "the acting commanding officer"
total_positions = 1
spawn_positions = 1
marine_sided = TRUE

/datum/timelock/command
name = "Command Roles"
Expand All @@ -23,7 +24,7 @@

/datum/timelock/human/can_play(client/C)
return C.get_total_human_playtime() >= time_required

/datum/timelock/human/get_role_requirement(client/C)
return time_required - C.get_total_human_playtime()

Expand All @@ -33,4 +34,4 @@
/datum/timelock/dropship/New(name, time_required, list/roles)
. = ..()
src.roles = JOB_DROPSHIP_ROLES_LIST

16 changes: 16 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
var/job_options
/// If TRUE, this job will spawn w/ a cryo emergency kit during evac/red alert
var/gets_emergency_kit = TRUE
var/marine_sided = FALSE
var/xeno_sided = FALSE

/datum/job/New()
. = ..()
Expand Down Expand Up @@ -239,8 +241,22 @@

setup_human(new_character, NP)

addtimer(CALLBACK(src, PROC_REF(add_to_battlepass_earners), new_character), BATTLEPASS_TIME_TO_EARN_REWARD)

return new_character

/datum/job/proc/add_to_battlepass_earners(mob/living/carbon/human/character)
if(!character?.client?.ckey)
return

var/ckey = character.client.ckey

// You cannot double dip; marine or xeno only
if(marine_sided && !(ckey in SSbattlepass.xeno_battlepass_earners))
SSbattlepass.marine_battlepass_earners |= ckey
else if(xeno_sided && !(ckey in SSbattlepass.marine_battlepass_earners))
SSbattlepass.xeno_battlepass_earners |= ckey

/datum/job/proc/equip_job(mob/living/M)
if(!istype(M))
return
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/marine/marine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
total_positions = 8
spawn_positions = 8
allow_additional = 1
marine_sided = TRUE

/datum/job/marine/generate_entry_message(mob/living/carbon/human/current_human)
if(current_human.assigned_squad)
Expand Down
3 changes: 3 additions & 0 deletions code/game/jobs/job/special/uscm.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/datum/job/special/uscm
marine_sided = TRUE

/datum/job/special/uscm/colonel
title = JOB_COLONEL
/datum/job/special/uscm/general
Expand Down
Loading

0 comments on commit 018cf35

Please sign in to comment.