mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Fix: Quirk Points & Augments+ (#19063)
* Fix filter_invalid_quirks to check augments, and fixed augments to check quirks * Cleaning up log calls and docs * Remove stray comment * Adding missed Skyrat edit comment
This commit is contained in:
@@ -157,13 +157,18 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
|
||||
/// be valid.
|
||||
/// If no changes need to be made, will return the same list.
|
||||
/// Expects all quirk names to be unique, but makes no other expectations.
|
||||
/datum/controller/subsystem/processing/quirks/proc/filter_invalid_quirks(list/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/balance = 0
|
||||
|
||||
var/list/all_quirks = get_quirks()
|
||||
|
||||
// SKYRAT EDIT BEGIN - AUGMENTS+
|
||||
for(var/key in augments)
|
||||
var/datum/augment_item/aug = GLOB.augment_items[augments[key]]
|
||||
balance += aug.cost
|
||||
// SKYRAT EDIT END
|
||||
for (var/quirk_name in quirks)
|
||||
var/datum/quirk/quirk = all_quirks[quirk_name]
|
||||
if (isnull(quirk))
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
//SKYRAT EDIT END
|
||||
|
||||
var/list/new_quirks = preferences.all_quirks | quirk_name
|
||||
if (SSquirks.filter_invalid_quirks(new_quirks) != new_quirks)
|
||||
if (SSquirks.filter_invalid_quirks(new_quirks, preferences.augments) != new_quirks)// SKYRAT EDIT - AUGMENTS+
|
||||
// If the client is sending an invalid give_quirk, that means that
|
||||
// something went wrong with the client prediction, so we should
|
||||
// catch it back up to speed.
|
||||
@@ -77,10 +77,7 @@
|
||||
var/quirk_name = params["quirk"]
|
||||
|
||||
var/list/new_quirks = preferences.all_quirks - quirk_name
|
||||
if ( \
|
||||
!(quirk_name in preferences.all_quirks) \
|
||||
|| SSquirks.filter_invalid_quirks(new_quirks) != new_quirks \
|
||||
)
|
||||
if (!(quirk_name in preferences.all_quirks) || SSquirks.filter_invalid_quirks(new_quirks, preferences.augments) != new_quirks)// SKYRAT EDIT - AUGMENTS+
|
||||
// If the client is sending an invalid remove_quirk, that means that
|
||||
// something went wrong with the client prediction, so we should
|
||||
// catch it back up to speed.
|
||||
|
||||
@@ -312,7 +312,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
|
||||
if(job_preferences[j] != JP_LOW && job_preferences[j] != JP_MEDIUM && job_preferences[j] != JP_HIGH)
|
||||
job_preferences -= j
|
||||
|
||||
all_quirks = SSquirks.filter_invalid_quirks(SANITIZE_LIST(all_quirks))
|
||||
all_quirks = SSquirks.filter_invalid_quirks(SANITIZE_LIST(all_quirks), augments)// SKYRAT EDIT - AUGMENTS+
|
||||
validate_quirks()
|
||||
|
||||
return TRUE
|
||||
|
||||
+10
@@ -63,6 +63,11 @@
|
||||
preferences.augments -= limbs_to_process[limb_slot]
|
||||
else
|
||||
preferences.augments[limbs_to_process[limb_slot]] = augment_to_path[augment_name]
|
||||
// Remove some positive quirks if the point balance becomes too low.
|
||||
var/list/filtered_quirks = SSquirks.filter_invalid_quirks(preferences.all_quirks, preferences.augments)
|
||||
if(filtered_quirks != preferences.all_quirks)
|
||||
preferences.all_quirks = filtered_quirks
|
||||
preferences.update_static_data(user)
|
||||
preferences.character_preview_view.update_body()
|
||||
return TRUE
|
||||
|
||||
@@ -183,6 +188,11 @@
|
||||
preferences.augments -= organs_to_process[organ_slot]
|
||||
else
|
||||
preferences.augments[organs_to_process[organ_slot]] = augment_to_path[augment_name]
|
||||
// Remove some positive quirks if the point balance becomes too low.
|
||||
var/list/filtered_quirks = SSquirks.filter_invalid_quirks(preferences.all_quirks, preferences.augments)
|
||||
if(filtered_quirks != preferences.all_quirks)
|
||||
preferences.all_quirks = filtered_quirks
|
||||
preferences.update_static_data(user)
|
||||
preferences.character_preview_view.update_body()
|
||||
return TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user