forked from SierraBay/SierraBay12
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
255 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
GLOBAL_LIST_INIT(psi_status2text, list("C", "B", "A", "S")) | ||
GLOBAL_LIST_INIT(text2psi_status, list("C" = 1, "B" = 2, "A" = 3, "S" = 4)) | ||
|
||
/datum/preferences | ||
var/psi_threat_level = 0 | ||
var/psi_status = 4 | ||
var/psi_openness = FALSE | ||
|
||
/datum/category_item/player_setup_item/psionics/basic | ||
name = "Basic" | ||
sort_order = 1 | ||
|
||
/datum/category_item/player_setup_item/psionics/basic/load_character(datum/pref_record_reader/R) | ||
pref.psi_threat_level = R.read("psi_threat_level") | ||
pref.psi_status = R.read("psi_status") | ||
pref.psi_openness = R.read("psi_openness") | ||
|
||
/datum/category_item/player_setup_item/psionics/basic/save_character(datum/pref_record_writer/W) | ||
W.write("psi_threat_level", pref.psi_threat_level) | ||
W.write("psi_status", pref.psi_status) | ||
W.write("psi_openness", pref.psi_openness) | ||
|
||
/datum/category_item/player_setup_item/psionics/basic/sanitize_character() | ||
pref.psi_threat_level = clamp(pref.psi_threat_level, 0, 4) | ||
pref.psi_status = clamp(pref.psi_status , 1, 4) | ||
|
||
/datum/category_item/player_setup_item/psionics/basic/content() | ||
. = list() | ||
. += "Threat level: <a href='?src=\ref[src];select_psi_threat_level=1'><b>[pref.psi_threat_level]</b></a><br>" | ||
|
||
if(pref.psi_threat_level) | ||
. += "Psionic status: <a href='?src=\ref[src];select_psi_status=1'><b>[GLOB.psi_status2text[pref.psi_status]]</b></a><br>" | ||
. += "Openness: <a href='?src=\ref[src];toggle_psi_openness=1'><b>[pref.psi_openness ? "Yes" : "No"]</b></a><br>" | ||
|
||
. = jointext(.,null) | ||
|
||
/datum/category_item/player_setup_item/psionics/OnTopic(href, list/href_list, mob/user) | ||
if(href_list["select_psi_threat_level"]) | ||
pref.psi_threat_level = text2num(input("Select threat level", CHARACTER_PREFERENCE_INPUT_TITLE, pref.psi_threat_level) in list("0", "1", "2", "3", "4")) | ||
pref.psi_threat_level = clamp(pref.psi_threat_level, 0, 4) | ||
return TOPIC_REFRESH | ||
|
||
else if(href_list["select_psi_status"]) | ||
var/selection = input("Select psionics status", CHARACTER_PREFERENCE_INPUT_TITLE, GLOB.psi_status2text[pref.psi_status]) in GLOB.text2psi_status | ||
if(!(selection in GLOB.text2psi_status)) | ||
return TOPIC_HANDLED | ||
|
||
pref.psi_status = GLOB.text2psi_status[selection] | ||
return TOPIC_REFRESH | ||
|
||
else if(href_list["toggle_psi_openness"]) | ||
pref.psi_openness = !pref.psi_openness | ||
return TOPIC_REFRESH | ||
|
||
return ..() |
117 changes: 117 additions & 0 deletions
117
code/modules/client/preference_setup/psionics/02_abilities.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
GLOBAL_LIST_INIT(psi_level2cost, list( | ||
"Blunt" = 0, | ||
"Latent" = 1, | ||
"Apprentice" = 2, | ||
"Operant" = 4, | ||
"Master" = 6, | ||
"Grandmaster" = 8 | ||
)) | ||
|
||
GLOBAL_LIST_INIT(psi_faculty2color, list( | ||
"Catastellia" = COLOR_SURGERY_BLUE, | ||
"Allaxetia" = COLOR_SURGERY_BLUE, | ||
"Hyloforia" = COLOR_MEDICAL_UNKNOWN_IMPLANT, | ||
"Demiurgy" = COLOR_LIGHT_CYAN, | ||
"Metaplexy" = COLOR_SEDONA, | ||
"Teleplexy" = COLOR_LIGHT_CYAN, | ||
"Ephanoferia" = MANIFEST_COLOR_SERVICE | ||
)) | ||
|
||
GLOBAL_LIST_INIT(psi_threat_level2free_points, list(3, 4, 9, 14)) | ||
|
||
/datum/preferences | ||
var/list/psi_abilities | ||
|
||
|
||
/datum/category_item/player_setup_item/psionics/abilities | ||
name = "Abilities" | ||
sort_order = 3 | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/load_character(datum/pref_record_reader/R) | ||
pref.psi_abilities = R.read("psi_abilities") | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/save_character(datum/pref_record_writer/W) | ||
W.write("psi_abilities", pref.psi_abilities) | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/sanitize_character() | ||
if(pref.psi_abilities) | ||
return ..() | ||
|
||
pref.psi_abilities = list() | ||
for(var/faculty in SSpsi.faculties_by_name) | ||
pref.psi_abilities[faculty] = 1 | ||
|
||
return ..() | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/proc/calculate_free_points() | ||
. = GLOB.psi_threat_level2free_points[pref.psi_threat_level] | ||
|
||
for(var/faculty in pref.psi_abilities) | ||
for(var/level in 1 to GLOB.psi_level2cost.len) | ||
var/level_name = GLOB.psi_level2cost[level] | ||
var/level_cost = GLOB.psi_level2cost[level_name] | ||
|
||
if(pref.psi_abilities[faculty] == level) | ||
. -= level_cost | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/proc/can_select_level(faculty, level) | ||
return (calculate_free_points() + GLOB.psi_level2cost[GLOB.psi_level2cost[pref.psi_abilities[faculty]]]) >= GLOB.psi_level2cost[GLOB.psi_level2cost[level]] | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/content() | ||
if(!pref.psi_threat_level) | ||
return ..() | ||
|
||
. = list() | ||
|
||
. += "<style>" | ||
. += ".Current{background: #2f943c}" | ||
. += ".Unavailable{background: #404040}" | ||
. += ".Selectable, a.Selectable{float:none; border:none; margin:none !important; padding:none !important}" | ||
. += ".center { margin: auto; }" | ||
. += ".candystripe { background-color: rgba(148, 148, 148, 0.25);}" | ||
. += ".candystripe:nth-child(odd) {background-color: rgba(0, 0, 0, 0.16);}" | ||
|
||
. += "</style>" | ||
|
||
. += "<tt><center>" | ||
|
||
. += FONT_LARGE("<b>Points remaining: [calculate_free_points()]</b>") | ||
|
||
. += "<table style='width: 100%' style='font-size: 15px; text-align: center' class='table'>" | ||
|
||
for(var/faculty in pref.psi_abilities) | ||
. += "<tr class='candystripe'>" | ||
. += "<th><div class='average' style='color: [GLOB.psi_faculty2color[faculty]]'>[faculty]:</div></th>" | ||
|
||
for(var/level_index in 1 to GLOB.psi_level2cost.len) | ||
var/level_name = GLOB.psi_level2cost[level_index] | ||
|
||
if(pref.psi_abilities[faculty] == level_index) | ||
. += "<td class='Current'><div class='center'>[level_name]</div></td>" | ||
else if(can_select_level(faculty, level_index)) | ||
. += "<td class style='background: #40628a;'><div class='center'><a class='Selectable' href='?src=\ref[src];select=[level_index];faculty=[faculty]'>[level_name]</a></div></td>" | ||
else | ||
. += "<td class='Unavailable'><div class='center'>[level_name]</div></td>" | ||
|
||
. += "</tr>" | ||
|
||
. += "</table>" | ||
|
||
. += "</center></tt>" | ||
|
||
. = jointext(., null) | ||
|
||
/datum/category_item/player_setup_item/psionics/abilities/OnTopic(href, list/href_list, mob/user) | ||
if(..()) | ||
return TOPIC_HANDLED | ||
|
||
if(href_list["select"]) | ||
var/level = text2num(href_list["select"]) | ||
var/faculty = href_list["faculty"] | ||
|
||
if(!can_select_level(faculty, level)) | ||
return TOPIC_HANDLED | ||
|
||
pref.psi_abilities[faculty] = level | ||
|
||
return TOPIC_REFRESH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters