mirror of
https://github.com/KabKebab/GS13.git
synced 2026-07-09 15:05:38 +01:00
quirks are now categorized, i hate byond
This commit is contained in:
@@ -198,6 +198,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
var/custom_species = null
|
||||
|
||||
var/list/all_quirks = list()
|
||||
var/compressed_quirks = FALSE //Hyperstation edit: Use a smaller font for the quirks list
|
||||
var/old_view = FALSE //Hyperstation edit: toggle for sorting by category
|
||||
|
||||
//Jobs, uses bitflags
|
||||
var/job_civilian_high = 0
|
||||
@@ -1431,7 +1433,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
to_chat(user, "<span class='danger'>The quirk subsystem is still initializing! Try again in a minute.</span>")
|
||||
return
|
||||
|
||||
var/list/dat = list()
|
||||
var/dat = ""
|
||||
if(!SSquirks.quirks.len)
|
||||
dat += "The quirk subsystem hasn't finished initializing, please hold..."
|
||||
dat += "<center><a href='?_src_=prefs;preference=trait;task=close'>Done</a></center><br>"
|
||||
@@ -1440,50 +1442,76 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
dat += "<center><b>Choose quirk setup</b></center><br>"
|
||||
dat += "<div align='center'>Left-click to add or remove quirks. You need negative quirks to have positive ones.<br>\
|
||||
Quirks are applied at roundstart and cannot normally be removed.</div>"
|
||||
dat += "<center><a href='?_src_=prefs;preference=trait;task=close'>Done</a></center>"
|
||||
dat += "<center><a href='?_src_=prefs;preference=trait;task=close'>Done</a><br>\
|
||||
<a href='?_src_=prefs;preference=trait;task=trait_small_text'>[compressed_quirks ? "Normal View" : "Small View"]</a> \
|
||||
<a href='?_src_=prefs;preference=trait;task=old_view'>[old_view ? "Current View" : "Old View"]</a> </center>" //Hyper edit
|
||||
dat += "<hr>"
|
||||
dat += "<center><b>Current quirks:</b> [all_quirks.len ? all_quirks.Join(", ") : "None"]</center>"
|
||||
dat += "<center>[GetPositiveQuirkCount()] / [MAX_QUIRKS] max positive quirks<br>\
|
||||
<b>Quirk balance remaining:</b> [GetQuirkBalance()]</center><br>"
|
||||
for(var/V in SSquirks.quirks)
|
||||
var/datum/quirk/T = SSquirks.quirks[V]
|
||||
var/quirk_name = initial(T.name)
|
||||
var/has_quirk
|
||||
var/quirk_cost = initial(T.value) * -1
|
||||
var/lock_reason = "This trait is unavailable."
|
||||
var/quirk_conflict = FALSE
|
||||
for(var/_V in all_quirks)
|
||||
if(_V == quirk_name)
|
||||
has_quirk = TRUE
|
||||
if(initial(T.mood_quirk) && CONFIG_GET(flag/disable_human_mood))
|
||||
lock_reason = "Mood is disabled."
|
||||
quirk_conflict = TRUE
|
||||
if(has_quirk)
|
||||
if(quirk_conflict)
|
||||
all_quirks -= quirk_name
|
||||
has_quirk = FALSE
|
||||
var/list/hacky = SSquirks.quirk_categories
|
||||
if(old_view)
|
||||
hacky = list(1) //Hyperstation edit; super hacky, but it works
|
||||
|
||||
//Hyperstation Edit: Categorize quirks
|
||||
for(var/_cat in hacky)
|
||||
var/list/L = SSquirks.quirks_sorted[_cat]
|
||||
if(!old_view)
|
||||
if(compressed_quirks)
|
||||
dat += "<p style='color:white;margin-bottom:1px;margin-top:6px'><u>[_cat]</u></p>"
|
||||
else
|
||||
quirk_cost *= -1 //invert it back, since we'd be regaining this amount
|
||||
if(quirk_cost > 0)
|
||||
quirk_cost = "+[quirk_cost]"
|
||||
var/font_color = "#AAAAFF"
|
||||
if(initial(T.value) != 0)
|
||||
font_color = initial(T.value) > 0 ? "#AAFFAA" : "#FFAAAA"
|
||||
if(quirk_conflict)
|
||||
dat += "<font color='[font_color]'>[quirk_name]</font> - [initial(T.desc)] \
|
||||
<font color='red'><b>LOCKED: [lock_reason]</b></font><br>"
|
||||
dat += "<p style='color:white;font-size:12px;margin-bottom:2px;margin-top:4px'><u>[_cat]</u></p>"
|
||||
else
|
||||
L = SSquirks.quirks
|
||||
|
||||
for(var/T in L)
|
||||
//End Hyperstation Edit
|
||||
var/datum/quirk/Q = SSquirks.quirks[T]
|
||||
var/quirk_name = initial(Q.name)
|
||||
var/has_quirk
|
||||
var/quirk_cost = initial(Q.value) * -1
|
||||
var/lock_reason = "This trait is unavailable."
|
||||
var/quirk_conflict = FALSE
|
||||
for(var/_V in all_quirks)
|
||||
if(_V == quirk_name)
|
||||
has_quirk = TRUE
|
||||
break
|
||||
if(initial(Q.mood_quirk) && CONFIG_GET(flag/disable_human_mood))
|
||||
lock_reason = "Mood is disabled."
|
||||
quirk_conflict = TRUE
|
||||
if(has_quirk)
|
||||
dat += "<a href='?_src_=prefs;preference=trait;task=update;trait=[quirk_name]'>[has_quirk ? "Remove" : "Take"] ([quirk_cost] pts.)</a> \
|
||||
<b><font color='[font_color]'>[quirk_name]</font></b> - [initial(T.desc)]<br>"
|
||||
else
|
||||
dat += "<a href='?_src_=prefs;preference=trait;task=update;trait=[quirk_name]'>[has_quirk ? "Remove" : "Take"] ([quirk_cost] pts.)</a> \
|
||||
<font color='[font_color]'>[quirk_name]</font> - [initial(T.desc)]<br>"
|
||||
if(quirk_conflict)
|
||||
all_quirks -= quirk_name
|
||||
has_quirk = FALSE
|
||||
else
|
||||
quirk_cost *= -1 //invert it back, since we'd be regaining this amount
|
||||
if(quirk_cost > 0)
|
||||
quirk_cost = "+[quirk_cost]"
|
||||
var/font_color = "#AAAAFF"
|
||||
if(initial(Q.value) != 0)
|
||||
font_color = initial(Q.value) > 0 ? "#AAFFAA" : "#FFAAAA"
|
||||
|
||||
if(compressed_quirks) //Hyperstation Edit: smol text
|
||||
if(quirk_conflict)
|
||||
dat += "<a><font size='1' color='red'>([quirk_cost]) [quirk_name])</font></a>"
|
||||
else
|
||||
dat += "[has_quirk ? "<b><u>" : ""]<a href='?_src_=prefs;preference=trait;task=update;trait=[quirk_name]'><font size='1' color='[font_color]'>([quirk_cost]) [quirk_name]</font></a>[has_quirk ? "</u></b>" : ""]"
|
||||
else //if(old_view)
|
||||
if(quirk_conflict)
|
||||
dat += "<font color='[font_color]'>[quirk_name]</font> - \
|
||||
<font color='red'><b>LOCKED: [lock_reason]</b></font>"
|
||||
else
|
||||
dat += "<a href='?_src_=prefs;preference=trait;task=update;trait=[quirk_name]'>[has_quirk ? "Remove" : "Take"] ([quirk_cost] pts.)</a> \
|
||||
[has_quirk ? "<b>" : ""]<font color='[font_color]'>[quirk_name]</font>[has_quirk ? "</b>": ""] - [initial(Q.desc)]"
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br>"
|
||||
|
||||
dat += "<br><center><a href='?_src_=prefs;preference=trait;task=reset'>Reset Quirks</a></center>"
|
||||
|
||||
var/datum/browser/popup = new(user, "mob_occupation", "<div align='center'>Quirk Preferences</div>", 900, 600) //no reason not to reuse the occupation window, as it's cleaner that way
|
||||
popup.set_window_options("can_close=0")
|
||||
popup.set_content(dat.Join())
|
||||
popup.set_content(dat)
|
||||
popup.open(FALSE)
|
||||
|
||||
/datum/preferences/proc/GetQuirkBalance()
|
||||
@@ -1572,8 +1600,16 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
|
||||
else if(href_list["preference"] == "trait")
|
||||
switch(href_list["task"])
|
||||
if("trait_small_text")
|
||||
compressed_quirks = !compressed_quirks
|
||||
SetQuirks(user)
|
||||
if("old_view")
|
||||
old_view = !old_view
|
||||
SetQuirks(user)
|
||||
if("close")
|
||||
user << browse(null, "window=mob_occupation")
|
||||
compressed_quirks = FALSE
|
||||
//Intentional for old_view to not be reset here. But we don't save the varx
|
||||
ShowChoices(user)
|
||||
if("update")
|
||||
var/quirk = href_list["trait"]
|
||||
|
||||
Reference in New Issue
Block a user