diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Input.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Input.lua index 73c301a4f..cc323dde3 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/Input.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/Input.lua @@ -2,38 +2,42 @@ -- !Section "Input" -- !Description "Checks if specific game key has just been hit (will be true only for 1 frame, until the key is released and hit again)." -- !Conditional "True" --- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load ]" +-- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ]" -LevelFuncs.Engine.Node.KeyIsHit = function(keyCode) - return TEN.Input.KeyIsHit(keyCode) +LevelFuncs.Engine.Node.KeyIsHit = function(index) + local actionID = LevelFuncs.Engine.Node.GetInput(index) + return TEN.Input.KeyIsHit(actionID) end -- !Name "If key is held..." -- !Section "Input" -- !Description "Checks if specific game key is being held (will be true as long as the player keeps their finger on that key)." -- !Conditional "True" --- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load ]" +-- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ]" -LevelFuncs.Engine.Node.KeyIsHeld = function(keyCode) - return TEN.Input.KeyIsHeld(keyCode) +LevelFuncs.Engine.Node.KeyIsHeld = function(index) + local actionID = LevelFuncs.Engine.Node.GetInput(index) + return TEN.Input.KeyIsHeld(actionID) end -- !Name "Push a key" -- !Section "Input" -- !Description "Emulates push of a specified key. If called continuously, registers as a hold event, otherwise as a hit." --- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load ]" +-- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ]" -LevelFuncs.Engine.Node.PushKey = function(keyCode) - return TEN.Input.KeyPush(keyCode) +LevelFuncs.Engine.Node.PushKey = function(index) + local actionID = LevelFuncs.Engine.Node.GetInput(index) + return TEN.Input.KeyPush(actionID) end -- !Name "Clear a key" -- !Section "Input" -- !Description "Blocks specified key from pushing." --- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load ]" +-- !Arguments "Enumeration, 35, [ Forward | Back | Left | Right | Step Left | Step Right | Walk | Sprint | Crouch | Jump | Roll | Action | Draw | Look | Accelerate (Vehicle) | Reverse (Vehicle) | Faster (Vehicle) | Slower (Vehicle) | Brake (Vehicle) | Fire (Vehicle) | Flare | Small Medipack | Large Medipack | Previous Weapon | Next Weapon | Weapon 1 | Weapon 2 | Weapon 3 | Weapon 4 | Weapon 5 | Weapon 6 | Weapon 7 | Weapon 8 | Weapon 9 | Weapon 10 | Select | Deselect | Pause | Inventory | Save | Load | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ]" -LevelFuncs.Engine.Node.BlockKey = function(keyCode) - return TEN.Input.KeyClear(keyCode) +LevelFuncs.Engine.Node.BlockKey = function(index) + local actionID = LevelFuncs.Engine.Node.GetInput(index) + return TEN.Input.KeyClear(actionID) end -- !Name "Vibrate game controller" @@ -44,4 +48,6 @@ end LevelFuncs.Engine.Node.Vibrate = function(strength, time) TEN.Input.Vibrate(strength, time) -end \ No newline at end of file +end + + diff --git a/TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua b/TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua index 372f9d8ac..b6840d794 100644 --- a/TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua +++ b/TombLib/TombLib/Catalogs/TEN Node Catalogs/_System.lua @@ -208,4 +208,79 @@ LevelFuncs.Engine.Node.SetInteractionHighlightType = function(index) } return interactionIconType[index] end - \ No newline at end of file + +-- Helper function for input nodes to get correct input. +LevelFuncs.Engine.Node.GetInput = function(index) +local keyboardInput = + { + [0] = TEN.Input.ActionID.FORWARD, + [1] = TEN.Input.ActionID.BACK, + [2] = TEN.Input.ActionID.LEFT, + [3] = TEN.Input.ActionID.RIGHT, + [4] = TEN.Input.ActionID.STEP_LEFT, + [5] = TEN.Input.ActionID.STEP_RIGHT, + [6] = TEN.Input.ActionID.WALK, + [7] = TEN.Input.ActionID.SPRINT, + [8] = TEN.Input.ActionID.CROUCH, + [9] = TEN.Input.ActionID.JUMP, + [10] = TEN.Input.ActionID.ROLL, + [11] = TEN.Input.ActionID.ACTION, + [12] = TEN.Input.ActionID.DRAW, + [13] = TEN.Input.ActionID.LOOK, + [14] = TEN.Input.ActionID.ACCELERATE, + [15] = TEN.Input.ActionID.REVERSE, + [16] = TEN.Input.ActionID.FASTER, + [17] = TEN.Input.ActionID.SLOWER, + [18] = TEN.Input.ActionID.BRAKE, + [19] = TEN.Input.ActionID.FIRE, + [20] = TEN.Input.ActionID.FLARE, + [21] = TEN.Input.ActionID.SMALL_MEDIPACK, + [22] = TEN.Input.ActionID.LARGE_MEDIPACK, + [23] = TEN.Input.ActionID.PREVIOUS_WEAPON, + [24] = TEN.Input.ActionID.NEXT_WEAPON, + [25] = TEN.Input.ActionID.WEAPON_1, + [26] = TEN.Input.ActionID.WEAPON_2, + [27] = TEN.Input.ActionID.WEAPON_3, + [28] = TEN.Input.ActionID.WEAPON_4, + [29] = TEN.Input.ActionID.WEAPON_5, + [30] = TEN.Input.ActionID.WEAPON_6, + [31] = TEN.Input.ActionID.WEAPON_7, + [32] = TEN.Input.ActionID.WEAPON_8, + [33] = TEN.Input.ActionID.WEAPON_9, + [34] = TEN.Input.ActionID.WEAPON_10, + [35] = TEN.Input.ActionID.SELECT, + [36] = TEN.Input.ActionID.DESELECT, + [37] = TEN.Input.ActionID.PAUSE, + [38] = TEN.Input.ActionID.INVENTORY, + [39] = TEN.Input.ActionID.SAVE, + [40] = TEN.Input.ActionID.LOAD, + [41] = TEN.Input.ActionID.A, + [42] = TEN.Input.ActionID.B, + [43] = TEN.Input.ActionID.C, + [44] = TEN.Input.ActionID.D, + [45] = TEN.Input.ActionID.E, + [46] = TEN.Input.ActionID.F, + [47] = TEN.Input.ActionID.G, + [48] = TEN.Input.ActionID.H, + [49] = TEN.Input.ActionID.I, + [50] = TEN.Input.ActionID.J, + [51] = TEN.Input.ActionID.K, + [52] = TEN.Input.ActionID.L, + [53] = TEN.Input.ActionID.M, + [54] = TEN.Input.ActionID.N, + [55] = TEN.Input.ActionID.O, + [56] = TEN.Input.ActionID.P, + [57] = TEN.Input.ActionID.Q, + [58] = TEN.Input.ActionID.R, + [59] = TEN.Input.ActionID.S, + [60] = TEN.Input.ActionID.T, + [61] = TEN.Input.ActionID.U, + [62] = TEN.Input.ActionID.V, + [63] = TEN.Input.ActionID.W, + [64] = TEN.Input.ActionID.X, + [65] = TEN.Input.ActionID.Y, + [66] = TEN.Input.ActionID.Z, + } + + return keyboardInput[index] +end \ No newline at end of file