Set up Thrustmaster test assets

This commit is contained in:
Malin E
2021-12-13 13:50:15 +01:00
parent 09b9d8437f
commit 27948b8a43
4 changed files with 111 additions and 32 deletions

View File

@@ -60,10 +60,9 @@ asset.onInitialize(function()
local name = "T.A320 Pilot";
-- Deadzones
openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], 0.15);
openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], 0.15);
openspace.navigation.setAxisDeadZone(name, controller.Twist[1], 0.15);
openspace.navigation.setAxisDeadZone(name, controller.Thrust[1], 0.15);
openspace.navigation.setAxisDeadZone(name, controller.Tilt[1], 0.1);
openspace.navigation.setAxisDeadZone(name, controller.Tilt[2], 0.1);
openspace.navigation.setAxisDeadZone(name, controller.Twist[1], 0.1);
-- Bind axis
openspace.navigation.bindJoystickAxis(name, controller.Tilt[1], "Orbit X");
@@ -71,4 +70,87 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickAxis(name, controller.Twist[1], "GlobalRoll X", true);
-- Bind buttons
-- Bomb
openspace.navigation.bindJoystickButton(
name,
controller.TriggerButton,
"openspace.setPropertyValueSingle('ScreenSpace.bomb.CartesianPosition', {0.0, -1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.bomb.Scale', 0.3)" ..
"openspace.setPropertyValueSingle('ScreenSpace.bomb.CartesianPosition', {0.0, 1.5, -2.000000}, 2.5)" ..
"openspace.setPropertyValueSingle('ScreenSpace.bomb.Scale', 0.0, 1.25)",
"Bomb"
);
-- Small fire
openspace.navigation.bindJoystickButton(
name,
controller.Trigger,
"openspace.setPropertyValueSingle('ScreenSpace.shot.CartesianPosition', {0.0, -1.8, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.shot.Scale', 0.3)" ..
"openspace.setPropertyValueSingle('ScreenSpace.shot.CartesianPosition', {0.0, 1.8, -2.000000}, 1.0)" ..
"openspace.setPropertyValueSingle('ScreenSpace.shot.Scale', 0.0, 0.5)",
"Pew Pew"
);
-- Crosshair
openspace.navigation.bindJoystickButton(
name,
controller.Trigger,
"openspace.setPropertyValueSingle('ScreenSpace.crosshair.Enabled', true);",
"Crosshair on",
"Press"
);
openspace.navigation.bindJoystickButton(
name,
controller.Trigger,
"openspace.setPropertyValueSingle('ScreenSpace.crosshair.Enabled', false);",
"Crosshair off",
"Release"
);
-- Space cow
openspace.navigation.bindJoystickButton(
name,
controller.MiniJoystick.Up,
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, -1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, 1.5, -2.000000}, 5.0)",
"Cow Up"
);
openspace.navigation.bindJoystickButton(
name,
controller.MiniJoystick.Right,
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {-3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {3.0, 0.0, -2.000000}, 5.5)",
"Cow Right"
);
-- Wrench
openspace.navigation.bindJoystickButton(
name,
controller.MiniJoystick.Down,
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, 1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, -1.5, -2.000000}, 5.0)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.0)",
"Wrench Down"
);
openspace.navigation.bindJoystickButton(
name,
controller.MiniJoystick.Left,
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {-3.0, 0.0, -2.000000}, 5.5)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.5)",
"Wrench Left"
);
-- UFO
openspace.navigation.bindJoystickButton(
name,
controller.RightButton,
"openspace.setPropertyValueSingle('ScreenSpace.ufo.CartesianPosition', {3.0, 0.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.ufo.CartesianPosition', {-3.0, 0.5, -2.000000}, 4.0)",
"UFO"
);
end)

View File

@@ -50,19 +50,23 @@ asset.onInitialize(function()
local controller = TCAQEng1and2;
local name = "TCA Q-Eng 1&2";
-- Deadzones
openspace.navigation.setAxisDeadZone(name, controller.Sticks[1], 0.15)
openspace.navigation.setAxisDeadZone(name, controller.Sticks[2], 0.15)
-- Bind axis
openspace.navigation.bindJoystickAxisProperty(
name,
controller.Sticks[1],
"NavigationHandler.PathNavigator.SpeedScale",
0.1,
5,
0.4,
2.8,
true
); -- Assume they are bound together
-- Bind buttons
-- Sputnik
openspace.navigation.bindJoystickButton(
name,
controller.RightStickButton,
"openspace.setPropertyValueSingle('ScreenSpace.sputnik.CartesianPosition', {-3.0, -1.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.sputnik.CartesianPosition', {3.0, 1.0, -2.000000}, 6.0)",
"Sputnik"
);
end)

View File

@@ -82,10 +82,9 @@ asset.onInitialize(function()
local name = "X52 H.O.T.A.S.";
-- Deadzones
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Tilt[1], 0.05);
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Tilt[2], 0.05);
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Twist[1], 0.05);
openspace.navigation.setAxisDeadZone(name, controller.Thruster.Thrust[1], 0.05)
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Tilt[1], 0.1);
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Tilt[2], 0.1);
openspace.navigation.setAxisDeadZone(name, controller.Joystick.Twist[1], 0.1);
-- Bind axis
openspace.navigation.bindJoystickAxis(name, controller.Joystick.Tilt[1], "Orbit X");
@@ -109,9 +108,10 @@ asset.onInitialize(function()
"openspace.setPropertyValueSingle('ScreenSpace.bomb.Scale', 0.3)" ..
"openspace.setPropertyValueSingle('ScreenSpace.bomb.CartesianPosition', {0.0, 1.5, -2.000000}, 2.5)" ..
"openspace.setPropertyValueSingle('ScreenSpace.bomb.Scale', 0.0, 1.25)",
"Print Fire"
"Bomb"
);
-- Small fire
openspace.navigation.bindJoystickButton(
name,
@@ -120,7 +120,7 @@ asset.onInitialize(function()
"openspace.setPropertyValueSingle('ScreenSpace.shot.Scale', 0.3)" ..
"openspace.setPropertyValueSingle('ScreenSpace.shot.CartesianPosition', {0.0, 1.8, -2.000000}, 1.0)" ..
"openspace.setPropertyValueSingle('ScreenSpace.shot.Scale', 0.0, 0.5)",
"Print Fire"
"Pew Pew"
);
@@ -129,14 +129,14 @@ asset.onInitialize(function()
name,
controller.Joystick.HalfTrigger,
"openspace.setPropertyValueSingle('ScreenSpace.crosshair.Enabled', true);",
"Print Fire",
"Crosshair on",
"Press"
);
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.HalfTrigger,
"openspace.setPropertyValueSingle('ScreenSpace.crosshair.Enabled', false);",
"Print Fire",
"Crosshair off",
"Release"
);
@@ -145,7 +145,6 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.ButtomMiniJoystick.Up,
"openspace.printInfo('Up')" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, -1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, 1.5, -2.000000}, 5.0)",
"Cow Up"
@@ -153,7 +152,6 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.ButtomMiniJoystick.Right,
"openspace.printInfo('Right')" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {-3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {3.0, 0.0, -2.000000}, 5.5)",
"Cow Right"
@@ -161,7 +159,6 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.ButtomMiniJoystick.Down,
"openspace.printInfo('Down')" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, 1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {0.0, -1.5, -2.000000}, 5.0)",
"Cow Down"
@@ -169,7 +166,6 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.ButtomMiniJoystick.Left,
"openspace.printInfo('Left');" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.space-cow.CartesianPosition', {-3.0, 0.0, -2.000000}, 5.5)",
"Cow Left"
@@ -180,42 +176,38 @@ asset.onInitialize(function()
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.LeftMiniJoystick.Up,
"openspace.printInfo('Up')" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, -1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, 1.5, -2.000000}, 5.0)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.0)",
"Cow Up"
"Wrench Up"
);
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.LeftMiniJoystick.Right,
"openspace.printInfo('Right')" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {-3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {3.0, 0.0, -2.000000}, 5.5)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.5)",
"Cow Right"
"Wrench Right"
);
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.LeftMiniJoystick.Down,
"openspace.printInfo('Down')" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, 1.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {0.0, -1.5, -2.000000}, 5.0)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.0)",
"Cow Down"
"Wrench Down"
);
openspace.navigation.bindJoystickButton(
name,
controller.Joystick.LeftMiniJoystick.Left,
"openspace.printInfo('Left');" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {3.0, 0.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {-3.000000, 0.000000, 0.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.CartesianPosition', {-3.0, 0.0, -2.000000}, 5.5)" ..
"openspace.setPropertyValueSingle('ScreenSpace.wrench.Rotation', {3.000000, 0.000000, 0.000000}, 5.5)",
"Cow Left"
"Wrench Left"
);
@@ -225,7 +217,7 @@ asset.onInitialize(function()
controller.Joystick.B,
"openspace.setPropertyValueSingle('ScreenSpace.ufo.CartesianPosition', {3.0, 0.5, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.ufo.CartesianPosition', {-3.0, 0.5, -2.000000}, 4.0)",
"Cow Left"
"UFO"
);
@@ -235,6 +227,6 @@ asset.onInitialize(function()
controller.Thruster.E,
"openspace.setPropertyValueSingle('ScreenSpace.sputnik.CartesianPosition', {-3.0, -1.0, -2.000000})" ..
"openspace.setPropertyValueSingle('ScreenSpace.sputnik.CartesianPosition', {3.0, 1.0, -2.000000}, 6.0)",
"Cow Left"
"Sputnik"
);
end)

View File

@@ -48,6 +48,7 @@
"events/toggle_globe_trails",
"scene/solarsystem/planets/earth/earth",
"scene/solarsystem/planets/earth/satellites/satellites",
"spaceship/spaceship",
"util/joysticks/TA320_Pilot",
"util/joysticks/TCA_Q-Eng_1&2"
],