Skip to content

Commit

Permalink
[MIRROR] Add: 2 Quirks Configs (#549)
Browse files Browse the repository at this point in the history
* Add: 2 Quirks Configs

* Conflicts

* Hotfix for Upstream Merge 81033 (#564)

* Add boolean quirk_points_enabled to LimbsPage, auto-hide quirk points balance on Augments page if false.

* Add boolean quirk_points_enabled to LimbsPage preferences middleware

* Nothing, Just forcing CI to run (hopefully)

---------

Co-authored-by: SomeRandomOwl <[email protected]>

* Silly Wabbit

* Removes Gifted

---------

Co-authored-by: Dani Glore <[email protected]>
Co-authored-by: Mal <[email protected]>
Co-authored-by: SomeRandomOwl <[email protected]>
Co-authored-by: Zergspower <[email protected]>
  • Loading branch information
5 people authored and FFMirrorBot committed Jan 31, 2024
1 parent e8a2021 commit c1c5486
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 60 deletions.
4 changes: 0 additions & 4 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,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.
Expand Down
5 changes: 1 addition & 4 deletions code/__DEFINES/~nova_defines/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
/// Trait to spawn with a pet in a pet carrier (veteran only)
#define TRAIT_PET_OWNER "pet_owner"

/// adds -6 quirk to negative quirks for free points.
#define TRAIT_GIFTED "gifted"

//AdditionalEmotes *turf traits
#define TRAIT_WATER_ASPECT "water_aspect"
#define TRAIT_WEBBING_ASPECT "webbing_aspect"
Expand All @@ -44,7 +41,7 @@
#define TRAIT_SPARKLE_ASPECT "sparkle_aspect"

// Trait sources
#define TRAIT_GHOSTROLE "ghostrole" // NOVA EDIT ADDITION -- Ghost Cafe Traits
#define TRAIT_GHOSTROLE "ghostrole"

/// One can breath under water, you get me?
#define TRAIT_WATER_BREATHING "water_breathing"
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_FLORAL_ASPECT" = TRAIT_FLORAL_ASPECT,
"TRAIT_FREE_GHOST" = TRAIT_FREE_GHOST,
"TRAIT_GHOSTROLE" = TRAIT_GHOSTROLE,
"TRAIT_GIFTED" = TRAIT_GIFTED,

"TRAIT_GLASSBLOWING" = TRAIT_GLASSBLOWING,
"TRAIT_GLOVES" = TRAIT_GLOVES,
"TRAIT_GLUED_ITEM" = TRAIT_GLUED_ITEM,
Expand Down
1 change: 0 additions & 1 deletion code/_globalvars/traits/admin_tooling.dm
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ GLOBAL_LIST_INIT(admin_visible_traits, list(
"TRAIT_FLORAL_ASPECT" = TRAIT_FLORAL_ASPECT,
"TRAIT_FREE_GHOST" = TRAIT_FREE_GHOST,
"TRAIT_GHOSTROLE" = TRAIT_GHOSTROLE,
"TRAIT_GIFTED" = TRAIT_GIFTED,
"TRAIT_GLASSBLOWING" = TRAIT_GLASSBLOWING,
"TRAIT_GLOVES" = TRAIT_GLOVES,
"TRAIT_GLUED_ITEM" = TRAIT_GLUED_ITEM,
Expand Down
27 changes: 27 additions & 0 deletions code/controllers/configuration/entries/game_options.dm
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,30 @@
/datum/config_entry/flag/give_tutorials_without_db

/datum/config_entry/string/new_player_alert_role_id
<<<<<<< HEAD

Check failure on line 433 in code/controllers/configuration/entries/game_options.dm

View workflow job for this annotation

GitHub Actions / Run Linters

got '<<', expected one of: newline, '/', identifier
=======

/datum/config_entry/keyed_list/positive_station_traits
default = list("0" = 8, "1" = 4, "2" = 2, "3" = 1)
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_NUM

/datum/config_entry/keyed_list/negative_station_traits
default = list("0" = 8, "1" = 4, "2" = 2, "3" = 1)
key_mode = KEY_MODE_TEXT
value_mode = VALUE_MODE_NUM

/datum/config_entry/keyed_list/neutral_station_traits
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
>>>>>>> c193bbc94 ([MIRROR] Add: 2 Quirks Configs (#549))
40 changes: 24 additions & 16 deletions code/controllers/subsystem/processing/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,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
Expand Down Expand Up @@ -157,19 +162,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
Expand All @@ -187,6 +193,8 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/quirks, list/augments) // NOVA 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()
Expand Down Expand Up @@ -223,15 +231,15 @@ 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

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)
Expand Down
3 changes: 3 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
//NOVA EDIT BEGIN
data["preview_selection"] = preview_pref

data["quirk_points_enabled"] = !CONFIG_GET(flag/disable_quirk_points)
data["quirks_balance"] = GetQuirkBalance()
data["positive_quirk_count"] = GetPositiveQuirkCount()
//NOVA EDIT END
Expand Down Expand Up @@ -540,6 +541,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()

Expand Down
8 changes: 7 additions & 1 deletion code/modules/client/preferences/middleware/quirks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -47,9 +52,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)
Expand Down
31 changes: 31 additions & 0 deletions config/game_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,37 @@ DISALLOW_TITLE_MUSIC
## don't need (or want) this.
#GIVE_TUTORIALS_WITHOUT_DB

<<<<<<< HEAD
## FF CONFIGS
ROUNDSTART_RACES nabber
ROUNDSTART_RACES teshari_alt
=======
## Configuration for station traits of each type.
## The first value (key) is the budget, or the space available to use for station traits of that type. Some take more space than others.
## The second value (assoc) is the weight associated with said budget compared to the rest for that type.
POSITIVE_STATION_TRAITS 0 8
POSITIVE_STATION_TRAITS 1 4
POSITIVE_STATION_TRAITS 2 2
POSITIVE_STATION_TRAITS 3 1

NEUTRAL_STATION_TRAITS 0 10
NEUTRAL_STATION_TRAITS 1 10
NEUTRAL_STATION_TRAITS 2 3
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

# 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
>>>>>>> c193bbc94 ([MIRROR] Add: 2 Quirks Configs (#549))
1 change: 0 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6222,7 +6222,6 @@
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\all_nighter.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\blooddeficiency.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\brainproblems.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\gifted.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\heavy_sleeper.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\narcolepsy.dm"
#include "modular_nova\master_files\code\datums\quirks\negative_quirks\nerve_staple.dm"
Expand Down
57 changes: 34 additions & 23 deletions tgui/packages/tgui/interfaces/PreferencesMenu/LimbsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ export const AugmentationPage = (props) => {
onSelected={(value) => {
// Since the costs are positive,
// it's added and not substracted
if (balance + props.limb.costs[value] > 0) {
if (
data.quirk_points_enabled &&
balance + props.limb.costs[value] > 0
) {
return;
}
act('set_limb_aug', {
Expand Down Expand Up @@ -198,7 +201,10 @@ export const OrganPage = (props) => {
displayText={props.organ.chosen_organ}
onSelected={(value) => {
// Since the costs are positive, it's added and not substracted
if (balance + props.organ.costs[value] > 0) {
if (
data.quirk_points_enabled &&
balance + props.organ.costs[value] > 0
) {
return;
}
act('set_organ_aug', {
Expand Down Expand Up @@ -245,27 +251,32 @@ export const LimbsPage = (props) => {
width="100%"
/>
<RotateCharacterButtons />
<Box
style={{
marginTop: '3em',
}}
>
<Section title="Quirk Points Balance" />
</Box>

<Box
backgroundColor="#eee"
bold
color="black"
fontSize="1.2em"
py={0.5}
style={{
width: '20%',
alignItems: 'center',
}}
>
{balance}
</Box>
{data.quirk_points_enabled ? (
<Section
fill
align="center"
title="Quirk Points Balance"
style={{ marginTop: '3em' }}
>
<Stack justify="center">
<Box
backgroundColor="#eee"
bold
color="black"
fontSize="1.2em"
py={0.5}
style={{
width: '20%',
alignItems: 'center',
}}
>
{balance}
</Box>
</Stack>
</Section>
) : (
''
)}
</Section>
</Stack.Item>
<Stack.Item minWidth="33%">
Expand Down
Loading

0 comments on commit c1c5486

Please sign in to comment.