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

Static anomaly #1103

Open
wants to merge 12 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using Content.Shared.ADT.Silicon.Components;
using Content.Shared.ADT.Anomaly.Effects.Components;
using Content.Shared.StatusEffect;
using Content.Shared.Anomaly.Components;
using Content.Shared.Mobs.Components;
using Content.Server.Chat;
using Content.Shared.ADT.StaticTV.Components;
using Content.Server.Body.Systems;
using Content.Server.Chat.Systems;

namespace Content.Server.ADT.Anomaly.Effects;
public sealed class StaticAnomalySystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly StatusEffectsSystem _status = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly BloodstreamSystem _blood = default!;
[Dependency] private readonly AutoEmoteSystem _autoEmote = default!;
public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<StaticAnomalyComponent, AnomalySupercriticalEvent>(OnSupercritical);
}

public override void Update(float frameTime)
{
base.Update(frameTime);

//Anomaly
var AnomalyQuery = EntityQueryEnumerator<StaticAnomalyComponent>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

локальные переменные функции должны называться с маленькой буквы

while (AnomalyQuery.MoveNext(out var uid, out var comp))
{
foreach (var ent in _lookup.GetEntitiesInRange(uid, comp.NoiseRange))
{
if (HasComp<MobStateComponent>(ent) == true)
{

_status.TryAddStatusEffect<SeeingStaticComponent>(ent, "SeeingStatic", TimeSpan.FromSeconds(5f), true);

if (_entityManager.TryGetComponent<SeeingStaticComponent>(ent, out var staticComp))
staticComp.Multiplier = comp.NoiseStrong;
}
}
}

//StaticTV
var StaticTVQuery = EntityQueryEnumerator<StaticTVComponent>();
while (StaticTVQuery.MoveNext(out var uid, out var comp))
{
foreach (var ent in _lookup.GetEntitiesInRange(uid, comp.Range))
{
if (HasComp<MobStateComponent>(ent) == true)
{
_status.TryAddStatusEffect<SeeingStaticComponent>(ent, "SeeingStatic", TimeSpan.FromSeconds(5f), true);

if (_entityManager.TryGetComponent<SeeingStaticComponent>(ent, out var staticComp))
staticComp.Multiplier = comp.NoiseStrong;

_blood.TryModifyBloodLevel(ent, (comp.BloodlossStrong));
_blood.TryModifyBleedAmount(ent, comp.BleedingStrong);
}
}
}

//FakeStaticTV
var FakeStaticTVQuery = EntityQueryEnumerator<NervousSourceComponent>();
while (FakeStaticTVQuery.MoveNext(out var uid, out var comp))
{
foreach (var ent in _lookup.GetEntitiesInRange(uid, comp.NervousRange))
{
if (HasComp<MobStateComponent>(ent) == true)
{
EnsureComp<AutoEmoteComponent>(ent);
_autoEmote.AddEmote(ent, "NervousSream");
if (Transform(uid).Coordinates.TryDistance(EntityManager, Transform(ent).Coordinates, out var distance)
&& distance >= comp.NervousRange)
Copy link
Collaborator

Choose a reason for hiding this comment

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

в игре достаточно способов это сломать, чего только телепорт стоит.
глянь как работает стационарная вспышка, либо добавь список в компонент
(ну или просто не используй автоэмоут систему, а пропиши всю логику тут, ещё лучше будет)

{
_autoEmote.RemoveEmote(ent, "NervousSream");
}
}
}
}
}

//Anomaly
private void OnSupercritical(EntityUid uid, StaticAnomalyComponent comp, ref AnomalySupercriticalEvent args)
{
foreach (var ent in _lookup.GetEntitiesInRange(uid, comp.NoiseRange))
{
_status.TryRemoveStatusEffect(ent, "SeeingStatic");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Content.Shared.ADT.Anomaly.Effects.Components;

[RegisterComponent]
public sealed partial class NervousSourceComponent : Component
{
[DataField]
public float NervousRange = 7;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Content.Shared.ADT.Anomaly.Effects.Components;

[RegisterComponent]
public sealed partial class StaticAnomalyComponent : Component
{
[DataField]
public float NoiseRange = 12;

[DataField]
public float NoiseStrong = 0.55f;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Content.Shared.ADT.StaticTV.Components;

[RegisterComponent]
public sealed partial class StaticTVComponent : Component
{
[DataField]
public float Range = 15;

[DataField]
public float NoiseStrong = 1f;

[DataField]
public float BleedingStrong = 0.03f;

[DataField]
public float BloodlossStrong = -0.04f;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ent-ADTAnomalyMonkey = { ent-BaseAnomaly }
.suffix = Обезьяна
.desc = Иногда, когда слишком много думаешь, может выпасть мозг. Проверено самим главой времени.

ent-ADTAnomalyStatic = { ent-BaseAnomaly }
.suffix = Cтатика
.desc = Кажется этот телевизор сломан. Подождите... кто это там?
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ ent-ADTAnomalyCoreMonkeyInert = { ent-BaseAnomalyInertCore }
ent-ADTAnomalyCoreMonkey = { ent-BaseAnomalyCore }
.suffix = Обезьяна
.desc = { ent-BaseAnomalyCore.desc }

ent-ADTAnomalyCoreStatic = { ent-BaseAnomalyInertCore }
.suffix = Статика, Инертный
.desc = { ent-BaseAnomalyInertCore.desc }
ent-ADTAnomalyCoreStaticInert = { ent-BaseAnomalyCore }
.suffix = Статика
.desc = { ent-BaseAnomalyCore.desc }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ent-StativTV = статический телевизор
.desc = Переключите канал!

ent-FakeTV = фальшивый телевизор
.desc = Кажется знакомым.
89 changes: 89 additions & 0 deletions Resources/Prototypes/ADT/Entities/Misc/staticTV.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
- type: entity
name: stativ TV
parent: BaseStructure
id: StativTV
description: Change the channel!
components:
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeCircle
radius: 0.35
density: 200
mask:
- FullTileMask
layer:
- WallLayer
- type: Sprite
sprite: ADT/Structures/Specific/Anomalies/static_anum.rsi
state: pulse
- type: Physics
- type: StaticTV
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Metallic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 500
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 250
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Тут два раза прописаны одинаковые триггеры с разным значением
  2. 250 хп - слишком жирно для аномального объекта

behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- !type:PlaySoundBehavior
sound:
collection: MetalBreak

- type: entity
name: fake TV
parent: BaseStructure
id: FakeTV
description: He looks familiar.
components:
- type: Fixtures
fixtures:
fix1:
shape:
!type:PhysShapeCircle
radius: 0.35
density: 200
mask:
- TableMask
layer:
- WallLayer
- type: Sprite
sprite: ADT/Objects/Misc/fakeTV.rsi
state: fakeTV
- type: Physics
- type: PointLight
radius: 1.2
energy: 10.5
color: "#ffffff"
- type: NervousSource
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Metallic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 75
behaviors:
- !type:DoActsBehavior
acts: [ "Destruction" ]
- trigger:
!type:DamageTrigger
damage: 36
behaviors:
- !type:DoActsBehavior
acts: ["Destruction"]
- !type:PlaySoundBehavior
sound:
collection: MetalBreak
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,29 @@
energy: 2.0
color: "#FFFE42"
castShadows: false

- type: entity
parent: BaseAnomalyCore
id: ADTAnomalyCoreStatic
suffix: Static
components:
- type: Sprite
sprite: ADT/Structures/Specific/Anomalies/Cores/static_core.rsi
- type: PointLight
radius: 1.0
energy: 1.5
color: "#ffffff"
castShadows: false

- type: entity
parent: BaseAnomalyInertCore
id: ADTAnomalyCoreStaticInert
suffix: Static, Inert
components:
- type: Sprite
sprite: ADT/Structures/Specific/Anomalies/Cores/static_core.rsi
- type: PointLight
radius: 1.0
energy: 1.5
color: "#ffffff"
castShadows: false
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,52 @@
maxRange: 2.5
spawns:
- ADTSpecialMobGorilla

- type: entity
id: ADTAnomalyStatic
parent: BaseAnomaly
suffix: Static
components:
- type: Sprite
sprite: ADT/Structures/Specific/Anomalies/static_anum.rsi
layers:
- state: anom
map: ["enum.AnomalyVisualLayers.Base"]
- state: pulse
map: ["enum.AnomalyVisualLayers.Animated"]
visible: false
- type: StaticAnomaly
- type: PointLight
radius: 1.5
energy: 12.5
color: "#ffffff"
- type: Anomaly
corePrototype: ADTAnomalyCoreStatic
coreInertPrototype: ADTAnomalyCoreStaticInert
minPulseLength: 30
maxPulseLength: 90
- type: EntitySpawnAnomaly
entries:
- settings:
spawnOnPulse: true
minAmount: 1
maxAmount: 3
maxRange: 5
spawns:
- FakeTV
- settings:
spawnOnSuperCritical: true
minAmount: 1
maxAmount: 1
maxRange: 1
spawns:
- StativTV
- type: DamageOnInteract
damage:
types:
Cold: 10
popupText: anomaly-component-contact-damage
- type: DamageOnAttacked
damage:
types:
Cold: 10
13 changes: 13 additions & 0 deletions Resources/Prototypes/ADT/Voice/auto_emotes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- type: autoEmote
id: NervousCrying
emote: Crying
interval: 15.0
chance: 0.5
withChat: false

- type: autoEmote
id: NervousSream
emote: Scream
interval: 15.0
chance: 0.5
withChat: false
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- type: entity
- type: entity
id: RandomAnomalySpawner
name: random anomaly spawner
parent: MarkerBase
Expand All @@ -22,6 +22,7 @@
- AnomalyFlora
- AnomalyShadow
- AnomalyTech
- ADTAnomalyStatic # ADT-Tweak
#- AnomalySanta
rareChance: 0.3
rarePrototypes:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Copy link
Collaborator

Choose a reason for hiding this comment

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

Если оставить так, на всех будет действовать ЭМИ, по крайней мере статика от него

Copy link
Collaborator

Choose a reason for hiding this comment

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

Так вроде статика должна как раз на всех, разве нет?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Так вроде статика должна как раз на всех, разве нет?

От ЭМИ гранат? С чего бы?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Но ведь это не так. Я много раз проверял. Эми всё так же действует только на КПБ

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
- Adrenaline # ADT-Medicine
- ADTHallucinations # ADT-Tweak
- ADTStarvation # ADT-Tweak
- SeeingStatic # ADT-Tweak
- type: Body
prototype: Human
requiredLegs: 2
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions Resources/Textures/ADT/Objects/Misc/fakeTV.rsi/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 1,
"license": "CC0-1.0",
"copyright": "Created by Username228 (#serj3428 discord) for space-station-14",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "fakeTV",
"dalays": [
[
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2,
0.2
]
]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading