Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antag mix Whitelist #1710

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ tag = "mindflayer"
"Special Operations Officer",
"Solar Federation General",
]
possible_species = ["Machine"]
"allowed_species" = ["Machine"]

[[antag_mix_gamemode_configuration.antag_scenarios_configuration]]
tag = "vox_raiders"
Expand Down
26 changes: 14 additions & 12 deletions modular_ss220/antagonists/code/antag_datum.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/datum/antagonist/proc/make_body(loc_spawn, datum/mind/mind, try_use_preference = FALSE, species_name = null, list/possible_species)
/datum/antagonist/proc/make_body(loc_spawn, datum/mind/mind, try_use_preference = FALSE, species_name = null, list/species_pool)
var/datum/character_save/character
var/mob/living/carbon/human/H = mind.current
if(!H)
Expand All @@ -8,18 +8,20 @@

var/client/client = mind.current.client
if(try_use_preference && client && client.prefs && length(client.prefs.character_saves))
var/temp_species_name = species_name
if(!temp_species_name)
if(length(possible_species))
temp_species_name = pick(possible_species)
else
temp_species_name = "Human"
var/list/species_pool_to_use
if(species_name)
species_pool_to_use.Add(species_name)
else
species_pool_to_use = species_pool

var/list/eligible_characters
for(var/datum/character_save/temp_character in client.prefs.character_saves)
if(temp_character.species == temp_species_name)
character = temp_character
species_name = temp_species_name
new_name = random_name(character.gender, character.species)
break
for(var/temp_species_name in species_pool_to_use)
if(temp_character.species == temp_species_name)
eligible_characters.Add(temp_character)

if(eligible_characters.len > 0)
character = pick(eligible_characters)

if(!character)
// Randomize appearance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
var/list/protected_roles = list()
/// Species that can't be chosen for the scenario
var/list/restricted_species = list()
/// Only species that can be chosen for the scenario, null - for all
var/list/allowed_species = null
Comment on lines +40 to +41
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такое я имел в виду

Suggested change
/// Only species that can be chosen for the scenario, null - for all
var/list/allowed_species = null
/// Only species that can be chosen for the scenario. Consider empty list as no restriction.
var/list/allowed_species = list()

/// List of available candidates for this scenario
var/list/mob/new_player/candidates = list()
/// List of players that were drafted to be antagonists of this scenario
Expand All @@ -46,12 +48,12 @@
var/is_crew_antag = TRUE
/// Spawn antagonist at landmark name
var/obj/effect/landmark/spawner/landmark_type = /obj/effect/landmark/spawner/xeno
/// What species can be used for the antagonist
var/list/possible_species = list("Human")
/// Recommended species at prefs to increase the chance of getting a role for RP-experienced players
/// What species can be used to create antagonist
var/list/species_pool = null
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Избавляемся везде от null для упрощения проверок

Suggested change
var/list/species_pool = null
var/list/species_pool = list()

// Recommended species at prefs to increase the chance of getting a role for RP-experienced players
// For example list("Vox" = 8) modifier that increases the chance of landing by 8 times
var/list/recommended_species_active_pref
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var/list/recommended_species_active_pref
var/list/recommended_species_active_pref = list()

/// Multiplication modifier that increases the chance of landing by N times
var/recommended_species_mod = 0

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


/datum/antag_scenario/New()
if(abstract)
Expand Down Expand Up @@ -176,6 +178,7 @@
for(var/mob/new_player/candidate as anything in candidates)
var/client/candidate_client = candidate.client
var/datum/mind/candidate_mind = candidate.mind
var/my_specie = candidate_client.prefs.active_character.species
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var/my_specie = candidate_client.prefs.active_character.species
var/candidate_species = candidate_client.prefs.active_character.species

if(!candidate_client || !candidate_mind || !candidate.ready)
candidates.Remove(candidate)
continue
Expand All @@ -196,7 +199,11 @@
candidates.Remove(candidate)
continue

if(!(antag_role in candidate.client.prefs.be_special) || (candidate.client.prefs.active_character.species in restricted_species))
if(!(antag_role in candidate_client.prefs.be_special) || (my_specie in restricted_species))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(!(antag_role in candidate_client.prefs.be_special) || (my_specie in restricted_species))
if(!(antag_role in candidate_client.prefs.be_special) || (candidate_species in restricted_species))

candidates.Remove(candidate)
continue

if(!((isnull(allowed_species)) || (my_specie in allowed_species)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(!((isnull(allowed_species)) || (my_specie in allowed_species)))
if(allowed_species && !(candidate_species in allowed_species))

candidates.Remove(candidate)
continue

Expand Down Expand Up @@ -241,9 +248,9 @@
* Сreate characters if the antagonist is not from the crew.
*/
/datum/antag_scenario/proc/make_character(datum/mind/mind, turf/loc_spawn)
var/picked_species = pick(possible_species)
var/picked_species = pick(species_pool)
var/datum/antagonist/temp_antag_datum = locate(antag_datum) in mind.antag_datums
temp_antag_datum.make_body(loc_spawn, mind, TRUE, picked_species, possible_species)
temp_antag_datum.make_body(loc_spawn, mind, TRUE, picked_species, species_pool)

/datum/antag_scenario/proc/equip_character(datum/mind/mind)
return TRUE
Expand All @@ -254,16 +261,13 @@
if(!length(candidates))
return

if(!recommended_species_mod)
return

if(!length(recommended_species_active_pref))
return

for(var/mob/new_player/candidate in candidates)
var/list/datum/character_save/characters = candidate.client.prefs.character_saves
for(var/datum/character_save/character in characters)
if(character.species in recommended_species_active_pref)
candidates[candidate] = recommended_species_mod
candidates[candidate] = recommended_species_active_pref[character.species]
else
candidates[candidate] = 1
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

is_crew_antag = FALSE
landmark_type = /obj/effect/landmark/spawner/vox_raider
possible_species = list("Vox")
recommended_species_active_pref = list("Vox")
recommended_species_mod = 8
species_pool = list("Vox")
recommended_species_active_pref = list("Vox" = 8)


/datum/antag_scenario/team/vox_raiders/equip_character(datum/mind/mind)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@
"Special Operations Officer",
"Syndicate Officer",
"Solar Federation General")
possible_species = list("Machine")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

allowed_species = list("Machine")

/datum/antag_scenario/team/blood_brothers
name = "Blood Brothers"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@
if(mind.current)
H.equipOutfit(/datum/outfit/vox, visualsOnly)

/datum/antagonist/vox_raider/make_body(spawn_loc, datum/mind/mind, try_use_preference = FALSE, species_name = null, list/possible_species)
/datum/antagonist/vox_raider/make_body(spawn_loc, datum/mind/mind, try_use_preference = FALSE, species_name = null, list/species_pool)
. = ..()
mind.store_memory("<B> Я Вокс-Рейдер, основа моя: беречь стаю, тащить ценности. </B>.")
Loading