forked from space-wizards/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Gnomeev/Cult-Storage
Cult Heal
- Loading branch information
Showing
9 changed files
with
141 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
using Content.Shared.SS220.CultYogg.EntitySystems; | ||
|
||
namespace Content.Client.SS220.CultYogg; | ||
|
||
public sealed partial class CultYoggHealSystem : SharedCultYoggHealSystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
using Content.Shared.SS220.CultYogg.Components; | ||
using Content.Shared.SS220.CultYogg.EntitySystems; | ||
using Content.Server.EUI; | ||
using Content.Server.Ghost; | ||
using Content.Server.Popups; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Mind; | ||
using Content.Shared.Mobs; | ||
using Content.Shared.Mobs.Components; | ||
using Content.Shared.Mobs.Systems; | ||
using Content.Shared.Popups; | ||
|
||
namespace Content.Server.SS220.CultYogg; | ||
|
||
public sealed class CultYoggHealSystem : SharedCultYoggHealSystem | ||
{ | ||
[Dependency] private readonly DamageableSystem _damageable = default!; | ||
[Dependency] private readonly EuiManager _euiManager = default!; | ||
[Dependency] private readonly MobStateSystem _mobState = default!; | ||
[Dependency] private readonly MobThresholdSystem _mobThreshold = default!; | ||
[Dependency] private readonly PopupSystem _popup = default!; | ||
[Dependency] private readonly SharedMindSystem _mind = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<CultYoggHealComponent, ComponentStartup>(SetupMiGoHeal); | ||
} | ||
private void SetupMiGoHeal(Entity<CultYoggHealComponent> uid, ref ComponentStartup args) | ||
{ | ||
uid.Comp.NextIncidentTime = uid.Comp.TimeBetweenIncidents; | ||
} | ||
public override void Update(float frameTime) | ||
{ | ||
base.Update(frameTime); | ||
|
||
var query = EntityQueryEnumerator<CultYoggHealComponent, MobStateComponent>(); | ||
while (query.MoveNext(out var uid, out var healComp, out var _)) | ||
{ | ||
healComp.NextIncidentTime -= frameTime; | ||
|
||
if (healComp.NextIncidentTime > 0) | ||
continue; | ||
|
||
Heal(uid, healComp); | ||
|
||
healComp.NextIncidentTime += healComp.TimeBetweenIncidents; | ||
} | ||
} | ||
public void Heal(EntityUid uid, CultYoggHealComponent component) | ||
{ | ||
if (!TryComp<MobStateComponent>(uid, out var mobComp)) | ||
return; | ||
|
||
if (!TryComp<DamageableComponent>(uid, out var damageableComp)) | ||
return; | ||
|
||
_damageable.TryChangeDamage(uid, component.Heal, true, interruptsDoAfters: false, damageableComp); | ||
|
||
if (!_mobState.IsDead(uid, mobComp)) | ||
return; | ||
|
||
if (_mobThreshold.TryGetDeadThreshold(uid, out var threshold) && damageableComp.TotalDamage < threshold) | ||
{ | ||
_mobState.ChangeMobState(uid, MobState.Critical); | ||
_popup.PopupEntity(Loc.GetString("cult-yogg-resurrected-by-heal", ("target", uid)), uid, PopupType.Medium); | ||
|
||
if (!_mind.TryGetMind(uid, out var _, out var mind)) | ||
return; | ||
|
||
if (mind.Session != null && mind.CurrentEntity != uid) | ||
_euiManager.OpenEui(new ReturnToBodyEui(mind, _mind), mind.Session); | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
Content.Shared/SS220/CultYogg/Components/CultYoggHealComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// © SS220, An EULA/CLA with a hosting restriction, full text: https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/CLA.txt | ||
using Robust.Shared.GameStates; | ||
using System.Text.Json.Serialization; | ||
using Content.Shared.Damage; | ||
|
||
namespace Content.Shared.SS220.CultYogg.Components; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class CultYoggHealComponent : Component | ||
{ | ||
/// <summary> | ||
/// Damage that heals in a single incident | ||
/// </summary> | ||
[DataField(required: true)] | ||
public DamageSpecifier Heal = new DamageSpecifier // god forgive me for hardcoding values | ||
{ | ||
DamageDict = new() | ||
{ | ||
{ "Slash", -6 }, | ||
{ "Blunt", -6 }, | ||
{ "Piercing", -6}, | ||
{"Heat", -4}, | ||
{"Cold", -4}, | ||
{"Shock", -4}, | ||
{"Airloss", -5}, | ||
} | ||
}; | ||
/// <summary> | ||
/// Time between each healing incident | ||
/// </summary> | ||
public float TimeBetweenIncidents = 2.5f; // most balanced value | ||
|
||
public float NextIncidentTime; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
Content.Shared/SS220/CultYogg/Components/MiGoHealComponent.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters