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

Dynamic mode votes can happen now #1202

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ SUBSYSTEM_DEF(ticker)

if(!modevoted)
var/forcemode = CONFIG_GET(string/force_gamemode)
if(forcemode)
if(forcemode && !check_forced_exemption()) //SPLURT EDIT - Allow for rounds with votes even when a gamemode is forced
force_gamemode(forcemode)
if(!forcemode || (GLOB.master_mode == "dynamic" && CONFIG_GET(flag/dynamic_voting)))
send_gamemode_vote()
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/flavor_text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ GLOBAL_LIST_EMPTY(mobs_with_editable_flavor_text) //et tu, hacky code
if(L.client.prefs.extremepref == "Yes")
content += "<br><b>Extreme content:</b> [L.client.prefs.extremepref] <b>| Extreme content harm:</b> [L.client.prefs.extremeharm]\n"

if(L.client.prefs.be_victim == BEVICTIM_ASK || L.client.prefs.be_victim == BEVICTIM_YES)
if((L.client.prefs.be_victim == BEVICTIM_ASK || L.client.prefs.be_victim == BEVICTIM_YES) && GLOB.master_mode == "extended")
content += "<br><b>Be antag victim:</b> [L.client.prefs.be_victim]\n"

content += "\n"
Expand Down
13 changes: 13 additions & 0 deletions config/splurt/general.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,16 @@ CHARACTER_COLOR_LIMITS
# Max amount of songs that can be added to the jukebox each round.
# -1 or comment to unlimit
#MAX_JUKEBOX_SONGS -1

# Vote mode exemption
# Toggles the system to run a dynamic/extended vote mode every few rounds and days according to the config
# Useless without a forced mode
#VOTE_MODE_EXEMPTION

# Vote exemption days
# The VOTE exemption clause will be available every X days
#VOTE_EXEMPTION_DAYS 2

# Vote exemption rounds
# The VOTE exemption clause will be available every X rounds
#VOTE_EXEMPTION_ROUNDS 2
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@

/datum/config_entry/number/max_jukebox_songs
default = -1

/datum/config_entry/flag/vote_mode_exemption

/datum/config_entry/number/vote_exemption_days
default = 2
min_val = 1

/datum/config_entry/number/vote_exemption_rounds
default = 2
min_val = 1
41 changes: 41 additions & 0 deletions modular_splurt/code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,44 @@
if(player.ready == PLAYER_READY_TO_OBSERVE && player.mind && !(player.client?.prefs.toggles & TG_PLAYER_PANEL))
//Break chain since this has a sleep input in it
addtimer(CALLBACK(player, TYPE_PROC_REF(/mob/dead/new_player, make_me_an_observer)), 1)

/datum/controller/subsystem/ticker/proc/check_forced_exemption()
if(!CONFIG_GET(flag/vote_mode_exemption))
return FALSE

var/current_day = text2num(time2text(world.timeofday, "DD"))
var/current_month = text2num(time2text(world.timeofday, "MM"))
var/current_year = text2num(time2text(world.timeofday, "YYYY"))
var/current_round = GLOB.round_id

var/days = CONFIG_GET(number/vote_exemption_days)
var/rounds = CONFIG_GET(number/vote_exemption_rounds)

var/list/days_in_months = list(
1 = 31, // January
2 = IsLeapYear(current_year) ? 29 : 28, // February
3 = 31, // March
4 = 30, // April
5 = 31, // May
6 = 30, // June
7 = 31, // July
8 = 31, // August
9 = 30, // September
10 = 31, // October
11 = 30, // November
12 = 31 // December
)

// Add the number of days in the past months to the current day
for (var/i in 1 to (current_month - 1))
current_day += days_in_months[i]

// Check if the current day is part of the cycle of every [days] days
if (current_day % days != 0)
return FALSE

// Check if the current round is part of the cycle of every [rounds] rounds
if (current_round % rounds != 0)
return FALSE

return TRUE
Loading