mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 16:44:43 +01:00
[MIRROR] Add: 2 Quirks Configs (#26206)
* Add: 2 Quirks Configs (#81033) 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. 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. 🆑 A.C.M.O. config: Added two new config flags for quirks, DISABLE_QUIRK_POINTS and MAX_POSITIVE_QUIRKS. /🆑 * Oh come on --------- Co-authored-by: Dani Glore <fantasticdragons@gmail.com> Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
This commit is contained in:
@@ -121,10 +121,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
|
||||
@@ -154,19 +159,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
|
||||
@@ -184,6 +190,8 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/quirks, list/augments) // SKYRAT EDIT - AUGMENTS+
|
||||
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()
|
||||
@@ -220,7 +228,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
|
||||
@@ -228,7 +236,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)
|
||||
|
||||
Reference in New Issue
Block a user