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

[FEATURE] Xeno Maid #888

Merged
merged 9 commits into from
Dec 8, 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
52 changes: 52 additions & 0 deletions Content.Server/Backmen/Abilities/Xeno/XenoAbilitiesSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using Content.Server.Weapons.Ranged.Systems;
using Content.Shared.Actions;
using Content.Shared.Backmen.Abilities.Xeno;
using Robust.Server.GameObjects;
using Robust.Shared.Audio.Systems;

namespace Content.Server.Backmen.Abilities.Xeno;

public sealed class XenoAbilitiesSystem : EntitySystem
{
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly GunSystem _gunSystem = default!;
[Dependency] private readonly PhysicsSystem _physics = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly SharedActionsSystem _actions = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<XenoAcidSpillerComponent, XenoAcidSpitActionEvent>(OnAcidSpit);
SubscribeLocalEvent<XenoAcidSpillerComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<XenoAcidSpillerComponent, ComponentShutdown>(OnShutdown);
}

private void OnAcidSpit(EntityUid uid, XenoAcidSpillerComponent component, XenoAcidSpitActionEvent args)
{
if (args.Handled)
return;

var xform = Transform(uid);
var acidBullet = Spawn(component.BulletSpawnId, xform.Coordinates);
var mapCoords = _transform.ToMapCoordinates(args.Target);
var direction = mapCoords.Position - _transform.GetMapCoordinates(xform).Position;
var userVelocity = _physics.GetMapLinearVelocity(uid);

_gunSystem.ShootProjectile(acidBullet, direction, userVelocity, uid, uid);
_audioSystem.PlayPvs(component.BulletSound, uid, component.BulletSound.Params);

args.Handled = true;
}
Comment on lines +26 to +41
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

Необходима валидация входных параметров

В методе OnAcidSpit отсутствуют проверки:

  • Валидность цели (args.Target)
  • Нулевой вектор направления
  • Возможные коллизии

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

 private void OnAcidSpit(EntityUid uid, XenoAcidSpillerComponent component, XenoAcidSpitActionEvent args)
 {
     if (args.Handled)
         return;
 
+    if (!args.Target.IsValid())
+        return;
+
     var xform = Transform(uid);
     var acidBullet = Spawn(component.BulletSpawnId, xform.Coordinates);
     var mapCoords = _transform.ToMapCoordinates(args.Target);
     var direction = mapCoords.Position -  _transform.GetMapCoordinates(xform).Position;
+    
+    if (direction == Vector2.Zero)
+        return;
+
     var userVelocity = _physics.GetMapLinearVelocity(uid);
 
     _gunSystem.ShootProjectile(acidBullet, direction, userVelocity, uid, uid);
     _audioSystem.PlayPvs(component.BulletSound, uid, component.BulletSound.Params);
 
     args.Handled = true;
 }
📝 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
private void OnAcidSpit(EntityUid uid, XenoAcidSpillerComponent component, XenoAcidSpitActionEvent args)
{
if (args.Handled)
return;
var xform = Transform(uid);
var acidBullet = Spawn(component.BulletSpawnId, xform.Coordinates);
var mapCoords = _transform.ToMapCoordinates(args.Target);
var direction = mapCoords.Position - _transform.GetMapCoordinates(xform).Position;
var userVelocity = _physics.GetMapLinearVelocity(uid);
_gunSystem.ShootProjectile(acidBullet, direction, userVelocity, uid, uid);
_audioSystem.PlayPvs(component.BulletSound, uid, component.BulletSound.Params);
args.Handled = true;
}
private void OnAcidSpit(EntityUid uid, XenoAcidSpillerComponent component, XenoAcidSpitActionEvent args)
{
if (args.Handled)
return;
if (!args.Target.IsValid())
return;
var xform = Transform(uid);
var acidBullet = Spawn(component.BulletSpawnId, xform.Coordinates);
var mapCoords = _transform.ToMapCoordinates(args.Target);
var direction = mapCoords.Position - _transform.GetMapCoordinates(xform).Position;
if (direction == Vector2.Zero)
return;
var userVelocity = _physics.GetMapLinearVelocity(uid);
_gunSystem.ShootProjectile(acidBullet, direction, userVelocity, uid, uid);
_audioSystem.PlayPvs(component.BulletSound, uid, component.BulletSound.Params);
args.Handled = true;
}


private void OnStartup(EntityUid uid, XenoAcidSpillerComponent component, ComponentStartup args)
{
_actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId);
}
Comment on lines +43 to +46
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

Добавьте обработку ошибок при добавлении действия

Метод AddAction может завершиться неудачно, но текущая реализация не обрабатывает такой случай.

 private void OnStartup(EntityUid uid, XenoAcidSpillerComponent component, ComponentStartup args)
 {
-    _actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId);
+    if (!_actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId))
+    {
+        Log.Warning($"Failed to add acid spit action to {ToPrettyString(uid)}");
+    }
 }
📝 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
private void OnStartup(EntityUid uid, XenoAcidSpillerComponent component, ComponentStartup args)
{
_actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId);
}
private void OnStartup(EntityUid uid, XenoAcidSpillerComponent component, ComponentStartup args)
{
if (!_actions.AddAction(uid, ref component.AcidSpitAction, component.AcidSpitActionId))
{
Log.Warning($"Failed to add acid spit action to {ToPrettyString(uid)}");
}
}


private void OnShutdown(EntityUid uid, XenoAcidSpillerComponent component, ComponentShutdown args)
{
_actions.RemoveAction(uid, component.AcidSpitAction);
}
}
2 changes: 1 addition & 1 deletion Content.Server/Backmen/Research/Oracle/OracleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public sealed class OracleSystem : EntitySystem
[ValidatePrototypeId<ReagentPrototype>]
public readonly IReadOnlyList<ProtoId<ReagentPrototype>> RewardReagents = new ProtoId<ReagentPrototype>[]
{
"LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "Wine", "Blood", "Ichor", "FluorosulfuricAcid"
"LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "LotophagoiOil", "Wine", "Blood", "Ichor", "SlermQueenPlus"
};

[ViewVariables(VVAccess.ReadWrite)]
Expand Down
2 changes: 0 additions & 2 deletions Content.Server/Content.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
<ItemGroup>
<Folder Include="Tools\Systems\" />
<Folder Include="Objectives\Interfaces\" />
<Folder Include="_Shitmed\Body\Organ\" />
<Folder Include="_Shitmed\Body\Systems\" />
</ItemGroup>
<ItemGroup>
<Compile Update="Backmen\Species\Shadowkin\Systems\ShadowkinPowerSystem.Darken.cs">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;

namespace Content.Shared.Backmen.Abilities.Xeno;

[RegisterComponent]
public sealed partial class XenoAcidSpillerComponent : Component
{
[DataField]
public EntProtoId AcidSpitActionId = "ActionXenoSpitMaidAcid";

[DataField]
public EntityUid? AcidSpitAction;

[DataField]
public EntProtoId BulletSpawnId = "BulletSplashMaidAcid";
Comment on lines +15 to +16
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

Характеристики прототипа пули требуют корректировки

Анализ показал следующие характеристики:

  • Урон от кислоты (Caustic): 5 единиц
  • Распыление 30 единиц реагента SlermQueenPlus при попадании
  • Реагент SlermQueenPlus имеет следующие эффекты:
    • Кислотное воздействие при контакте
    • 30% шанс заражения XenoMaidVirus
    • Токсичное воздействие при метаболизме

Рекомендуется:

  • Увеличить базовый урон от кислоты, так как 5 единиц слишком мало
  • Уменьшить количество распыляемого реагента с 30 до 15-20 единиц для лучшего баланса
  • Рассмотреть снижение шанса заражения вирусом до 20%
🔗 Analysis chain

Проверить прототип пули

Необходимо проверить характеристики "BulletSplashMaidAcid" для обеспечения игрового баланса.


Let me gather more information about the bullet prototype's damage configuration.


Let me check the properties of the reagent being used in the splash effect.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Поиск определения прототипа пули
rg "BulletSplashMaidAcid" -A 10

Length of output: 1347


Script:

#!/bin/bash
# Поиск полного определения прототипа пули и его характеристик
rg -A 20 "id: BulletSplashMaidAcid" Resources/Prototypes/_Backmen/Actions/xeno.yml

Length of output: 515


Script:

#!/bin/bash
# Поиск определения реагента SlermQueenPlus
rg "SlermQueenPlus" -A 10

Length of output: 4383


[DataField]
public SoundSpecifier BulletSound = new SoundPathSpecifier("/Audio/Effects/Fluids/splat.ogg");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Content.Shared.Actions;

namespace Content.Shared.Backmen.Abilities.Xeno;

public sealed partial class XenoAcidSpitActionEvent : WorldTargetActionEvent;
2 changes: 1 addition & 1 deletion Content.Shared/Backmen/Disease/DiseasePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class DiseasePrototype : IPrototype, IInheritingPrototype
public string ID { get; private set; } = default!;

[DataField("name")]
public string Name { get; private set; } = string.Empty;
public LocId Name { get; private set; } = string.Empty;

[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<DiseasePrototype>))]
public string[]? Parents { get; private set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Content.Shared.Actions;
using Content.Shared.Ghost;
using Content.Shared.Magic;
using Robust.Shared.Audio;


namespace Content.Server.Backmen.Species.Shadowkin.Events;

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/backmen/disease/disease-proto.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ disease-proto-tongue-twister = Tongue Twister

# XenoVirus
disease-proto-xeno = XenoVirus
disease-proto-xeno-slerm = Slerm Alpha-virus
disease-proto-xenodrone = XenoVirus
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/backmen/reagents/toxins.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ reagent-desc-lotophagoi-oil = Сверхсильный наркотик, кот

reagent-name-bloodsucker-toxin = вампирский вирус
reagent-desc-bloodsucker-toxin = Многие называют это лекарством от старости, его состав говорит о том что он относится к классу токсинов и вызывает множество негативных мутаций.

reagent-name-slerm = слерма ксено
reagent-desc-slerm = Самая мерзкая жидкость в галактике, которая при попадании на кожу вызывает сильные мутации.
33 changes: 33 additions & 0 deletions Resources/Prototypes/_Backmen/Actions/xeno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- type: entity
id: ActionXenoSpitMaidAcid
name: Spit slerm
description: Spit the violet acid on your enemies.
components:
- type: WorldTargetAction
icon: Interface/Actions/fleshAcidSpit.png
#itemIconStyle: NoItem
event: !type:XenoAcidSpitActionEvent
checkCanAccess: true
useDelay: 60
range: 32
repeat: true
priority: -20

- type: entity
id: BulletSplashMaidAcid
name: maid acid spit
parent: BaseBulletTrigger
categories: [ HideSpawnMenu ]
components:
- type: Sprite
sprite: Objects/Weapons/Guns/Projectiles/flesh_toxic.rsi
layers:
- state: flesh_toxic
- type: Projectile
damage:
types:
Caustic: 5
- type: SplashOnTrigger
splashReagents:
- ReagentId: SlermQueenPlus
Quantity: 30
7 changes: 7 additions & 0 deletions Resources/Prototypes/_Backmen/Diseases/furry_virus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
# fake: true
# disease: FurryVirus


- type: emote
id: BCatMeow
name: chat-emote-name-BCatMeow
category: Vocal
chatMessages: ["chat-emote-msg-BCatMeow"]

- type: disease
parent: FurryVirus
id: FurryVirusPlus
cures: []

Comment on lines +17 to +21
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

Отсутствие лечения может быть проблематичным

FurryVirusPlus не имеет способов лечения (cures: []). Это может привести к дисбалансу в игровом процессе, так как игроки не смогут вылечиться от болезни.

Хотите, чтобы я предложил список подходящих методов лечения?

- type: disease
id: FurryVirus
name: disease-proto-furry-virus
Expand Down
83 changes: 82 additions & 1 deletion Resources/Prototypes/_Backmen/Diseases/noninfectious.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
- 2
# possible xeno polymorph
- !type:DiseasePolymorph
probability: 0.050
probability: 0.030
polymorphId: XenoDroneMorph
polymorphMessage: disease-xeno-polymorph
polymorphSound:
Expand All @@ -142,3 +142,84 @@
path: /Audio/Animals/space_dragon_roar.ogg
stages:
- 2

- type: disease
id: XenoMaidVirus
name: disease-proto-xeno-slerm
cureResist: 1
infectious: false
stages:
- 0
- 120
- 600
effects:
# compulsion pop ups
- !type:DiseasePopUp
probability: 0.015
type: Pvs
message: disease-seizures-compulsion
visualType: Medium
stages:
- 0
- 1
- 2
- !type:DiseasePopUp
probability: 0.03
message: disease-blood-compulsion
visualType: Medium
stages:
- 0
- 1
- 2
- !type:DiseasePopUp
probability: 0.05
message: disease-eaten-inside
visualType: Medium
# Seizures
- !type:DiseaseAdjustReagent
probability: 0.025
reagent:
ReagentId: Licoxide
amount: 0.5
# accent chance when speaking
- !type:DiseaseGenericStatusEffect
probability: 0.1
key: Stutter
component: XenoAccent
stages:
- 1
- !type:DiseaseGenericStatusEffect
probability: 0.4
key: Stutter
component: XenoAccent
stages:
- 2
# cellular damage, from being eaten on the inside
- !type:DiseaseHealthChange
probability: 0.025
damage:
types:
Genetic: 0.1
stages:
- 2
- !type:DiseasePolymorph
probability: 0.07
polymorphId: XenoMaidMorph # >w<
polymorphMessage: disease-xeno-polymorph
polymorphSound:
path: /Audio/Animals/cat_meow.ogg
stages:
- 2
- !type:DiseasePolymorph
probability: 0.001
polymorphId: XenoQueenMorph # >w<
polymorphMessage: disease-xeno-polymorph
polymorphSound:
path: /Audio/Animals/cat_meow.ogg
stages:
- 2
cures:
- !type:DiseaseReagentCure
reagent:
ReagentId: Diphenylmethylamine # the hardest-to-get med known to mankind... good luck
min: 5
12 changes: 12 additions & 0 deletions Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/TGMC_xeno.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@
- id: XenoRCD
- id: WeaponXenoHealingSpit
- id: PinpointerXeno
- type: XenoAcidSpiller
- type: SolutionContainerManager
solutions:
udder:
maxVol: 250
reagents:
- ReagentId: SlermQueenPlus
Quantity: 30
- type: Udder
reagentId: SlermQueenPlus
quantityPerUpdate: 25
growthDelay: 30
- type: Destructible
thresholds:
- trigger:
Expand Down
95 changes: 95 additions & 0 deletions Resources/Prototypes/_Backmen/Entities/Mobs/NPCs/xeno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
- type: entity
id: MobMaidXeno
parent: MobXeno
name: горничная ксеноморфа
description: Это чертовски мило, пока она сытная.
components:
- type: LagCompensation
- type: Input
context: "human"
- type: MovedByPressure
- type: DamageOnHighSpeedImpact
damage:
types:
Blunt: 5
soundHit:
path: /Audio/Effects/hit_kick.ogg
- type: Sprite
drawdepth: Mobs
sprite: Backmen/Mobs/Aliens/Xenos/maidxenos.rsi
layers:
- map: ["enum.DamageStateVisualLayers.Base"]
state: running
noRot: true
netsync: false
- type: Clickable
- type: InteractionOutline
- type: SolutionContainerManager
- type: AtmosExposed
- type: MobThresholds
thresholds:
0: Alive
100: Dead
- type: Internals
- type: Damageable
damageContainer: Biological
damageModifierSet: Xenolian
- type: Body
prototype: Animal
- type: Actions
- type: DoAfter
- type: Polymorphable
- type: Buckle
- type: Insulated
- type: Hands
showInHands: true
- type: MobState
allowedStates:
- Alive
- Dead
- type: MovementSpeedModifier
baseWalkSpeed : 2.5
baseSprintSpeed : 4
- type: Stamina
critThreshold: 500
- type: Appearance
- type: Bloodstream
bloodMaxVolume: 0
- type: UnpoweredFlashlight
- type: PointLight
enabled: false
radius: 4
color: "purple"
- type: Puller
needsHands: false
- type: NoSlip
- type: IgnoreSpiderWeb
- type: IntrinsicRadioReceiver
- type: ActiveRadio
channels:
- Hivemind
- type: IntrinsicRadioTransmitter
channels:
- Hivemind
- type: LizardAccent
- type: Speech
speechSounds: Xeno
- type: Eye
drawFov: false
- type: SolutionRegeneration
solution: spray
generated:
reagents:
- ReagentId: Water
Quantity: 10
- type: Access
tags:
- Xeno
- type: LanguageSpeaker
currentLanguage: Xeno
- type: LanguageKnowledge
speaks:
- Xeno
understands:
- Xeno
- TauCetiBasic
Loading
Loading