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 8 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, Loc.GetString(comp.PostingSayDamage), InGameICChatType.Emote, ChatTransmitRange.HideChat);
}

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

[DataField("emoteMessage")]
public string? PostingMessageEmote = "Кхе";
public string? PostingMessageEmote = default;

[DataField("randomIntervalEmote"), ViewVariables(VVAccess.ReadWrite)]
public bool RandomIntervalEmote = false;
Expand All @@ -23,6 +23,4 @@ public sealed partial class AutoEmotePostingChatComponent : Component

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


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public sealed partial class AutoSpeakPostingChatComponent : Component
public int SpeakTimerRead = 10;

[DataField("speakMessage")]
public string? PostingMessageSpeak = "Вульп-вульп!";
public string? PostingMessageSpeak = default;

[DataField("randomIntervalSpeak"), ViewVariables(VVAccess.ReadWrite)]
public bool RandomIntervalSpeak = false;
Expand Down
22 changes: 22 additions & 0 deletions Content.Shared/ADT/BloodCough/BloodCoughComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;

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 = default;

public bool CheckCoughBlood = false;
}
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/ADT/Chat/blood-cough-system.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
blood-cough = Кашляет кровью.
blood-cough-ipc = Искрит и раздраженно жужит.
blood-cough-novakid = Кашляет плазмой.
2 changes: 2 additions & 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,5 @@
tallscale: 1.15
short: true
shortscale: 1
- type: BloodCough
postingSayDamage: blood-cough
2 changes: 2 additions & 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,5 @@
tallscale: 1
short: true
shortscale: 0.85
- type: BloodCough
postingSayDamage: blood-cough
2 changes: 2 additions & 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,5 @@
32:
sprite: Mobs/Species/Human/displacement.rsi
state: jumpsuit-female
- type: BloodCough
postingSayDamage: blood-cough
2 changes: 2 additions & 0 deletions Resources/Prototypes/ADT/Entities/Mobs/Player/Vulpkanin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
postingSayDamage: blood-cough
2 changes: 2 additions & 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,7 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
postingSayDamage: blood-cough

#Weh
2 changes: 2 additions & 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,5 @@
tallscale: 1
short: true
shortscale: 0.8
- type: BloodCough
postingSayDamage: blood-cough
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: blood-cough-ipc

- type: entity
save: false
name: Urist McPositronic
Expand Down
2 changes: 2 additions & 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,6 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
postingSayDamage: blood-cough

3 changes: 3 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,6 @@
name: Urist McFluff
parent: BaseMobMoth
id: MobMoth
components:
- type: BloodCough
postingSayDamage: blood-cough
4 changes: 4 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,9 @@
tallscale: 1.1
short: true
shortscale: 0.9
- type: BloodCough
postingSayDamage: blood-cough-novakid

#blood-cough-novakid

#Weh
3 changes: 3 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,6 @@
parent: BaseMobShadekin
id: MobShadekin
name: Урист МакСумеречник
components:
- type: BloodCough
postingSayDamage: blood-cough
1 change: 1 addition & 0 deletions Resources/Prototypes/ADT/Voice/speech_emotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,4 @@
- раздражённо жужжит.
- раздраженно жужжит
- раздраженно жужжит.
- искрит и раздраженно жужит. # ADT-Tweak-BloodCough
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Player/arachnid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
damageRecovery:
types:
Asphyxiation: -0.5
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough
4 changes: 3 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,8 @@
damageRecovery:
types:
Asphyxiation: -1.0
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough

# Reformed Diona
- type: entity
Expand All @@ -20,4 +22,4 @@
name: Reformed Diona
components:
- type: IsDeadIC
- type: RandomHumanoidAppearance
- type: RandomHumanoidAppearance
3 changes: 3 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,6 @@
name: Urist McHands The Dwarf
parent: BaseMobDwarf
id: MobDwarf
components:
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough
3 changes: 3 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,9 @@
name: Urist McHands
parent: BaseMobHuman
id: MobHuman
components:
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough

#Syndie
- type: entity
Expand Down
3 changes: 3 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,8 @@
suffix: Urisst' Mzhand
parent: BaseMobReptilian
id: MobReptilian
components:
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough

#Weh
3 changes: 3 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,6 @@
name: Uristititi McVox
parent: BaseMobVox
id: MobVox
components:
- type: BloodCough # ADT Tweak
postingSayDamage: blood-cough
4 changes: 4 additions & 0 deletions Resources/Prototypes/Voice/disease_emotes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
- кашель
- кашляет
# Corvax-Localization-End
# Start-ADT-Tweak-AddComp-BloodCough
- кашляет кровью
- кашляет плазмой
# End-ADT-Tweak-AddComp-BloodCough

- type: emote
id: CatMeow
Expand Down
Loading