init
This commit is contained in:
51
Connector.cs
Normal file
51
Connector.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public class Main
|
||||||
|
{
|
||||||
|
void Main()
|
||||||
|
{
|
||||||
|
IMyBlockGroup batteryGroup = GridTerminalSystem.GetBlockGroupWithName("Batteries");
|
||||||
|
List<IMyBatteryBlock> batteries = new List<IMyBatteryBlock>();
|
||||||
|
batteryGroup.GetBlocksOfType(batteries, block => block.IsSameConstructAs(Me));
|
||||||
|
|
||||||
|
List<IMyTerminalBlock> engines = new List<IMyTerminalBlock>();
|
||||||
|
GridTerminalSystem.GetBlockGroupWithName("Engines").GetBlocks(engines, block => block.IsSameConstructAs(Me));
|
||||||
|
|
||||||
|
IMyShipConnector connector = GridTerminalSystem.GetBlockWithName("Connector") as IMyShipConnector;
|
||||||
|
|
||||||
|
if (connector.Status == MyShipConnectorStatus.Connectable)
|
||||||
|
{
|
||||||
|
connector.GetActionWithName("SwitchLock").Apply(connector);
|
||||||
|
|
||||||
|
if (connector.Status != MyShipConnectorStatus.Connected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var engine in engines)
|
||||||
|
{
|
||||||
|
engine.GetActionWithName("OnOff_Off").Apply(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var battery in batteries)
|
||||||
|
{
|
||||||
|
battery.GetActionWithName("Recharge").Apply(battery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (connector.Status == MyShipConnectorStatus.Connected)
|
||||||
|
{
|
||||||
|
foreach (var battery in batteries)
|
||||||
|
{
|
||||||
|
battery.GetActionWithName("Auto").Apply(battery);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var engine in engines)
|
||||||
|
{
|
||||||
|
engine.GetActionWithName("OnOff_On").Apply(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
connector.GetActionWithName("SwitchLock").Apply(connector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyAdvancedDoor.cs
Normal file
11
Ingame/IMyAdvancedDoor.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyAdvancedDoor : IMyDoor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyAirtightDoorBase.cs
Normal file
11
Ingame/IMyAirtightDoorBase.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyAirtightDoorBase : IMyDoor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyAirtightHangarDoor.cs
Normal file
11
Ingame/IMyAirtightHangarDoor.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyAirtightHangarDoor : IMyAirtightDoorBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyAirtightSlideDoor.cs
Normal file
11
Ingame/IMyAirtightSlideDoor.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyAirtightSlideDoor : IMyAirtightDoorBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyAssembler.cs
Normal file
12
Ingame/IMyAssembler.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyAssembler : IMyProductionBlock
|
||||||
|
{
|
||||||
|
bool DisassembleEnabled { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
23
Ingame/IMyBatteryBlock.cs
Normal file
23
Ingame/IMyBatteryBlock.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyBatteryBlock : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool HasCapacityRemaining { get; }
|
||||||
|
|
||||||
|
float CurrentStoredPower { get; }
|
||||||
|
float MaxStoredPower { get; }
|
||||||
|
|
||||||
|
float CurrentInput { get; }
|
||||||
|
float CurrentOutput { get; }
|
||||||
|
bool IsCharging { get; }
|
||||||
|
|
||||||
|
bool OnlyRecharge { get; set; }
|
||||||
|
bool OnlyDischarge { get; set; }
|
||||||
|
bool SemiautoEnabled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyBeacon.cs
Normal file
12
Ingame/IMyBeacon.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyBeacon : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
float Radius { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Ingame/IMyBlockGroup.cs
Normal file
17
Ingame/IMyBlockGroup.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Sandbox.ModAPI;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyBlockGroup
|
||||||
|
{
|
||||||
|
void GetBlocks(List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null);
|
||||||
|
void GetBlocksOfType<T>(List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null) where T : class;
|
||||||
|
void GetBlocksOfType<T>(List<T> blocks, Func<T, bool> collect = null) where T : class;
|
||||||
|
|
||||||
|
string Name { get;}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
Ingame/IMyCameraBlock.cs
Normal file
72
Ingame/IMyCameraBlock.cs
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyCameraBlock:IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Does a raycast in the direction the camera is facing. Pitch and Yaw are in degrees.
|
||||||
|
/// Will return an empty struct if distance or angle are out of bounds.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="distance"></param>
|
||||||
|
/// <param name="pitch"></param>
|
||||||
|
/// <param name="yaw"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
MyDetectedEntityInfo Raycast(double distance, float pitch = 0, float yaw = 0);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does a raycast to the given point.
|
||||||
|
/// Will return an empty struct if distance or angle are out of bounds.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="targetPos"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
MyDetectedEntityInfo Raycast(Vector3D targetPos);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Does a raycast in the given direction.
|
||||||
|
/// Will return an empty struct if distance or angle are out of bounds.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="distance"></param>
|
||||||
|
/// <param name="targetDirection"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
MyDetectedEntityInfo Raycast(double distance, Vector3D targetDirection);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum distance that this camera can scan, based on the time since the last scan.
|
||||||
|
/// </summary>
|
||||||
|
double AvailableScanRange { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// When this is true, the available raycast distance will count up, and power usage is increased.
|
||||||
|
/// </summary>
|
||||||
|
bool EnableRaycast { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if the camera can scan the given distance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="distance"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool CanScan(double distance);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the number of milliseconds until the camera can do a raycast of the given distance.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="distance"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
int TimeUntilScan(double distance);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum positive angle you can apply for pitch and yaw.
|
||||||
|
/// </summary>
|
||||||
|
float RaycastConeLimit { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the maximum distance you can request a raycast. -1 means infinite.
|
||||||
|
/// </summary>
|
||||||
|
double RaycastDistanceLimit { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyCargoContainer.cs
Normal file
11
Ingame/IMyCargoContainer.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyCargoContainer : IMyTerminalBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyCockpit.cs
Normal file
11
Ingame/IMyCockpit.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyCockpit : IMyShipController
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyCollector.cs
Normal file
12
Ingame/IMyCollector.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyCollector : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyConveyor.cs
Normal file
13
Ingame/IMyConveyor.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyConveyor : IMyCubeBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
104
Ingame/IMyConveyorSorter.cs
Normal file
104
Ingame/IMyConveyorSorter.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game;
|
||||||
|
using VRage.Game.ObjectBuilders.Definitions;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the current mode of a conveyor sorter.
|
||||||
|
/// </summary>
|
||||||
|
public enum MyConveyorSorterMode
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The items in the filter list are the only items allowed through this sorter.
|
||||||
|
/// </summary>
|
||||||
|
Whitelist,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The items in the filter list are not allowed through this sorter.
|
||||||
|
/// </summary>
|
||||||
|
Blacklist
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct MyInventoryItemFilter
|
||||||
|
{
|
||||||
|
public static implicit operator MyInventoryItemFilter(MyDefinitionId definitionId)
|
||||||
|
{
|
||||||
|
return new MyInventoryItemFilter(definitionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether all subtypes of the given item ID should pass this filter check.
|
||||||
|
/// </summary>
|
||||||
|
public readonly bool AllSubTypes;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies an item to filter. Set <see cref="AllSubTypes"/> to true to only check the main type part of this ID.
|
||||||
|
/// </summary>
|
||||||
|
public readonly MyDefinitionId ItemId;
|
||||||
|
|
||||||
|
public MyInventoryItemFilter(string itemId, bool allSubTypes = false) : this()
|
||||||
|
{
|
||||||
|
ItemId = MyDefinitionId.Parse(itemId);
|
||||||
|
AllSubTypes = allSubTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyInventoryItemFilter(MyDefinitionId itemId, bool allSubTypes = false) : this()
|
||||||
|
{
|
||||||
|
ItemId = itemId;
|
||||||
|
AllSubTypes = allSubTypes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IMyConveyorSorter : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the sorter should drain any inventories connected to it and push them to the other side - as long
|
||||||
|
/// as the items passes the filtering as defined by the filter list (<see cref="GetFilterList"/>) and <see cref="Mode"/>.
|
||||||
|
/// </summary>
|
||||||
|
bool DrainAll { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the current mode of this sorter. Use <see cref="SetWhitelist"/> or <see cref="SetBlacklist"/> to change the mode.
|
||||||
|
/// </summary>
|
||||||
|
MyConveyorSorterMode Mode { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the items currently being allowed through or rejected, depending on the <see cref="Mode"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="items"></param>
|
||||||
|
void GetFilterList(List<MyInventoryItemFilter> items);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a single item to the filter list. See <see cref="SetFilter"/> to change the filter mode and/or fill
|
||||||
|
/// the entire list in one go.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
void AddItem(MyInventoryItemFilter item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a single item from the filter list. See <see cref="SetFilter"/> to change the filter mode and/or clear
|
||||||
|
/// the entire list in one go.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
void RemoveItem(MyInventoryItemFilter item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether a given item type is allowed through the sorter, depending on the filter list (<see cref="GetFilterList"/>) and <see cref="Mode"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool IsAllowed(MyDefinitionId id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the sorter to desired mode and filters the provided items. You can pass in <c>null</c> to empty the list.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mode"></param>
|
||||||
|
/// <param name="items"></param>
|
||||||
|
void SetFilter(MyConveyorSorterMode mode, List<MyInventoryItemFilter> items);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyConveyorTube.cs
Normal file
13
Ingame/IMyConveyorTube.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyConveyorTube : IMyCubeBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyCryoChamber.cs
Normal file
12
Ingame/IMyCryoChamber.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyCryoChamber : IMyCockpit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyDecoy.cs
Normal file
12
Ingame/IMyDecoy.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyDecoy : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Ingame/IMyDoor.cs
Normal file
20
Ingame/IMyDoor.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyDoor : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether door is opened or closed. True when door is opened.
|
||||||
|
/// </summary>
|
||||||
|
bool Open { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Door state, zero is fully closed. One is fully opened.
|
||||||
|
/// </summary>
|
||||||
|
float OpenRatio { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyExtendedPistonBase.cs
Normal file
12
Ingame/IMyExtendedPistonBase.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game.ModAPI;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyExtendedPistonBase : IMyPistonBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyFunctionalBlock.cs
Normal file
13
Ingame/IMyFunctionalBlock.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyFunctionalBlock : IMyTerminalBlock
|
||||||
|
{
|
||||||
|
bool Enabled { get; }
|
||||||
|
void RequestEnable(bool enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
Ingame/IMyGridProgramRuntimeInfo.cs
Normal file
47
Ingame/IMyGridProgramRuntimeInfo.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides runtime info for a running grid program.
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyGridProgramRuntimeInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the time elapsed since the last time the Main method of this program was run. This property returns no
|
||||||
|
/// valid data neither in the constructor nor the Save method.
|
||||||
|
/// </summary>
|
||||||
|
TimeSpan TimeSinceLastRun { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the number of milliseconds it took to execute the Main method the last time it was run. This property returns no valid
|
||||||
|
/// data neither in the constructor nor the Save method.
|
||||||
|
/// </summary>
|
||||||
|
double LastRunTimeMs { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the maximum number of significant instructions that can be executing during a single run, including
|
||||||
|
/// any other programmable blocks invoked immediately.
|
||||||
|
/// </summary>
|
||||||
|
int MaxInstructionCount { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current number of significant instructions executed.
|
||||||
|
/// </summary>
|
||||||
|
int CurrentInstructionCount { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the maximum number of method calls that can be executed during a single run, including
|
||||||
|
/// any other programmable blocks invoked immediately.
|
||||||
|
/// </summary>
|
||||||
|
int MaxMethodCallCount { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current number of method calls.
|
||||||
|
/// </summary>
|
||||||
|
int CurrentMethodCallCount { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Ingame/IMyGridTerminalSystem.cs
Normal file
20
Ingame/IMyGridTerminalSystem.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using VRage.Collections;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyGridTerminalSystem
|
||||||
|
{
|
||||||
|
void GetBlocks(List<IMyTerminalBlock> blocks);
|
||||||
|
void GetBlockGroups(List<IMyBlockGroup> blockGroups, Func<IMyBlockGroup, bool> collect = null);
|
||||||
|
void GetBlocksOfType<T>(List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null) where T: class;
|
||||||
|
void GetBlocksOfType<T>(List<T> blocks, Func<T, bool> collect = null) where T: class;
|
||||||
|
void SearchBlocksOfName(string name, List<IMyTerminalBlock> blocks, Func<IMyTerminalBlock, bool> collect = null);
|
||||||
|
IMyTerminalBlock GetBlockWithName(string name);
|
||||||
|
IMyBlockGroup GetBlockGroupWithName(string name);
|
||||||
|
IMyTerminalBlock GetBlockWithId(long id);
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Ingame/IMyGyro.cs
Normal file
16
Ingame/IMyGyro.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyGyro : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
float GyroPower { get; }
|
||||||
|
bool GyroOverride { get; }
|
||||||
|
float Yaw { get; }
|
||||||
|
float Pitch { get; }
|
||||||
|
float Roll { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyJumpDrive.cs
Normal file
11
Ingame/IMyJumpDrive.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyJumpDrive : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyLCDScreen.cs
Normal file
11
Ingame/IMyLCDScreen.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyLCDScreen
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
74
Ingame/IMyLargeTurretBase.cs
Normal file
74
Ingame/IMyLargeTurretBase.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRageMath;
|
||||||
|
using Sandbox.ModAPI;
|
||||||
|
using VRage.ModAPI;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyLargeTurretBase : IMyUserControllableGun
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether a block is locally or remotely controlled.
|
||||||
|
/// </summary>
|
||||||
|
bool IsUnderControl { get; }
|
||||||
|
bool CanControl { get; }
|
||||||
|
float Range { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tracks entity with enabled position prediction
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
void TrackTarget(IMyEntity entity);
|
||||||
|
/// <summary>
|
||||||
|
/// Tracks given target with enabled position prediction
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
/// <param name="velocity"></param>
|
||||||
|
void TrackTarget(Vector3D pos, Vector3 velocity);
|
||||||
|
/// <summary>
|
||||||
|
/// Tracks target without position prediction
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Entity"></param>
|
||||||
|
void SetTarget(IMyEntity Entity);
|
||||||
|
/// <summary>
|
||||||
|
/// Targets given position
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pos"></param>
|
||||||
|
void SetTarget(Vector3D pos);
|
||||||
|
/// <summary>
|
||||||
|
/// Sets/gets elevation of turret, this method is not synced, you need to sync elevation manually
|
||||||
|
/// </summary>
|
||||||
|
float Elevation { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// method used to sync elevation of turret , you need to call it to sync elevation for other clients/server
|
||||||
|
/// </summary>
|
||||||
|
void SyncElevation();
|
||||||
|
/// <summary>
|
||||||
|
/// Sets/gets azimuth of turret, this method is not synced, you need to sync azimuth manually
|
||||||
|
/// </summary>
|
||||||
|
float Azimuth { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// method used to sync azimuth, you need to call it to sync azimuth for other clients/server
|
||||||
|
/// </summary>
|
||||||
|
void SyncAzimuth();
|
||||||
|
/// <summary>
|
||||||
|
/// enable/disable idle rotation for turret, this method is not synced, you need to sync manually
|
||||||
|
/// </summary>
|
||||||
|
bool EnableIdleRotation { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// method used to sync idle rotation and elevation, you need to call it to sync rotation and elevation for other clients/server
|
||||||
|
/// </summary>
|
||||||
|
void SyncEnableIdleRotation();
|
||||||
|
/// <summary>
|
||||||
|
/// Checks is AI is enabled for turret
|
||||||
|
/// </summary>
|
||||||
|
bool AIEnabled { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// resert targeting to default values
|
||||||
|
/// </summary>
|
||||||
|
void ResetTargetingToDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
43
Ingame/IMyLaserAntenna.cs
Normal file
43
Ingame/IMyLaserAntenna.cs
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Laser antenna block interface
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyLaserAntenna : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// get target coordinates
|
||||||
|
/// </summary>
|
||||||
|
Vector3D TargetCoords
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set coordinates of target
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="coords">GPS coordinates string</param>
|
||||||
|
void SetTargetCoords(string coords);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connect to target defined by SetTargetCoords
|
||||||
|
/// </summary>
|
||||||
|
void Connect();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Connection is permanent
|
||||||
|
/// </summary>
|
||||||
|
bool IsPermanent { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Target is outside movement limits of antenna
|
||||||
|
/// </summary>
|
||||||
|
bool IsOutsideLimits { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
19
Ingame/IMyLightingBlock.cs
Normal file
19
Ingame/IMyLightingBlock.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyLightingBlock : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
float Radius { get; }
|
||||||
|
float ReflectorRadius { get; }
|
||||||
|
float Intensity { get; }
|
||||||
|
float BlinkIntervalSeconds{get;}
|
||||||
|
[Obsolete("Use BlinkLength instead.")]
|
||||||
|
float BlinkLenght { get; }
|
||||||
|
float BlinkLength { get; }
|
||||||
|
float BlinkOffset{get;}
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyMotorAdvancedRotor.cs
Normal file
12
Ingame/IMyMotorAdvancedRotor.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorAdvancedRotor : IMyMotorRotor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyMotorAdvancedStator.cs
Normal file
12
Ingame/IMyMotorAdvancedStator.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorAdvancedStator : IMyMotorStator
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Ingame/IMyMotorBase.cs
Normal file
30
Ingame/IMyMotorBase.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorBase : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets if the piston top is attached to something
|
||||||
|
/// </summary>
|
||||||
|
bool IsAttached { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets if the motor stator is looking for a rotor
|
||||||
|
/// </summary>
|
||||||
|
bool PendingAttachment { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to attach to a nearby rotor/wheel
|
||||||
|
/// </summary>
|
||||||
|
void Attach();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detaches the rotor/wheel from the stator/suspension
|
||||||
|
/// </summary>
|
||||||
|
void Detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Ingame/IMyMotorRotor.cs
Normal file
16
Ingame/IMyMotorRotor.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorRotor : IMyCubeBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets whether the rotor is attached to a stator/suspension block
|
||||||
|
/// </summary>
|
||||||
|
bool IsAttached { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
20
Ingame/IMyMotorStator.cs
Normal file
20
Ingame/IMyMotorStator.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorStator : IMyMotorBase
|
||||||
|
{
|
||||||
|
bool IsLocked { get; }
|
||||||
|
float Angle { get; }
|
||||||
|
float Torque { get; }
|
||||||
|
float BrakingTorque { get; }
|
||||||
|
float Velocity { get; }
|
||||||
|
float LowerLimit { get; }
|
||||||
|
float UpperLimit { get; }
|
||||||
|
float Displacement { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
58
Ingame/IMyMotorSuspension.cs
Normal file
58
Ingame/IMyMotorSuspension.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyMotorSuspension : IMyMotorBase
|
||||||
|
{
|
||||||
|
bool Steering { get; }
|
||||||
|
|
||||||
|
bool Propulsion { get; }
|
||||||
|
|
||||||
|
bool InvertSteer { get; }
|
||||||
|
|
||||||
|
bool InvertPropulsion { get; }
|
||||||
|
|
||||||
|
float Damping { get; }
|
||||||
|
|
||||||
|
float Strength { get; }
|
||||||
|
|
||||||
|
float Friction { get; }
|
||||||
|
|
||||||
|
float Power { get; }
|
||||||
|
|
||||||
|
float Height { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wheel's current steering angle
|
||||||
|
/// </summary>
|
||||||
|
float SteerAngle { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Max steering angle in radians.
|
||||||
|
/// </summary>
|
||||||
|
float MaxSteerAngle { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speed at which wheel steers.
|
||||||
|
/// </summary>
|
||||||
|
float SteerSpeed { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Speed at which wheel returns from steering.
|
||||||
|
/// </summary>
|
||||||
|
float SteerReturnSpeed { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Suspension travel, value from 0 to 1.
|
||||||
|
/// </summary>
|
||||||
|
float SuspensionTravel { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set/get brake applied to the wheel.
|
||||||
|
/// </summary>
|
||||||
|
bool Brake { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyOreDetector.cs
Normal file
13
Ingame/IMyOreDetector.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyOreDetector : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
float Range {get;}
|
||||||
|
bool BroadcastUsingAntennas {get;}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Ingame/IMyOxygenGenerator.cs
Normal file
18
Ingame/IMyOxygenGenerator.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Oxygen generator interface
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyOxygenGenerator : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Autorefill enabled
|
||||||
|
/// </summary>
|
||||||
|
bool AutoRefill { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
7
Ingame/IMyOxygenTank.cs
Normal file
7
Ingame/IMyOxygenTank.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyOxygenTank : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
float GetOxygenLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyPassage.cs
Normal file
13
Ingame/IMyPassage.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyPassage : IMyCubeBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
52
Ingame/IMyPistonBase.cs
Normal file
52
Ingame/IMyPistonBase.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyPistonBase : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Param - limit is top
|
||||||
|
/// </summary>
|
||||||
|
float Velocity { get; }
|
||||||
|
float MinLimit { get; }
|
||||||
|
float MaxLimit { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current position of the piston head relative to the base.
|
||||||
|
/// </summary>
|
||||||
|
float CurrentPosition { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current status.
|
||||||
|
/// </summary>
|
||||||
|
PistonStatus Status { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets if the piston base is attached to the top piece
|
||||||
|
/// </summary>
|
||||||
|
bool IsAttached { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets if the piston is safety locked (welded)
|
||||||
|
/// </summary>
|
||||||
|
bool IsLocked { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets if the piston is looking for a top part
|
||||||
|
/// </summary>
|
||||||
|
bool PendingAttachment { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attaches a nearby top part to the piston block
|
||||||
|
/// </summary>
|
||||||
|
void Attach();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detaches the top from the piston
|
||||||
|
/// </summary>
|
||||||
|
void Detach();
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyPistonTop.cs
Normal file
13
Ingame/IMyPistonTop.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyPistonTop : IMyCubeBlock
|
||||||
|
{
|
||||||
|
bool IsAttached { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Ingame/IMyProductionBlock.cs
Normal file
18
Ingame/IMyProductionBlock.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyProductionBlock:IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool IsProducing { get; }
|
||||||
|
bool IsQueueEmpty { get; }
|
||||||
|
void MoveQueueItemRequest(uint queueItemId, int targetIdx);
|
||||||
|
uint NextItemId { get; }
|
||||||
|
//event Action<IMyProductionBlock> QueueChanged;
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Ingame/IMyProgrammableBlock.cs
Normal file
29
Ingame/IMyProgrammableBlock.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyProgrammableBlock : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This programmable block is currently running its program.
|
||||||
|
/// </summary>
|
||||||
|
bool IsRunning { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Contains the value of the default terminal argument.
|
||||||
|
/// </summary>
|
||||||
|
string TerminalRunArgument { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to run this programmable block using the given argument. An already running
|
||||||
|
/// programmable block cannot be run again.
|
||||||
|
/// This is equivalent to running <c>block.ApplyAction("Run", argumentsList);</c>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="argument"></param>
|
||||||
|
/// <returns><c>true</c> if the action was applied, <c>false</c> otherwise</returns>
|
||||||
|
bool TryRun(string argument);
|
||||||
|
}
|
||||||
|
}
|
||||||
73
Ingame/IMyProjector.cs
Normal file
73
Ingame/IMyProjector.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using VRage.Game;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyProjector : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
[Obsolete( "Use ProjectionOffset vector instead." )]
|
||||||
|
int ProjectionOffsetX { get; }
|
||||||
|
|
||||||
|
[Obsolete( "Use ProjectionOffset vector instead." )]
|
||||||
|
int ProjectionOffsetY { get; }
|
||||||
|
|
||||||
|
[Obsolete( "Use ProjectionOffset vector instead." )]
|
||||||
|
int ProjectionOffsetZ { get; }
|
||||||
|
|
||||||
|
[Obsolete( "Use ProjectionRotation vector instead." )]
|
||||||
|
int ProjectionRotX { get; }
|
||||||
|
|
||||||
|
[Obsolete( "Use ProjectionRotation vector instead." )]
|
||||||
|
int ProjectionRotY { get; }
|
||||||
|
|
||||||
|
[Obsolete( "Use ProjectionRotation vector instead." )]
|
||||||
|
int ProjectionRotZ { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks if there is an active projection
|
||||||
|
/// </summary>
|
||||||
|
bool IsProjecting { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total number of blocks in the projection
|
||||||
|
/// </summary>
|
||||||
|
int TotalBlocks { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of blocks left to be welded
|
||||||
|
/// </summary>
|
||||||
|
int RemainingBlocks { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A comprehensive list of blocks left to be welded
|
||||||
|
/// </summary>
|
||||||
|
Dictionary<MyDefinitionBase, int> RemainingBlocksPerType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of armor blocks left to be welded
|
||||||
|
/// </summary>
|
||||||
|
int RemainingArmorBlocks { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Count of blocks which can be welded now
|
||||||
|
/// </summary>
|
||||||
|
int BuildableBlocksCount { get; }
|
||||||
|
|
||||||
|
Vector3I ProjectionOffset { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// These values are not in degrees. 1 = 90 degrees, 2 = 180 degrees
|
||||||
|
/// </summary>
|
||||||
|
Vector3I ProjectionRotation { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Call this after setting ProjectionOffset and ProjectionRotation to update the projection
|
||||||
|
/// </summary>
|
||||||
|
void UpdateOffsetAndRotation();
|
||||||
|
|
||||||
|
bool LoadRandomBlueprint( string searchPattern );
|
||||||
|
bool LoadBlueprint( string name );
|
||||||
|
}
|
||||||
|
}
|
||||||
28
Ingame/IMyRadioAntenna.cs
Normal file
28
Ingame/IMyRadioAntenna.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Antenna block interface
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyRadioAntenna : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Broadcasting/Receiving range (read-only)
|
||||||
|
/// </summary>
|
||||||
|
float Radius {get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show shipname on hud (read-only)
|
||||||
|
/// </summary>
|
||||||
|
bool ShowShipName { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if antena is broadcasting (read-only)
|
||||||
|
/// </summary>
|
||||||
|
bool IsBroadcasting { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Ingame/IMyReactor.cs
Normal file
22
Ingame/IMyReactor.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyReactor : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current output of reactor in Megawatts
|
||||||
|
/// </summary>
|
||||||
|
float CurrentOutput { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maximum output of reactor in Megawatts
|
||||||
|
/// </summary>
|
||||||
|
float MaxOutput { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyRefinery.cs
Normal file
11
Ingame/IMyRefinery.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyRefinery : IMyProductionBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyReflectorLight.cs
Normal file
11
Ingame/IMyReflectorLight.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyReflectorLight:IMyLightingBlock
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
65
Ingame/IMyRemoteControl.cs
Normal file
65
Ingame/IMyRemoteControl.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides basic information about a waypoint.
|
||||||
|
/// </summary>
|
||||||
|
public struct MyWaypointInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The waypoint name
|
||||||
|
/// </summary>
|
||||||
|
public readonly string Name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The coordinates of this waypoint
|
||||||
|
/// </summary>
|
||||||
|
public readonly Vector3D Coords;
|
||||||
|
|
||||||
|
public MyWaypointInfo(string name, Vector3D coords)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Coords = coords;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IMyRemoteControl : IMyShipController
|
||||||
|
{
|
||||||
|
// Gets the nearest player's position. Will only work if the remote control belongs to an NPC
|
||||||
|
bool GetNearestPlayer(out Vector3D playerPosition);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes all existing waypoints.
|
||||||
|
/// </summary>
|
||||||
|
void ClearWaypoints();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets basic information about the currently configured waypoints.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="waypoints"></param>
|
||||||
|
void GetWaypointInfo(List<MyWaypointInfo> waypoints);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a new waypoint.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="coords"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
void AddWaypoint(Vector3D coords, string name);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables or disables the autopilot.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="enabled"></param>
|
||||||
|
void SetAutoPilotEnabled(bool enabled);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the autopilot is currently enabled.
|
||||||
|
/// </summary>
|
||||||
|
bool IsAutoPilotEnabled { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
41
Ingame/IMySensorBlock.cs
Normal file
41
Ingame/IMySensorBlock.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.ModAPI;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMySensorBlock : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Param - active
|
||||||
|
/// </summary>
|
||||||
|
float MaxRange { get; }
|
||||||
|
float LeftExtend { get; }
|
||||||
|
float RightExtend { get; }
|
||||||
|
float TopExtend { get; }
|
||||||
|
float BottomExtend { get; }
|
||||||
|
float FrontExtend { get; }
|
||||||
|
float BackExtend { get; }
|
||||||
|
|
||||||
|
bool PlayProximitySound { get; }
|
||||||
|
bool DetectPlayers { get; }
|
||||||
|
bool DetectFloatingObjects { get; }
|
||||||
|
bool DetectSmallShips { get; }
|
||||||
|
bool DetectLargeShips { get; }
|
||||||
|
bool DetectStations { get; }
|
||||||
|
bool DetectSubgrids { get; }
|
||||||
|
bool DetectAsteroids { get; }
|
||||||
|
|
||||||
|
bool DetectOwner { get; }
|
||||||
|
bool DetectFriendly { get; }
|
||||||
|
bool DetectNeutral { get; }
|
||||||
|
bool DetectEnemy { get; }
|
||||||
|
|
||||||
|
bool IsActive { get; }
|
||||||
|
|
||||||
|
MyDetectedEntityInfo LastDetectedEntity { get; }
|
||||||
|
void DetectedEntities(List<MyDetectedEntityInfo> entities);
|
||||||
|
}
|
||||||
|
}
|
||||||
16
Ingame/IMyShipConnector.cs
Normal file
16
Ingame/IMyShipConnector.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyShipConnector:IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool ThrowOut { get; }
|
||||||
|
bool CollectAll { get; }
|
||||||
|
bool IsLocked { get; }
|
||||||
|
bool IsConnected { get; }
|
||||||
|
IMyShipConnector OtherConnector { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
161
Ingame/IMyShipController.cs
Normal file
161
Ingame/IMyShipController.cs
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
using System.Text;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public struct MyShipMass
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the base mass of the ship.
|
||||||
|
/// </summary>
|
||||||
|
public readonly int BaseMass;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total mass of the ship, including cargo.
|
||||||
|
/// </summary>
|
||||||
|
public readonly int TotalMass;
|
||||||
|
|
||||||
|
public MyShipMass(int mass, int totalMass) : this()
|
||||||
|
{
|
||||||
|
BaseMass = mass;
|
||||||
|
TotalMass = totalMass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describes what detail level to retrieve the planet elevation for.
|
||||||
|
/// </summary>
|
||||||
|
public enum MyPlanetElevation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Only return the distance to the planetary sealevel.
|
||||||
|
/// </summary>
|
||||||
|
Sealevel,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the distance to the closest point of the planet. This is the same value
|
||||||
|
/// displayed in the HUD.
|
||||||
|
/// </summary>
|
||||||
|
Surface
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct MyShipVelocities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ship's linear velocity (motion).
|
||||||
|
/// </summary>
|
||||||
|
public readonly Vector3D LinearVelocity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ship's angular velocity (rotation).
|
||||||
|
/// </summary>
|
||||||
|
public readonly Vector3D AngularVelocity;
|
||||||
|
|
||||||
|
public MyShipVelocities(Vector3D linearVelocity, Vector3D angularVelocity) : this()
|
||||||
|
{
|
||||||
|
LinearVelocity = linearVelocity;
|
||||||
|
AngularVelocity = angularVelocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IMyShipController : IMyTerminalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether a block is locally or remotely controlled.
|
||||||
|
/// </summary>
|
||||||
|
bool IsUnderControl { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether wheels are being controlled by this controller.
|
||||||
|
/// </summary>
|
||||||
|
bool ControlWheels { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether thrusters are being controlled by this controller.
|
||||||
|
/// </summary>
|
||||||
|
bool ControlThrusters { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates the current state of the handbrake.
|
||||||
|
/// </summary>
|
||||||
|
bool HandBrake { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether dampeners are currently enabled.
|
||||||
|
/// </summary>
|
||||||
|
bool DampenersOverride { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the detected natural gravity vector and power at the current location.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Vector3D GetNaturalGravity();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the detected artificial gravity vector and power at the current location.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Vector3D GetArtificialGravity();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the total accumulated gravity vector and power at the current location,
|
||||||
|
/// taking both natural and artificial gravity into account.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Vector3D GetTotalGravity();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the basic ship speed in meters per second, for when you just need to know how fast you're going.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
double GetShipSpeed();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines the linear velocities in meters per second and angular velocities in radians per second.
|
||||||
|
/// Provides a more accurate representation of the directions and axis speeds.
|
||||||
|
/// </summary>
|
||||||
|
MyShipVelocities GetShipVelocities();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets information about the current mass of the ship.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
MyShipMass CalculateShipMass();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to get the world position of the nearest planet. This method is only available when a ship is
|
||||||
|
/// within the gravity well of a planet.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool TryGetPlanetPosition(out Vector3D position);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to get the elevation of the ship in relation to the nearest planet. This method is only available
|
||||||
|
/// when a ship is within the gravity well of a planet.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="detail"></param>
|
||||||
|
/// <param name="elevation"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
bool TryGetPlanetElevation(MyPlanetElevation detail, out double elevation);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Directional input from user/autopilot. Values can be very large with high controller sensitivity
|
||||||
|
/// </summary>
|
||||||
|
Vector3 MoveIndicator { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Pitch, yaw input from user/autopilot. Values can be very large with high controller sensitivity
|
||||||
|
/// </summary>
|
||||||
|
Vector2 RotationIndicator { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Roll input from user/autopilot. Values can be very large with high controller sensitivity
|
||||||
|
/// </summary>
|
||||||
|
float RollIndicator { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyShipDrill.cs
Normal file
12
Ingame/IMyShipDrill.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyShipDrill : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMyShipGrinder.cs
Normal file
11
Ingame/IMyShipGrinder.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyShipGrinder : IMyShipToolBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyShipToolBase.cs
Normal file
12
Ingame/IMyShipToolBase.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyShipToolBase : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Ingame/IMyShipWelder.cs
Normal file
18
Ingame/IMyShipWelder.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ship welder interface
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyShipWelder : IMyShipToolBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// True if welder is set to helper mode
|
||||||
|
/// </summary>
|
||||||
|
bool HelpOthers { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMySmallGatlingGun.cs
Normal file
12
Ingame/IMySmallGatlingGun.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMySmallGatlingGun : IMyUserControllableGun
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMySmallMissileLauncher.cs
Normal file
12
Ingame/IMySmallMissileLauncher.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMySmallMissileLauncher : IMyUserControllableGun
|
||||||
|
{
|
||||||
|
bool UseConveyorSystem { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Ingame/IMySmallMissileLauncherReload.cs
Normal file
11
Ingame/IMySmallMissileLauncherReload.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMySmallMissileLauncherReload : IMySmallMissileLauncher
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
113
Ingame/IMyTerminalBlock.cs
Normal file
113
Ingame/IMyTerminalBlock.cs
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Collections;
|
||||||
|
using VRage.Game.Entity;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
using IMyInventoryOwner = VRage.Game.ModAPI.Ingame.IMyInventoryOwner;
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyTerminalBlock : IMyCubeBlock
|
||||||
|
{
|
||||||
|
string CustomName { get; }
|
||||||
|
string CustomNameWithFaction { get; }
|
||||||
|
string DetailedInfo { get; }
|
||||||
|
string CustomInfo { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the Custom Data string.
|
||||||
|
/// NOTE: Only use this for user input. For storing large mod configs, create your own MyModStorageComponent
|
||||||
|
/// </summary>
|
||||||
|
string CustomData { get; set; }
|
||||||
|
bool HasLocalPlayerAccess();
|
||||||
|
bool HasPlayerAccess(long playerId);
|
||||||
|
void SetCustomName(string text);
|
||||||
|
void SetCustomName(StringBuilder text);
|
||||||
|
bool ShowOnHUD { get; }
|
||||||
|
void GetActions(List<Sandbox.ModAPI.Interfaces.ITerminalAction> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalAction, bool> collect = null);
|
||||||
|
void SearchActionsOfName(string name,List<Sandbox.ModAPI.Interfaces.ITerminalAction> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalAction, bool> collect = null);
|
||||||
|
Sandbox.ModAPI.Interfaces.ITerminalAction GetActionWithName(string name);
|
||||||
|
Sandbox.ModAPI.Interfaces.ITerminalProperty GetProperty(string id);
|
||||||
|
void GetProperties(List<Sandbox.ModAPI.Interfaces.ITerminalProperty> resultList, Func<Sandbox.ModAPI.Interfaces.ITerminalProperty, bool> collect = null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Written by Kalvin Osborne, AKA Night Lone. Please do not remove this line.
|
||||||
|
*/
|
||||||
|
public static class TerminalBlockExtentions
|
||||||
|
{
|
||||||
|
public static long GetId(this IMyTerminalBlock block)
|
||||||
|
{
|
||||||
|
return block.EntityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ApplyAction(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, string actionName)
|
||||||
|
{
|
||||||
|
block.GetActionWithName(actionName).Apply(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetInventoryCount(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block)
|
||||||
|
{
|
||||||
|
var entity = block as MyEntity;
|
||||||
|
if (entity == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return entity.InventoryCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use the blocks themselves, this method is no longer reliable")]
|
||||||
|
public static bool GetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block)
|
||||||
|
{
|
||||||
|
if (block is IMyInventoryOwner)
|
||||||
|
{
|
||||||
|
return ((IMyInventoryOwner)block).UseConveyorSystem;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("Use the blocks themselves, this method is no longer reliable")]
|
||||||
|
public static void SetUseConveyorSystem(this Sandbox.ModAPI.Ingame.IMyTerminalBlock block, bool use)
|
||||||
|
{
|
||||||
|
if (block is IMyInventoryOwner)
|
||||||
|
{
|
||||||
|
((IMyInventoryOwner)block).UseConveyorSystem = use;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
66
Ingame/IMyTextPanel.cs
Normal file
66
Ingame/IMyTextPanel.cs
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game.GUI.TextPanel;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyTextPanel : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool WritePublicText(string value, bool append = false);
|
||||||
|
string GetPublicText();
|
||||||
|
|
||||||
|
bool WritePublicTitle(string value, bool append = false);
|
||||||
|
string GetPublicTitle();
|
||||||
|
|
||||||
|
[Obsolete("LCD private text is deprecated")]
|
||||||
|
bool WritePrivateText(string value, bool append = false);
|
||||||
|
[Obsolete("LCD private text is deprecated")]
|
||||||
|
string GetPrivateText();
|
||||||
|
|
||||||
|
[Obsolete("LCD private text is deprecated")]
|
||||||
|
bool WritePrivateTitle(string value, bool append = false);
|
||||||
|
[Obsolete("LCD private text is deprecated")]
|
||||||
|
string GetPrivateTitle();
|
||||||
|
|
||||||
|
void AddImageToSelection(string id, bool checkExistence = false);
|
||||||
|
void AddImagesToSelection(List<string> ids, bool checkExistence = false);
|
||||||
|
|
||||||
|
void RemoveImageFromSelection(string id, bool removeDuplicates = false);
|
||||||
|
void RemoveImagesFromSelection(List<string> ids, bool removeDuplicates = false);
|
||||||
|
|
||||||
|
void ClearImagesFromSelection();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Outputs the selected image ids to the specified list.
|
||||||
|
///
|
||||||
|
/// NOTE: List is not cleared internally.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="output"></param>
|
||||||
|
void GetSelectedImages(List<string> output);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The image that is currently shown on the screen.
|
||||||
|
///
|
||||||
|
/// Returns NULL if there are no images selected OR the screen is in text mode.
|
||||||
|
/// </summary>
|
||||||
|
string CurrentlyShownImage { get; }
|
||||||
|
|
||||||
|
void ShowPublicTextOnScreen();
|
||||||
|
[Obsolete("LCD private text is deprecated")]
|
||||||
|
void ShowPrivateTextOnScreen();
|
||||||
|
void ShowTextureOnScreen();
|
||||||
|
void SetShowOnScreen(ShowTextOnScreenFlag set);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates what should be shown on the screen, none being an image.
|
||||||
|
/// </summary>
|
||||||
|
ShowTextOnScreenFlag ShowOnScreen { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if the ShowOnScreen flag is set to either PUBLIC or PRIVATE
|
||||||
|
/// </summary>
|
||||||
|
bool ShowText { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Ingame/IMyThrust.cs
Normal file
25
Ingame/IMyThrust.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyThrust: IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the override thrust amount, in Newtons (N)
|
||||||
|
/// </summary>
|
||||||
|
float ThrustOverride { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the maximum thrust amount, in Newtons (N)
|
||||||
|
/// </summary>
|
||||||
|
float MaxThrust { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the current thrust amount, in Newtons (N)
|
||||||
|
/// </summary>
|
||||||
|
float CurrentThrust { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
25
Ingame/IMyUpgradableBlock.cs
Normal file
25
Ingame/IMyUpgradableBlock.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using VRage.Game.ModAPI.Ingame;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// interface to retrieve upgrade effects on block
|
||||||
|
/// </summary>
|
||||||
|
public interface IMyUpgradableBlock : IMyCubeBlock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// get list of upgrades (r/o);
|
||||||
|
/// string - upgrade type, float - effect value as float (1 = 100%)
|
||||||
|
/// </summary>
|
||||||
|
void GetUpgrades(out Dictionary<string, float> upgrades);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// number of upgrades applied
|
||||||
|
/// </summary>
|
||||||
|
uint UpgradeCount { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyUserControllableGun.cs
Normal file
12
Ingame/IMyUserControllableGun.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyUserControllableGun : IMyFunctionalBlock
|
||||||
|
{
|
||||||
|
bool IsShooting { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Ingame/IMyWarhead.cs
Normal file
13
Ingame/IMyWarhead.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyWarhead: IMyTerminalBlock
|
||||||
|
{
|
||||||
|
bool IsCountingDown { get; }
|
||||||
|
float DetonationTime { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Ingame/IMyWheel.cs
Normal file
12
Ingame/IMyWheel.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public interface IMyWheel : IMyMotorRotor
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
101
Ingame/MyDetectedEntityInfo.cs
Normal file
101
Ingame/MyDetectedEntityInfo.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using VRage.Game;
|
||||||
|
using VRageMath;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public enum MyDetectedEntityType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Unknown,
|
||||||
|
SmallGrid,
|
||||||
|
LargeGrid,
|
||||||
|
CharacterHuman,
|
||||||
|
CharacterOther,
|
||||||
|
FloatingObject,
|
||||||
|
Asteroid,
|
||||||
|
Planet,
|
||||||
|
Meteor,
|
||||||
|
Missile,
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct MyDetectedEntityInfo
|
||||||
|
{
|
||||||
|
public MyDetectedEntityInfo(long entityId, string name, MyDetectedEntityType type, Vector3D? hitPosition, MatrixD orientation, Vector3 velocity, MyRelationsBetweenPlayerAndBlock relationship, BoundingBoxD boundingBox, long timeStamp)
|
||||||
|
{
|
||||||
|
if (timeStamp <= 0)
|
||||||
|
throw new ArgumentException("Invalid Timestamp", "timeStamp");
|
||||||
|
EntityId = entityId;
|
||||||
|
Name = name;
|
||||||
|
Type = type;
|
||||||
|
HitPosition = hitPosition;
|
||||||
|
Orientation = orientation;
|
||||||
|
Velocity = velocity;
|
||||||
|
Relationship = relationship;
|
||||||
|
BoundingBox = boundingBox;
|
||||||
|
TimeStamp = timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's EntityId
|
||||||
|
/// </summary>
|
||||||
|
public readonly long EntityId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's display name if it is friendly, or a generic descriptor if it is not
|
||||||
|
/// </summary>
|
||||||
|
public readonly string Name;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum describing the type of entity
|
||||||
|
/// </summary>
|
||||||
|
public readonly MyDetectedEntityType Type;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position where the raycast hit the entity. (can be null if the sensor didn't use a raycast)
|
||||||
|
/// </summary>
|
||||||
|
public readonly Vector3D? HitPosition;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's absolute orientation at the time it was detected
|
||||||
|
/// </summary>
|
||||||
|
public readonly MatrixD Orientation;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's absolute velocity at the time it was detected
|
||||||
|
/// </summary>
|
||||||
|
public readonly Vector3 Velocity;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Relationship between the entity and the owner of the sensor
|
||||||
|
/// </summary>
|
||||||
|
public readonly MyRelationsBetweenPlayerAndBlock Relationship;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's world-aligned bounding box
|
||||||
|
/// </summary>
|
||||||
|
public readonly BoundingBoxD BoundingBox;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Time when the entity was detected. This field counts milliseconds, compensated for simspeed
|
||||||
|
/// </summary>
|
||||||
|
public readonly long TimeStamp;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The entity's position (center of the Bounding Box)
|
||||||
|
/// </summary>
|
||||||
|
public Vector3D Position
|
||||||
|
{
|
||||||
|
get { return BoundingBox.Center; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if this structure is empty; meaning it does not contain any meaningful data
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool IsEmpty()
|
||||||
|
{
|
||||||
|
return TimeStamp == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
165
Ingame/MyGridProgram.cs
Normal file
165
Ingame/MyGridProgram.cs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
#if !XB1
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// All programmable block scripts derive from this class, meaning that all properties in this
|
||||||
|
/// class are directly available for use in your scripts.
|
||||||
|
/// If you use Visual Studio or other external editors to write your scripts, you can derive
|
||||||
|
/// directly from this class and have a compatible script template.
|
||||||
|
/// </summary>
|
||||||
|
/// <example>
|
||||||
|
/// <code>
|
||||||
|
/// public void Main()
|
||||||
|
/// {
|
||||||
|
/// // Print out the time elapsed since the currently running programmable block was run
|
||||||
|
/// // the last time.
|
||||||
|
/// Echo(Me.CustomName + " was last run " + Runtime.TimeSinceLastRun.TotalSeconds + " seconds ago.");
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public abstract class MyGridProgram : IMyGridProgram
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Note from the author (Malware):
|
||||||
|
*
|
||||||
|
* This class is intended to serve not only as the base class of the "real" ingame-scripts, but also when
|
||||||
|
* used externally, for instance when writing scripts in Visual Studio. It is also designed to be unit-testable
|
||||||
|
* which means it should never rely on anything that requires the game to run. Everything should be configurable
|
||||||
|
* via the IMyGridProgram interface, which is not available in-game.
|
||||||
|
*
|
||||||
|
* Finally, as any member of this class becomes a root member of the script, try to avoid overcrowding it. If
|
||||||
|
* possible, compartmentalize (like for instance the Runtime Info).
|
||||||
|
*/
|
||||||
|
|
||||||
|
// WARNING: Do not autoinitialize any of these fields, or the grid program initialization process
|
||||||
|
// will fail.
|
||||||
|
private string m_storage;
|
||||||
|
private readonly Action<string> m_main;
|
||||||
|
private readonly Action m_save;
|
||||||
|
|
||||||
|
protected MyGridProgram()
|
||||||
|
{
|
||||||
|
// First try to get the main method with a string argument. If this fails, try to get one without.
|
||||||
|
var type = this.GetType();
|
||||||
|
var mainMethod = type.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, new[] {typeof(string)}, null);
|
||||||
|
if (mainMethod != null)
|
||||||
|
{
|
||||||
|
this.m_main = mainMethod.CreateDelegate<Action<string>>(this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainMethod = type.GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null);
|
||||||
|
if (mainMethod != null)
|
||||||
|
{
|
||||||
|
var mainWithoutArgument = mainMethod.CreateDelegate<Action>(this);
|
||||||
|
this.m_main = arg => mainWithoutArgument();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var saveMethod = type.GetMethod("Save", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
if (saveMethod != null)
|
||||||
|
{
|
||||||
|
this.m_save = saveMethod.CreateDelegate<Action>(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides access to the grid terminal system as viewed from this programmable block.
|
||||||
|
/// </summary>
|
||||||
|
public virtual IMyGridTerminalSystem GridTerminalSystem { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a reference to the currently running programmable block.
|
||||||
|
/// </summary>
|
||||||
|
public virtual IMyProgrammableBlock Me { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the amount of in-game time elapsed from the previous run.
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("Use Runtime.TimeSinceLastRun instead")]
|
||||||
|
public virtual TimeSpan ElapsedTime { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets runtime information for the running grid program.
|
||||||
|
/// </summary>
|
||||||
|
public virtual IMyGridProgramRuntimeInfo Runtime { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Allows you to store data between game sessions.
|
||||||
|
/// </summary>
|
||||||
|
public virtual string Storage
|
||||||
|
{
|
||||||
|
get { return this.m_storage ?? ""; }
|
||||||
|
protected set { this.m_storage = value ?? ""; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prints out text onto the currently running programmable block's detail info area.
|
||||||
|
/// </summary>
|
||||||
|
public Action<string> Echo { get; protected set; }
|
||||||
|
|
||||||
|
IMyGridTerminalSystem IMyGridProgram.GridTerminalSystem
|
||||||
|
{
|
||||||
|
get { return GridTerminalSystem; }
|
||||||
|
set { GridTerminalSystem = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
IMyProgrammableBlock IMyGridProgram.Me
|
||||||
|
{
|
||||||
|
get { return Me; }
|
||||||
|
set { Me = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeSpan IMyGridProgram.ElapsedTime
|
||||||
|
{
|
||||||
|
get { return ElapsedTime; }
|
||||||
|
set { ElapsedTime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
string IMyGridProgram.Storage
|
||||||
|
{
|
||||||
|
get { return Storage; }
|
||||||
|
set { Storage = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
Action<string> IMyGridProgram.Echo
|
||||||
|
{
|
||||||
|
get { return Echo; }
|
||||||
|
set { Echo = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
IMyGridProgramRuntimeInfo IMyGridProgram.Runtime
|
||||||
|
{
|
||||||
|
get { return Runtime; }
|
||||||
|
set { Runtime = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IMyGridProgram.HasMainMethod
|
||||||
|
{
|
||||||
|
get { return m_main != null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
void IMyGridProgram.Main(string argument)
|
||||||
|
{
|
||||||
|
if (m_main == null)
|
||||||
|
throw new InvalidOperationException("No Main method available");
|
||||||
|
m_main(argument ?? string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IMyGridProgram.HasSaveMethod
|
||||||
|
{
|
||||||
|
get { return this.m_save != null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
void IMyGridProgram.Save()
|
||||||
|
{
|
||||||
|
if (m_save == null)
|
||||||
|
return;
|
||||||
|
m_save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !XB1
|
||||||
33
Ingame/PistonStatus.cs
Normal file
33
Ingame/PistonStatus.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes the current status of the piston.
|
||||||
|
/// </summary>
|
||||||
|
public enum PistonStatus
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The piston velocity is 0 (stationary).
|
||||||
|
/// </summary>
|
||||||
|
Stopped,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The piston is being extended (moving).
|
||||||
|
/// </summary>
|
||||||
|
Extending,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The piston is in its extended position (stationary).
|
||||||
|
/// </summary>
|
||||||
|
Extended,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The piston is being retracted (moving).
|
||||||
|
/// </summary>
|
||||||
|
Retracting,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The piston is in its retracted position (stationary).
|
||||||
|
/// </summary>
|
||||||
|
Retracted
|
||||||
|
}
|
||||||
|
}
|
||||||
130
Ingame/TerminalActionParameter.cs
Normal file
130
Ingame/TerminalActionParameter.cs
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Reflection;
|
||||||
|
using VRage.Game;
|
||||||
|
using VRage.ObjectBuilders;
|
||||||
|
|
||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public struct TerminalActionParameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets an empty parameter.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly TerminalActionParameter Empty = new TerminalActionParameter();
|
||||||
|
|
||||||
|
static Type ToType(TypeCode code)
|
||||||
|
{
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
case TypeCode.Boolean:
|
||||||
|
return typeof(bool);
|
||||||
|
|
||||||
|
case TypeCode.Byte:
|
||||||
|
return typeof(byte);
|
||||||
|
|
||||||
|
case TypeCode.Char:
|
||||||
|
return typeof(char);
|
||||||
|
|
||||||
|
case TypeCode.DateTime:
|
||||||
|
return typeof(DateTime);
|
||||||
|
|
||||||
|
case TypeCode.Decimal:
|
||||||
|
return typeof(decimal);
|
||||||
|
|
||||||
|
case TypeCode.Double:
|
||||||
|
return typeof(double);
|
||||||
|
|
||||||
|
case TypeCode.Int16:
|
||||||
|
return typeof(short);
|
||||||
|
|
||||||
|
case TypeCode.Int32:
|
||||||
|
return typeof(int);
|
||||||
|
|
||||||
|
case TypeCode.Int64:
|
||||||
|
return typeof(long);
|
||||||
|
|
||||||
|
case TypeCode.SByte:
|
||||||
|
return typeof(sbyte);
|
||||||
|
|
||||||
|
case TypeCode.Single:
|
||||||
|
return typeof(float);
|
||||||
|
|
||||||
|
case TypeCode.String:
|
||||||
|
return typeof(string);
|
||||||
|
|
||||||
|
case TypeCode.UInt16:
|
||||||
|
return typeof(ushort);
|
||||||
|
|
||||||
|
case TypeCode.UInt32:
|
||||||
|
return typeof(uint);
|
||||||
|
|
||||||
|
case TypeCode.UInt64:
|
||||||
|
return typeof(ulong);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="TerminalActionParameter"/> from a serialized value in a string and a type code.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="serializedValue"></param>
|
||||||
|
/// <param name="typeCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TerminalActionParameter Deserialize(string serializedValue, TypeCode typeCode)
|
||||||
|
{
|
||||||
|
AssertTypeCodeValidity(typeCode);
|
||||||
|
var targetType = ToType(typeCode);
|
||||||
|
if (targetType == null)
|
||||||
|
return Empty;
|
||||||
|
var value = Convert.ChangeType(serializedValue, typeCode, CultureInfo.InvariantCulture);
|
||||||
|
return new TerminalActionParameter(typeCode, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="TerminalActionParameter"/> from the given value.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static TerminalActionParameter Get(object value)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
return Empty;
|
||||||
|
var typeCode = Type.GetTypeCode(value.GetType());
|
||||||
|
AssertTypeCodeValidity(typeCode);
|
||||||
|
return new TerminalActionParameter(typeCode, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void AssertTypeCodeValidity(TypeCode typeCode)
|
||||||
|
{
|
||||||
|
switch (typeCode)
|
||||||
|
{
|
||||||
|
case TypeCode.Empty:
|
||||||
|
case TypeCode.Object:
|
||||||
|
case TypeCode.DBNull:
|
||||||
|
throw new ArgumentException("Only primitive types are allowed for action parameters", "value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly TypeCode TypeCode;
|
||||||
|
public readonly object Value;
|
||||||
|
|
||||||
|
private TerminalActionParameter(TypeCode typeCode, object value)
|
||||||
|
{
|
||||||
|
TypeCode = typeCode;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsEmpty { get { return this.TypeCode == TypeCode.Empty; } }
|
||||||
|
|
||||||
|
public MyObjectBuilder_ToolbarItemActionParameter GetObjectBuilder()
|
||||||
|
{
|
||||||
|
var itemObjectBuilder = MyObjectBuilderSerializer.CreateNewObject<MyObjectBuilder_ToolbarItemActionParameter>();
|
||||||
|
itemObjectBuilder.TypeCode = TypeCode;
|
||||||
|
itemObjectBuilder.Value = (this.Value == null) ? null : Convert.ToString(this.Value, CultureInfo.InvariantCulture);
|
||||||
|
return itemObjectBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
Mayak.test.cs
Normal file
45
Mayak.test.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public class Main
|
||||||
|
{
|
||||||
|
void Main()
|
||||||
|
{
|
||||||
|
IMyTerminalBlock mayak = GridTerminalSystem.GetBlockWithName("Маяк") as IMyTerminalBlock;
|
||||||
|
|
||||||
|
if (mayak.)
|
||||||
|
if (connector.Status == MyShipConnectorStatus.Connectable)
|
||||||
|
{
|
||||||
|
connector.GetActionWithName("SwitchLock").Apply(connector);
|
||||||
|
|
||||||
|
if (connector.Status != MyShipConnectorStatus.Connected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var engine in engines)
|
||||||
|
{
|
||||||
|
engine.GetActionWithName("OnOff_Off").Apply(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var battery in batteries)
|
||||||
|
{
|
||||||
|
battery.GetActionWithName("Recharge").Apply(battery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (connector.Status == MyShipConnectorStatus.Connected)
|
||||||
|
{
|
||||||
|
foreach (var battery in batteries)
|
||||||
|
{
|
||||||
|
battery.GetActionWithName("Auto").Apply(battery);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var engine in engines)
|
||||||
|
{
|
||||||
|
engine.GetActionWithName("OnOff_On").Apply(engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
connector.GetActionWithName("SwitchLock").Apply(connector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
Svarshiki.cs
Normal file
9
Svarshiki.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Sandbox.ModAPI.Ingame
|
||||||
|
{
|
||||||
|
public class Main
|
||||||
|
{
|
||||||
|
public void Main(string argument, UpdateType updateSource)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
vendor
Submodule
1
vendor
Submodule
Submodule vendor added at a109106fc0
Reference in New Issue
Block a user