From 00ecd0f766fc6bff08d300b101fb2f51014a8af5 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Wed, 24 Sep 2025 15:59:37 +0300 Subject: [PATCH] antag definitions + servant background --- .../Antag/AntagSelectionSystem.API.cs | 2 +- Content.Server/Antag/AntagSelectionSystem.cs | 8 +-- .../Components/AntagSelectionComponent.cs | 6 ++ .../GameTicking/Rules/CP14LurkerHuntRule.cs | 65 ++++++++++++++++++- .../Components/CP14LurkerHuntRuleComponent.cs | 12 +++- .../CP14BackgroundMerkasServantComponent.cs | 8 +++ .../gameTicking/gameRules/blood-moon.ftl | 6 -- .../gameTicking/gameRules/lurker-hunt.ftl | 3 + Resources/Locale/en-US/_CP14/traits/trait.ftl | 7 +- .../gameTicking/gameRules/blood-moon.ftl | 6 -- .../gameTicking/gameRules/lurker-hunt.ftl | 3 + Resources/Locale/ru-RU/_CP14/traits/trait.ftl | 7 +- .../Entities/Markers/Spawners/ghost_roles.yml | 20 ++++++ .../_CP14/GameRules/subgamemodes.yml | 38 ++++++++++- .../Prototypes/_CP14/Traits/backgrounds.yml | 8 +++ .../Prototypes/_CP14/Traits/categories.yml | 2 +- .../Prototypes/_CP14/Traits/physical.yml | 12 ++-- 17 files changed, 181 insertions(+), 32 deletions(-) create mode 100644 Content.Shared/_CP14/Background/CP14BackgroundMerkasServantComponent.cs delete mode 100644 Resources/Locale/en-US/_CP14/gameTicking/gameRules/blood-moon.ftl create mode 100644 Resources/Locale/en-US/_CP14/gameTicking/gameRules/lurker-hunt.ftl delete mode 100644 Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/blood-moon.ftl create mode 100644 Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/lurker-hunt.ftl create mode 100644 Resources/Prototypes/_CP14/Traits/backgrounds.yml diff --git a/Content.Server/Antag/AntagSelectionSystem.API.cs b/Content.Server/Antag/AntagSelectionSystem.API.cs index 975c802eed..43ec5560b6 100644 --- a/Content.Server/Antag/AntagSelectionSystem.API.cs +++ b/Content.Server/Antag/AntagSelectionSystem.API.cs @@ -169,7 +169,7 @@ public sealed partial class AntagSelectionSystem return true; if (def.PrefRoles.Count == 0) - return false; + return true; //CP14 - If definition dont have PrefRoles, everyone can be this antag var pref = (HumanoidCharacterProfile) _pref.GetPreferences(session.UserId).SelectedCharacter; return pref.AntagPreferences.Any(p => def.PrefRoles.Contains(p)); diff --git a/Content.Server/Antag/AntagSelectionSystem.cs b/Content.Server/Antag/AntagSelectionSystem.cs index 7fdf812fbe..2ebd855dbd 100644 --- a/Content.Server/Antag/AntagSelectionSystem.cs +++ b/Content.Server/Antag/AntagSelectionSystem.cs @@ -393,7 +393,7 @@ public sealed partial class AntagSelectionSystem : GameRuleSystem [ByRefEvent] -public record struct AntagSelectEntityEvent(ICommonSession? Session, Entity GameRule) +public record struct AntagSelectEntityEvent(ICommonSession? Session, Entity GameRule, AntagSelectionDefinition? Def = null) //CP14 Definition added { public readonly ICommonSession? Session = Session; @@ -616,7 +616,7 @@ public record struct AntagSelectEntityEvent(ICommonSession? Session, Entity [ByRefEvent] -public record struct AntagSelectLocationEvent(ICommonSession? Session, Entity GameRule) +public record struct AntagSelectLocationEvent(ICommonSession? Session, Entity GameRule, AntagSelectionDefinition? Def = null) //CP14 Definition added { public readonly ICommonSession? Session = Session; diff --git a/Content.Server/Antag/Components/AntagSelectionComponent.cs b/Content.Server/Antag/Components/AntagSelectionComponent.cs index 71bc564c73..fc5622a947 100644 --- a/Content.Server/Antag/Components/AntagSelectionComponent.cs +++ b/Content.Server/Antag/Components/AntagSelectionComponent.cs @@ -73,6 +73,12 @@ public sealed partial class AntagSelectionComponent : Component [DataDefinition] public partial struct AntagSelectionDefinition() { + /// + /// CP14 - unique keys that allow you to separate logic in AfterAntagEntitySelectedEvent, depending on the key + /// + [DataField] + public string DefinitionKey = string.Empty; + /// /// A list of antagonist roles that are used for selecting which players will be antagonists. /// diff --git a/Content.Server/_CP14/GameTicking/Rules/CP14LurkerHuntRule.cs b/Content.Server/_CP14/GameTicking/Rules/CP14LurkerHuntRule.cs index c9a652ef38..a04ed00df9 100644 --- a/Content.Server/_CP14/GameTicking/Rules/CP14LurkerHuntRule.cs +++ b/Content.Server/_CP14/GameTicking/Rules/CP14LurkerHuntRule.cs @@ -1,23 +1,84 @@ using Content.Server._CP14.GameTicking.Rules.Components; +using Content.Server.Antag; using Content.Server.GameTicking.Rules; using Content.Shared.GameTicking.Components; +using Content.Shared.Objectives.Systems; +using Content.Shared.Players; namespace Content.Server._CP14.GameTicking.Rules; public sealed class CP14LurkerHuntRule : GameRuleSystem { + [Dependency] private readonly SharedObjectivesSystem _objectives = default!; + [Dependency] private readonly SharedTransformSystem _transform = default!; + + private const string LurkerDefinitionKey = "Lurker"; + private const string HunterDefinitionKey = "Hunter"; + private const string VictimDefinitionKey = "Victim"; + public override void Initialize() { base.Initialize(); + SubscribeLocalEvent(AfterRoleSelected); + SubscribeLocalEvent(OnAntagSelectLocation); + SubscribeLocalEvent(OnAntagSelectEntity); + } + + private void OnAntagSelectEntity(Entity ent, ref AntagSelectEntityEvent args) + { + if (args.Handled) + return; + + if (args.Def is null) + return; + + if (args.Def.Value.DefinitionKey == LurkerDefinitionKey) + { + args.Entity = Spawn(ent.Comp.LurkerProto); + } + } + + private void OnAntagSelectLocation(Entity ent, ref AntagSelectLocationEvent args) + { + if (args.Def is null) + return; + + //Spawn lurker on random position on the map + if (args.Def.Value.DefinitionKey == LurkerDefinitionKey && TryFindRandomTile(out _, out _, out _, out var coords)) + { + args.Coordinates.Add(_transform.ToMapCoordinates(coords)); + } + } + + private void AfterRoleSelected(Entity ent, ref AfterAntagEntitySelectedEvent args) + { + if (args.Session is null) + return; + + var mind = args.Session.GetMind(); + + if (mind is null) + return; + + switch (args.Def.DefinitionKey) + { + case LurkerDefinitionKey: + ent.Comp.Lurker = mind; + break; + case VictimDefinitionKey: + ent.Comp.Victims.Add(mind.Value); + break; + case HunterDefinitionKey: + ent.Comp.Hunters.Add(mind.Value); + break; + } } protected override void Added(EntityUid uid, CP14LurkerHuntRuleComponent component, GameRuleComponent gameRule, GameRuleAddedEvent args) { - - } protected override void Started(EntityUid uid, diff --git a/Content.Server/_CP14/GameTicking/Rules/Components/CP14LurkerHuntRuleComponent.cs b/Content.Server/_CP14/GameTicking/Rules/Components/CP14LurkerHuntRuleComponent.cs index 807749ba15..a73724c074 100644 --- a/Content.Server/_CP14/GameTicking/Rules/Components/CP14LurkerHuntRuleComponent.cs +++ b/Content.Server/_CP14/GameTicking/Rules/Components/CP14LurkerHuntRuleComponent.cs @@ -1,4 +1,3 @@ -using Content.Shared._CP14.Procedural.Prototypes; using Robust.Shared.Prototypes; namespace Content.Server._CP14.GameTicking.Rules.Components; @@ -6,4 +5,15 @@ namespace Content.Server._CP14.GameTicking.Rules.Components; [RegisterComponent, Access(typeof(CP14LurkerHuntRule))] public sealed partial class CP14LurkerHuntRuleComponent : Component { + [DataField] + public EntProtoId LurkerProto = "CP14MobLurker"; + + [DataField] + public EntityUid? Lurker; + + [DataField] + public HashSet Hunters = new(); + + [DataField] + public HashSet Victims = new(); } diff --git a/Content.Shared/_CP14/Background/CP14BackgroundMerkasServantComponent.cs b/Content.Shared/_CP14/Background/CP14BackgroundMerkasServantComponent.cs new file mode 100644 index 0000000000..b9eed04ab0 --- /dev/null +++ b/Content.Shared/_CP14/Background/CP14BackgroundMerkasServantComponent.cs @@ -0,0 +1,8 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared._CP14.Background; + +[RegisterComponent, NetworkedComponent] +public sealed partial class CP14BackgroundMerkasServantComponent : Component +{ +} diff --git a/Resources/Locale/en-US/_CP14/gameTicking/gameRules/blood-moon.ftl b/Resources/Locale/en-US/_CP14/gameTicking/gameRules/blood-moon.ftl deleted file mode 100644 index 30683c7f6a..0000000000 --- a/Resources/Locale/en-US/_CP14/gameTicking/gameRules/blood-moon.ftl +++ /dev/null @@ -1,6 +0,0 @@ -cp14-bloodmoon-raising = The moon in the sky is stained with blood. The next night will be terrible. -cp14-bloodmoon-start = The blood moon shines in full force, enslaving minds. -cp14-bloodmoon-end = The blood moon sets over the horizon, losing its power. - -cp14-bloodmoon-curse-removed = The curse of the blood moon is dispelled. -cp14-bloodmoon-curse-examined = [color=red]The aura of the blood moon hovers around this creature. Be careful, for his mind is unstable.[/color] \ No newline at end of file diff --git a/Resources/Locale/en-US/_CP14/gameTicking/gameRules/lurker-hunt.ftl b/Resources/Locale/en-US/_CP14/gameTicking/gameRules/lurker-hunt.ftl new file mode 100644 index 0000000000..97bd7706a5 --- /dev/null +++ b/Resources/Locale/en-US/_CP14/gameTicking/gameRules/lurker-hunt.ftl @@ -0,0 +1,3 @@ +cp14-lurker-briefing = In the past, you made a pact with Darkness for power and influence. Now it demands its payment. You must reap the harvest from those chosen by Lady Darkness. Use your Lurker form, to turn pitiful mortals into obedient servants of darkness. +cp14-lurker-victim-briefing = Shadows gather around you. Whispers call your name in the darkness. Dark entities are out hunting, and you are their prey. What has attracted their attention, that Darkness itself reaches out to embrace you? +cp14-lurker-hunter-briefing = Your duty as a servant of Merkas has brought you to these lands, where Darkness has set its sights on mortals. Protect the people by destroying the cursed creatures lurking in the darkness. \ No newline at end of file diff --git a/Resources/Locale/en-US/_CP14/traits/trait.ftl b/Resources/Locale/en-US/_CP14/traits/trait.ftl index 7fcce81f99..d783c3f965 100644 --- a/Resources/Locale/en-US/_CP14/traits/trait.ftl +++ b/Resources/Locale/en-US/_CP14/traits/trait.ftl @@ -21,4 +21,9 @@ cp14-trait-snoring-name = Loud snoring cp14-trait-snoring-desc = It is simply impossible to sleep next to you because you snore terribly loudly at everything. cp14-trait-mana-wasting-name = Magical mediocrity. -cp14-trait-mana-wasting-desc = Fate has decreed that magic is just an empty sound for you. You are unable to store or use magical energy. \ No newline at end of file +cp14-trait-mana-wasting-desc = Fate has decreed that magic is just an empty sound for you. You are unable to store or use magical energy. + +# Backgrounds + +cp14-trait-bg-merkas-servant-name = Servant of the Light Merkas +cp14-trait-bg-merkas-servant-desc = Your past is closely tied to serving Merkas, the god of light, and his dogma is still strong in your mind. You feel compelled to help those in need, banish darkness, and bring light to the hearts of those around you. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/blood-moon.ftl b/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/blood-moon.ftl deleted file mode 100644 index 8a1f4268b6..0000000000 --- a/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/blood-moon.ftl +++ /dev/null @@ -1,6 +0,0 @@ -cp14-bloodmoon-raising = Луна на небосводе обагривается кровью. Следующая ночь будет ужасной. -cp14-bloodmoon-start = Кровавая луна сияет в полную силу, порабощая разумы. -cp14-bloodmoon-end = Кровавая луна заходит за горизонт, теряя свою силу. - -cp14-bloodmoon-curse-removed = Проклятье кровавой луны развеивается. -cp14-bloodmoon-curse-examined = [color=red]Аура кровавой луны витает вокруг этого существа. Будьте осторожны, ибо его разум нестабилен.[/color] \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/lurker-hunt.ftl b/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/lurker-hunt.ftl new file mode 100644 index 0000000000..ac892a4c2e --- /dev/null +++ b/Resources/Locale/ru-RU/_CP14/gameTicking/gameRules/lurker-hunt.ftl @@ -0,0 +1,3 @@ +cp14-lurker-briefing = прошлом вы заключили контракт с Тьмой ради силы и власти. Теперь она требует свою плату. Вы должны собрать жатву с тех, кого укажет госпожа Тьма. Используйте свой теневой облик Таящегося, чтобы обратить жалких смертных в покорных слуг тьмы. +cp14-lurker-victim-briefing = Тени сгущаются рядом с вами. В темноте слышны шепоты, зовущие по имени. Темные сущности выходят на охоту, и их цель — вы. Чем вы привлекли их внимание, что сама Тьма протягивает к вам свои объятия? +cp14-lurker-hunter-briefing = Ваш долг служителя Меркаса привел вас в эти земли, где Тьма устроила свою охоту на смертных. Защитите людей, уничтожив проклятых созданий, таящихся во мраке. \ No newline at end of file diff --git a/Resources/Locale/ru-RU/_CP14/traits/trait.ftl b/Resources/Locale/ru-RU/_CP14/traits/trait.ftl index dd583c7634..9e492888d2 100644 --- a/Resources/Locale/ru-RU/_CP14/traits/trait.ftl +++ b/Resources/Locale/ru-RU/_CP14/traits/trait.ftl @@ -21,4 +21,9 @@ cp14-trait-snoring-name = Громкий храп cp14-trait-snoring-desc = Спать рядом с вами просто невозможно, потому что во все вы жутко громко храпите. cp14-trait-mana-wasting-name = Магическая бездарность -cp14-trait-mana-wasting-desc = Судьба распорядилась так, что магия для вас - лишь пустой звук. Вы не способны ни накапливать, ни использовать магическую энергию. \ No newline at end of file +cp14-trait-mana-wasting-desc = Судьба распорядилась так, что магия для вас - лишь пустой звук. Вы не способны ни накапливать, ни использовать магическую энергию. + +# Backgrounds + +cp14-trait-bg-merkas-servant-name = Служитель светлого Меркаса +cp14-trait-bg-merkas-servant-desc = Ваше прошлое тесно связано с служением Меркасу - богу света, и его догмы все еще сильны в вашем сознании. Вы считаете себя должным помогать нуждающимся, изгонять тьму и нести свет в сердца окружающих. \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Markers/Spawners/ghost_roles.yml b/Resources/Prototypes/_CP14/Entities/Markers/Spawners/ghost_roles.yml index f6547e1411..d2613a789e 100644 --- a/Resources/Prototypes/_CP14/Entities/Markers/Spawners/ghost_roles.yml +++ b/Resources/Prototypes/_CP14/Entities/Markers/Spawners/ghost_roles.yml @@ -21,3 +21,23 @@ - state: green - sprite: _CP14/Mobs/Pets/rat.rsi state: rat + +- type: entity + categories: [ HideSpawnMenu, Spawner ] + parent: BaseAntagSpawner + id: CP14SpawnPointLurker + components: + - type: GhostRole + name: cp14-ghost-role-information-name-lurker + description: cp14-ghost-role-information-description-lurker + rules: cp14-ghost-role-information-rules-demiplane #TODO + mindRoles: + - CP14MindRoleDemiplaneAntag + raffle: + settings: default + - type: Sprite + sprite: Markers/jobs.rsi + layers: + - state: green + - sprite: _CP14/Mobs/Monster/lurker.rsi + state: live \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/GameRules/subgamemodes.yml b/Resources/Prototypes/_CP14/GameRules/subgamemodes.yml index a4fef3b28e..18ea5860dc 100644 --- a/Resources/Prototypes/_CP14/GameRules/subgamemodes.yml +++ b/Resources/Prototypes/_CP14/GameRules/subgamemodes.yml @@ -5,6 +5,38 @@ - type: CP14StationAdditionalModifierRule modifiers: - Geodes - - Geodes - - Geodes - - Geodes \ No newline at end of file + - type: CP14LurkerHuntRule + - type: GameRule + minPlayers: 7 + - type: AntagSelection + selectionTime: PrePlayerSpawn + definitions: + - definitionKey: Lurker + spawnerPrototype: CP14SpawnPointLurker + min: 1 + max: 1 + blacklist: + components: + - CP14BackgroundMerkasServant + briefing: + text: cp14-lurker-briefing + - definitionKey: Victim + lateJoinAdditional: true + min: 1 + max: 3 + playerRatio: 3 + blacklist: + components: + - CP14BackgroundMerkasServant + briefing: + text: cp14-lurker-victim-briefing + - definitionKey: Hunter + lateJoinAdditional: true + min: 1 + max: 3 + playerRatio: 3 + whitelist: + components: + - CP14BackgroundMerkasServant + briefing: + text: cp14-lurker-hunter-briefing \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Traits/backgrounds.yml b/Resources/Prototypes/_CP14/Traits/backgrounds.yml new file mode 100644 index 0000000000..7f6e5be265 --- /dev/null +++ b/Resources/Prototypes/_CP14/Traits/backgrounds.yml @@ -0,0 +1,8 @@ +- type: trait + id: CP14BackgroundMerkasServant + name: cp14-trait-bg-merkas-servant-name + description: cp14-trait-bg-merkas-servant-desc + category: CP14Background + cost: 1 + components: + - type: CP14BackgroundMerkasServant \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Traits/categories.yml b/Resources/Prototypes/_CP14/Traits/categories.yml index 36d92aa6b4..2d36a5f39e 100644 --- a/Resources/Prototypes/_CP14/Traits/categories.yml +++ b/Resources/Prototypes/_CP14/Traits/categories.yml @@ -1,7 +1,7 @@ - type: traitCategory id: CP14PhysicalTraits name: cp14-trait-category-physical - maxTraitPoints: 1 + maxTraitPoints: 2 - type: traitCategory id: CP14Background diff --git a/Resources/Prototypes/_CP14/Traits/physical.yml b/Resources/Prototypes/_CP14/Traits/physical.yml index 181c794a5f..dc9e45e349 100644 --- a/Resources/Prototypes/_CP14/Traits/physical.yml +++ b/Resources/Prototypes/_CP14/Traits/physical.yml @@ -6,7 +6,7 @@ description: cp14-trait-blindness-desc #traitGear: WhiteCane category: CP14PhysicalTraits - cost: -2 + cost: 2 whitelist: components: - Blindable @@ -18,7 +18,7 @@ name: cp14-trait-mana-wasting-name description: cp14-trait-mana-wasting-desc category: CP14PhysicalTraits - cost: -2 + cost: 2 whitelist: components: - CP14MagicEnergyContainer @@ -38,7 +38,7 @@ description: cp14-trait-poor-vision-desc #traitGear: ClothingEyesGlasses category: CP14PhysicalTraits - cost: -1 + cost: 1 whitelist: components: - Blindable @@ -51,7 +51,7 @@ name: cp14-trait-narcolepsy-name description: cp14-trait-narcolepsy-desc category: CP14PhysicalTraits - cost: -1 + cost: 1 components: - type: Narcolepsy timeBetweenIncidents: 300, 600 @@ -61,7 +61,7 @@ id: CP14Muted name: cp14-trait-muted-name description: cp14-trait-muted-desc - cost: -1 + cost: 1 category: CP14PhysicalTraits components: - type: Muted @@ -70,7 +70,7 @@ id: CP14PainNumbness name: trait-painnumbness-name description: trait-painnumbness-desc - cost: -1 + cost: 1 category: CP14PhysicalTraits components: - type: PainNumbness