Skip to content

Commit

Permalink
Removes legacy yogtoggles, mood is enabled by default. (yogstation13#…
Browse files Browse the repository at this point in the history
…19591)

* Moves yog's legacy toggles to non legacy, mood enabled by default

* Update quirks.dm
  • Loading branch information
JohnFulpWillard authored Jul 10, 2023
1 parent b9471c7 commit 52d933c
Show file tree
Hide file tree
Showing 18 changed files with 51 additions and 69 deletions.
8 changes: 0 additions & 8 deletions code/__DEFINES/{yogs_defines}/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@

#define DONOR_BYOND_SLOTS 2
#define DONOR_YOGS_SLOTS 3

//YOGS pref.yogstoggles enum's
// !!! DO NOT ADD ANY NEW ONES HERE !!!
// Use `/datum/preference/toggle` instead.
#define QUIET_ROUND (1<<0) //Donor features, quiet round; in /~yogs_defines/, as god intended
#define PREF_MOOD (1<<1) //Toggles the use of the Mood feature. Defaults to off, thank god.

#define YOGTOGGLES_DEFAULT 0
33 changes: 13 additions & 20 deletions code/controllers/subsystem/economy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,20 @@ SUBSYSTEM_DEF(economy)
D.adjust_money(500)

/datum/controller/subsystem/economy/proc/secmedsrv_payout()
for(var/mob/m in GLOB.mob_list)
if(isnewplayer(m))
for(var/mob/living/carbon/human/human_player in GLOB.player_list)
if(human_player.stat == DEAD)
continue
if(m.mind)
if(isbrain(m) || iscameramob(m))
continue
if(ishuman(m))
var/mob/living/carbon/human/H = m
if(H.stat != DEAD)
var/datum/component/mood/mood = H.GetComponent(/datum/component/mood)
var/medical_cash = (H.health / H.maxHealth) * alive_humans_bounty
if(mood)
var/datum/bank_account/D = get_dep_account(ACCOUNT_SRV)
if(D)
var/mood_dosh = (mood.mood_level / 9) * mood_bounty
D.adjust_money(mood_dosh)
medical_cash *= (mood.sanity / 100)

var/datum/bank_account/D = get_dep_account(ACCOUNT_MED)
if(D)
D.adjust_money(medical_cash)
var/datum/component/mood/mood = human_player.GetComponent(/datum/component/mood)
var/medical_cash = (human_player.health / human_player.maxHealth) * alive_humans_bounty
if(mood)
var/datum/bank_account/D = get_dep_account(ACCOUNT_SRV)
if(D)
var/mood_dosh = (mood.mood_level / 9) * mood_bounty
D.adjust_money(mood_dosh)
medical_cash *= (mood.sanity / 100)
var/datum/bank_account/D = get_dep_account(ACCOUNT_MED)
if(D)
D.adjust_money(medical_cash)
CHECK_TICK

var/service_passive_income = (rand(1, 6) * 400) //min 400, max 2400
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ SUBSYSTEM_DEF(job)
JobDebug("FOC incompatible with antagonist role, Player: [player]")
continue
// yogs start - Donor features, quiet round
if(((job.title in GLOB.command_positions) || (job.title in GLOB.nonhuman_positions)) && (player.client.prefs.yogtoggles & QUIET_ROUND))
if(((job.title in GLOB.command_positions) || (job.title in GLOB.nonhuman_positions)) && (player.client.prefs.read_preference(/datum/preference/toggle/quiet_mode)))
JobDebug("FOC quiet check failed, Player: [player]")
continue
// yogs end
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
prefs = client.prefs

// If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (prefs.yogtoggles & PREF_MOOD))
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (prefs.read_preference(/datum/preference/toggle/mood_enabled)))

for (var/quirk_name in quirks)
var/datum/quirk/quirk = SSquirks.quirks[quirk_name]
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
var/mood_was_enabled = FALSE//Yogs -- Mood Preferences
if(current) // remove ourself from our old body's mind variable
// Yogs start -- Mood preferences
if(current.client && current.client.prefs.yogtoggles & PREF_MOOD)
if(current.client && current.client.prefs.read_preference(/datum/preference/toggle/mood_enabled))
mood_was_enabled = TRUE
else if(ishuman(current) && CONFIG_GET(flag/disable_human_mood))
var/mob/living/carbon/human/H = current
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/game_mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
// Ultimate randomizing code right here
for(var/mob/dead/new_player/player in GLOB.player_list)
if(player.client && player.ready == PLAYER_READY_TO_PLAY && player.check_preferences())
if(player.client.prefs.yogtoggles & QUIET_ROUND)
if(player.client.prefs.read_preference(/datum/preference/toggle/quiet_mode))
player.mind.quiet_round = TRUE
else
players += player
Expand Down
5 changes: 2 additions & 3 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,8 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
if (prefs.unlock_content & DONOR_YOGS)
src.add_donator_verbs()
else
if(prefs.yogtoggles & QUIET_ROUND)
prefs.yogtoggles &= ~QUIET_ROUND
prefs.save_preferences()
if(prefs.read_preference(/datum/preference/toggle/quiet_mode))
prefs.write_preference(/datum/preference/toggle/quiet_mode, FALSE)

. = ..() //calls mob.Login()

Expand Down
6 changes: 5 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/db_flags
var/chat_toggles = TOGGLES_DEFAULT_CHAT
var/extra_toggles = TOGGLES_DEFAULT_EXTRA
var/yogtoggles = YOGTOGGLES_DEFAULT
var/ghost_form = "ghost"

var/list/player_alt_titles = list()
Expand Down Expand Up @@ -80,6 +79,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
/// If set to TRUE, will update character_profiles on the next ui_data tick.
var/tainted_character_profiles = FALSE


///removed, kept here for migration in 'legacy_mood_migration.dm'
///DO NOT USE THIS!
var/yogtoggles

/datum/preferences/Destroy(force, ...)
QDEL_NULL(character_preview_view)
QDEL_LIST(middleware)
Expand Down
6 changes: 6 additions & 0 deletions code/modules/client/preferences/donor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,9 @@
data[CHOICED_PREFERENCE_DISPLAY_NAMES] = display_names

return data

/datum/preference/toggle/quiet_mode
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "quiet_mode"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
21 changes: 0 additions & 21 deletions code/modules/client/preferences/middleware/legacy_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
"ghost_ckey" = GHOST_CKEY,
)

var/static/list/legacy_yog_toggles = list(
"quiet_mode" = QUIET_ROUND,
"pref_mood" = PREF_MOOD,
)

/datum/preference_middleware/legacy_toggles/get_character_preferences(mob/user)
if (preferences.current_window != PREFERENCE_TAB_GAME_PREFERENCES)
return list()
Expand Down Expand Up @@ -95,7 +90,6 @@

var/list/new_game_preferences = list()
var/is_admin = is_admin(user.client)
var/is_donor = is_donator(user.client)

for (var/toggle_name in legacy_toggles)
if (!is_admin && (toggle_name in admin_only_legacy_toggles))
Expand All @@ -120,12 +114,6 @@
continue

new_game_preferences[toggle_name] = (preferences.chat_toggles & legacy_chat_toggles[toggle_name]) != 0

for (var/toggle_name in legacy_yog_toggles)
if (!is_donor && (toggle_name in donor_only_yog_toggles))
continue

new_game_preferences[toggle_name] = (preferences.yogtoggles & legacy_yog_toggles[toggle_name]) != 0

return list(
PREFERENCE_CATEGORY_GAME_PREFERENCES = new_game_preferences,
Expand Down Expand Up @@ -157,14 +145,5 @@
preferences.chat_toggles &= ~legacy_chat_flag

return TRUE

var/legacy_yog_flag = legacy_yog_toggles[preference]
if (!isnull(legacy_yog_flag))
if (value)
preferences.yogtoggles |= legacy_yog_flag
else
preferences.yogtoggles &= ~legacy_yog_flag

return TRUE

return FALSE
6 changes: 2 additions & 4 deletions code/modules/client/preferences/middleware/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
data["locked_quirks"] = get_locked_quirks()

// If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (user.client?.prefs.yogtoggles & PREF_MOOD))
data["mood_enabled"] = ismoody
data["mood_enabled"] = (!CONFIG_GET(flag/disable_human_mood) || (user.client?.prefs.read_preference(/datum/preference/toggle/mood_enabled)))

return data

Expand All @@ -31,8 +30,7 @@
data["locked_quirks"] = get_locked_quirks()

// If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (user.client?.prefs.yogtoggles & PREF_MOOD))
data["mood_enabled"] = ismoody
data["mood_enabled"] = (!CONFIG_GET(flag/disable_human_mood) || (user.client?.prefs.read_preference(/datum/preference/toggle/mood_enabled)))

return data

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/preferences/proc/migrate_yog_legacy_toggles(savefile/savefile)
write_preference(GLOB.preference_entries[/datum/preference/toggle/quiet_mode], yogtoggles & 1<<0)
write_preference(GLOB.preference_entries[/datum/preference/toggle/mood_enabled], yogtoggles & 1<<1)
5 changes: 5 additions & 0 deletions code/modules/client/preferences/mood_enabling.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/datum/preference/toggle/mood_enabled
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "pref_mood"
savefile_identifier = PREFERENCE_PLAYER

9 changes: 5 additions & 4 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//This is the lowest supported version, anything below this is completely obsolete and the entire savefile will be wiped.
#define SAVEFILE_VERSION_MIN 30
#define SAVEFILE_VERSION_MIN 30

//This is the current version, anything below this will attempt to update (if it's not obsolete)
// You do not need to raise this if you are adding new values that have sane defaults.
// Only raise this value when changing the meaning/format/name/layout of an existing value
// where you would want the updater procs below to run
#define SAVEFILE_VERSION_MAX 42
#define SAVEFILE_VERSION_MAX 43

/*
SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn
Expand Down Expand Up @@ -64,6 +64,9 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
key_bindings["action_3"] = GLOB.default_hotkeys["action_3"]
key_bindings["action_4"] = GLOB.default_hotkeys["action_4"]

if(current_version > 42)
migrate_yog_legacy_toggles(S)



/datum/preferences/proc/update_character(current_version, savefile/S)
Expand Down Expand Up @@ -158,7 +161,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
READ_FILE(S["toggles"], toggles)
READ_FILE(S["chat_toggles"], chat_toggles)
READ_FILE(S["extra_toggles"], extra_toggles)
READ_FILE(S["yogtoggles"], yogtoggles)

READ_FILE(S["ignoring"], ignoring)

Expand Down Expand Up @@ -216,7 +218,6 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["toggles"], toggles)
WRITE_FILE(S["chat_toggles"], chat_toggles)
WRITE_FILE(S["extra_toggles"], extra_toggles)
WRITE_FILE(S["yogtoggles"], yogtoggles)

WRITE_FILE(S["ignoring"], ignoring)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
SSjob.AssignRole(src, rank, 1)

var/mob/living/character = create_character(TRUE) //creates the human and transfers vars and mind
character.mind.quiet_round = character.client.prefs.yogtoggles & QUIET_ROUND // yogs - Donor Features
character.mind.quiet_round = character.client.prefs.read_preference(/datum/preference/toggle/quiet_mode) // yogs - Donor Features
var/equip = SSjob.EquipRank(character, rank, TRUE)
if(isliving(equip)) //Borgs get borged in the equip, so we need to make sure we handle the new mob.
character = equip
Expand Down
4 changes: 3 additions & 1 deletion yogstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -2038,6 +2038,7 @@
#include "code\modules\client\preferences\items.dm"
#include "code\modules\client\preferences\jobless_role.dm"
#include "code\modules\client\preferences\mood.dm"
#include "code\modules\client\preferences\mood_enabling.dm"
#include "code\modules\client\preferences\names.dm"
#include "code\modules\client\preferences\ooc.dm"
#include "code\modules\client\preferences\parallax.dm"
Expand All @@ -2053,7 +2054,6 @@
#include "code\modules\client\preferences\skin_tone.dm"
#include "code\modules\client\preferences\species.dm"
#include "code\modules\client\preferences\tgui.dm"
#include "code\modules\client\preferences\tgui_prefs_migration.dm"
#include "code\modules\client\preferences\tooltips.dm"
#include "code\modules\client\preferences\ui_style.dm"
#include "code\modules\client\preferences\uplink_location.dm"
Expand All @@ -2069,6 +2069,8 @@
#include "code\modules\client\preferences\middleware\random.dm"
#include "code\modules\client\preferences\middleware\skillcapes.dm"
#include "code\modules\client\preferences\middleware\species.dm"
#include "code\modules\client\preferences\migrations\legacy_mood_migration.dm"
#include "code\modules\client\preferences\migrations\tgui_prefs_migration.dm"
#include "code\modules\client\preferences\species_features\basic.dm"
#include "code\modules\client\preferences\species_features\ethereal.dm"
#include "code\modules\client\preferences\species_features\felinid.dm"
Expand Down
4 changes: 2 additions & 2 deletions yogstation/code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/datum/controller/subsystem/processing/quirks/proc/checkquirks(mob/living/user,client/cli) // Returns true when the player isn't trying to fuckin scum the mood pref stuff to exploit
var/mob/living/carbon/human/U = user
U.mood_enabled = cli.prefs.yogtoggles & PREF_MOOD // Marks whether this player had moods enabled in preferences at the time of spawning (helps prevent exploitation)
U.mood_enabled = cli.prefs.read_preference(/datum/preference/toggle/mood_enabled) // Marks whether this player had moods enabled in preferences at the time of spawning (helps prevent exploitation)

var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (cli.prefs.yogtoggles & PREF_MOOD)) // If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled
var/ismoody = (!CONFIG_GET(flag/disable_human_mood) || (cli.prefs.read_preference(/datum/preference/toggle/mood_enabled))) // If moods are globally enabled, or this guy does indeed have his mood pref set to Enabled

var/points = 0;
var/good_quirks = 0;
Expand Down

0 comments on commit 52d933c

Please sign in to comment.