From 654f2ccaa09a1f56c4478e182ae731fc632586ef Mon Sep 17 00:00:00 2001 From: PsiOmegaDelta Date: Sat, 30 Jan 2016 17:22:17 +0100 Subject: [PATCH] Makes all special role entries use unique ids now that it is possible. --- baystation12.dme | 6 ++-- code/__defines/gamemode.dm | 22 ++----------- code/_helpers/game.dm | 2 +- code/game/antagonist/alien/xenomorph.dm | 1 - code/game/antagonist/antagonist.dm | 5 ++- code/game/antagonist/outsider/actors.dm | 3 +- code/game/antagonist/outsider/deathsquad.dm | 1 - code/game/antagonist/outsider/ert.dm | 3 +- code/game/antagonist/outsider/mercenary.dm | 1 - code/game/antagonist/outsider/ninja.dm | 1 - code/game/antagonist/outsider/raider.dm | 1 - code/game/antagonist/outsider/wizard.dm | 1 - code/game/antagonist/station/changeling.dm | 1 - code/game/antagonist/station/cultist.dm | 1 - code/game/antagonist/station/loyalist.dm | 1 - code/game/antagonist/station/revolutionary.dm | 1 - code/game/antagonist/station/rogue_ai.dm | 1 - code/game/jobs/whitelist.dm | 2 ++ code/game/objects/structures/alien/egg.dm | 2 +- .../{02_candidacy.dm => 01_candidacy.dm} | 33 ++++++++++++------- .../antagonism/{01_basic.dm => 02_setup.dm} | 10 +++--- .../preference_setup/preference_setup.dm | 2 +- code/modules/ghosttrap/trap.dm | 4 +-- 23 files changed, 46 insertions(+), 59 deletions(-) rename code/modules/client/preference_setup/antagonism/{02_candidacy.dm => 01_candidacy.dm} (72%) rename code/modules/client/preference_setup/antagonism/{01_basic.dm => 02_setup.dm} (87%) diff --git a/baystation12.dme b/baystation12.dme index 139ebc26a95..077b78116a4 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -971,8 +971,8 @@ #include "code\modules\client\preferences_toggles.dm" #include "code\modules\client\ui_style.dm" #include "code\modules\client\preference_setup\preference_setup.dm" -#include "code\modules\client\preference_setup\antagonism\01_basic.dm" -#include "code\modules\client\preference_setup\antagonism\02_candidacy.dm" +#include "code\modules\client\preference_setup\antagonism\01_candidacy.dm" +#include "code\modules\client\preference_setup\antagonism\02_setup.dm" #include "code\modules\client\preference_setup\general\01_basic.dm" #include "code\modules\client\preference_setup\general\02_language.dm" #include "code\modules\client\preference_setup\general\03_body.dm" @@ -1882,10 +1882,10 @@ #include "code\modules\xgm\xgm_gas_data.dm" #include "code\modules\xgm\xgm_gas_mixture.dm" #include "code\unit_tests\equipment_tests.dm" +#include "code\unit_tests\map_tests.dm" #include "code\unit_tests\mob_tests.dm" #include "code\unit_tests\unit_test.dm" #include "code\unit_tests\zas_tests.dm" -#include "code\unit_tests\map_tests.dm" #include "code\ZAS\_docs.dm" #include "code\ZAS\Airflow.dm" #include "code\ZAS\Atom.dm" diff --git a/code/__defines/gamemode.dm b/code/__defines/gamemode.dm index cf8d4f47667..94288982684 100644 --- a/code/__defines/gamemode.dm +++ b/code/__defines/gamemode.dm @@ -9,25 +9,9 @@ #define SEC_LEVEL_RED 2 #define SEC_LEVEL_DELTA 3 -#define BE_TRAITOR 0x1 -#define BE_OPERATIVE 0x2 -#define BE_CHANGELING 0x4 -#define BE_WIZARD 0x8 -#define BE_MALF 0x10 -#define BE_REV 0x20 -#define BE_ALIEN 0x40 -#define BE_AI 0x80 -#define BE_CULTIST 0x100 -#define BE_MONKEY 0x200 -#define BE_NINJA 0x400 -#define BE_RAIDER 0x800 -#define BE_PLANT 0x1000 -#define BE_MUTINEER 0x2000 -#define BE_PAI 0x4000 -#define BE_LOYALIST 0x8000 - -#define IS_MODE_COMPILED(MODE) (ispath(text2path("/datum/game_mode/"+(MODE)))) - +#define BE_PLANT "BE_PLANT" +#define BE_SYNTH "BE_SYNTH" +#define BE_PAI "BE_PAI" // Antagonist datum flags. #define ANTAG_OVERRIDE_JOB 0x1 // Assigned job is set to MODE when spawning. diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index 13c6611f631..2a4dc372d92 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -334,7 +334,7 @@ proc/isInSight(var/atom/A, var/atom/B) var/i = 0 while(candidates.len <= 0 && i < 5) for(var/mob/dead/observer/G in player_list) - if(BE_ALIEN in G.client.prefs.be_special_role) + if(MODE_XENOMORPH in G.client.prefs.be_special_role) if(((G.client.inactivity/10)/60) <= ALIEN_SELECT_AFK_BUFFER + i) // the most active players are more likely to become an alien if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) candidates += G.key diff --git a/code/game/antagonist/alien/xenomorph.dm b/code/game/antagonist/alien/xenomorph.dm index 36f5216045a..2eb8d2d23fc 100644 --- a/code/game/antagonist/alien/xenomorph.dm +++ b/code/game/antagonist/alien/xenomorph.dm @@ -2,7 +2,6 @@ var/datum/antagonist/xenos/xenomorphs /datum/antagonist/xenos id = MODE_XENOMORPH - role_type = BE_ALIEN role_text = "Xenomorph" role_text_plural = "Xenomorphs" mob_path = /mob/living/carbon/alien/larva diff --git a/code/game/antagonist/antagonist.dm b/code/game/antagonist/antagonist.dm index 32f40ad985d..2dd934d1f04 100644 --- a/code/game/antagonist/antagonist.dm +++ b/code/game/antagonist/antagonist.dm @@ -14,7 +14,7 @@ // Role data. var/id = "traitor" // Unique datum identifier. - var/role_type = BE_TRAITOR // Preferences option for this role. + var/role_type // Preferences option for this role. Defaults to the id if unset var/role_text = "Traitor" // special_role text. var/role_text_plural = "Traitors" // As above but plural. @@ -72,6 +72,9 @@ /datum/antagonist/New() ..() + if(!role_type) + role_type = id + cur_max = hard_cap get_starting_locations() if(!role_text_plural) diff --git a/code/game/antagonist/outsider/actors.dm b/code/game/antagonist/outsider/actors.dm index 7d5deb39e76..d9e8d422700 100644 --- a/code/game/antagonist/outsider/actors.dm +++ b/code/game/antagonist/outsider/actors.dm @@ -2,8 +2,7 @@ var/datum/antagonist/actor/actor /datum/antagonist/actor id = MODE_ACTOR - bantype = "operative" - role_type = BE_OPERATIVE + bantype = "actor" role_text = "NanoTrasen Actor" role_text_plural = "NanoTrasen Actors" welcome_text = "You've been hired to entertain people through the power of television!" diff --git a/code/game/antagonist/outsider/deathsquad.dm b/code/game/antagonist/outsider/deathsquad.dm index ca0b39aaefe..2abdb5db3d4 100644 --- a/code/game/antagonist/outsider/deathsquad.dm +++ b/code/game/antagonist/outsider/deathsquad.dm @@ -2,7 +2,6 @@ var/datum/antagonist/deathsquad/deathsquad /datum/antagonist/deathsquad id = MODE_DEATHSQUAD - role_type = BE_OPERATIVE role_text = "Death Commando" role_text_plural = "Death Commandos" welcome_text = "You work in the service of corporate Asset Protection, answering directly to the Board of Directors." diff --git a/code/game/antagonist/outsider/ert.dm b/code/game/antagonist/outsider/ert.dm index e8517dbf4e8..5408a8a889d 100644 --- a/code/game/antagonist/outsider/ert.dm +++ b/code/game/antagonist/outsider/ert.dm @@ -3,7 +3,6 @@ var/datum/antagonist/ert/ert /datum/antagonist/ert id = MODE_ERT bantype = "Emergency Response Team" - role_type = BE_OPERATIVE role_text = "Emergency Responder" role_text_plural = "Emergency Responders" welcome_text = "As member of the Emergency Response Team, you answer only to your leader and company officials." @@ -41,6 +40,6 @@ var/datum/antagonist/ert/ert player.equip_to_slot_or_del(new /obj/item/clothing/shoes/swat(src), slot_shoes) player.equip_to_slot_or_del(new /obj/item/clothing/gloves/swat(src), slot_gloves) player.equip_to_slot_or_del(new /obj/item/clothing/glasses/sunglasses(src), slot_glasses) - + create_id(role_text, player) return 1 diff --git a/code/game/antagonist/outsider/mercenary.dm b/code/game/antagonist/outsider/mercenary.dm index e2c44aef70f..82415de808a 100644 --- a/code/game/antagonist/outsider/mercenary.dm +++ b/code/game/antagonist/outsider/mercenary.dm @@ -2,7 +2,6 @@ var/datum/antagonist/mercenary/mercs /datum/antagonist/mercenary id = MODE_MERCENARY - role_type = BE_OPERATIVE role_text = "Mercenary" bantype = "operative" antag_indicator = "synd" diff --git a/code/game/antagonist/outsider/ninja.dm b/code/game/antagonist/outsider/ninja.dm index 09dc15b5949..eeead17be7f 100644 --- a/code/game/antagonist/outsider/ninja.dm +++ b/code/game/antagonist/outsider/ninja.dm @@ -2,7 +2,6 @@ var/datum/antagonist/ninja/ninjas /datum/antagonist/ninja id = MODE_NINJA - role_type = BE_NINJA role_text = "Ninja" role_text_plural = "Ninja" bantype = "ninja" diff --git a/code/game/antagonist/outsider/raider.dm b/code/game/antagonist/outsider/raider.dm index 8ab342bbf24..26648a34f04 100644 --- a/code/game/antagonist/outsider/raider.dm +++ b/code/game/antagonist/outsider/raider.dm @@ -2,7 +2,6 @@ var/datum/antagonist/raider/raiders /datum/antagonist/raider id = MODE_RAIDER - role_type = BE_RAIDER role_text = "Raider" role_text_plural = "Raiders" bantype = "raider" diff --git a/code/game/antagonist/outsider/wizard.dm b/code/game/antagonist/outsider/wizard.dm index f6741cafa07..292277b1a27 100644 --- a/code/game/antagonist/outsider/wizard.dm +++ b/code/game/antagonist/outsider/wizard.dm @@ -2,7 +2,6 @@ var/datum/antagonist/wizard/wizards /datum/antagonist/wizard id = MODE_WIZARD - role_type = BE_WIZARD role_text = "Space Wizard" role_text_plural = "Space Wizards" bantype = "wizard" diff --git a/code/game/antagonist/station/changeling.dm b/code/game/antagonist/station/changeling.dm index b3f5605a91c..216d731137d 100644 --- a/code/game/antagonist/station/changeling.dm +++ b/code/game/antagonist/station/changeling.dm @@ -1,6 +1,5 @@ /datum/antagonist/changeling id = MODE_CHANGELING - role_type = BE_CHANGELING role_text = "Changeling" role_text_plural = "Changelings" bantype = "changeling" diff --git a/code/game/antagonist/station/cultist.dm b/code/game/antagonist/station/cultist.dm index aba2115d152..cc6314c7519 100644 --- a/code/game/antagonist/station/cultist.dm +++ b/code/game/antagonist/station/cultist.dm @@ -13,7 +13,6 @@ var/datum/antagonist/cultist/cult bantype = "cultist" restricted_jobs = list("Chaplain","AI", "Cyborg", "Internal Affairs Agent", "Head of Security", "Captain") protected_jobs = list("Security Officer", "Warden", "Detective") - role_type = BE_CULTIST feedback_tag = "cult_objective" antag_indicator = "cult" welcome_text = "You have a talisman in your possession; one that will help you start the cult on this station. Use it well and remember - there are others." diff --git a/code/game/antagonist/station/loyalist.dm b/code/game/antagonist/station/loyalist.dm index fddf0c37960..f8b5ec49946 100644 --- a/code/game/antagonist/station/loyalist.dm +++ b/code/game/antagonist/station/loyalist.dm @@ -2,7 +2,6 @@ var/datum/antagonist/loyalists/loyalists /datum/antagonist/loyalists id = MODE_LOYALIST - role_type = BE_LOYALIST role_text = "Head Loyalist" role_text_plural = "Loyalists" bantype = "loyalist" diff --git a/code/game/antagonist/station/revolutionary.dm b/code/game/antagonist/station/revolutionary.dm index 96e37529915..ca0011f8d72 100644 --- a/code/game/antagonist/station/revolutionary.dm +++ b/code/game/antagonist/station/revolutionary.dm @@ -2,7 +2,6 @@ var/datum/antagonist/revolutionary/revs /datum/antagonist/revolutionary id = MODE_REVOLUTIONARY - role_type = BE_REV role_text = "Head Revolutionary" role_text_plural = "Revolutionaries" bantype = "revolutionary" diff --git a/code/game/antagonist/station/rogue_ai.dm b/code/game/antagonist/station/rogue_ai.dm index 4240708cc22..ea99bf14afb 100644 --- a/code/game/antagonist/station/rogue_ai.dm +++ b/code/game/antagonist/station/rogue_ai.dm @@ -2,7 +2,6 @@ var/datum/antagonist/rogue_ai/malf /datum/antagonist/rogue_ai id = MODE_MALFUNCTION - role_type = BE_MALF role_text = "Rampant AI" role_text_plural = "Rampant AIs" mob_path = /mob/living/silicon/ai diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index 3cbacf9e501..613e9c7241a 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -52,6 +52,8 @@ var/list/whitelist = list() //todo: admin aliens /proc/is_alien_whitelisted(mob/M, var/species) + if(!M || !species) + return 0 if(!config.usealienwhitelist) return 1 if(istype(species,/datum/species) || istype(species,/datum/language)) diff --git a/code/game/objects/structures/alien/egg.dm b/code/game/objects/structures/alien/egg.dm index 5eb44d08327..5d32f9685f6 100644 --- a/code/game/objects/structures/alien/egg.dm +++ b/code/game/objects/structures/alien/egg.dm @@ -30,7 +30,7 @@ progress++ if(progress >= MAX_PROGRESS) for(var/mob/M in dead_mob_list) - if(istype(M,/mob/dead) && M.client && M.client.prefs && (BE_ALIEN in M.client.prefs.be_special_role)) + if(istype(M,/mob/dead) && M.client && M.client.prefs && (MODE_XENOMORPH in M.client.prefs.be_special_role)) M << "An alien is ready to hatch! ([ghost_follow_link(src, M)]) (spawn)" processing_objects -= src update_icon() diff --git a/code/modules/client/preference_setup/antagonism/02_candidacy.dm b/code/modules/client/preference_setup/antagonism/01_candidacy.dm similarity index 72% rename from code/modules/client/preference_setup/antagonism/02_candidacy.dm rename to code/modules/client/preference_setup/antagonism/01_candidacy.dm index 3f71893e6be..449a5ceb747 100644 --- a/code/modules/client/preference_setup/antagonism/02_candidacy.dm +++ b/code/modules/client/preference_setup/antagonism/01_candidacy.dm @@ -2,7 +2,7 @@ var/list/private_valid_special_roles /datum/category_item/player_setup_item/antagonism/candidacy name = "Candidacy" - sort_order = 2 + sort_order = 1 /datum/category_item/player_setup_item/antagonism/candidacy/load_character(var/savefile/S) S["be_special"] >> pref.be_special_role @@ -20,14 +20,17 @@ var/list/private_valid_special_roles /datum/category_item/player_setup_item/antagonism/candidacy/content(var/mob/user) . += "Special Role Availability:
" - for(var/datum/antagonist/antag in all_antag_types) - . += "[antag.role_text]: " + . += "" + for(var/antag_type in all_antag_types) + var/datum/antagonist/antag = all_antag_types[antag_type] + . += "" var/list/ghost_traps = get_ghost_traps() for(var/ghost_trap_key in ghost_traps) @@ -35,15 +38,21 @@ var/list/private_valid_special_roles 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)) - . += "\[BANNED\]
" - continue - if(ghost_trap.pref_check in pref.be_special_role) + . += "" + . += "
[antag.role_text]: " if(jobban_isbanned(preference_mob(), antag.bantype)) . += "\[BANNED\]
" else if(antag.role_type in pref.be_special_role) . += "Yes / No
" else . += "Yes / No
" + . += "
[(ghost_trap.ghost_trap_role)]: " + if(banned_from_ghost_role(preference_mob(), ghost_trap)) + . += "\[BANNED\]
" + else if(ghost_trap.pref_check in pref.be_special_role) . += "Yes / No
" else . += "Yes / No
" + . += "
" + +/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"]) @@ -59,11 +68,13 @@ var/list/private_valid_special_roles return ..() /datum/category_item/player_setup_item/antagonism/candidacy/proc/valid_special_roles() - if(!private_valid_special_roles) + if(!(private_valid_special_roles && private_valid_special_roles.len)) private_valid_special_roles = list() - for(var/datum/antagonist/antag in all_antag_types) + 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) diff --git a/code/modules/client/preference_setup/antagonism/01_basic.dm b/code/modules/client/preference_setup/antagonism/02_setup.dm similarity index 87% rename from code/modules/client/preference_setup/antagonism/01_basic.dm rename to code/modules/client/preference_setup/antagonism/02_setup.dm index eefc531da15..249d7bf2bb5 100644 --- a/code/modules/client/preference_setup/antagonism/01_basic.dm +++ b/code/modules/client/preference_setup/antagonism/02_setup.dm @@ -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) - . +="Uplink Type : [pref.uplinklocation]" - . +="
" - . +="Exploitable information:
" + . +="Antag Setup:
" + . +="Uplink Type: [pref.uplinklocation]
" + . +="Exploitable information:
" if(jobban_isbanned(user, "Records")) . += "You are banned from using character records.
" else diff --git a/code/modules/client/preference_setup/preference_setup.dm b/code/modules/client/preference_setup/preference_setup.dm index 13df4a05e01..90a15851dc4 100644 --- a/code/modules/client/preference_setup/preference_setup.dm +++ b/code/modules/client/preference_setup/preference_setup.dm @@ -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 diff --git a/code/modules/ghosttrap/trap.dm b/code/modules/ghosttrap/trap.dm index 89358ab2347..92eb1d0f1c5 100644 --- a/code/modules/ghosttrap/trap.dm +++ b/code/modules/ghosttrap/trap.dm @@ -23,7 +23,7 @@ var/list/ghost_traps var/object = "positronic brain" var/minutes_since_death = 0 // If non-zero the ghost must have been dead for this many minutes to be allowed to spawn var/list/ban_checks = list("AI","Cyborg") - var/pref_check = BE_AI + var/pref_check = BE_SYNTH var/ghost_trap_message = "They are occupying a positronic brain now." var/ghost_trap_role = "Positronic Brain" var/can_set_own_name = TRUE @@ -150,7 +150,7 @@ var/list/ghost_traps /datum/ghosttrap/borer object = "cortical borer" ban_checks = list("Borer") - pref_check = BE_ALIEN + pref_check = MODE_BORER ghost_trap_message = "They are occupying a borer now." ghost_trap_role = "Cortical Borer" can_set_own_name = FALSE