mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
Add: 2 Quirks Configs (#81033)
## About The Pull Request This PR adds two new config options for quirks: - *Flag* `DISABLE_QUIRK_POINTS` - When enabled, disables quirk points balancing. - When enabled, players can select positive quirks without first selecting negative ones. - When enabled, the quirk points balance visually hides itself on the Quirks page. - *Number* `MAX_POSITIVE_QUIRKS` - Limits the maximum quantity of positive quirks which players can select using the Character Preferences page. - I ported this from the old `MAX_QUIRKS` define. - When set to `0`, players won't be able to select any positive quirks, and they won't appear on the Quirks page. - When set to `-1`, players will be able to select any quantity of positive quirks. - When commented-out or undefined, the default is `6`. - When set to `0` or `-1`, the positive quirk balance visually hides itself on the Quirks page. ## Why It's Good For The Game There is some downstream repositories asking for the quirks system to be configurable. Additionally, I always find myself tweaking these values on my own private servers and I thought it would be nice to share my edits. Usually I was simply commenting-out sections of this code in order to get the same result, so it helps to have an official way to disable quirk points. ## Changelog 🆑 A.C.M.O. config: Added two new config flags for quirks, DISABLE_QUIRK_POINTS and MAX_POSITIVE_QUIRKS. /🆑
This commit is contained in:
@@ -473,10 +473,6 @@
|
||||
#define FLASH_PROTECTION_FLASH 1
|
||||
#define FLASH_PROTECTION_WELDER 2
|
||||
|
||||
// Roundstart trait system
|
||||
|
||||
#define MAX_QUIRKS 6 //The maximum amount of quirks one character can have at roundstart
|
||||
|
||||
// AI Toggles
|
||||
#define AI_CAMERA_LUMINOSITY 5
|
||||
#define AI_VOX // Comment out if you don't want VOX to be enabled and have players download the voice sounds.
|
||||
|
||||
@@ -445,3 +445,12 @@
|
||||
default = list("0" = 10, "1" = 10, "2" = 3, "2.5" = 1)
|
||||
key_mode = KEY_MODE_TEXT
|
||||
value_mode = VALUE_MODE_NUM
|
||||
|
||||
// Configs for the Quirk system
|
||||
/// Disables Quirk point balancing for the server and clients.
|
||||
/datum/config_entry/flag/disable_quirk_points
|
||||
|
||||
/// The maximum amount of positive quirks one character can have at roundstart.
|
||||
/datum/config_entry/number/max_positive_quirks
|
||||
default = 6
|
||||
min_val = -1
|
||||
|
||||
@@ -104,10 +104,15 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
var/bonus_quirks = max((length(user.quirks) + rand(-RANDOM_QUIRK_BONUS, RANDOM_QUIRK_BONUS)), MINIMUM_RANDOM_QUIRKS)
|
||||
var/added_quirk_count = 0 //How many we've added
|
||||
var/list/quirks_to_add = list() //Quirks we're adding
|
||||
var/good_count = 0 //Maximum of 6 good perks
|
||||
var/good_count = 0
|
||||
var/score //What point score we're at
|
||||
///Cached list of possible quirks
|
||||
var/list/possible_quirks = quirks.Copy()
|
||||
|
||||
var/max_positive_quirks = CONFIG_GET(number/max_positive_quirks)
|
||||
if(max_positive_quirks < 0)
|
||||
max_positive_quirks = 6
|
||||
|
||||
//Create a random list of stuff to start with
|
||||
while(bonus_quirks > added_quirk_count)
|
||||
var/quirk = pick(possible_quirks) //quirk is a string
|
||||
@@ -137,19 +142,20 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
quirks_to_add += quirk
|
||||
|
||||
//And have benefits too
|
||||
while(score < 0 && good_count <= MAX_QUIRKS)
|
||||
if(!length(possible_quirks))//Lets not get stuck
|
||||
break
|
||||
var/quirk = pick(quirks)
|
||||
if(quirk in GLOB.quirk_blacklist) //prevent blacklisted
|
||||
possible_quirks -= quirk
|
||||
continue
|
||||
if(!quirk_points[quirk] > 0) //positive only
|
||||
possible_quirks -= quirk
|
||||
continue
|
||||
good_count++
|
||||
score += quirk_points[quirk]
|
||||
quirks_to_add += quirk
|
||||
if(max_positive_quirks > 0)
|
||||
while(score < 0 && good_count <= max_positive_quirks)
|
||||
if(!length(possible_quirks))//Lets not get stuck
|
||||
break
|
||||
var/quirk = pick(quirks)
|
||||
if(quirk in GLOB.quirk_blacklist) //prevent blacklisted
|
||||
possible_quirks -= quirk
|
||||
continue
|
||||
if(!(quirk_points[quirk] > 0)) //positive only
|
||||
possible_quirks -= quirk
|
||||
continue
|
||||
good_count++
|
||||
score += quirk_points[quirk]
|
||||
quirks_to_add += quirk
|
||||
|
||||
for(var/datum/quirk/quirk as anything in user.quirks)
|
||||
if(quirk.name in quirks_to_add) //Don't delete ones we keep
|
||||
@@ -167,6 +173,8 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/quirks)
|
||||
var/list/new_quirks = list()
|
||||
var/list/positive_quirks = list()
|
||||
var/points_enabled = !CONFIG_GET(flag/disable_quirk_points)
|
||||
var/max_positive_quirks = CONFIG_GET(number/max_positive_quirks)
|
||||
var/balance = 0
|
||||
|
||||
var/list/all_quirks = get_quirks()
|
||||
@@ -198,7 +206,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
|
||||
var/value = initial(quirk.value)
|
||||
if (value > 0)
|
||||
if (positive_quirks.len == MAX_QUIRKS)
|
||||
if (max_positive_quirks >= 0 && positive_quirks.len == max_positive_quirks)
|
||||
continue
|
||||
|
||||
positive_quirks[quirk_name] = value
|
||||
@@ -206,7 +214,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
balance += value
|
||||
new_quirks += quirk_name
|
||||
|
||||
if (balance > 0)
|
||||
if (points_enabled && balance > 0)
|
||||
var/balance_left_to_remove = balance
|
||||
|
||||
for (var/positive_quirk in positive_quirks)
|
||||
|
||||
@@ -436,6 +436,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
.++
|
||||
|
||||
/datum/preferences/proc/validate_quirks()
|
||||
if(CONFIG_GET(flag/disable_quirk_points))
|
||||
return
|
||||
if(GetQuirkBalance() < 0)
|
||||
all_quirks = list()
|
||||
|
||||
|
||||
@@ -31,8 +31,13 @@
|
||||
|
||||
var/list/quirks = SSquirks.get_quirks()
|
||||
|
||||
var/max_positive_quirks = CONFIG_GET(number/max_positive_quirks)
|
||||
var/positive_quirks_disabled = max_positive_quirks == 0
|
||||
for (var/quirk_name in quirks)
|
||||
var/datum/quirk/quirk = quirks[quirk_name]
|
||||
if(positive_quirks_disabled && initial(quirk.value) > 0)
|
||||
continue
|
||||
|
||||
var/datum/quirk_constant_data/constant_data = GLOB.all_quirk_constant_data[quirk]
|
||||
var/list/datum/preference/customization_options = constant_data?.get_customization_data()
|
||||
|
||||
@@ -46,9 +51,10 @@
|
||||
)
|
||||
|
||||
return list(
|
||||
"max_positive_quirks" = MAX_QUIRKS,
|
||||
"max_positive_quirks" = max_positive_quirks,
|
||||
"quirk_info" = quirk_info,
|
||||
"quirk_blacklist" = GLOB.quirk_string_blacklist,
|
||||
"points_enabled" = !CONFIG_GET(flag/disable_quirk_points),
|
||||
)
|
||||
|
||||
/datum/preference_middleware/quirks/on_new_character(mob/user)
|
||||
|
||||
@@ -546,4 +546,15 @@ NEUTRAL_STATION_TRAITS 2.5 1
|
||||
NEGATIVE_STATION_TRAITS 0 8
|
||||
NEGATIVE_STATION_TRAITS 1 4
|
||||
NEGATIVE_STATION_TRAITS 2 2
|
||||
NEGATIVE_STATION_TRAITS 3 1
|
||||
NEGATIVE_STATION_TRAITS 3 1
|
||||
|
||||
# Uncomment to disable Quirk point balancing for the server and clients.
|
||||
# If enabled, players will be able to select positive quirks without first selecting negative quirks.
|
||||
# If enabled, randomized Quirks will still use points internally, in order to maintain balance.
|
||||
#DISABLE_QUIRK_POINTS
|
||||
|
||||
# The maximum amount of positive quirks one character can have at roundstart.
|
||||
# If set to -1, then players will be able to select any quantity of positive quirks.
|
||||
# If set to 0, then players won't be able to select any positive quirks.
|
||||
# If commented-out or undefined, the maximum default is 6.
|
||||
MAX_POSITIVE_QUIRKS 6
|
||||
|
||||
@@ -316,6 +316,7 @@ export function QuirksPage(props) {
|
||||
max_positive_quirks: maxPositiveQuirks,
|
||||
quirk_blacklist: quirkBlacklist,
|
||||
quirk_info: quirkInfo,
|
||||
points_enabled: pointsEnabled,
|
||||
} = server_data.quirks;
|
||||
|
||||
const quirks = Object.entries(quirkInfo);
|
||||
@@ -347,9 +348,12 @@ export function QuirksPage(props) {
|
||||
const quirk = quirkInfo[quirkName];
|
||||
|
||||
if (quirk.value > 0) {
|
||||
if (positiveQuirks >= maxPositiveQuirks) {
|
||||
if (
|
||||
maxPositiveQuirks !== -1 &&
|
||||
positiveQuirks >= maxPositiveQuirks
|
||||
) {
|
||||
return "You can't have any more positive quirks!";
|
||||
} else if (balance + quirk.value > 0) {
|
||||
} else if (pointsEnabled && balance + quirk.value > 0) {
|
||||
return 'You need a negative quirk to balance this out!';
|
||||
}
|
||||
}
|
||||
@@ -379,7 +383,7 @@ export function QuirksPage(props) {
|
||||
const getReasonToNotRemove = (quirkName: string) => {
|
||||
const quirk = quirkInfo[quirkName];
|
||||
|
||||
if (balance - quirk.value > 0) {
|
||||
if (pointsEnabled && balance - quirk.value > 0) {
|
||||
return 'You need to remove a positive quirk first!';
|
||||
}
|
||||
|
||||
@@ -391,13 +395,21 @@ export function QuirksPage(props) {
|
||||
<Stack.Item basis="50%">
|
||||
<Stack vertical fill align="center">
|
||||
<Stack.Item>
|
||||
<Box fontSize="1.3em">Positive Quirks</Box>
|
||||
{maxPositiveQuirks > 0 ? (
|
||||
<Box fontSize="1.3em">Positive Quirks</Box>
|
||||
) : (
|
||||
<Box mt={pointsEnabled ? 3.4 : 0} />
|
||||
)}
|
||||
</Stack.Item>
|
||||
|
||||
<Stack.Item>
|
||||
<StatDisplay>
|
||||
{positiveQuirks} / {maxPositiveQuirks}
|
||||
</StatDisplay>
|
||||
{maxPositiveQuirks > 0 ? (
|
||||
<StatDisplay>
|
||||
{positiveQuirks} / {maxPositiveQuirks}
|
||||
</StatDisplay>
|
||||
) : (
|
||||
<Box mt={pointsEnabled ? 3.4 : 0} />
|
||||
)}
|
||||
</Stack.Item>
|
||||
|
||||
<Stack.Item>
|
||||
@@ -445,11 +457,19 @@ export function QuirksPage(props) {
|
||||
<Stack.Item basis="50%">
|
||||
<Stack vertical fill align="center">
|
||||
<Stack.Item>
|
||||
<Box fontSize="1.3em">Quirk Balance</Box>
|
||||
{pointsEnabled ? (
|
||||
<Box fontSize="1.3em">Quirk Balance</Box>
|
||||
) : (
|
||||
<Box mt={maxPositiveQuirks > 0 ? 3.4 : 0} />
|
||||
)}
|
||||
</Stack.Item>
|
||||
|
||||
<Stack.Item>
|
||||
<StatDisplay>{balance}</StatDisplay>
|
||||
{pointsEnabled ? (
|
||||
<StatDisplay>{balance}</StatDisplay>
|
||||
) : (
|
||||
<Box mt={maxPositiveQuirks > 0 ? 3.4 : 0} />
|
||||
)}
|
||||
</Stack.Item>
|
||||
|
||||
<Stack.Item>
|
||||
|
||||
@@ -91,6 +91,7 @@ export type QuirkInfo = {
|
||||
max_positive_quirks: number;
|
||||
quirk_info: Record<string, Quirk>;
|
||||
quirk_blacklist: string[][];
|
||||
points_enabled: boolean;
|
||||
};
|
||||
|
||||
export enum RandomSetting {
|
||||
|
||||
Reference in New Issue
Block a user