mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
remove GetMethod usages
This commit is contained in:
parent
248527d65b
commit
88fcaec4b8
@ -6,10 +6,7 @@ namespace QSB.CampfireSync.WorldObjects
|
||||
public class QSBCampfire : WorldObject<Campfire>
|
||||
{
|
||||
public void StartRoasting()
|
||||
=> AttachedObject
|
||||
.GetType()
|
||||
.GetMethod("StartRoasting", BindingFlags.NonPublic | BindingFlags.Instance)
|
||||
.Invoke(AttachedObject, null);
|
||||
=> AttachedObject.StartRoasting();
|
||||
|
||||
public Campfire.State GetState()
|
||||
=> AttachedObject.GetState();
|
||||
|
@ -50,9 +50,7 @@ namespace QSB.QuantumSync.Patches
|
||||
__result = QSBPlayerManager.GetPlayersWithCameras()
|
||||
.Any(x => GeometryUtility.TestPlanesAABB(x.Camera.GetFrustumPlanes(), ____renderer.bounds))
|
||||
&& (!____checkFrustumOcclusion || QSBPlayerManager.GetPlayersWithCameras()
|
||||
.Any(x => !(bool)__instance.GetType()
|
||||
.GetMethod("IsOccludedFromPosition", BindingFlags.NonPublic | BindingFlags.Instance)
|
||||
.Invoke(__instance, new object[] { x.Camera.transform.position })));
|
||||
.Any(x => !__instance.IsOccludedFromPosition(x.Camera.transform.position)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -114,8 +114,6 @@ namespace QSB.QuantumSync
|
||||
return new Tuple<bool, List<PlayerInfo>>(false, new List<PlayerInfo>());
|
||||
}
|
||||
|
||||
var frustumMethod = tracker.GetType().GetMethod("IsInFrustum", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
|
||||
var playersWhoCanSee = new List<PlayerInfo>();
|
||||
var foundPlayers = false;
|
||||
foreach (var player in playersWithCameras)
|
||||
@ -126,7 +124,7 @@ namespace QSB.QuantumSync
|
||||
continue;
|
||||
}
|
||||
|
||||
var isInFrustum = (bool)frustumMethod.Invoke(tracker, new object[] { player.Camera.GetFrustumPlanes() });
|
||||
var isInFrustum = tracker.IsInFrustum(player.Camera.GetFrustumPlanes());
|
||||
if (isInFrustum)
|
||||
{
|
||||
playersWhoCanSee.Add(player);
|
||||
@ -144,7 +142,7 @@ namespace QSB.QuantumSync
|
||||
|
||||
public static IEnumerable<PlayerInfo> GetEntangledPlayers(QuantumObject obj)
|
||||
{
|
||||
if (!WorldObjectManager.AllObjectsReady)
|
||||
if (!AllObjectsReady)
|
||||
{
|
||||
return Enumerable.Empty<PlayerInfo>();
|
||||
}
|
||||
|
@ -34,10 +34,9 @@ namespace QSB.Utility
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetCallingType(StackTrace frame)
|
||||
{
|
||||
var stackFrame = frame.GetFrames().First(x => x.GetMethod().DeclaringType.Name != "DebugLog");
|
||||
return stackFrame.GetMethod().DeclaringType.Name;
|
||||
}
|
||||
private static string GetCallingType(StackTrace frame) =>
|
||||
frame.GetFrames()!
|
||||
.Select(x => x.GetMethod().DeclaringType!.Name)
|
||||
.First(x => x == nameof(DebugLog));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user