mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 20:11:04 +01:00
Merge pull request #11988 from PsiOmegaDelta/160115-IAmALittleBitSpecial(InTheHead)
Makes special role preferences a list, instead of flag entry.
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
var/list/private_valid_special_roles
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy
|
||||
name = "Candidacy"
|
||||
sort_order = 1
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/load_character(var/savefile/S)
|
||||
S["be_special"] >> pref.be_special_role
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/save_character(var/savefile/S)
|
||||
S["be_special"] << pref.be_special_role
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/sanitize_character()
|
||||
if(!istype(pref.be_special_role))
|
||||
pref.be_special_role = list()
|
||||
|
||||
for(var/role in pref.be_special_role)
|
||||
if(!(role in valid_special_roles()))
|
||||
pref.be_special_role -= role
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/content(var/mob/user)
|
||||
. += "<b>Special Role Availability:</b><br>"
|
||||
. += "<table>"
|
||||
for(var/antag_type in all_antag_types)
|
||||
var/datum/antagonist/antag = all_antag_types[antag_type]
|
||||
. += "<tr><td>[antag.role_text]: </td><td>"
|
||||
if(jobban_isbanned(preference_mob(), antag.bantype))
|
||||
. += "<span class='danger'>\[BANNED\]</span><br>"
|
||||
else if(antag.role_type in pref.be_special_role)
|
||||
. += "<b>Yes</b> / <a href='?src=\ref[src];del_special=[antag.role_type]'>No</a></br>"
|
||||
else
|
||||
. += "<a href='?src=\ref[src];add_special=[antag.role_type]'>Yes</a> / <b>No</b></br>"
|
||||
. += "</td></tr>"
|
||||
|
||||
var/list/ghost_traps = get_ghost_traps()
|
||||
for(var/ghost_trap_key in ghost_traps)
|
||||
var/datum/ghosttrap/ghost_trap = ghost_traps[ghost_trap_key]
|
||||
if(!ghost_trap.list_as_special_role)
|
||||
continue
|
||||
|
||||
. += "<tr><td>[(ghost_trap.ghost_trap_role)]: </td><td>"
|
||||
if(banned_from_ghost_role(preference_mob(), ghost_trap))
|
||||
. += "<span class='danger'>\[BANNED\]</span><br>"
|
||||
else if(ghost_trap.pref_check in pref.be_special_role)
|
||||
. += "<b>Yes</b> / <a href='?src=\ref[src];del_special=[ghost_trap.pref_check]'>No</a></br>"
|
||||
else
|
||||
. += "<a href='?src=\ref[src];add_special=[ghost_trap.pref_check]'>Yes</a> / <b>No</b></br>"
|
||||
. += "</td></tr>"
|
||||
. += "</table>"
|
||||
|
||||
/datum/category_item/player_setup_item/proc/banned_from_ghost_role(var/mob, var/datum/ghosttrap/ghost_trap)
|
||||
for(var/ban_type in ghost_trap.ban_checks)
|
||||
if(jobban_isbanned(mob, ban_type))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/OnTopic(var/href,var/list/href_list, var/mob/user)
|
||||
if(href_list["add_special"])
|
||||
if(!(href_list["add_special"] in valid_special_roles()))
|
||||
return TOPIC_HANDLED
|
||||
pref.be_special_role |= href_list["add_special"]
|
||||
return TOPIC_REFRESH
|
||||
|
||||
if(href_list["del_special"])
|
||||
pref.be_special_role -= href_list["del_special"]
|
||||
return TOPIC_REFRESH
|
||||
|
||||
return ..()
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/proc/valid_special_roles()
|
||||
if(!(private_valid_special_roles && private_valid_special_roles.len))
|
||||
private_valid_special_roles = list()
|
||||
for(var/antag_type in all_antag_types)
|
||||
var/datum/antagonist/antag = all_antag_types[antag_type]
|
||||
private_valid_special_roles += antag.role_type
|
||||
|
||||
var/list/ghost_traps = get_ghost_traps()
|
||||
for(var/ghost_trap_key in ghost_traps)
|
||||
var/datum/ghosttrap/ghost_trap = ghost_traps[ghost_trap_key]
|
||||
if(!ghost_trap.list_as_special_role)
|
||||
continue
|
||||
private_valid_special_roles += ghost_trap.pref_check
|
||||
|
||||
return private_valid_special_roles
|
||||
@@ -1,54 +0,0 @@
|
||||
var/global/list/special_roles = list( //keep synced with the defines BE_* in setup.dm --rastaf
|
||||
//some autodetection here.
|
||||
// TODO: Update to new antagonist system.
|
||||
"traitor" = IS_MODE_COMPILED("traitor"), // 0
|
||||
"operative" = IS_MODE_COMPILED("nuclear"), // 1
|
||||
"changeling" = IS_MODE_COMPILED("changeling"), // 2
|
||||
"wizard" = IS_MODE_COMPILED("wizard"), // 3
|
||||
"malf AI" = IS_MODE_COMPILED("malfunction"), // 4
|
||||
"revolutionary" = IS_MODE_COMPILED("revolution"), // 5
|
||||
"alien candidate" = 1, //always show // 6
|
||||
"positronic brain" = 1, // 7
|
||||
"cultist" = IS_MODE_COMPILED("cult"), // 8
|
||||
"infested monkey" = IS_MODE_COMPILED("monkey"), // 9
|
||||
"ninja" = "true", // 10
|
||||
"raider" = IS_MODE_COMPILED("heist"), // 11
|
||||
"diona" = 1, // 12
|
||||
"loyalist" = IS_MODE_COMPILED("revolution"), // 13
|
||||
"pAI candidate" = 1, // -- TLE // 14
|
||||
)
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy
|
||||
name = "Candidacy"
|
||||
sort_order = 2
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/load_character(var/savefile/S)
|
||||
S["be_special"] >> pref.be_special
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/save_character(var/savefile/S)
|
||||
S["be_special"] << pref.be_special
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/sanitize_character()
|
||||
pref.be_special = sanitize_integer(pref.be_special, 0, 65535, initial(pref.be_special))
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/content(var/mob/user)
|
||||
if(jobban_isbanned(user, "Syndicate"))
|
||||
. += "<b>You are banned from antagonist roles.</b>"
|
||||
pref.be_special = 0
|
||||
else
|
||||
var/n = 0
|
||||
for (var/i in special_roles)
|
||||
if(special_roles[i]) //if mode is available on the server
|
||||
if(jobban_isbanned(user, i) || (i == "positronic brain" && jobban_isbanned(user, "AI") && jobban_isbanned(user, "Cyborg")) || (i == "pAI candidate" && jobban_isbanned(user, "pAI")))
|
||||
. += "<b>Be [i]:</b> <font color=red><b> \[BANNED]</b></font><br>"
|
||||
else
|
||||
. += "<b>Be [i]:</b> <a href='?src=\ref[src];be_special=[n]'><b>[pref.be_special&(1<<n) ? "Yes" : "No"]</b></a><br>"
|
||||
n++
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/OnTopic(var/href,var/list/href_list, var/mob/user)
|
||||
if(href_list["be_special"])
|
||||
var/num = text2num(href_list["be_special"])
|
||||
pref.be_special ^= (1<<num)
|
||||
return TOPIC_REFRESH
|
||||
|
||||
return ..()
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
var/global/list/uplink_locations = list("PDA", "Headset", "None")
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/basic
|
||||
name = "Basic"
|
||||
sort_order = 1
|
||||
name = "Setup"
|
||||
sort_order = 2
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/basic/load_character(var/savefile/S)
|
||||
S["uplinklocation"] >> pref.uplinklocation
|
||||
@@ -16,9 +16,9 @@ var/global/list/uplink_locations = list("PDA", "Headset", "None")
|
||||
pref.uplinklocation = sanitize_inlist(pref.uplinklocation, uplink_locations, initial(pref.uplinklocation))
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/basic/content(var/mob/user)
|
||||
. +="<b>Uplink Type : <a href='?src=\ref[src];antagtask=1'>[pref.uplinklocation]</a></b>"
|
||||
. +="<br>"
|
||||
. +="<b>Exploitable information:</b><br>"
|
||||
. +="<b>Antag Setup:</b><br>"
|
||||
. +="Uplink Type: <a href='?src=\ref[src];antagtask=1'>[pref.uplinklocation]</a><br>"
|
||||
. +="Exploitable information:<br>"
|
||||
if(jobban_isbanned(user, "Records"))
|
||||
. += "<b>You are banned from using character records.</b><br>"
|
||||
else
|
||||
@@ -19,7 +19,7 @@
|
||||
category_item_type = /datum/category_item/player_setup_item/occupation
|
||||
|
||||
/datum/category_group/player_setup_category/appearance_preferences
|
||||
name = "Antagonism"
|
||||
name = "Roles"
|
||||
sort_order = 4
|
||||
category_item_type = /datum/category_item/player_setup_item/antagonism
|
||||
|
||||
|
||||
Reference in New Issue
Block a user