quirk removal fixes

This commit is contained in:
DeltaFire
2022-01-03 06:42:28 +01:00
parent 82177b9ecc
commit 6c5dabe8bc
2 changed files with 28 additions and 5 deletions

View File

@@ -48,6 +48,13 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
cli.prefs.save_character()
if (!silent && LAZYLEN(cut))
to_chat(to_chat_target || user, "<span class='boldwarning'>Some quirks have been cut from your character because of these quirks conflicting with your job assignment: [english_list(cut)].</span>")
var/mob/living/carbon/human/H = user
if(istype(H) && H.dna?.species)
var/datum/species/S = H.dna.species
if(S.remove_blacklisted_quirks(H))
to_chat(to_chat_target || user, "<span class='boldwarning'>Some quirks have been cut from your character due to them conflicting with your species: [english_list(S.removed_quirks)]</span>")
/datum/controller/subsystem/processing/quirks/proc/quirk_path_by_name(name)
return quirks[name]

View File

@@ -581,16 +581,32 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
// shamelessly inspired by antag_datum.remove_blacklisted_quirks()
/datum/species/proc/remove_blacklisted_quirks(mob/living/carbon/C)
var/mob/living/L = C.mind?.current
if(istype(L))
. = 0
if(istype(C))
if(!balance_point_values)
for(var/q in L.roundstart_quirks)
for(var/q in C.roundstart_quirks)
var/datum/quirk/Q = q
if(Q.type in blacklisted_quirks)
qdel(Q)
removed_quirks += Q.type
. += 1
qdel(Q)
else
removed_quirks += SSquirks.filter_quirks(L.roundstart_quirks, blacklisted_quirks)
var/point_overhead = 0
for(var/datum/quirk/Q as anything in C.roundstart_quirks)
if(Q.type in blacklisted_quirks)
point_overhead -= Q.value
removed_quirks += Q.type
. += 1
qdel(Q)
if(point_overhead)
for(var/datum/quirk/Q as anything in C.roundstart_quirks)
if(Q.value > 0)
point_overhead -= Q.value
removed_quirks += Q.type
. += 1
qdel(Q)
if(!point_overhead)
break
// restore any quirks that we removed
/datum/species/proc/restore_quirks(mob/living/carbon/C)