This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- ToggleHealthOverlay Action - Moved files to better paths - Shared the disallowed events to prevent desync
- Loading branch information
1 parent
e478961
commit da14a79
Showing
13 changed files
with
163 additions
and
47 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Content.Client/SimpleStation14/StationAI/Systems/StationAISystem.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,30 @@ | ||
using Content.Shared.EntityHealthBar; | ||
using Content.Shared.SimpleStation14.StationAI.Events; | ||
|
||
namespace Content.Client.SimpleStation14.StationAI | ||
{ | ||
public sealed class StationAISystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeNetworkEvent<NetworkedAIHealthOverlayEvent>(OnHealthOverlayEvent); | ||
} | ||
|
||
private void OnHealthOverlayEvent(NetworkedAIHealthOverlayEvent args) | ||
{ | ||
var uid = args.Performer; | ||
|
||
if (!_entityManager.TryGetComponent<ShowHealthBarsComponent>(uid, out var health)) | ||
{ | ||
health = _entityManager.AddComponent<ShowHealthBarsComponent>(uid); | ||
} | ||
else { | ||
_entityManager.RemoveComponent<ShowHealthBarsComponent>(uid); | ||
} | ||
} | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
Content.Server/SimpleStation14/StationAI/Systems/StationAISystem.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,46 @@ | ||
using Content.Shared.Actions; | ||
using Content.Shared.EntityHealthBar; | ||
using Content.Shared.Actions.ActionTypes; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.SimpleStation14.StationAI.Events; | ||
|
||
namespace Content.Shared.SimpleStation14.StationAI | ||
{ | ||
public sealed class StationAISystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IEntityManager _entityManager = default!; | ||
[Dependency] private readonly SharedActionsSystem _actions = default!; | ||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<StationAIComponent, ComponentStartup>(OnStartup); | ||
SubscribeLocalEvent<StationAIComponent, ComponentShutdown>(OnShutdown); | ||
|
||
SubscribeLocalEvent<AIHealthOverlayEvent>(OnHealthOverlayEvent); | ||
} | ||
|
||
private void OnStartup(EntityUid uid, StationAIComponent component, ComponentStartup args) | ||
{ | ||
if (!_prototypeManager.TryIndex(component.Action, out InstantActionPrototype? proto)) return; | ||
var action = new InstantAction(proto); | ||
_actions.AddAction(uid, action, null); | ||
} | ||
|
||
private void OnShutdown(EntityUid uid, StationAIComponent component, ComponentShutdown args) | ||
{ | ||
if (!_prototypeManager.TryIndex(component.Action, out InstantActionPrototype? proto)) return; | ||
var action = new InstantAction(proto); | ||
_actions.RemoveAction(uid, action, null); | ||
} | ||
|
||
|
||
private void OnHealthOverlayEvent(AIHealthOverlayEvent args) | ||
{ | ||
RaiseNetworkEvent(new NetworkedAIHealthOverlayEvent(args.Performer)); | ||
args.Handled = true; | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../Telegnosis/AITelegnosisPowerComponent.cs → .../Components/AITelegnosisPowerComponent.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
4 changes: 2 additions & 2 deletions
4
...nosis/AITelegnosticProjectionComponent.cs → ...nents/AITelegnosticProjectionComponent.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,8 +1,8 @@ | ||
namespace Content.Shared.SimpleStation14.Abilities.Psionics | ||
namespace Content.Shared.SimpleStation14.StationAI | ||
{ | ||
[RegisterComponent] | ||
public sealed class AITelegnosticProjectionComponent : Component | ||
{ | ||
|
||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Content.Shared/SimpleStation14/StationAI/Components/StationAIComponent.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,9 @@ | ||
namespace Content.Shared.SimpleStation14.StationAI | ||
{ | ||
[RegisterComponent] | ||
public sealed class StationAIComponent : Component | ||
{ | ||
[DataField("action")] | ||
public string Action = "AIHealthOverlay"; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Content.Shared/SimpleStation14/StationAI/Events/StationAIEvents.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,24 @@ | ||
using Content.Shared.Actions; | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.SimpleStation14.StationAI.Events | ||
{ | ||
public sealed class AIHealthOverlayEvent : InstantActionEvent | ||
{ | ||
public AIHealthOverlayEvent() | ||
{ | ||
|
||
} | ||
} | ||
|
||
[Serializable, NetSerializable] | ||
public sealed class NetworkedAIHealthOverlayEvent : EntityEventArgs | ||
{ | ||
public EntityUid Performer = EntityUid.Invalid; | ||
|
||
public NetworkedAIHealthOverlayEvent(EntityUid performer) | ||
{ | ||
Performer = performer; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Content.Shared/SimpleStation14/StationAI/Systems/StationAISystem.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,30 @@ | ||
using Content.Shared.Throwing; | ||
using Content.Shared.Item; | ||
using Content.Shared.DragDrop; | ||
using Content.Shared.Strip.Components; | ||
|
||
namespace Content.Shared.SimpleStation14.StationAI | ||
{ | ||
public sealed class StationAISystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<StationAIComponent, ThrowAttemptEvent>(OnDisallowedEvent); | ||
SubscribeLocalEvent<StationAIComponent, PickupAttemptEvent>(OnDisallowedEvent); | ||
SubscribeLocalEvent<StationAIComponent, DropAttemptEvent>(OnDisallowedEvent); | ||
SubscribeLocalEvent<StationAIComponent, StrippingSlotButtonPressed>(OnStripEvent); | ||
} | ||
|
||
private void OnDisallowedEvent(EntityUid uid, Component component, CancellableEntityEventArgs args) | ||
{ | ||
args.Cancel(); | ||
} | ||
|
||
private void OnStripEvent(EntityUid uid, Component component, StrippingSlotButtonPressed args) | ||
{ | ||
return; | ||
} | ||
} | ||
} |
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