Skip to content

Commit

Permalink
feat: add antag-mix gamemode. Add blood brothers (ss220club#840)
Browse files Browse the repository at this point in the history
## Что этот PR делает

Добавляем новый режим `Antag Mix`, который позволяет совмешать без
лишних проблем разных антагонистов раундстартом.
Так же добавлены `Antag Scenarios`, которые собственно и представляют
отдельных антагонистов в `Antag-Mix`.
Поправлены баги, которые я так же поправлю на оффах, и лично решу мерж
конлфликт, как он возникнет.
Так же, особенностью этого режима есть то, что раунд всегда будет
заполнен антагонистами, если они есть.
Допустим, что есть `changeling` и `traitor`. Если у всех игроков
отключен `changeling`, то в раунд смогут попасть только `traitor` и
займут все доступные слоты, и наоборот. Если будут включены и те, и те -
выбор будет происходит из тех и других, беря во внимание `weight`
сценариев.

Так же добавлен новый антагонист `Blood Brothers`, из-за которого,
собственно, и возникла причина добавить режим `Antag Mix`, потому что
создавать комбинации режимов для каждого антагониста - это за гранью
моих сил :clueless:

Отдельное спасибо @dj-34 за созданную им композицию для антаг интро
(музыка при получении роли)

## Почему это хорошо для игры

Больше контроля за раундстарт антагонистами, достаточно гибкая настройка
каждого антаг сценария.
Новый Кооп антагонист - Blood Brothers. О нём вы сможете прочитать
детальнее на [вики](https://wiki.ss220.club/index.php/Blood_Brothers), а
короткая сводка выводится при старте игры за этого антагониста.

## Изображения изменений
Всё в коде.

## Тестирование
<!-- Как вы тестировали свой PR, если делали это вовсе? -->

## Changelog

:cl:
add: Добавлен антагонист `Blood Brothers`. Включать, как обычно, в
префах
add: Режим `Antag Mix`, который позволяет раундстартом вводить в раунд
разных антагонистов. Пока миксуются только трейторы, генокрады, вампиры
и новые `Братья по крови`
/:cl:

---------

Co-authored-by: Volodymir Ohorodnytskyi <[email protected]>
  • Loading branch information
Gaxeer and Legendaxe authored Dec 15, 2023
1 parent e23d949 commit 34c7161
Show file tree
Hide file tree
Showing 22 changed files with 1,292 additions and 26 deletions.
12 changes: 0 additions & 12 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
var/miming = 0 // Mime's vow of silence
/// A list of all the antagonist datums that the player is (does not include undatumized antags)
var/list/antag_datums
/// A lazy list of all teams the player is part of but doesnt have an antag role for, (i.e. a custom admin team)
var/list/teams

var/antag_hud_icon_state = null //this mind's ANTAG_HUD should have this icon_state
var/datum/atom_hud/antag/antag_hud = null //this mind's antag HUD
Expand Down Expand Up @@ -226,11 +224,6 @@
for(var/datum/antagonist/A as anything in antag_datums)
if(A.has_antag_objectives(include_team)) // this checks teams also
return TRUE
// For custom non-antag role teams
if(include_team && LAZYLEN(teams))
for(var/datum/team/team as anything in teams)
if(team.objective_holder.has_objectives())
return TRUE
return FALSE

/**
Expand All @@ -248,11 +241,6 @@
if(team) // have to make asure a team exists here, team?. does not work below because it will add the null to the list
all_objectives += team.objective_holder.get_objectives() // Get all of their teams' objectives

// For custom non-antag role teams
if(include_team && LAZYLEN(teams))
for(var/datum/team/team as anything in teams)
all_objectives += team.objective_holder.get_objectives()

return all_objectives

/**
Expand Down
12 changes: 8 additions & 4 deletions code/modules/antagonists/_common/antag_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,16 @@ GLOBAL_LIST_EMPTY(antagonists)
*/
/datum/antagonist/proc/remove_innate_effects(mob/living/mob_override)
SHOULD_CALL_PARENT(TRUE)
var/mob/living/L = mob_override || owner.current

var/mob/living/remove_effects_from = mob_override || owner?.current
if(!remove_effects_from)
return

if(antag_hud_type && antag_hud_name)
remove_antag_hud(L)
remove_antag_hud(remove_effects_from)
// If `mob_override` exists it means we're only transferring this datum, we don't need to show the clown any text.
handle_clown_mutation(L, mob_override ? null : clown_removal_text)
return L
handle_clown_mutation(remove_effects_from, mob_override ? null : clown_removal_text)
return remove_effects_from

/**
* Adds this datum's antag hud to `antag_mob`.
Expand Down
20 changes: 10 additions & 10 deletions code/modules/antagonists/_common/antag_team.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ GLOBAL_LIST_EMPTY(antagonist_teams)
/// The name to save objective successes under in the blackboxes. Saves nothing if blank.
var/blackbox_save_name

/datum/team/New(list/starting_members)
/datum/team/New(list/starting_members, add_antag_datum = TRUE)
..()
members = list()
objective_holder = new(src)

if(starting_members && !islist(starting_members))
starting_members = list(starting_members)
for(var/datum/mind/M as anything in starting_members)
add_member(M)
add_member(M, add_antag_datum)
GLOB.antagonist_teams += src

/datum/team/Destroy(force = FALSE, ...)
Expand All @@ -42,20 +43,22 @@ GLOBAL_LIST_EMPTY(antagonist_teams)
*
* Generally this should ONLY be called by `add_antag_datum()` to ensure proper order of operations.
*/
/datum/team/proc/add_member(datum/mind/new_member)
/datum/team/proc/add_member(datum/mind/new_member, add_antag_datum = TRUE)
SHOULD_CALL_PARENT(TRUE)
var/datum/antagonist/antag = get_antag_datum_from_member(new_member) // make sure they have the antag datum
members |= new_member
if(!antag) // this team has no antag role, we'll add it directly to their mind team
LAZYDISTINCTADD(new_member.teams, src)

if(add_antag_datum && antag_datum_type)
var/datum/antagonist/antag = get_antag_datum_from_member(new_member) // make sure they have the antag datum
// If no matching antag datum was found, give them one.
if(!antag)
return new_member.add_antag_datum(antag_datum_type, src)

/**
* Removes `member` from this team.
*/
/datum/team/proc/remove_member(datum/mind/member)
SHOULD_CALL_PARENT(TRUE)
members -= member
LAZYREMOVE(member.teams, src)
var/datum/antagonist/antag = get_antag_datum_from_member(member)
if(!QDELETED(antag))
qdel(antag)
Expand Down Expand Up @@ -103,9 +106,6 @@ GLOBAL_LIST_EMPTY(antagonist_teams)
if(A.get_team() != src)
continue
return A
// If no matching antag datum was found, give them one.
if(antag_datum_type)
return member.add_antag_datum(antag_datum_type, src)

/**
* Special overrides for teams for target exclusion from objectives.
Expand Down
141 changes: 141 additions & 0 deletions config/example/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# SS220 CONFIGS
# - gateway_configuration
# - tts_configuration
# - antag_mix_gamemode_configuration

################################################################

Expand Down Expand Up @@ -247,6 +248,7 @@ gamemode_probabilities = [
{gamemode = "vampire", probability = 3},
{gamemode = "wizard", probability = 2},
{gamemode = "trifecta", probability = 3},
{gamemode = "antag_mix", probability = 3},
]
# Do we want the amount of traitors to scale with population?
traitor_scaling = true
Expand Down Expand Up @@ -901,3 +903,142 @@ force_discord_verification = false
species_whitelist_enabled = false

################################################################


[antag_mix_gamemode_configuration]
# This section contains all settings related to antag_mix gamemode

# Budged multiplier of antag_mix gamemode.
# Which controlls how basic budget is multiplied, values less than 1 result in less antag budget
budget_multiplier = 1
# Max fraction of antags relative to ready players. Value between 0 and 1
max_antag_fraction = 1
# Configuration of antag scenarios
# Must be list of objects with next params:
# - [tag] required param which identifies the antag scenarios
# - [params] antag scenario specific params
#
# Valid scenario params are:
# - [cost] optional param, which defines how much of `antag_mix` budget will be spent on it
# - [weight] optional param, which defines how often this scenario will be picked, related to others
# - [antag_cap] optional param, which defines how many players can be picked for this scenario at most
# - [candidates_required] optional param, which defines how many players must be picked for this scenario at least
# - [restricted_roles] optional param, which defines which roles are restricted from becoming candidate for this scenario.
# Must be list of strings
# - [protected_roles] optional param, which defines which roles are protected from becoming candidate for this scenario.
# Must be list of strings
# - [restricted_species] optional param, which defines which species are restricted from becoming candidate for this scenario.
# Must be list of strings
# Team antag specific:
# - [team_size] optional param, which defines how much of players must be present in one team. Must equal or lower than antag_cap,
# or otherwise scenario won't be rolled
[[antag_mix_gamemode_configuration.antag_scenarios_configuration]]
tag = "traitor"

[antag_mix_gamemode_configuration.antag_scenarios_configuration.params]
"required_players" = 1
"cost" = 1
"weight" = 1
"antag_cap" = 1
"candidates_required" = 1
"restricted_roles" = ["Cyborg"]
"protected_roles" = [
"Security Cadet",
"Security Officer",
"Warden",
"Detective",
"Head of Security",
"Captain",
"Blueshield",
"Nanotrasen Representative",
"Magistrate",
"Internal Affairs Agent",
"Nanotrasen Navy Officer",
"Special Operations Officer",
"Syndicate Officer",
"Solar Federation General",
]

[[antag_mix_gamemode_configuration.antag_scenarios_configuration]]
tag = "changeling"

[antag_mix_gamemode_configuration.antag_scenarios_configuration.params]
"required_players" = 1
"cost" = 1
"weight" = 1
"antag_cap" = 1
"candidates_required" = 1
"restricted_roles" = ["Cyborg", "AI"]
"protected_roles" = [
"Security Cadet",
"Security Officer",
"Warden",
"Detective",
"Head of Security",
"Captain",
"Blueshield",
"Nanotrasen Representative",
"Magistrate",
"Internal Affairs Agent",
"Nanotrasen Navy Officer",
"Special Operations Officer",
"Solar Federation General",
]
"restricted_species" = ["Machine"]

[[antag_mix_gamemode_configuration.antag_scenarios_configuration]]
tag = "vampire"

[antag_mix_gamemode_configuration.antag_scenarios_configuration.params]
"required_players" = 1
"cost" = 1
"weight" = 1
"antag_cap" = 1
"candidates_required" = 1
"restricted_roles" = ["Cyborg", "AI", "Chaplain"]
"protected_roles" = [
"Security Cadet",
"Security Officer",
"Warden",
"Detective",
"Head of Security",
"Captain",
"Blueshield",
"Nanotrasen Representative",
"Magistrate",
"Internal Affairs Agent",
"Nanotrasen Navy Officer",
"Special Operations Officer",
"Solar Federation General",
]
"restricted_species" = ["Machine"]

[[antag_mix_gamemode_configuration.antag_scenarios_configuration]]
tag = "blood_brothers"

[antag_mix_gamemode_configuration.antag_scenarios_configuration.params]
"required_players" = 1
"cost" = 1
"weight" = 1
"antag_cap" = 1
"team_size" = 1
"candidates_required" = 1
"restricted_roles" = ["Cyborg", "AI"]
"protected_roles" = [
"Security Cadet",
"Security Officer",
"Warden",
"Detective",
"Head of Security",
"Captain",
"Blueshield",
"Nanotrasen Representative",
"Magistrate",
"Internal Affairs Agent",
"Nanotrasen Navy Officer",
"Special Operations Officer",
"Solar Federation General",
]


################################################################
Binary file modified icons/mob/hud/antaghud.dmi
Binary file not shown.
3 changes: 3 additions & 0 deletions modular_ss220/_defines220/_defines220.dme
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "code/signals_obj.dm"
#include "code/cult_defines_ss220.dm"
#include "code/hud_ss220.dm"
#include "code/atom_hud.dm"
#include "code/gamemode.dm"
#include "code/role_preferences.dm"
#include "code/layers_ss220.dm"
#include "code/signals_atom.dm"
#include "code/jobs_defines.dm"
Expand Down
1 change: 1 addition & 0 deletions modular_ss220/_defines220/code/atom_hud.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define ANTAG_HUD_BLOOD_BROTHER 21
1 change: 1 addition & 0 deletions modular_ss220/_defines220/code/gamemode.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define SPECIAL_ROLE_BLOOD_BROTHER "Blood Brother"
1 change: 1 addition & 0 deletions modular_ss220/_defines220/code/role_preferences.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define ROLE_BLOOD_BROTHER "blood brother"
8 changes: 8 additions & 0 deletions modular_ss220/antagonists/_antagonists.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/datum/modpack/antagonists
name = "Антагонисты и режимы"
desc = "Добавляет новые режимы и антагонистов."
author = "Gaxeer, dj-34"

/datum/modpack/antagonists/initialize()
GLOB.special_roles |= ROLE_BLOOD_BROTHER
GLOB.huds += new/datum/atom_hud/antag/hidden()
10 changes: 10 additions & 0 deletions modular_ss220/antagonists/_antagonists.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "_antagonists.dm"

#include "code/antag_mix/scenarios/antag_scenario.dm"
#include "code/antag_mix/scenarios/antag_team_scenario.dm"
#include "code/antag_mix/scenarios/minor_scenarios.dm"
#include "code/configuration/antag_mix_configuration.dm"
#include "code/blood_brothers/blood_brothers_datum.dm"
#include "code/blood_brothers/blood_brothers_team.dm"
#include "code/mind/memory_edit.dm"
#include "code/antag_mix/antag_mix.dm"
Loading

0 comments on commit 34c7161

Please sign in to comment.