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

Blood cough #388

Merged
merged 16 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
68 changes: 68 additions & 0 deletions Content.Server/ADT/BloodCough/BloodCoughSystem.cs
Schrodinger71 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using Content.Server.Chat.Systems;
using Content.Shared.ADT.BloodCough;
using Robust.Shared.Timing;
using Robust.Shared.Random;
using Robust.Shared.Console;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.ADT.AutoPostingChat;
public sealed class BloodCoughSystem : EntitySystem
{
[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly IGameTiming _time = default!;
[Dependency] private readonly IRobustRandom _random = default!;

public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BloodCoughComponent, DamageChangedEvent>(OnMobStateDamage);
}

private void OnMobStateDamage(EntityUid uid, BloodCoughComponent component, DamageChangedEvent args)
{
if (EntityManager.TryGetComponent<DamageableComponent>(uid, out var damageable))
{
var currentDamage = damageable.TotalDamage;
if (currentDamage > 70)
{
Log.Debug($"Сущность {ToPrettyString(uid)} имеет урон больше 70: {currentDamage}");
if (TryComp<BloodCoughComponent>(uid, out var posting))
{
posting.CheckCoughBlood = true;
}
}
if (currentDamage <= 70)
{
if (TryComp<BloodCoughComponent>(uid, out var posting))
{
posting.CheckCoughBlood = false;
}
}
}
else
{
Log.Debug($"Сущность {ToPrettyString(uid)} не имеет компонента BloodCoughComponent.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

DamageableComponent а не BloodCoughComponent

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

блятьацацаца

}
}

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

var query = EntityQueryEnumerator<BloodCoughComponent>();
while (query.MoveNext(out var uid, out var comp))
{
if (_time.CurTime >= comp.NextSecond)
{
var delay = _random.Next(comp.CoughTimeMin, comp.CoughTimeMax);
if (comp.PostingSayDamage != null)
{
if (comp.CheckCoughBlood)
_chat.TrySendInGameICMessage(uid, comp.PostingSayDamage, InGameICChatType.Emote, ChatTransmitRange.Normal);
}

comp.NextSecond = _time.CurTime + TimeSpan.FromSeconds(delay);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ public sealed partial class AutoEmotePostingChatComponent : Component

[DataField("min"), ViewVariables(VVAccess.ReadWrite)]
public int IntervalRandomEmoteMin = 2;


}
21 changes: 21 additions & 0 deletions Content.Shared/ADT/BloodCough/BloodCoughComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Robust.Shared.GameStates;

namespace Content.Shared.ADT.BloodCough;

[RegisterComponent]
[NetworkedComponent]
public sealed partial class BloodCoughComponent : Component
{
public TimeSpan NextSecond = TimeSpan.Zero;

[DataField("coughTimeMin"), ViewVariables(VVAccess.ReadWrite)]
public int CoughTimeMin = 2;

[DataField("coughTimeMax"), ViewVariables(VVAccess.ReadWrite)]
public int CoughTimeMax = 12;

[DataField("postingSayDamage")]
public string? PostingSayDamage = "Кашляет кровью";
Schrodinger71 marked this conversation as resolved.
Show resolved Hide resolved

public bool CheckCoughBlood = false;
}
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/Drask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@
tallscale: 1.15
short: true
shortscale: 1
- type: BloodCough
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/Tajaran.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@
tallscale: 1
short: true
shortscale: 0.85
- type: BloodCough
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/Ursus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@
32:
sprite: Mobs/Species/Human/displacement.rsi
state: jumpsuit-female
- type: BloodCough
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/demon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough

#Weh
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/felinid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@
tallscale: 1
short: true
shortscale: 0.8
- type: BloodCough
4 changes: 3 additions & 1 deletion Resources/Prototypes/ADT/Entities/Mobs/Player/ipc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@
shortscale: 0.9
- type: CanEnterCryostorage
- type: Crawler

- type: BloodCough
postingSayDamage: "Искрит и раздраженно жужит"

- type: entity
save: false
name: Urist McPositronic
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/kobalt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough

2 changes: 2 additions & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/moth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
name: Urist McFluff
parent: BaseMobMoth
id: MobMoth
components:
- type: BloodCough
2 changes: 2 additions & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/novakid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
postingSayDamage: "Кашляет плазмой"

#Weh
2 changes: 2 additions & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/shadekin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
parent: BaseMobShadekin
id: MobShadekin
name: Урист МакСумеречник
components:
- type: BloodCough
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Mobs/Player/arachnid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
damageRecovery:
types:
Asphyxiation: -0.5
- type: BloodCough # ADT Tweak
3 changes: 2 additions & 1 deletion Resources/Prototypes/Entities/Mobs/Player/diona.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
damageRecovery:
types:
Asphyxiation: -1.0
- type: BloodCough # ADT Tweak

# Reformed Diona
- type: entity
Expand All @@ -20,4 +21,4 @@
name: Reformed Diona
components:
- type: IsDeadIC
- type: RandomHumanoidAppearance
- type: RandomHumanoidAppearance
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/dwarf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
name: Urist McHands The Dwarf
parent: BaseMobDwarf
id: MobDwarf
components:
- type: BloodCough # ADT Tweak
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/human.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
name: Urist McHands
parent: BaseMobHuman
id: MobHuman
components:
- type: BloodCough # ADT Tweak

#Syndie
- type: entity
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/reptilian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
suffix: Urisst' Mzhand
parent: BaseMobReptilian
id: MobReptilian
components:
- type: BloodCough # ADT Tweak

#Weh
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/vox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
name: Uristititi McVox
parent: BaseMobVox
id: MobVox
components:
- type: BloodCough # ADT Tweak
5 changes: 5 additions & 0 deletions Resources/Prototypes/Voice/disease_emotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
- кашель
- кашляет
# Corvax-Localization-End
# Start-ADT-Tweak-AddComp-BloodCough
- кашляет кровью # ADT-Tweak-AddComp-BloodCough
- искрит и раздраженно жужит
- кашляет плазмой
# End-ADT-Tweak-AddComp-BloodCough

- type: emote
id: CatMeow
Expand Down