|
|
@@ -12,27 +12,41 @@ namespace GamecraftModdingAPI.Input |
|
|
|
{ |
|
|
|
private static readonly FakeInputEngine inputEngine = new FakeInputEngine(); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Customize the player input. |
|
|
|
/// </summary> |
|
|
|
/// <param name="input">The custom input.</param> |
|
|
|
/// <param name="playerID">The player. Omit this to use the local player.</param> |
|
|
|
public static void CustomInput(LocalInputEntityStruct input, uint playerID = uint.MaxValue) |
|
|
|
/// <summary> |
|
|
|
/// Customize the local input. |
|
|
|
/// </summary> |
|
|
|
/// <param name="input">The custom input.</param> |
|
|
|
public static void CustomInput(LocalInputEntityStruct input) |
|
|
|
{ |
|
|
|
inputEngine.SendCustomInput(input); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Customize the player input. |
|
|
|
/// </summary> |
|
|
|
/// <param name="input">The custom input.</param> |
|
|
|
/// <param name="playerID">The player. Omit this to use the local player.</param> |
|
|
|
public static void CustomPlayerInput(LocalPlayerInputEntityStruct input, uint playerID = uint.MaxValue) |
|
|
|
{ |
|
|
|
if (playerID == uint.MaxValue) |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
inputEngine.SendCustomInput(input, playerID); |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
inputEngine.SendCustomPlayerInput(input, playerID); |
|
|
|
} |
|
|
|
|
|
|
|
public static LocalInputEntityStruct GetInput(uint playerID = uint.MaxValue) |
|
|
|
public static LocalInputEntityStruct GetInput() |
|
|
|
{ |
|
|
|
return inputEngine.GetInput(); |
|
|
|
} |
|
|
|
|
|
|
|
public static LocalPlayerInputEntityStruct GetPlayerInput(uint playerID = uint.MaxValue) |
|
|
|
{ |
|
|
|
if (playerID == uint.MaxValue) |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
return inputEngine.GetInput(playerID); |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
return inputEngine.GetPlayerInput(playerID); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -59,7 +73,7 @@ namespace GamecraftModdingAPI.Input |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
ref LocalInputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); |
|
|
|
ref LocalInputEntityStruct currentInput = ref inputEngine.GetInputRef(); |
|
|
|
//Utility.Logging.CommandLog($"Current sim frame {currentInput.frame}"); |
|
|
|
// set inputs |
|
|
|
switch(hotbar) |
|
|
@@ -107,10 +121,10 @@ namespace GamecraftModdingAPI.Input |
|
|
|
{ |
|
|
|
playerID = inputEngine.GetLocalPlayerID(); |
|
|
|
} |
|
|
|
ref LocalInputEntityStruct currentInput = ref inputEngine.GetInputRef(playerID); |
|
|
|
//Utility.Logging.CommandLog($"Current sim frame {currentInput.frame}"); |
|
|
|
// set inputs - TODO |
|
|
|
/*if (toggleMode) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.ToggleTimeRunningMode; |
|
|
|
ref LocalPlayerInputEntityStruct currentInput = ref inputEngine.GetPlayerInputRef(playerID); |
|
|
|
//Utility.Logging.CommandLog($"Current sim frame {currentInput.frame}"); |
|
|
|
// set inputs |
|
|
|
if (toggleMode) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.ToggleTimeRunningMode; |
|
|
|
if (forward) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Forward; |
|
|
|
if (backward) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Backward; |
|
|
|
if (up) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.Up; |
|
|
@@ -134,7 +148,7 @@ namespace GamecraftModdingAPI.Input |
|
|
|
if (rotateBlockCounterclockwise) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.RotateBlockAnticlockwise; |
|
|
|
if (cutSelection) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.CutSelection; |
|
|
|
if (copySelection) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.CopySelection; |
|
|
|
if (deleteSelection) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.DeleteSelection;*/ |
|
|
|
if (deleteSelection) currentInput.actionMask |= RobocraftX.Common.Input.ActionInput.DeleteSelection; |
|
|
|
} |
|
|
|
|
|
|
|
public static void Init() |
|
|
|