forked from AdventureTimeSS14/space_station
-
Notifications
You must be signed in to change notification settings - Fork 0
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 AdventureTimeSS14#252 from FrisKisDr/origmaster
Фикс мед худов
- Loading branch information
Showing
9 changed files
with
325 additions
and
303 deletions.
There are no files selected for viewing
461 changes: 230 additions & 231 deletions
461
Content.Client/Sirena/EntityHealthBar/EntityHealthBarOverlay.cs
Large diffs are not rendered by default.
Oops, something went wrong.
128 changes: 64 additions & 64 deletions
128
Content.Client/Sirena/EntityHealthBar/ShowHealthBarsSystem.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 |
---|---|---|
@@ -1,64 +1,64 @@ | ||
// using Content.Shared.Sirena.EntityHealthBar; | ||
// using Content.Shared.GameTicking; | ||
// using Robust.Client.Player; | ||
// using Robust.Client.Graphics; | ||
// using Robust.Client.GameObjects; | ||
// using Robust.Shared.Prototypes; | ||
// | ||
// namespace Content.Client.Sirena.EntityHealthBar | ||
// { | ||
// public sealed class ShowHealthBarsSystem : EntitySystem | ||
// { | ||
// [Dependency] private readonly IPlayerManager _player = default!; | ||
// [Dependency] private readonly IPrototypeManager _protoMan = default!; | ||
// [Dependency] private readonly IOverlayManager _overlayMan = default!; | ||
// | ||
// private EntityHealthBarOverlay _overlay = default!; | ||
// public override void Initialize() | ||
// { | ||
// base.Initialize(); | ||
// | ||
// SubscribeLocalEvent<ShowHealthBarsComponent, ComponentInit>(OnInit); | ||
// SubscribeLocalEvent<ShowHealthBarsComponent, ComponentRemove>(OnRemove); | ||
// SubscribeLocalEvent<ShowHealthBarsComponent, PlayerAttachedEvent>(OnPlayerAttached); | ||
// SubscribeLocalEvent<ShowHealthBarsComponent, PlayerDetachedEvent>(OnPlayerDetached); | ||
// SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart); | ||
// | ||
// _overlay = new(EntityManager, _protoMan); | ||
// } | ||
// | ||
// private void OnInit(EntityUid uid, ShowHealthBarsComponent component, ComponentInit args) | ||
// { | ||
// if (_player.LocalPlayer?.ControlledEntity == uid) | ||
// { | ||
// _overlayMan.AddOverlay(_overlay); | ||
// _overlay.DamageContainer = component.DamageContainer; | ||
// } | ||
// | ||
// | ||
// } | ||
// private void OnRemove(EntityUid uid, ShowHealthBarsComponent component, ComponentRemove args) | ||
// { | ||
// if (_player.LocalPlayer?.ControlledEntity == uid) | ||
// { | ||
// _overlayMan.RemoveOverlay(_overlay); | ||
// } | ||
// } | ||
// | ||
// private void OnPlayerAttached(EntityUid uid, ShowHealthBarsComponent component, PlayerAttachedEvent args) | ||
// { | ||
// _overlayMan.AddOverlay(_overlay); | ||
// _overlay.DamageContainer = component.DamageContainer; | ||
// } | ||
// | ||
// private void OnPlayerDetached(EntityUid uid, ShowHealthBarsComponent component, PlayerDetachedEvent args) | ||
// { | ||
// _overlayMan.RemoveOverlay(_overlay); | ||
// } | ||
// | ||
// private void OnRoundRestart(RoundRestartCleanupEvent args) | ||
// { | ||
// _overlayMan.RemoveOverlay(_overlay); | ||
// } | ||
// } | ||
// } | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.Sirena.EntityHealthBar; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.Player; | ||
using Robust.Shared.Player; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Client.Sirena.EntityHealthBar | ||
{ | ||
public sealed class ShowHealthBarsSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IPlayerManager _player = default!; | ||
[Dependency] private readonly IPrototypeManager _protoMan = default!; | ||
[Dependency] private readonly IOverlayManager _overlayMan = default!; | ||
|
||
private EntityHealthBarOverlay _overlay = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ShowHealthBarsComponent, ComponentInit>(OnInit); | ||
SubscribeLocalEvent<ShowHealthBarsComponent, ComponentRemove>(OnRemove); | ||
SubscribeLocalEvent<ShowHealthBarsComponent, LocalPlayerAttachedEvent>(OnPlayerAttached); | ||
SubscribeLocalEvent<ShowHealthBarsComponent, LocalPlayerDetachedEvent>(OnPlayerDetached); | ||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart); | ||
|
||
_overlay = new(EntityManager, _protoMan); | ||
} | ||
|
||
private void OnInit(EntityUid uid, ShowHealthBarsComponent component, ComponentInit args) | ||
{ | ||
if (_player.LocalPlayer?.ControlledEntity == uid) | ||
{ | ||
_overlayMan.AddOverlay(_overlay); | ||
_overlay.DamageContainer = component.DamageContainer; | ||
} | ||
|
||
|
||
} | ||
private void OnRemove(EntityUid uid, ShowHealthBarsComponent component, ComponentRemove args) | ||
{ | ||
if (_player.LocalPlayer?.ControlledEntity == uid) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
} | ||
|
||
private void OnPlayerAttached(EntityUid uid, ShowHealthBarsComponent component, LocalPlayerAttachedEvent args) | ||
{ | ||
_overlayMan.AddOverlay(_overlay); | ||
_overlay.DamageContainer = component.DamageContainer; | ||
} | ||
|
||
private void OnPlayerDetached(EntityUid uid, ShowHealthBarsComponent component, LocalPlayerDetachedEvent args) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
|
||
private void OnRoundRestart(RoundRestartCleanupEvent args) | ||
{ | ||
_overlayMan.RemoveOverlay(_overlay); | ||
} | ||
} | ||
} |
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
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
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