private static bool CheckConcealForce(IMyCubeGrid grid, ulong steamId) { List <IMySlimBlock> blocks = new List <IMySlimBlock>(); // Live dangerously grid.GetBlocks(blocks, x => x.FatBlock != null); foreach (IMySlimBlock block in blocks) { IMyCubeBlock cubeBlock = block.FatBlock; if (cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_MedicalRoom)) { MyObjectBuilder_MedicalRoom medical = (MyObjectBuilder_MedicalRoom)cubeBlock.GetObjectBuilderCubeBlock(); if (!medical.Enabled) { continue; } Sandbox.ModAPI.Ingame.IMyTerminalBlock terminalBlock = (Sandbox.ModAPI.Ingame.IMyTerminalBlock)cubeBlock; long playerId = PlayerMap.Instance.GetFastPlayerIdFromSteamId(steamId); if (medical.Owner == playerId || (medical.ShareMode == MyOwnershipShareModeEnum.Faction && Player.CheckPlayerSameFaction(medical.Owner, playerId))) { return(true); } } } return(false); }
public static void SetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, bool use) { if (block is IMyInventoryOwner) { ((IMyInventoryOwner)block).UseConveyorSystem = use; } }
public void listActions(Sandbox.ModAPI.Ingame.IMyTerminalBlock block, Logger log, Config config) { List <ITerminalAction> actions = new List <ITerminalAction>(); block.GetActions(actions); for (int i = 0; i < actions.Count; i++) { log.log(config.statusPanel, actions[i].Name.ToString() + "(" + actions[i].Id + ")", ErrorSeverity.Notice); } }
public void listProperties(Sandbox.ModAPI.Ingame.IMyTerminalBlock block, Logger log, Config config) { List <ITerminalProperty> properties = new List <ITerminalProperty>(); block.GetProperties(properties); for (int i = 0; i < properties.Count; i++) { log.log(config.statusPanel, properties[i].Id, ErrorSeverity.Notice); } }
public IMyTerminalBlock GetTargetKeyAttackPoint(IMyCubeGrid grid) { TargetDetails details; IMyTerminalBlock block = null; if (targets.TryGetValue(grid, out details)) { block = details.GetTargetKeyAttackPoint(); } return(block); }
public static VRage.ModAPI.Ingame.IMyInventory GetInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, int index) { if (block is IMyInventoryOwner) { return(((IMyInventoryOwner)block).GetInventory(index)); } else { return(null); } }
public static int GetInventoryCount(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { var entity = block as MyEntity; if (entity == null) { return(0); } return(entity.InventoryCount); }
public static int GetInventoryCount(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { if (block is IMyInventoryOwner) { return(((IMyInventoryOwner)block).InventoryCount); } else { return(0); } }
public static bool GetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { if (block is IMyInventoryOwner) { return(((IMyInventoryOwner)block).UseConveyorSystem); } else { return(false); } }
public static Sandbox.ModAPI.Interfaces.IMyInventory GetInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, int index) { if (block.HasInventory()) { return(((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)block).GetInventory(index)); } else { return(null); } }
public static void SetCustomName(Sandbox.ModAPI.Ingame.IMyTerminalBlock terminalBlock, string text) { try { StringBuilder newCustomName = new StringBuilder(text); InvokeStaticMethod(terminalBlock.GetType(), TerminalBlockBroadcastCustomNameMethod, new object[] { terminalBlock, newCustomName }); } catch (Exception ex) { LogManager.APILog.WriteLineAndConsole(string.Format("SetCustomName(): {0}", ex.ToString())); } }
public static bool HasInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { var entity = block as MyEntity; if (entity == null) { return(false); } if (!(block is IMyInventoryOwner)) { return(false); } return(entity.HasInventory); }
public static VRage.Game.ModAPI.Ingame.IMyInventory GetInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, int index) { var entity = block as MyEntity; if (entity == null) { return(null); } if (!entity.HasInventory) { return(null); } return(entity.GetInventoryBase(index) as IMyInventory); }
private static bool TAPI_IsShieldUp(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_IsShieldUp(arg as IMyTerminalBlock);
public static bool HasInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { return(block is Sandbox.ModAPI.Interfaces.IMyInventoryOwner); }
public static void ApplyAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName, List <TerminalActionParameter> parameters) { block.GetActionWithName(actionName).Apply(block, parameters); }
public static bool HasAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName) { return(block.GetActionWithName(actionName) != null); }
private static double TAPI_GetDistanceToShield(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg1, Vector3D arg2) => TAPI_GetDistanceToShield(arg1 as IMyTerminalBlock, arg2);
public static void ApplyAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName) { block.GetActionWithName(actionName).Apply(block); }
private static bool CheckConcealBlockRules(IMyCubeGrid grid, List <IMyPlayer> players) { List <IMySlimBlock> blocks = new List <IMySlimBlock>(); // Live dangerously grid.GetBlocks(blocks, x => x.FatBlock != null); //CubeGrids.GetAllConnectedBlocks(m_processedGrids, grid, blocks, x => x.FatBlock != null); int beaconCount = 0; //bool found = false; //bool powered = false; foreach (IMySlimBlock block in blocks) { IMyCubeBlock cubeBlock = block.FatBlock; if (cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_Beacon)) { Sandbox.ModAPI.Ingame.IMyBeacon beacon = (Sandbox.ModAPI.Ingame.IMyBeacon)cubeBlock; //MyObjectBuilder_Beacon beacon = (MyObjectBuilder_Beacon)cubeBlock.GetObjectBuilderCubeBlock(); beaconCount++; // Keep this return here, as 4 beacons always means true if (beaconCount >= 4) { return(true); } if (!beacon.Enabled) { continue; } Sandbox.ModAPI.Ingame.IMyTerminalBlock terminalBlock = (Sandbox.ModAPI.Ingame.IMyTerminalBlock)cubeBlock; // Console.WriteLine("Found: {0} {1} {2}", beacon.BroadcastRadius, terminalBlock.IsWorking, terminalBlock.IsFunctional); //if (!terminalBlock.IsWorking) //{ // continue; //} foreach (IMyPlayer player in players) { double distance = 0d; if (Entity.GetDistanceBetweenPointAndPlayer(grid.GetPosition(), player, out distance)) { if (distance < beacon.Radius) { // Console.WriteLine("Not concealed due to broadcast radius"); //found = true; //break; return(true); } } } } if (cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_RadioAntenna)) { //MyObjectBuilder_RadioAntenna antenna = (MyObjectBuilder_RadioAntenna)cubeBlock.GetObjectBuilderCubeBlock(); Sandbox.ModAPI.Ingame.IMyRadioAntenna antenna = (Sandbox.ModAPI.Ingame.IMyRadioAntenna)cubeBlock; if (!antenna.Enabled) { continue; } Sandbox.ModAPI.Ingame.IMyTerminalBlock terminalBlock = (Sandbox.ModAPI.Ingame.IMyTerminalBlock)cubeBlock; //if (!terminalBlock.IsWorking) // continue; foreach (IMyPlayer player in players) { double distance = 0d; if (Entity.GetDistanceBetweenPointAndPlayer(grid.GetPosition(), player, out distance)) { if (distance < antenna.Radius) { // Console.WriteLine("Not concealed due to antenna broadcast radius"); //found = true; //break; return(true); } } } } if (cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_MedicalRoom)) { //MyObjectBuilder_MedicalRoom medical = (MyObjectBuilder_MedicalRoom)cubeBlock.GetObjectBuilderCubeBlock(); Sandbox.ModAPI.Ingame.IMyMedicalRoom medical = (Sandbox.ModAPI.Ingame.IMyMedicalRoom)cubeBlock; if (!medical.Enabled) { continue; } Sandbox.ModAPI.Ingame.IMyFunctionalBlock functionalBlock = (Sandbox.ModAPI.Ingame.IMyFunctionalBlock)cubeBlock; //if (!terminalBlock.IsWorking) // continue; if (PluginSettings.Instance.DynamicConcealIncludeMedBays) { lock (m_online) { foreach (ulong connectedPlayer in m_online) { //if (PlayerMap.Instance.GetPlayerIdsFromSteamId(connectedPlayer).Count < 1) //continue; //long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(connectedPlayer).First(); long playerId = PlayerMap.Instance.GetFastPlayerIdFromSteamId(connectedPlayer); if (functionalBlock.OwnerId == playerId || (functionalBlock.GetUserRelationToOwner(playerId) == Sandbox.Common.MyRelationsBetweenPlayerAndBlock.FactionShare)) //if (functionalBlock.Owner == playerId || (functionalBlock.ShareMode == MyOwnershipShareModeEnum.Faction && Player.CheckPlayerSameFaction(functionalBlock.Owner, playerId))) //if (medical.HasPlayerAccess(playerId)) { return(true); } } } /* * foreach (ulong connectedPlayer in PlayerManager.Instance.ConnectedPlayers) * { * //if (PlayerMap.Instance.GetPlayerIdsFromSteamId(connectedPlayer).Count < 1) * //continue; * * //long playerId = PlayerMap.Instance.GetPlayerIdsFromSteamId(connectedPlayer).First(); * long playerId = PlayerMap.Instance.GetFastPlayerIdFromSteamId(connectedPlayer); * //if (medical.Owner == playerId || (medical.ShareMode == MyOwnershipShareModeEnum.Faction && Player.CheckPlayerSameFaction(medical.Owner, playerId))) * if(medical.HasPlayerAccess(playerId)) * { * return true; * } * } */ } else { return(true); } } if (cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_Refinery) || cubeBlock.BlockDefinition.TypeId == typeof(MyObjectBuilder_Assembler)) { //MyObjectBuilder_ProductionBlock production = (MyObjectBuilder_ProductionBlock)cubeBlock.GetObjectBuilderCubeBlock(); Sandbox.ModAPI.Ingame.IMyProductionBlock production = (Sandbox.ModAPI.Ingame.IMyProductionBlock)cubeBlock; if (!production.Enabled) { continue; } if (production.IsProducing) { return(true); } } foreach (string subType in PluginSettings.Instance.DynamicConcealIgnoreSubTypeList) { if (cubeBlock.BlockDefinition.SubtypeName.Contains(subType)) { // Console.WriteLine("Not concealed due subtype"); //found = true; return(true); } } } return(false); }
private static Vector3D?TAPI_GetClosestShieldPoint(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg1, Vector3D arg2) => TAPI_GetClosestShieldPoint(arg1 as IMyTerminalBlock, arg2);
public static bool HasAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string Action) { return(!(block.GetActionWithName(Action) == null)); }
public static bool HasInventory(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block) { return(((IMyInventoryOwner)block).HasInventory); }
private static bool TAPI_EntityBypass(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg1, VRage.Game.ModAPI.Ingame.IMyEntity arg2, bool arg3) => TAPI_EntityBypass(arg1 as IMyTerminalBlock, arg2 as IMyEntity, arg3);
private static float TAPI_GetMaxHpCap(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_GetMaxHpCap(arg as IMyTerminalBlock);
private static int TAPI_HpToChargeRatio(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_HpToChargeRatio(arg as IMyTerminalBlock);
private static float TAPI_GetCharge(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_GetCharge(arg as IMyTerminalBlock);
private static float TAPI_GetPowerUsed(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_GetPowerUsed(arg as IMyTerminalBlock);
private static int TAPI_GetShieldHeatLevel(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_GetShieldHeatLevel(arg as IMyTerminalBlock);
private static string TAPI_ShieldStatus(Sandbox.ModAPI.Ingame.IMyTerminalBlock arg) => TAPI_ShieldStatus(arg as IMyTerminalBlock);