mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
138 lines
6.7 KiB
Plaintext
138 lines
6.7 KiB
Plaintext
GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","Epsilon","Zeta","Eta","Theta","Iota","Kappa","Lambda","Mu","Nu","Xi","Omicron","Pi","Rho","Sigma","Tau","Upsilon","Phi","Chi","Psi","Omega"))
|
|
GLOBAL_LIST_INIT(slots, list("head", "wear_mask", "back", "wear_suit", "w_uniform", "shoes", "belt", "gloves", "glasses", "ears", "wear_id", "s_store"))
|
|
GLOBAL_LIST_INIT(slot2slot, list("head" = SLOT_HEAD, "wear_mask" = SLOT_WEAR_MASK, "neck" = SLOT_NECK, "back" = SLOT_BACK, "wear_suit" = SLOT_WEAR_SUIT, "w_uniform" = SLOT_W_UNIFORM, "shoes" = SLOT_SHOES, "belt" = SLOT_BELT, "gloves" = SLOT_GLOVES, "glasses" = SLOT_GLASSES, "ears" = SLOT_EARS, "wear_id" = SLOT_WEAR_ID, "s_store" = SLOT_S_STORE))
|
|
GLOBAL_LIST_INIT(slot2type, list("head" = /obj/item/clothing/head/changeling, "wear_mask" = /obj/item/clothing/mask/changeling, "back" = /obj/item/changeling, "wear_suit" = /obj/item/clothing/suit/changeling, "w_uniform" = /obj/item/clothing/under/changeling, "shoes" = /obj/item/clothing/shoes/changeling, "belt" = /obj/item/changeling, "gloves" = /obj/item/clothing/gloves/changeling, "glasses" = /obj/item/clothing/glasses/changeling, "ears" = /obj/item/changeling, "wear_id" = /obj/item/changeling, "s_store" = /obj/item/changeling))
|
|
GLOBAL_VAR(changeling_team_objective_type) //If this is not null, we hand our this objective to all lings
|
|
|
|
|
|
/datum/game_mode/changeling
|
|
name = "changeling"
|
|
config_tag = "changeling"
|
|
antag_flag = ROLE_CHANGELING
|
|
false_report_weight = 10
|
|
restricted_jobs = list("AI", "Cyborg")
|
|
protected_jobs = list("Security Officer", "Warden", "Detective", "Head of Security", "Captain", "Head of Personnel") //YOGS - added hop
|
|
required_players = 15
|
|
required_enemies = 1
|
|
recommended_enemies = 4
|
|
reroll_friendly = 1
|
|
|
|
announce_span = "green"
|
|
announce_text = "Alien changelings have infiltrated the crew!\n\
|
|
<span class='green'>Changelings</span>: Accomplish the objectives assigned to you.\n\
|
|
<span class='notice'>Crew</span>: Root out and eliminate the changeling menace."
|
|
|
|
var/const/changeling_amount = 4 //hard limit on changelings if scaling is turned off
|
|
var/list/changelings = list()
|
|
|
|
/datum/game_mode/changeling/pre_setup()
|
|
|
|
if(CONFIG_GET(flag/protect_roles_from_antagonist))
|
|
restricted_jobs += protected_jobs
|
|
|
|
if(CONFIG_GET(flag/protect_assistant_from_antagonist))
|
|
restricted_jobs += "Assistant"
|
|
|
|
var/num_changelings = 1
|
|
|
|
var/csc = CONFIG_GET(number/changeling_scaling_coeff)
|
|
if(csc)
|
|
num_changelings = max(1, min(round(num_players() / (csc * 2)) + 2, round(num_players() / csc)))
|
|
else
|
|
num_changelings = max(1, min(num_players(), changeling_amount))
|
|
|
|
if(antag_candidates.len>0)
|
|
for(var/i = 0, i < num_changelings, i++)
|
|
if(!antag_candidates.len)
|
|
break
|
|
var/datum/mind/changeling = antag_pick(antag_candidates)
|
|
antag_candidates -= changeling
|
|
changelings += changeling
|
|
changeling.special_role = ROLE_CHANGELING
|
|
changeling.restricted_roles = restricted_jobs
|
|
return 1
|
|
else
|
|
setup_error = "Not enough changeling candidates"
|
|
return 0
|
|
|
|
/datum/game_mode/changeling/post_setup()
|
|
//Decide if it's ok for the lings to have a team objective
|
|
//And then set it up to be handed out in forge_changeling_objectives
|
|
var/list/team_objectives = subtypesof(/datum/objective/changeling_team_objective)
|
|
var/list/possible_team_objectives = list()
|
|
for(var/T in team_objectives)
|
|
var/datum/objective/changeling_team_objective/CTO = T
|
|
|
|
if(changelings.len >= initial(CTO.min_lings))
|
|
possible_team_objectives += T
|
|
|
|
if(possible_team_objectives.len && prob(20*changelings.len))
|
|
GLOB.changeling_team_objective_type = pick(possible_team_objectives)
|
|
|
|
for(var/datum/mind/changeling in changelings)
|
|
//log_game("[key_name(changeling)] has been selected as a changeling") | yogs - redundant
|
|
var/datum/antagonist/changeling/new_antag = new()
|
|
//new_antag.team_mode = TRUE //yogs - lol
|
|
changeling.add_antag_datum(new_antag)
|
|
..()
|
|
|
|
/datum/game_mode/changeling/make_antag_chance(mob/living/carbon/human/character) //Assigns changeling to latejoiners
|
|
var/csc = CONFIG_GET(number/changeling_scaling_coeff)
|
|
var/changelingcap = min(round(GLOB.joined_player_list.len / (csc * 2)) + 2, round(GLOB.joined_player_list.len / csc))
|
|
if(changelings.len >= changelingcap) //Caps number of latejoin antagonists
|
|
return
|
|
if(changelings.len <= (changelingcap - 2) || prob(100 - (csc * 2)))
|
|
if(ROLE_CHANGELING in character.client.prefs.be_special)
|
|
if(!jobban_isbanned(character, ROLE_CHANGELING) && !QDELETED(character) && !jobban_isbanned(character, ROLE_SYNDICATE) && !QDELETED(character))
|
|
if(age_check(character.client))
|
|
if(!(character.job in restricted_jobs))
|
|
character.mind.make_Changeling()
|
|
changelings += character.mind
|
|
|
|
/datum/game_mode/changeling/generate_report()
|
|
return "The Gorlex Marauders have announced the successful raid and destruction of Central Command containment ship #S-[rand(1111, 9999)]. This ship housed only a single prisoner - \
|
|
codenamed \"Thing\", and it was highly adaptive and extremely dangerous. We have reason to believe that the Thing has allied with the Syndicate, and you should note that likelihood \
|
|
of the Thing being sent to a station in this sector is highly likely. It may be in the guise of any crew member. Trust nobody - suspect everybody. Do not announce this to the crew, \
|
|
as paranoia may spread and inhibit workplace efficiency."
|
|
|
|
/proc/changeling_transform(mob/living/carbon/human/user, datum/changelingprofile/chosen_prof)
|
|
var/datum/dna/chosen_dna = chosen_prof.dna
|
|
user.real_name = chosen_prof.name
|
|
user.underwear = chosen_prof.underwear
|
|
user.undershirt = chosen_prof.undershirt
|
|
user.socks = chosen_prof.socks
|
|
|
|
chosen_dna.transfer_identity(user, 1)
|
|
user.updateappearance(mutcolor_update=1)
|
|
user.update_body()
|
|
user.domutcheck()
|
|
|
|
//vars hackery. not pretty, but better than the alternative.
|
|
for(var/slot in GLOB.slots)
|
|
if(istype(user.vars[slot], GLOB.slot2type[slot]) && !(chosen_prof.exists_list[slot])) //remove unnecessary flesh items
|
|
qdel(user.vars[slot])
|
|
continue
|
|
|
|
if((user.vars[slot] && !istype(user.vars[slot], GLOB.slot2type[slot])) || !(chosen_prof.exists_list[slot]))
|
|
continue
|
|
|
|
var/obj/item/C
|
|
var/equip = 0
|
|
if(!user.vars[slot])
|
|
var/thetype = GLOB.slot2type[slot]
|
|
equip = 1
|
|
C = new thetype(user)
|
|
|
|
else if(istype(user.vars[slot], GLOB.slot2type[slot]))
|
|
C = user.vars[slot]
|
|
|
|
C.appearance = chosen_prof.appearance_list[slot]
|
|
C.name = chosen_prof.name_list[slot]
|
|
C.flags_cover = chosen_prof.flags_cover_list[slot]
|
|
C.item_color = chosen_prof.item_color_list[slot]
|
|
C.item_state = chosen_prof.item_state_list[slot]
|
|
if(equip)
|
|
user.equip_to_slot_or_del(C, GLOB.slot2slot[slot])
|
|
|
|
user.regenerate_icons()
|