Skip to content

Commit 1d575ca

Browse files
Merge pull request #333 from UchuServer/enhancement/brig-rock-filter
Ignore Ghosting Filter for Gnarled Forest Special Case
2 parents 70cb754 + 72d504e commit 1d575ca

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Uchu.World/Objects/GameObjects/GameObject.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ public int GameMasterLevel
120120

121121
public ReplicaComponent[] ReplicaComponents => Components.OfType<ReplicaComponent>().ToArray();
122122

123+
public int TotalReplicaComponents => Components.OfType<ReplicaComponent>().Count();
124+
123125
public Player[] Viewers => Zone.Players.Where(p => p.Perspective.TryGetNetworkId(this, out _)).ToArray();
124126

125127
#endregion
@@ -353,7 +355,17 @@ public bool TryGetComponents<T>(out T[] result) where T : Component
353355
result = GetComponents<T>();
354356
return result.Length != default;
355357
}
358+
359+
public bool HasComponent(Type type)
360+
{
361+
return GetComponent(type) != default;
362+
}
356363

364+
public bool HasComponent<T>() where T : Component
365+
{
366+
return GetComponent<T>() != default;
367+
}
368+
357369
public void RemoveComponent(Type type)
358370
{
359371
var comp = GetComponent(type);

Uchu.World/Objects/Perspective/Filters/RenderDistanceFilter.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ public Task Tick()
4242
/// <returns>Whether the object passes the render distance check.</returns>
4343
public bool View(GameObject gameObject)
4444
{
45-
if (gameObject?.Transform == default)
45+
if (gameObject == default)
46+
return false;
47+
48+
if (gameObject.TotalReplicaComponents == 3 && gameObject.HasComponent<SimplePhysicsComponent>() && gameObject.HasComponent<RendererComponent>() && gameObject.HasComponent<TriggerComponent>())
49+
return true;
50+
51+
if (gameObject.Transform == default)
4652
return false;
4753

4854
if (gameObject is Player)

0 commit comments

Comments
 (0)