24 lines
947 B
C#
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;
|
|
}
|
|
}
|
|
} |