@@ -18,6 +18,9 @@ public abstract class SharedContentEyeSystem : EntitySystem
18
18
{
19
19
[ Dependency ] private readonly ISharedAdminManager _admin = default ! ;
20
20
21
+ // Admin flags required to ignore normal eye restrictions.
22
+ public const AdminFlags EyeFlag = AdminFlags . Debug ;
23
+
21
24
public const float ZoomMod = 1.5f ;
22
25
public static readonly Vector2 DefaultZoom = Vector2 . One ;
23
26
public static readonly Vector2 MinZoom = DefaultZoom * ( float ) Math . Pow ( ZoomMod , - 3 ) ;
@@ -29,6 +32,7 @@ public override void Initialize()
29
32
base . Initialize ( ) ;
30
33
SubscribeLocalEvent < ContentEyeComponent , ComponentStartup > ( OnContentEyeStartup ) ;
31
34
SubscribeAllEvent < RequestTargetZoomEvent > ( OnContentZoomRequest ) ;
35
+ SubscribeAllEvent < RequestPvsScaleEvent > ( OnPvsScale ) ;
32
36
SubscribeAllEvent < RequestEyeEvent > ( OnRequestEye ) ;
33
37
34
38
CommandBinds . Builder
@@ -84,12 +88,18 @@ public void SetZoom(EntityUid uid, Vector2 zoom, bool ignoreLimits = false, Cont
84
88
85
89
private void OnContentZoomRequest ( RequestTargetZoomEvent msg , EntitySessionEventArgs args )
86
90
{
87
- var ignoreLimit = msg . IgnoreLimit && _admin . HasAdminFlag ( args . SenderSession , AdminFlags . Debug ) ;
91
+ var ignoreLimit = msg . IgnoreLimit && _admin . HasAdminFlag ( args . SenderSession , EyeFlag ) ;
88
92
89
93
if ( TryComp < ContentEyeComponent > ( args . SenderSession . AttachedEntity , out var content ) )
90
94
SetZoom ( args . SenderSession . AttachedEntity . Value , msg . TargetZoom , ignoreLimit , eye : content ) ;
91
95
}
92
96
97
+ private void OnPvsScale ( RequestPvsScaleEvent ev , EntitySessionEventArgs args )
98
+ {
99
+ if ( args . SenderSession . AttachedEntity is { } uid && _admin . HasAdminFlag ( args . SenderSession , EyeFlag ) )
100
+ _eye . SetPvsScale ( uid , ev . Scale ) ;
101
+ }
102
+
93
103
private void OnRequestEye ( RequestEyeEvent msg , EntitySessionEventArgs args )
94
104
{
95
105
if ( args . SenderSession . AttachedEntity is not { } player )
@@ -116,6 +126,7 @@ private void OnContentEyeStartup(EntityUid uid, ContentEyeComponent component, C
116
126
117
127
public void ResetZoom ( EntityUid uid , ContentEyeComponent ? component = null )
118
128
{
129
+ _eye . SetPvsScale ( uid , 1 ) ;
119
130
SetZoom ( uid , DefaultZoom , eye : component ) ;
120
131
}
121
132
@@ -146,6 +157,15 @@ public sealed class RequestTargetZoomEvent : EntityEventArgs
146
157
public bool IgnoreLimit ;
147
158
}
148
159
160
+ /// <summary>
161
+ /// Client->Server request for new PVS scale.
162
+ /// </summary>
163
+ [ Serializable , NetSerializable ]
164
+ public sealed class RequestPvsScaleEvent ( float scale ) : EntityEventArgs
165
+ {
166
+ public float Scale = scale ;
167
+ }
168
+
149
169
/// <summary>
150
170
/// Sendable from client to server to request changing fov.
151
171
/// </summary>
0 commit comments