mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-13 00:47:31 +01:00
Makes special role preferences a list, instead of flag entry.
Allows us to define more than 16 special roles. Updates some role usages to use the new ghost trap system.
This commit is contained in:
@@ -1,54 +1,72 @@
|
||||
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
|
||||
var/list/private_valid_special_roles
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/load_character(var/savefile/S)
|
||||
S["be_special"] >> pref.be_special
|
||||
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
|
||||
S["be_special"] << pref.be_special_role
|
||||
|
||||
/datum/category_item/player_setup_item/antagonism/candidacy/sanitize_character()
|
||||
pref.be_special = sanitize_integer(pref.be_special, 0, 65535, initial(pref.be_special))
|
||||
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)
|
||||
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++
|
||||
. += "<b>Special Role Availability:</b><br>"
|
||||
for(var/datum/antagonist/antag in all_antag_types)
|
||||
. += "[antag.role_text]: "
|
||||
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>"
|
||||
|
||||
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
|
||||
|
||||
. += "[(ghost_trap.ghost_trap_role)]: "
|
||||
for(var/ban_type in ghost_trap.ban_checks)
|
||||
if(jobban_isbanned(preference_mob(), ban_type))
|
||||
. += "<span class='danger'>\[BANNED\]</span><br>"
|
||||
continue
|
||||
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>"
|
||||
|
||||
/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)
|
||||
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 = list()
|
||||
for(var/datum/antagonist/antag in all_antag_types)
|
||||
private_valid_special_roles += antag.role_type
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user