Files
QuartZ-dump/GlobalShared/Patches/MyTerminalBlockPatch.cs
2024-12-29 21:15:58 +01:00

24 lines
947 B
C#

using HarmonyLib;
using Sandbox.Game.Entities.Cube;
using VRage.Game;
namespace Global.Patches
{
[HarmonyPatch(typeof(MyTerminalBlock))]
public class MyTerminalBlockPatch
{
[HarmonyPatch("HasPlayerAccess")]
[HarmonyPrefix]
public static bool HasPlayerAccessPrefix(bool __result, long identityId,
MyRelationsBetweenPlayerAndBlock defaultNoUser = MyRelationsBetweenPlayerAndBlock.NoOwnership)
{
if (identityId != 0) return true;
var defaultIsEnemyNeutralOrNoOwnership = defaultNoUser == MyRelationsBetweenPlayerAndBlock.Enemies ||
defaultNoUser == MyRelationsBetweenPlayerAndBlock.Neutral ||
defaultNoUser == MyRelationsBetweenPlayerAndBlock.NoOwnership;
__result = !defaultIsEnemyNeutralOrNoOwnership;
return false;
}
}
}