Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popbalance Toggle #3563

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@
#include "code\modules\halo\admin\difficulty.dm"
#include "code\modules\halo\admin\fleet_spawn.dm"
#include "code\modules\halo\admin\lore_accurate.dm"
#include "code\modules\halo\admin\poplock.dm"
#include "code\modules\halo\admin\radio_message.dm"
#include "code\modules\halo\admin\ship_load.dm"
#include "code\modules\halo\admin\spawn_conversion.dm"
Expand Down
4 changes: 3 additions & 1 deletion code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@
return TRUE
poplock_bypassing = 0
//is this gamemode trying to balance the faction population?
var/num_balancing_factions = ticker.mode ? ticker.mode.faction_balance.len : 0
var/num_balancing_factions = 0
if(GLOB.popbalance_active && ticker.mode)
num_balancing_factions = ticker.mode.faction_balance.len
if(ticker.current_state == GAME_STATE_PLAYING && num_balancing_factions >= 2) //Only popbalance if we're actually playing rn.
if(Debug2) to_debug_listeners("Checking gamemode balance for [src.title]...")

Expand Down
3 changes: 3 additions & 0 deletions code/modules/halo/admin/_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
admin_verbs_fun.Add(/client/proc/custom_radio_message)
admin_verbs_hideable.Add(/client/proc/custom_radio_message)

admin_verbs_fun.Add(/client/proc/pop_toggle)
admin_verbs_hideable.Add(/client/proc/pop_toggle)

return 1
15 changes: 15 additions & 0 deletions code/modules/halo/admin/poplock.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GLOBAL_VAR_INIT(popbalance_active,1)

/client/proc/pop_toggle()
set category = "Fun"
set name = "Toggle Popbalance"
if(!check_rights(R_FUN))
return

var/message = ""
if(GLOB.popbalance_active)
message = "Population-based faction balance inactive"
else
message = "Population-based faction balance active"
to_world("<span class = 'danger'>[message]</span>")
GLOB.popbalance_active = !GLOB.popbalance_active
2 changes: 1 addition & 1 deletion maps/_gamemodes/_popbalance.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//GLOBAL_VAR_INIT(max_overpop, 0.5) //now a config var
GLOBAL_VAR_INIT(round_no_balance_time, 0 MINUTES) //Nothing, right now.
GLOBAL_VAR_INIT(last_admin_notice_overpop, 0)
GLOBAL_VAR_INIT(min_players_balance, 3)
GLOBAL_VAR_INIT(min_players_balance, 10)

/datum/game_mode
//put the faction types in here that you want to be balanced
Expand Down
Loading