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

mini update #979

Merged
merged 1 commit into from
Dec 13, 2024
Merged
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
10 changes: 10 additions & 0 deletions Content.Client/Backmen/FootPrint/FootPrintsVisualizerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Shared.Backmen.FootPrint;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.GameStates;
using Robust.Shared.Random;
using Robust.Shared.Utility;

Expand All @@ -17,6 +18,15 @@ public override void Initialize()

SubscribeLocalEvent<FootPrintComponent, ComponentInit>(OnInitialized);
SubscribeLocalEvent<FootPrintComponent, ComponentShutdown>(OnShutdown);
SubscribeLocalEvent<FootPrintComponent, ComponentHandleState>(OnHandleState);
}

private void OnHandleState(Entity<FootPrintComponent> ent, ref ComponentHandleState args)
{
if (args.Current is not FootPrintState state || !TryGetEntity(state.PrintOwner, out var entity))
return;

ent.Comp.PrintOwner = entity.Value;
}

private void OnInitialized(EntityUid uid, FootPrintComponent comp, ComponentInit args)
Expand Down
11 changes: 9 additions & 2 deletions Content.Server/Backmen/FootPrint/FootPrintsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Gravity;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
using Robust.Shared.Random;

Expand Down Expand Up @@ -39,9 +40,15 @@ public override void Initialize()

SubscribeLocalEvent<FootPrintsComponent, ComponentStartup>(OnStartupComponent);
SubscribeLocalEvent<FootPrintsComponent, MoveEvent>(OnMove);
SubscribeLocalEvent<FootPrintComponent, ComponentGetState>(OnGetState);
}

private void OnStartupComponent(EntityUid uid, FootPrintsComponent comp, ComponentStartup args)
private void OnGetState(Entity<FootPrintComponent> ent, ref ComponentGetState args)
{
args.State = new FootPrintState(TerminatingOrDeleted(ent.Comp.PrintOwner) ? NetEntity.Invalid : GetNetEntity(ent.Comp.PrintOwner));
}

private void OnStartupComponent(EntityUid uid, FootPrintsComponent comp, ComponentStartup args)
{
comp.StepSize += _random.NextFloat(-0.05f, 0.05f);
}
Expand All @@ -52,7 +59,7 @@ private void OnMove(EntityUid uid, FootPrintsComponent comp, ref MoveEvent args)
if (comp.PrintsColor.A <= 0f)
return;

if (!_transformQuery.TryComp(uid, out var transform))
if (TerminatingOrDeleted(uid) || !_transformQuery.TryComp(uid, out var transform))
return;

if (_gravity.IsWeightless(uid, xform: transform))
Expand Down
19 changes: 14 additions & 5 deletions Content.Server/Backmen/FootPrint/PuddleFootPrintsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,28 @@ public sealed class PuddleFootPrintsSystem : EntitySystem
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
private EntityQuery<AppearanceComponent> _appearanceQuery;
private EntityQuery<PuddleComponent> _puddleQuery;
private EntityQuery<FootPrintsComponent> _footPrintsQuery;
private EntityQuery<SolutionContainerManagerComponent> _solutionContainerManageQuery;

public override void Initialize()
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<PuddleFootPrintsComponent, EndCollideEvent>(OnStepTrigger);

_appearanceQuery = GetEntityQuery<AppearanceComponent>();
_puddleQuery = GetEntityQuery<PuddleComponent>();
_footPrintsQuery = GetEntityQuery<FootPrintsComponent>();
_solutionContainerManageQuery = GetEntityQuery<SolutionContainerManagerComponent>();
}

private void OnStepTrigger(EntityUid uid, PuddleFootPrintsComponent comp, ref EndCollideEvent args)
{
if (!TryComp<AppearanceComponent>(uid, out var appearance) ||
!TryComp<PuddleComponent>(uid, out var puddle) ||
!TryComp<FootPrintsComponent>(args.OtherEntity, out var tripper) ||
!TryComp<SolutionContainerManagerComponent>(uid, out var solutionManager))
if (!_appearanceQuery.TryComp(uid, out var appearance) ||
!_puddleQuery.TryComp(uid, out var puddle) ||
!_footPrintsQuery.TryComp(args.OtherEntity, out var tripper) ||
!_solutionContainerManageQuery.TryComp(uid, out var solutionManager))
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Content.Server.Backmen.Xeno.Components;

[RegisterComponent]
public sealed partial class XenoAgentComponent : Component
{

}
9 changes: 9 additions & 0 deletions Content.Server/Backmen/Xeno/Roles/XenoAgentRoleComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Content.Shared.Roles;

namespace Content.Server.Backmen.Blob.Roles;

[RegisterComponent]
public sealed partial class XenoAgentRoleComponent : BaseMindRoleComponent
{

}
Comment on lines +5 to +9
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Компонент требует реализации

Компонент зарегистрирован корректно, но не содержит никакой логики. Необходимо добавить специфичное поведение для роли Ксено Агента.

Хотите, чтобы я предложил базовую реализацию компонента с основными свойствами и методами?

32 changes: 32 additions & 0 deletions Content.Server/Backmen/Xeno/XenoAgentSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Content.Server.Backmen.Language;
using Content.Server.Backmen.Language.Events;
using Content.Server.Backmen.Xeno.Components;
using Content.Shared.Backmen.Language;

namespace Content.Server.Backmen.Xeno;

public sealed class XenoAgentSystem : EntitySystem
{
[Dependency] private readonly LanguageSystem _language = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<XenoAgentComponent, MapInitEvent>(OnInit);
SubscribeLocalEvent<XenoAgentComponent, DetermineEntityLanguagesEvent>(OnApplyLanguages);
}

[ValidatePrototypeId<LanguagePrototype>]
private const string XenoLanguage = "Xeno";
Comment on lines +19 to +20
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Добавьте проверку существования прототипа языка

Хотя атрибут ValidatePrototypeId присутствует, рекомендуется добавить дополнительную проверку во время выполнения для более надёжной обработки ошибок.

 [ValidatePrototypeId<LanguagePrototype>]
 private const string XenoLanguage = "Xeno";
+private void EnsureLanguageExists()
+{
+    if (!_prototypeManager.HasIndex<LanguagePrototype>(XenoLanguage))
+        throw new InvalidOperationException($"Language prototype {XenoLanguage} not found");
+}

Committable suggestion skipped: line range outside the PR's diff.


private void OnApplyLanguages(Entity<XenoAgentComponent> ent, ref DetermineEntityLanguagesEvent args)
{
args.SpokenLanguages.Add(XenoLanguage);
args.UnderstoodLanguages.Add(XenoLanguage);
}

private void OnInit(Entity<XenoAgentComponent> ent, ref MapInitEvent args)
{
_language.UpdateEntityLanguages(ent.Owner);
}
}
6 changes: 4 additions & 2 deletions Content.Server/StationEvents/Events/MeteorSwarmSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Linq;
using System.Numerics;
using Content.Server.Chat.Systems;
using Content.Server.GameTicking.Rules;
Expand Down Expand Up @@ -44,11 +45,12 @@ protected override void ActiveTick(EntityUid uid, MeteorSwarmComponent component

component.NextWaveTime += TimeSpan.FromSeconds(component.WaveCooldown.Next(RobustRandom));

var stations = _station.GetStations().Where(HasComp<StationEventEligibleComponent>).ToList();

if (_station.GetStations().Count == 0)
if (stations.Count == 0)
return;

var station = RobustRandom.Pick(_station.GetStations());
var station = RobustRandom.Pick(stations); // backmen: centcomm
if (_station.GetLargestGrid(Comp<StationDataComponent>(station)) is not { } grid)
return;

Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Backmen/FootPrint/FootPrintComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ namespace Content.Shared.Backmen.FootPrint;
/// <summary>
/// This is used for marking footsteps, handling footprint drawing.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[RegisterComponent, NetworkedComponent]
public sealed partial class FootPrintComponent : Component
{
/// <summary>
/// Owner (with <see cref="FootPrintsComponent"/>) of a print (this component).
/// </summary>
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
[ViewVariables(VVAccess.ReadWrite)]
public EntityUid PrintOwner;

[DataField("solution")] public string SolutionName = "step";
Expand Down
9 changes: 9 additions & 0 deletions Content.Shared/Backmen/FootPrint/FootPrintState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Robust.Shared.Serialization;

namespace Content.Shared.Backmen.FootPrint;

[Serializable, NetSerializable]
public sealed class FootPrintState(NetEntity netEntity) : ComponentState
{
public NetEntity PrintOwner { get; private set; } = netEntity;
}
5 changes: 3 additions & 2 deletions Content.Shared/Backmen/FootPrint/FootPrintsComponent.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Numerics;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Shared.Backmen.FootPrint;

[RegisterComponent]
[RegisterComponent, NetworkedComponent]
public sealed partial class FootPrintsComponent : Component
{
[ViewVariables(VVAccess.ReadOnly), DataField("path")]
Expand Down Expand Up @@ -36,7 +37,7 @@ public sealed partial class FootPrintsComponent : Component

[ViewVariables(VVAccess.ReadOnly), DataField("protoId")]
public EntProtoId<FootPrintComponent> StepProtoId = "Footstep";

[ViewVariables(VVAccess.ReadWrite), DataField]
public Vector2 OffsetPrint = new(0.1f, 0f);

Expand Down
7 changes: 5 additions & 2 deletions Resources/Locale/ru-RU/backmen/reagents/toxins.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ reagent-desc-lotophagoi-oil = Сверхсильный наркотик, кот
reagent-name-bloodsucker-toxin = вампирский вирус
reagent-desc-bloodsucker-toxin = Многие называют это лекарством от старости, его состав говорит о том что он относится к классу токсинов и вызывает множество негативных мутаций.
reagent-name-slerm = слерма ксено
reagent-desc-slerm = Самая мерзкая жидкость в галактике, которая при попадании на кожу вызывает сильные мутации.
reagent-name-slerm = слерм
reagent-desc-slerm = Вкуснейший напиток в галактике
reagent-name-slerm-queen = слерм королевский
reagent-desc-slerm-queen = Вкуснейший деликатес! Секретный ингредиент который не так просто получить!
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
snap:
- Wall
components:
- type: MobThresholds
thresholds:
0: Alive
currentThresholdState: Alive
showOverlays: false
- type: MobState
Comment on lines +10 to +15
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Требуется добавить состояние Dead в blob_base.yml

Анализ показывает несоответствия в реализации:

  • В базовом классе blob_base.yml отсутствует состояние Dead, хотя оно присутствует во всех других реализациях мобов
  • Наследуемые классы в blob_mobs.yml определяют состояние Dead (с порогами 50 и 200)
  • Отключение showOverlays является нормальным для блоба, так как это соответствует его простой визуальной природе

Рекомендации:

  • Добавить состояние Dead в blob_base.yml с соответствующим порогом
  • Рассмотреть добавление промежуточного состояния Critical для консистентности с другими мобами
🔗 Analysis chain

Проверьте баланс и согласованность с другими мобами

Добавление компонентов MobThresholds и MobState требует проверки:

  1. Соответствует ли состояние "Alive" игровому балансу?
  2. Почему showOverlays установлен в false?
  3. Нужны ли дополнительные состояния кроме "Alive"?
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Поиск других реализаций MobThresholds для сравнения
rg -l "type: MobThresholds" "Resources/Prototypes"

Length of output: 2501


Script:

#!/bin/bash
# Проверяем содержимое нескольких файлов с MobThresholds для сравнения реализаций
rg "type: MobThresholds" -A 5 "Resources/Prototypes/Entities/Mobs/NPCs/animals.yml" "Resources/Prototypes/Entities/Mobs/base.yml" "Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/base.yml"

Length of output: 6218


Script:

#!/bin/bash
# Проверяем реализацию blob_base.yml и связанных файлов блоба
rg "type: MobThresholds" -A 5 "Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/blob/blob_base.yml" "Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/blob/blob_mobs.yml"

Length of output: 1813

- type: ZombieImmune
- type: StatusEffects
allowed:
Expand Down
12 changes: 11 additions & 1 deletion Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/xeno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@
state: running
noRot: true
netsync: false
- type: SolutionContainerManager
solutions:
udder:
maxVol: 250
reagents:
- ReagentId: Slerm
Quantity: 30
- type: Udder
reagentId: Slerm
quantityPerUpdate: 25
growthDelay: 30
- type: Clickable
- type: InteractionOutline
- type: SolutionContainerManager
- type: AtmosExposed
- type: MobThresholds
thresholds:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
- type: MovementSpeedModifier
baseWalkSpeed: 2.5
baseSprintSpeed: 5.0
- type: FootPrints

- type: entity
save: false
Expand Down
33 changes: 33 additions & 0 deletions Resources/Prototypes/_Backmen/GameRules/roundstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
max: 2
playerRatio: 40 #players = 2 blobs
allowNonHumans: true
components:
- type: BlobCarrier
blacklist:
components:
- AntagImmune
Expand Down Expand Up @@ -291,3 +293,34 @@
components:
- type: GameRule
- type: BabelTowerRule

#xeno
- type: entity
id: XenoAgentGameMode
parent: BaseGameRule
categories: [ HideSpawnMenu ]
components:
- type: GameRule
minPlayers: 15
#delay: # 7-10 minutes
# min: 420
# max: 600
Comment on lines +305 to +307
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Раскомментируйте настройки задержки

Закомментированные настройки задержки важны для баланса игрового режима. Без них режим может начаться слишком рано.

Предлагаемые изменения:

-    #delay: # 7-10 minutes
-    #  min: 420
-    #  max: 600
+    delay: # 7-10 minutes
+      min: 420
+      max: 600
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#delay: # 7-10 minutes
# min: 420
# max: 600
delay: # 7-10 minutes
min: 420
max: 600

- type: AntagSelection
definitions:
- prefRoles: [ XenoAgent ]
min: 1
max: 2
playerRatio: 40 #players = 2 blobs
allowNonHumans: true
components:
- type: XenoAgent
- type: NpcFactionMember
factions:
- Xeno
- NanoTrasen
- type: XenoAcidSpiller
blacklist:
components:
- AntagImmune
mindRoles:
- MindRoleXenoAgent
73 changes: 71 additions & 2 deletions Resources/Prototypes/_Backmen/Reagents/toxins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
# Xeno maid liquid real
- type: reagent
id: SlermQueenPlus
name: reagent-name-slerm
name: reagent-name-slerm-queen
group: Toxins
desc: reagent-desc-slerm
desc: reagent-desc-slerm-queen
physicalDesc: reagent-physical-desc-bubbling
flavor: bitter
color: "#b428c9"
Expand Down Expand Up @@ -55,4 +55,73 @@
min: 5
causeChance: 0.3
disease: XenoMaidVirus
- !type:GenericStatusEffect
key: SeeingRainbows
component: SeeingRainbows
type: Add
time: 5
refresh: false
- !type:ChemAddMoodlet
moodPrototype: SpaceDrugsBenefit
conditions:
- !type:ReagentThreshold
reagent: Slerm
min: 6
# end-backmen: Disease

- type: reagent
id: Slerm
name: reagent-name-slerm
group: Narcotics
desc: reagent-desc-slerm
physicalDesc: reagent-physical-desc-bubbling
flavor: soda
color: "#b428c9"
metabolisms:
Narcotic:
effects:
- !type:GenericStatusEffect
key: SeeingRainbows
component: SeeingRainbows
type: Add
time: 5
refresh: false
- !type:ChemAddMoodlet
moodPrototype: SpaceDrugsBenefit
conditions:
- !type:ReagentThreshold
reagent: Slerm
min: 6
# end-backmen: Disease

- type: entity
parent: DrinkGlass
id: DrinkSlermGlass
suffix: Slerm
components:
- type: SolutionContainerManager
solutions:
drink:
maxVol: 30
reagents:
- ReagentId: Slerm
Quantity: 30
- type: Icon
sprite: Objects/Consumable/Drinks/gsodaglass.rsi
state: icon

- type: entity
parent: DrinkGlass
id: DrinkSlermPlusGlass
suffix: Slerm Plus
components:
- type: SolutionContainerManager
solutions:
drink:
maxVol: 30
reagents:
- ReagentId: SlermQueenPlus
Quantity: 30
- type: Icon
sprite: Objects/Consumable/Drinks/gsodaglass.rsi
state: icon
Loading
Loading