-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New component NoShowFov для маски Хроноса
- Loading branch information
1 parent
ea62d5c
commit d71df94
Showing
4 changed files
with
44 additions
and
21 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,6 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.ADT.NoShowFov; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class NoShowFovComponent : Component { } |
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,36 @@ | ||
using Content.Shared.Inventory.Events; | ||
using Content.Shared.ADT.NoShowFov; | ||
|
||
namespace Content.Client.ADT.NoShowFov; | ||
|
||
public sealed class NoShowFovSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedEyeSystem _eye = default!; | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<NoShowFovComponent, GotEquippedEvent>(OnEquipped); | ||
SubscribeLocalEvent<NoShowFovComponent, GotUnequippedEvent>(OnUnequipped); | ||
} | ||
|
||
private void OnEquipped(EntityUid uid, NoShowFovComponent component, ref GotEquippedEvent args) | ||
{ | ||
ToggleFov(args.Equipee, false); | ||
} | ||
|
||
private void OnUnequipped(EntityUid uid, NoShowFovComponent component, ref GotUnequippedEvent args) | ||
{ | ||
ToggleFov(args.Equipee, true); | ||
} | ||
|
||
private void ToggleFov(EntityUid entity, bool drawFov) | ||
{ | ||
if (TryComp<EyeComponent>(entity, out var _)) | ||
{ | ||
_eye.SetDrawFov(entity, drawFov); | ||
} | ||
} | ||
} | ||
|
||
|
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