forked from space-wizards/RobustToolbox
-
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.
Move viewsubscriber to shared + handle eye targets
Need this stuff for AI.
- Loading branch information
1 parent
2178707
commit 2eb9937
Showing
6 changed files
with
99 additions
and
25 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
Robust.Client/GameObjects/EntitySystems/ViewSubscriberSystem.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,8 @@ | ||
using Robust.Shared.GameObjects; | ||
|
||
namespace Robust.Client.GameObjects; | ||
|
||
public sealed class ViewSubscriberSystem : SharedViewSubscriberSystem | ||
{ | ||
|
||
} |
12 changes: 0 additions & 12 deletions
12
Robust.Server/GameObjects/Components/Eye/ViewSubscriberComponent.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
11 changes: 11 additions & 0 deletions
11
Robust.Shared/GameObjects/Components/Eye/ViewSubscriberComponent.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,11 @@ | ||
using System.Collections.Generic; | ||
using Robust.Shared.Player; | ||
|
||
namespace Robust.Shared.GameObjects; | ||
|
||
// Not networked because doesn't do anything on client. | ||
[RegisterComponent] | ||
public sealed partial class ViewSubscriberComponent : Component | ||
{ | ||
internal readonly HashSet<ICommonSession> SubscribedSessions = new(); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
Robust.Shared/GameObjects/Systems/SharedViewSubscriberSystem.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,26 @@ | ||
using Robust.Shared.Player; | ||
|
||
namespace Robust.Shared.GameObjects; | ||
|
||
public abstract class SharedViewSubscriberSystem : EntitySystem | ||
{ | ||
// NOOP on client | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<ViewSubscriberComponent, ComponentShutdown>(OnViewSubscriberShutdown); | ||
} | ||
|
||
/// <summary> | ||
/// Subscribes the session to get PVS updates from the point of view of the specified entity. | ||
/// </summary> | ||
public virtual void AddViewSubscriber(EntityUid uid, ICommonSession session) {} | ||
|
||
/// <summary> | ||
/// Unsubscribes the session from getting PVS updates from the point of view of the specified entity. | ||
/// </summary> | ||
public virtual void RemoveViewSubscriber(EntityUid uid, ICommonSession session) {} | ||
|
||
protected virtual void OnViewSubscriberShutdown(EntityUid uid, ViewSubscriberComponent component, ComponentShutdown _) {} | ||
} |