Merge pull request #6356 from Citadel-Station-13/upstream-merge-37082

[MIRROR] Disables mood traits when mood is disabled
This commit is contained in:
deathride58
2018-04-11 21:31:46 +00:00
committed by GitHub
4 changed files with 24 additions and 9 deletions

View File

@@ -8,6 +8,7 @@
var/gain_text
var/lose_text
var/medical_record_text //This text will appear on medical records for the trait. Not yet implemented
var/mood_trait = FALSE //if true, this trait affects mood and is unavailable if moodlets are disabled
var/mob_trait //if applicable, apply and remove this mob trait
var/mob/living/trait_holder

View File

@@ -15,6 +15,7 @@
name = "Apathetic"
desc = "You just don't care as much as other people. That's nice to have in a place like this, I guess."
value = 1
mood_trait = TRUE
/datum/trait/apathetic/add()
GET_COMPONENT_FROM(mood, /datum/component/mood, trait_holder)
@@ -43,6 +44,7 @@
desc = "You sometimes just feel happy, for no reason at all."
value = 1
mob_trait = TRAIT_JOLLY
mood_trait = TRUE

View File

@@ -8,6 +8,7 @@
gain_text = "<span class='danger'>You start feeling depressed.</span>"
lose_text = "<span class='notice'>You no longer feel depressed.</span>" //if only it were that easy!
medical_record_text = "Patient has a severe mood disorder causing them to experience sudden moments of sadness."
mood_trait = TRUE
@@ -15,6 +16,7 @@
name = "Family Heirloom"
desc = "You are the current owner of an heirloom. passed down for generations. You have to keep it safe!"
value = -1
mood_trait = TRUE
var/obj/item/heirloom
var/where_text

View File

@@ -872,9 +872,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<center><a href='?_src_=prefs;preference=trait;task=close'>Done</a></center>"
dat += "<hr>"
dat += "<center><b>Current traits:</b> [all_traits.len ? all_traits.Join(", ") : "None"]</center>"
/*dat += "<center><font color='#AAFFAA'>[positive_traits.len] / [MAX_POSITIVE_TRAITS]</font> \
| <font color='#AAAAFF'>[neutral_traits.len] / [MAX_NEUTRAL_TRAITS]</font> \
| <font color='#FFAAAA'>[negative_traits.len] / [MAX_NEGATIVE_TRAITS]</font></center><br>"*/
dat += "<center>[all_traits.len] / [MAX_TRAITS] max traits<br>\
<b>Trait balance remaining:</b> [GetTraitBalance()]</center><br>"
for(var/V in SStraits.traits)
@@ -882,22 +879,35 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/trait_name = initial(T.name)
var/has_trait
var/trait_cost = initial(T.value) * -1
var/lock_reason = "This trait is unavailable."
var/trait_conflict = FALSE
for(var/_V in all_traits)
if(_V == trait_name)
has_trait = TRUE
if(initial(T.mood_trait) && CONFIG_GET(flag/disable_human_mood))
lock_reason = "Mood is disabled."
trait_conflict = TRUE
if(has_trait)
trait_cost *= -1 //invert it back, since we'd be regaining this amount
if(trait_conflict)
all_traits -= trait_name
has_trait = FALSE
else
trait_cost *= -1 //invert it back, since we'd be regaining this amount
if(trait_cost > 0)
trait_cost = "+[trait_cost]"
var/font_color = "#AAAAFF"
if(initial(T.value) != 0)
font_color = initial(T.value) > 0 ? "#AAFFAA" : "#FFAAAA"
if(has_trait)
dat += "<b><font color='[font_color]'>[trait_name]</font></b> - [initial(T.desc)] \
<a href='?_src_=prefs;preference=trait;task=update;trait=[trait_name]'>[has_trait ? "Lose" : "Take"] ([trait_cost] pts.)</a><br>"
else
if(trait_conflict)
dat += "<font color='[font_color]'>[trait_name]</font> - [initial(T.desc)] \
<a href='?_src_=prefs;preference=trait;task=update;trait=[trait_name]'>[has_trait ? "Lose" : "Take"] ([trait_cost] pts.)</a><br>"
<font color='red'><b>LOCKED: [lock_reason]</b></font><br>"
else
if(has_trait)
dat += "<b><font color='[font_color]'>[trait_name]</font></b> - [initial(T.desc)] \
<a href='?_src_=prefs;preference=trait;task=update;trait=[trait_name]'>[has_trait ? "Lose" : "Take"] ([trait_cost] pts.)</a><br>"
else
dat += "<font color='[font_color]'>[trait_name]</font> - [initial(T.desc)] \
<a href='?_src_=prefs;preference=trait;task=update;trait=[trait_name]'>[has_trait ? "Lose" : "Take"] ([trait_cost] pts.)</a><br>"
dat += "<br><center><a href='?_src_=prefs;preference=trait;task=reset'>Reset Traits</a></center>"
user << browse(null, "window=preferences")