Skip to content

Commit

Permalink
Merge branch 'cmss13-devs:master' into tgui-records
Browse files Browse the repository at this point in the history
  • Loading branch information
Crowbar764 authored Sep 30, 2023
2 parents 02ce133 + 9d0e0aa commit 270fa75
Show file tree
Hide file tree
Showing 46 changed files with 3,332 additions and 3,294 deletions.
2 changes: 2 additions & 0 deletions code/__HELPERS/game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@
if(sorted && length(candidates))
candidates = sort_list(candidates, GLOBAL_PROC_REF(cmp_obs_larvaqueuetime_asc))

GLOB.xeno_queue_candidate_count = length(candidates)

return candidates

/**
Expand Down
3 changes: 3 additions & 0 deletions code/_globalvars/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ GLOBAL_VAR_INIT(time_offset, setup_offset())
/// Sets the offset 2 lines above.
/proc/setup_offset()
return rand(10 MINUTES, 24 HOURS)

/// The last count of possible candidates in the xeno larva queue (updated via get_alien_candidates)
GLOBAL_VAR(xeno_queue_candidate_count)
4 changes: 0 additions & 4 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@ Voting
/datum/config_entry/string/gamemode_default
config_entry_value = "Extended"

// Rounds needed for gamemode vote
/datum/config_entry/number/gamemode_rounds_needed
config_entry_value = 5

/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

Expand Down
19 changes: 8 additions & 11 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,14 @@ SUBSYSTEM_DEF(ticker)
mode.declare_completion(force_ending)
REDIS_PUBLISH("byond.round", "type" = "round-complete")
flash_clients()
if(text2num(SSperf_logging?.round?.id) % CONFIG_GET(number/gamemode_rounds_needed) == 0)
addtimer(CALLBACK(
SSvote,
/datum/controller/subsystem/vote/proc/initiate_vote,
"gamemode",
"SERVER",
CALLBACK(src, PROC_REF(handle_map_reboot)),
TRUE
), 3 SECONDS)
else
handle_map_reboot()
addtimer(CALLBACK(
SSvote,
/datum/controller/subsystem/vote/proc/initiate_vote,
"gamemode",
"SERVER",
CALLBACK(src, PROC_REF(handle_map_reboot)),
TRUE
), 3 SECONDS)
Master.SetRunLevel(RUNLEVEL_POSTGAME)

/// Attempt to start game asynchronously if applicable
Expand Down
28 changes: 16 additions & 12 deletions code/game/gamemodes/cm_initialize.dm
Original file line number Diff line number Diff line change
Expand Up @@ -356,17 +356,21 @@ Additional game mode variables.
else
available_xenos_non_ssd += cur_xeno

var/datum/hive_status/hive
for(var/hivenumber in GLOB.hive_datum)
hive = GLOB.hive_datum[hivenumber]
if(!hive.hardcore && hive.stored_larva && (hive.hive_location || (world.time < XENO_BURIED_LARVA_TIME_LIMIT + SSticker.round_start_time)))
if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE))
available_xenos |= "any buried larva"
LAZYADD(available_xenos["any buried larva"], hive)
else
var/larva_option = "buried larva ([hive])"
available_xenos += larva_option
available_xenos[larva_option] = list(hive)
// Only offer buried larva if there is no queue:
// This basically means this block of code will almost never execute, because we are instead relying on the hive cores/larva pops to handle their larva
// Technically this should be after a get_alien_candidates() call to be accurate, but we are intentionally trying to not call that proc as much as possible
if(GLOB.xeno_queue_candidate_count < 1)
var/datum/hive_status/hive
for(var/hivenumber in GLOB.hive_datum)
hive = GLOB.hive_datum[hivenumber]
if(!hive.hardcore && hive.stored_larva && (hive.hive_location || (world.time < XENO_BURIED_LARVA_TIME_LIMIT + SSticker.round_start_time)))
if(SSticker.mode && (SSticker.mode.flags_round_type & MODE_RANDOM_HIVE))
available_xenos |= "any buried larva"
LAZYADD(available_xenos["any buried larva"], hive)
else
var/larva_option = "buried larva ([hive])"
available_xenos += larva_option
available_xenos[larva_option] = list(hive)

if(!available_xenos.len || (instant_join && !available_xenos_non_ssd.len))
if(!xeno_candidate.client || !xeno_candidate.client.prefs || !(xeno_candidate.client.prefs.be_special & BE_ALIEN_AFTER_DEATH))
Expand Down Expand Up @@ -446,7 +450,7 @@ Additional game mode variables.
to_chat(xeno_candidate, SPAN_WARNING("You cannot join if the xenomorph is dead."))
return FALSE

if(new_xeno.stat == UNCONSCIOUS)
if(new_xeno.health <= 0)
to_chat(xeno_candidate, SPAN_WARNING("You cannot join if the xenomorph is in critical condition or unconscious."))
return FALSE

Expand Down
13 changes: 7 additions & 6 deletions code/modules/cm_aliens/structures/special/pylon_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,25 +263,26 @@
linked_hive.hive_ui.update_burrowed_larva()
qdel(worm)

var/count_spawned = 0
var/spawning_larva = can_spawn_larva() && (last_larva_time + spawn_cooldown) < world.time
if(spawning_larva)
last_larva_time = world.time
if(spawning_larva || (last_larva_queue_time + spawn_cooldown * 4) < world.time)
last_larva_queue_time = world.time
var/list/players_with_xeno_pref = get_alien_candidates(linked_hive)
if(players_with_xeno_pref && players_with_xeno_pref.len)
if(length(players_with_xeno_pref))
if(spawning_larva && spawn_burrowed_larva(players_with_xeno_pref[1]))
// We were in spawning_larva mode and successfully spawned someone
message_alien_candidates(players_with_xeno_pref, dequeued = 1)
else
// Just time to update everyone their queue status (or the spawn failed)
message_alien_candidates(players_with_xeno_pref, dequeued = 0)
count_spawned = 1
// Update everyone's queue status
message_alien_candidates(players_with_xeno_pref, dequeued = count_spawned)

if(linked_hive.hijack_burrowed_surge && (last_surge_time + surge_cooldown) < world.time)
last_surge_time = world.time
linked_hive.stored_larva++
linked_hive.hijack_burrowed_left--
notify_ghosts(header = "Claim Xeno", message = "The Hive has gained another burrowed larva! Click to take it.", source = src, action = NOTIFY_JOIN_XENO, enter_link = "join_xeno")
if(GLOB.xeno_queue_candidate_count < 1 + count_spawned)
notify_ghosts(header = "Claim Xeno", message = "The Hive has gained another burrowed larva! Click to take it.", source = src, action = NOTIFY_JOIN_XENO, enter_link = "join_xeno")
if(surge_cooldown > 30 SECONDS) //mostly for sanity purposes
surge_cooldown = surge_cooldown - surge_incremental_reduction //ramps up over time
if(linked_hive.hijack_burrowed_left < 1)
Expand Down
Loading

0 comments on commit 270fa75

Please sign in to comment.