[READ-ONLY] Mirror of https://github.com/thoda-dev/du-default-autoconf. default autoconfig files from Dual Universe
0

Configure Feed

Select the types of activity you want to include in your feed.

conf files from game

Thomas (Jan 22, 2022, 9:04 PM +0100) 2e03d644 3ee9828c

+1089
+84
conf/ECU.conf
··· 1 + # This is a file describing a standard autoconfiguration, do not edit. 2 + # See custom/sample.conf for a more generic template and explanation on the syntax. 3 + 4 + name: ui_cu_autoconf_pvp_ecu 5 + 6 + slots: 7 + core: 8 + class: CoreUnit 9 + antigrav: 10 + class: AntiGravityGeneratorUnit 11 + container: 12 + class: FuelContainer 13 + select: all 14 + gyro: 15 + class: GyroUnit 16 + 17 + handlers: 18 + unit: 19 + start: 20 + lua: | 21 + Nav = Navigator.new(system, core, unit) 22 + planetInfluenceThreshold = 0.6 23 + if antigrav ~= nil then 24 + antigrav.activate() 25 + antigrav.show() 26 + end 27 + system: 28 + flush: 29 + lua: | 30 + local verticalAutoLandingSpeed = 20 --export: Vertical auto landing speec in km/h 31 + local power = 3 32 + local worldUp = vec3(core.getConstructWorldOrientationUp()) 33 + local worldForward = vec3(core.getConstructWorldOrientationForward()) 34 + local worldRight = vec3(core.getConstructWorldOrientationRight()) 35 + local worldVertical = vec3(core.getWorldVertical()) 36 + 37 + -- are we in deep space or are we near a planet ? 38 + local planetInfluence = Nav.control.getClosestPlanetInfluence() 39 + if planetInfluence > 0 40 + then 41 + -- stabilize orientation along the gravity 42 + if (rollPID == nil) then 43 + rollPID = pid.new(0.2, 0, 10) 44 + pitchPID = pid.new(0.2, 0, 10) 45 + end 46 + 47 + local yawVelocity = vec3(core.getWorldAngularVelocity()):dot(worldUp) 48 + local currentRoll = getRoll(worldVertical, worldForward, worldRight) 49 + local currentPitch = -math.asin(worldForward:dot(worldVertical)) * constants.rad2deg 50 + rollPID:inject(-currentRoll) 51 + pitchPID:inject(-currentPitch) 52 + local yawAcceleration = - power * yawVelocity 53 + angularAcceleration = rollPID:get() * worldForward + pitchPID:get() * worldRight + yawAcceleration * worldUp 54 + else 55 + -- cancel rotation 56 + local worldAngularVelocity = vec3(core.getWorldAngularVelocity()) 57 + angularAcceleration = - power * worldAngularVelocity 58 + end 59 + 60 + if planetInfluence > planetInfluenceThreshold 61 + then 62 + -- go down at verticalTargetSpeed when very close to a planet 63 + targetVelocity = (verticalAutoLandingSpeed / 3.6) * worldVertical 64 + else 65 + -- immobilize ship when not 66 + targetVelocity = vec3() 67 + end 68 + Nav:setEngineCommand('torque', vec3(), angularAcceleration) 69 + stabilization = power * (targetVelocity - vec3(core.getWorldVelocity())) 70 + Nav:setEngineCommand('vertical, brake, horizontal', stabilization -vec3(core.getWorldGravity()), vec3(), false) 71 + update: 72 + lua: | 73 + local accelThreshold = 0.1 74 + local speedThreshold = 0.1 75 + 76 + -- auto stopping mechanism when immobile and close to planet 77 + local accel = vec3(Nav.core.getWorldAcceleration()):len() 78 + local speed = vec3(Nav.core.getWorldVelocity()):len() 79 + if accel < accelThreshold 80 + and speed < speedThreshold 81 + and Nav.control.getClosestPlanetInfluence() > planetInfluenceThreshold 82 + then 83 + unit.exit() 84 + end
+431
conf/flying_construct.conf
··· 1 + # This is a file describing a standard autoconfiguration, do not edit. 2 + # See custom/sample.conf for a more generic template and explanation on the syntax. 3 + 4 + name: ui_cu_autoconf_construct_flying 5 + 6 + slots: 7 + core: 8 + class: CoreUnit 9 + antigrav: 10 + class: AntiGravityGeneratorUnit 11 + warpdrive: 12 + class: WarpDriveUnit 13 + atmofueltank: 14 + class: AtmoFuelContainer 15 + select: all 16 + spacefueltank: 17 + class: SpaceFuelContainer 18 + select: all 19 + rocketfueltank: 20 + class: RocketFuelContainer 21 + select: all 22 + gyro: 23 + class: GyroUnit 24 + shield: 25 + class: ShieldGeneratorUnit 26 + weapon: 27 + class: WeaponUnit 28 + select: manual 29 + radar: 30 + class: RadarPVPUnit 31 + select: manual 32 + 33 + handlers: 34 + unit: 35 + start: 36 + lua: | 37 + pitchInput = 0 38 + rollInput = 0 39 + yawInput = 0 40 + brakeInput = 0 41 + 42 + Nav = Navigator.new(system, core, unit) 43 + Nav.axisCommandManager:setupCustomTargetSpeedRanges(axisCommandId.longitudinal, {1000, 5000, 10000, 20000, 30000}) 44 + Nav.axisCommandManager:setTargetGroundAltitude(4) 45 + 46 + -- Parenting widget 47 + parentingPanelId = system.createWidgetPanel("Docking") 48 + parentingWidgetId = system.createWidget(parentingPanelId,"parenting") 49 + system.addDataToWidget(unit.getDataId(),parentingWidgetId) 50 + 51 + -- Combat stress widget 52 + coreCombatStressPanelId = system.createWidgetPanel("Core combat stress") 53 + coreCombatStressgWidgetId = system.createWidget(coreCombatStressPanelId,"core_stress") 54 + system.addDataToWidget(core.getDataId(),coreCombatStressgWidgetId) 55 + 56 + -- element widgets 57 + -- For now we have to alternate between PVP and non-PVP widgets to have them on the same side. 58 + _autoconf.displayCategoryPanel(weapon, weapon_size, L_TEXT("ui_lua_widget_weapon", "Weapons"), "weapon", true) 59 + core.show() 60 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_periscope", "Periscope"), "periscope") 61 + placeRadar = true 62 + if atmofueltank_size > 0 then 63 + _autoconf.displayCategoryPanel(atmofueltank, atmofueltank_size, L_TEXT("ui_lua_widget_atmofuel", "Atmo Fuel"), "fuel_container") 64 + if placeRadar then 65 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 66 + placeRadar = false 67 + end 68 + end 69 + if spacefueltank_size > 0 then 70 + _autoconf.displayCategoryPanel(spacefueltank, spacefueltank_size, L_TEXT("ui_lua_widget_spacefuel", "Space Fuel"), "fuel_container") 71 + if placeRadar then 72 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 73 + placeRadar = false 74 + end 75 + end 76 + _autoconf.displayCategoryPanel(rocketfueltank, rocketfueltank_size, L_TEXT("ui_lua_widget_rocketfuel", "Rocket Fuel"), "fuel_container") 77 + if placeRadar then -- We either have only rockets or no fuel tanks at all, uncommon for usual vessels 78 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 79 + placeRadar = false 80 + end 81 + if antigrav ~= nil then antigrav.show() end 82 + if warpdrive ~= nil then warpdrive.show() end 83 + if gyro ~= nil then gyro.show() end 84 + if shield ~= nil then shield.show() end 85 + 86 + -- freeze the player in he is remote controlling the construct 87 + if Nav.control.isRemoteControlled() == 1 then 88 + system.freeze(1) 89 + end 90 + 91 + -- landing gear 92 + -- make sure every gears are synchonized with the first 93 + gearExtended = (Nav.control.isAnyLandingGearExtended() == 1) -- make sure it's a lua boolean 94 + if gearExtended then 95 + Nav.control.extendLandingGears() 96 + else 97 + Nav.control.retractLandingGears() 98 + end 99 + stop: 100 + lua: | 101 + _autoconf.hideCategoryPanels() 102 + if antigrav ~= nil then antigrav.hide() end 103 + if warpdrive ~= nil then warpdrive.hide() end 104 + if gyro ~= nil then gyro.hide() end 105 + core.hide() 106 + Nav.control.switchOffHeadlights() 107 + 108 + system: 109 + flush: 110 + lua: | 111 + -- constants: use 'myvar = defaultValue --export: description' to expose the variable in context menu 112 + 113 + local pitchSpeedFactor = 0.8 --export: This factor will increase/decrease the player input along the pitch axis<br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 114 + local yawSpeedFactor = 1 --export: This factor will increase/decrease the player input along the yaw axis<br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 115 + local rollSpeedFactor = 1.5 --export: This factor will increase/decrease the player input along the roll axis<br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 116 + 117 + local brakeSpeedFactor = 3 --export: When braking, this factor will increase the brake force by brakeSpeedFactor * velocity<br>Valid values: Superior or equal to 0.01 118 + local brakeFlatFactor = 1 --export: When braking, this factor will increase the brake force by a flat brakeFlatFactor * velocity direction><br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 119 + 120 + local autoRoll = false --export: [Only in atmosphere]<br>When the pilot stops rolling, flight model will try to get back to horizontal (no roll) 121 + local autoRollFactor = 2 --export: [Only in atmosphere]<br>When autoRoll is engaged, this factor will increase to strength of the roll back to 0<br>Valid values: Superior or equal to 0.01 122 + 123 + local turnAssist = true --export: [Only in atmosphere]<br>When the pilot is rolling, the flight model will try to add yaw and pitch to make the construct turn better<br>The flight model will start by adding more yaw the more horizontal the construct is and more pitch the more vertical it is 124 + local turnAssistFactor = 2 --export: [Only in atmosphere]<br>This factor will increase/decrease the turnAssist effect<br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 125 + 126 + local torqueFactor = 2 -- Force factor applied to reach rotationSpeed<br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 127 + 128 + -- validate params 129 + pitchSpeedFactor = math.max(pitchSpeedFactor, 0.01) 130 + yawSpeedFactor = math.max(yawSpeedFactor, 0.01) 131 + rollSpeedFactor = math.max(rollSpeedFactor, 0.01) 132 + torqueFactor = math.max(torqueFactor, 0.01) 133 + brakeSpeedFactor = math.max(brakeSpeedFactor, 0.01) 134 + brakeFlatFactor = math.max(brakeFlatFactor, 0.01) 135 + autoRollFactor = math.max(autoRollFactor, 0.01) 136 + turnAssistFactor = math.max(turnAssistFactor, 0.01) 137 + 138 + -- final inputs 139 + local finalPitchInput = pitchInput + system.getControlDeviceForwardInput() 140 + local finalRollInput = rollInput + system.getControlDeviceYawInput() 141 + local finalYawInput = yawInput - system.getControlDeviceLeftRightInput() 142 + local finalBrakeInput = brakeInput 143 + 144 + -- Axis 145 + local worldVertical = vec3(core.getWorldVertical()) -- along gravity 146 + local constructUp = vec3(core.getConstructWorldOrientationUp()) 147 + local constructForward = vec3(core.getConstructWorldOrientationForward()) 148 + local constructRight = vec3(core.getConstructWorldOrientationRight()) 149 + local constructVelocity = vec3(core.getWorldVelocity()) 150 + local constructVelocityDir = vec3(core.getWorldVelocity()):normalize() 151 + local currentRollDeg = getRoll(worldVertical, constructForward, constructRight) 152 + local currentRollDegAbs = math.abs(currentRollDeg) 153 + local currentRollDegSign = utils.sign(currentRollDeg) 154 + 155 + -- Rotation 156 + local constructAngularVelocity = vec3(core.getWorldAngularVelocity()) 157 + local targetAngularVelocity = finalPitchInput * pitchSpeedFactor * constructRight 158 + + finalRollInput * rollSpeedFactor * constructForward 159 + + finalYawInput * yawSpeedFactor * constructUp 160 + 161 + -- In atmosphere? 162 + if worldVertical:len() > 0.01 and unit.getAtmosphereDensity() > 0.0 then 163 + local autoRollRollThreshold = 1.0 164 + -- autoRoll on AND currentRollDeg is big enough AND player is not rolling 165 + if autoRoll == true and currentRollDegAbs > autoRollRollThreshold and finalRollInput == 0 then 166 + local targetRollDeg = utils.clamp(0,currentRollDegAbs-30, currentRollDegAbs+30); -- we go back to 0 within a certain limit 167 + if (rollPID == nil) then 168 + rollPID = pid.new(autoRollFactor * 0.01, 0, autoRollFactor * 0.1) -- magic number tweaked to have a default factor in the 1-10 range 169 + end 170 + rollPID:inject(targetRollDeg - currentRollDeg) 171 + local autoRollInput = rollPID:get() 172 + 173 + targetAngularVelocity = targetAngularVelocity + autoRollInput * constructForward 174 + end 175 + local turnAssistRollThreshold = 20.0 176 + -- turnAssist AND currentRollDeg is big enough AND player is not pitching or yawing 177 + if turnAssist == true and currentRollDegAbs > turnAssistRollThreshold and finalPitchInput == 0 and finalYawInput == 0 then 178 + local rollToPitchFactor = turnAssistFactor * 0.1 -- magic number tweaked to have a default factor in the 1-10 range 179 + local rollToYawFactor = turnAssistFactor * 0.025 -- magic number tweaked to have a default factor in the 1-10 range 180 + 181 + -- rescale (turnAssistRollThreshold -> 180) to (0 -> 180) 182 + local rescaleRollDegAbs = ((currentRollDegAbs - turnAssistRollThreshold) / (180 - turnAssistRollThreshold)) * 180 183 + local rollVerticalRatio = 0 184 + if rescaleRollDegAbs < 90 then 185 + rollVerticalRatio = rescaleRollDegAbs / 90 186 + elseif rescaleRollDegAbs < 180 then 187 + rollVerticalRatio = (180 - rescaleRollDegAbs) / 90 188 + end 189 + 190 + rollVerticalRatio = rollVerticalRatio * rollVerticalRatio 191 + 192 + local turnAssistYawInput = - currentRollDegSign * rollToYawFactor * (1.0 - rollVerticalRatio) 193 + local turnAssistPitchInput = rollToPitchFactor * rollVerticalRatio 194 + 195 + targetAngularVelocity = targetAngularVelocity 196 + + turnAssistPitchInput * constructRight 197 + + turnAssistYawInput * constructUp 198 + end 199 + end 200 + 201 + -- Engine commands 202 + local keepCollinearity = 1 -- for easier reading 203 + local dontKeepCollinearity = 0 -- for easier reading 204 + local tolerancePercentToSkipOtherPriorities = 1 -- if we are within this tolerance (in%), we don't go to the next priorities 205 + 206 + -- Rotation 207 + local angularAcceleration = torqueFactor * (targetAngularVelocity - constructAngularVelocity) 208 + local airAcceleration = vec3(core.getWorldAirFrictionAngularAcceleration()) 209 + angularAcceleration = angularAcceleration - airAcceleration -- Try to compensate air friction 210 + Nav:setEngineTorqueCommand('torque', angularAcceleration, keepCollinearity, 'airfoil', '', '', tolerancePercentToSkipOtherPriorities) 211 + 212 + -- Brakes 213 + local brakeAcceleration = -finalBrakeInput * (brakeSpeedFactor * constructVelocity + brakeFlatFactor * constructVelocityDir) 214 + Nav:setEngineForceCommand('brake', brakeAcceleration) 215 + 216 + -- AutoNavigation regroups all the axis command by 'TargetSpeed' 217 + local autoNavigationEngineTags = '' 218 + local autoNavigationAcceleration = vec3() 219 + local autoNavigationUseBrake = false 220 + 221 + -- Longitudinal Translation 222 + local longitudinalEngineTags = 'thrust analog longitudinal' 223 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 224 + if (longitudinalCommandType == axisCommandType.byThrottle) then 225 + local longitudinalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(longitudinalEngineTags,axisCommandId.longitudinal) 226 + Nav:setEngineForceCommand(longitudinalEngineTags, longitudinalAcceleration, keepCollinearity) 227 + elseif (longitudinalCommandType == axisCommandType.byTargetSpeed) then 228 + local longitudinalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.longitudinal) 229 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. longitudinalEngineTags 230 + autoNavigationAcceleration = autoNavigationAcceleration + longitudinalAcceleration 231 + if (Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) == 0 or -- we want to stop 232 + Nav.axisCommandManager:getCurrentToTargetDeltaSpeed(axisCommandId.longitudinal) < - Nav.axisCommandManager:getTargetSpeedCurrentStep(axisCommandId.longitudinal) * 0.5) -- if the longitudinal velocity would need some braking 233 + then 234 + autoNavigationUseBrake = true 235 + end 236 + 237 + end 238 + 239 + -- Lateral Translation 240 + local lateralStrafeEngineTags = 'thrust analog lateral' 241 + local lateralCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.lateral) 242 + if (lateralCommandType == axisCommandType.byThrottle) then 243 + local lateralStrafeAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(lateralStrafeEngineTags,axisCommandId.lateral) 244 + Nav:setEngineForceCommand(lateralStrafeEngineTags, lateralStrafeAcceleration, keepCollinearity) 245 + elseif (lateralCommandType == axisCommandType.byTargetSpeed) then 246 + local lateralAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.lateral) 247 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. lateralStrafeEngineTags 248 + autoNavigationAcceleration = autoNavigationAcceleration + lateralAcceleration 249 + end 250 + 251 + -- Vertical Translation 252 + local verticalStrafeEngineTags = 'thrust analog vertical' 253 + local verticalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.vertical) 254 + if (verticalCommandType == axisCommandType.byThrottle) then 255 + local verticalStrafeAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(verticalStrafeEngineTags,axisCommandId.vertical) 256 + Nav:setEngineForceCommand(verticalStrafeEngineTags, verticalStrafeAcceleration, keepCollinearity, 'airfoil', 'ground', '', tolerancePercentToSkipOtherPriorities) 257 + elseif (verticalCommandType == axisCommandType.byTargetSpeed) then 258 + local verticalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.vertical) 259 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. verticalStrafeEngineTags 260 + autoNavigationAcceleration = autoNavigationAcceleration + verticalAcceleration 261 + end 262 + 263 + -- Auto Navigation (Cruise Control) 264 + if (autoNavigationAcceleration:len() > constants.epsilon) then 265 + if (brakeInput ~= 0 or autoNavigationUseBrake or math.abs(constructVelocityDir:dot(constructForward)) < 0.95) -- if the velocity is not properly aligned with the forward 266 + then 267 + autoNavigationEngineTags = autoNavigationEngineTags .. ', brake' 268 + end 269 + Nav:setEngineForceCommand(autoNavigationEngineTags, autoNavigationAcceleration, dontKeepCollinearity, '', '', '', tolerancePercentToSkipOtherPriorities) 270 + end 271 + 272 + -- Rockets 273 + Nav:setBoosterCommand('rocket_engine') 274 + 275 + update: 276 + lua: Nav:update() 277 + 278 + actionStart: 279 + args: [gear] 280 + lua: | 281 + gearExtended = not gearExtended 282 + if gearExtended then 283 + Nav.control.extendLandingGears() 284 + else 285 + Nav.control.retractLandingGears() 286 + end 287 + 288 + actionStart: 289 + args: [light] 290 + lua: | 291 + if Nav.control.isAnyHeadlightSwitchedOn() == 1 then 292 + Nav.control.switchOffHeadlights() 293 + else 294 + Nav.control.switchOnHeadlights() 295 + end 296 + 297 + actionStart: 298 + args: [forward] 299 + lua: pitchInput = pitchInput - 1 300 + actionStop: 301 + args: [forward] 302 + lua: pitchInput = pitchInput + 1 303 + actionStart: 304 + args: [backward] 305 + lua: pitchInput = pitchInput + 1 306 + actionStop: 307 + args: [backward] 308 + lua: pitchInput = pitchInput - 1 309 + actionStart: 310 + args: [left] 311 + lua: rollInput = rollInput - 1 312 + actionStop: 313 + args: [left] 314 + lua: rollInput = rollInput + 1 315 + actionStart: 316 + args: [right] 317 + lua: rollInput = rollInput + 1 318 + actionStop: 319 + args: [right] 320 + lua: rollInput = rollInput - 1 321 + 322 + actionStart: 323 + args: [straferight] 324 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.lateral, 1.0) 325 + actionStop: 326 + args: [straferight] 327 + lua: Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.lateral, -1.0) 328 + 329 + actionStart: 330 + args: [strafeleft] 331 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.lateral, -1.0) 332 + actionStop: 333 + args: [strafeleft] 334 + lua: Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.lateral, 1.0) 335 + 336 + actionStart: 337 + args: [up] 338 + lua: | 339 + Nav.axisCommandManager:deactivateGroundEngineAltitudeStabilization() 340 + Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.vertical, 1.0) 341 + actionStop: 342 + args: [up] 343 + lua: | 344 + Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.vertical, -1.0) 345 + Nav.axisCommandManager:activateGroundEngineAltitudeStabilization(currentGroundAltitudeStabilization) 346 + actionStart: 347 + args: [down] 348 + lua: | 349 + Nav.axisCommandManager:deactivateGroundEngineAltitudeStabilization() 350 + Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.vertical, -1.0) 351 + actionStop: 352 + args: [down] 353 + lua: | 354 + Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.vertical, 1.0) 355 + Nav.axisCommandManager:activateGroundEngineAltitudeStabilization(currentGroundAltitudeStabilization) 356 + 357 + actionStart: 358 + args: [groundaltitudeup] 359 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionStart(1.0) 360 + 361 + actionLoop: 362 + args: [groundaltitudeup] 363 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionLoop(1.0) 364 + 365 + 366 + actionStart: 367 + args: [groundaltitudedown] 368 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionStart(-1.0) 369 + 370 + actionLoop: 371 + args: [groundaltitudedown] 372 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionLoop(-1.0) 373 + 374 + actionStart: 375 + args: [yawright] 376 + lua: yawInput = yawInput - 1 377 + actionStop: 378 + args: [yawright] 379 + lua: yawInput = yawInput + 1 380 + actionStart: 381 + args: [yawleft] 382 + lua: yawInput = yawInput + 1 383 + actionStop: 384 + args: [yawleft] 385 + lua: yawInput = yawInput - 1 386 + actionStart: 387 + args: [brake] 388 + lua: | 389 + brakeInput = brakeInput + 1 390 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 391 + if (longitudinalCommandType == axisCommandType.byTargetSpeed) then 392 + local targetSpeed = Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) 393 + if (math.abs(targetSpeed) > constants.epsilon) then 394 + Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.longitudinal, - utils.sign(targetSpeed)) 395 + end 396 + end 397 + actionStop: 398 + args: [brake] 399 + lua: brakeInput = brakeInput - 1 400 + 401 + actionLoop: 402 + args: [brake] 403 + lua: | 404 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 405 + if (longitudinalCommandType == axisCommandType.byTargetSpeed) then 406 + local targetSpeed = Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) 407 + if (math.abs(targetSpeed) > constants.epsilon) then 408 + Nav.axisCommandManager:updateCommandFromActionLoop(axisCommandId.longitudinal, - utils.sign(targetSpeed)) 409 + end 410 + end 411 + actionStart: 412 + args: [booster] 413 + lua: Nav:toggleBoosters() 414 + actionStart: 415 + args: [stopengines] 416 + lua: Nav.axisCommandManager:resetCommand(axisCommandId.longitudinal) 417 + actionStart: 418 + args: [speedup] 419 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.longitudinal, 5.0) 420 + actionLoop: 421 + args: [speedup] 422 + lua: Nav.axisCommandManager:updateCommandFromActionLoop(axisCommandId.longitudinal, 1.0) 423 + actionStart: 424 + args: [speeddown] 425 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.longitudinal, -5.0) 426 + actionLoop: 427 + args: [speeddown] 428 + lua: Nav.axisCommandManager:updateCommandFromActionLoop(axisCommandId.longitudinal, -1.0) 429 + actionStart: 430 + args: [antigravity] 431 + lua: if antigrav ~= nil then antigrav.toggle() end
+557
conf/ground_construct.conf
··· 1 + # This is a file describing a standard autoconfiguration, do not edit. 2 + # See custom/sample.conf for a more generic template and explanation on the syntax. 3 + 4 + name: ui_cu_autoconf_construct_ground 5 + 6 + slots: 7 + core: 8 + class: CoreUnit 9 + antigrav: 10 + class: AntiGravityGeneratorUnit 11 + atmofueltank: 12 + class: AtmoFuelContainer 13 + select: all 14 + spacefueltank: 15 + class: SpaceFuelContainer 16 + select: all 17 + rocketfueltank: 18 + class: RocketFuelContainer 19 + select: all 20 + gyro: 21 + class: GyroUnit 22 + weapon: 23 + class: WeaponUnit 24 + select: manual 25 + radar: 26 + class: RadarPVPUnit 27 + select: manual 28 + 29 + handlers: 30 + unit: 31 + start: 32 + lua: | 33 + pitchInput = 0 34 + pitchInputFromDevice = 0 35 + rollInput = 0 36 + yawInput = 0 37 + verticalStrafeInput = 0 38 + lateralStrafeInput = 0 39 + brakeInput = 0 40 + goingBack = false 41 + goingForward = false 42 + shiftPressed = false 43 + jumpDelta = 0 44 + baseAcceleration = 0.8 --export: Acceleration provided when 'forward' is hit, expressed in g 45 + 46 + Nav = Navigator.new(system, core, unit) 47 + Nav.axisCommandManager:setupCustomTargetSpeedRanges(axisCommandId.longitudinal, {100, 500, 1000, 5000}) 48 + Nav.axisCommandManager:setTargetGroundAltitude(6) 49 + 50 + -- Parenting widget 51 + parentingPanelId = system.createWidgetPanel("Docking") 52 + parentingWidgetId = system.createWidget(parentingPanelId,"parenting") 53 + system.addDataToWidget(unit.getDataId(),parentingWidgetId) 54 + 55 + -- Combat stress widget 56 + coreCombatStressPanelId = system.createWidgetPanel("Core combat stress") 57 + coreCombatStressgWidgetId = system.createWidget(coreCombatStressPanelId,"core_stress") 58 + system.addDataToWidget(core.getDataId(),coreCombatStressgWidgetId) 59 + 60 + -- element widgets 61 + -- For now we have to alternate between PVP and non-PVP widgets to have them on the same side. 62 + _autoconf.displayCategoryPanel(weapon, weapon_size, L_TEXT("ui_lua_widget_weapon", "Weapons"), "weapon", true) 63 + core.show() 64 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_periscope", "Periscope"), "periscope") 65 + placeRadar = true 66 + if atmofueltank_size > 0 then 67 + _autoconf.displayCategoryPanel(atmofueltank, atmofueltank_size, L_TEXT("ui_lua_widget_atmofuel", "Atmo Fuel"), "fuel_container") 68 + if placeRadar then 69 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 70 + placeRadar = false 71 + end 72 + end 73 + if spacefueltank_size > 0 then 74 + _autoconf.displayCategoryPanel(spacefueltank, spacefueltank_size, L_TEXT("ui_lua_widget_spacefuel", "Space Fuel"), "fuel_container") 75 + if placeRadar then 76 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 77 + placeRadar = false 78 + end 79 + end 80 + _autoconf.displayCategoryPanel(rocketfueltank, rocketfueltank_size, L_TEXT("ui_lua_widget_rocketfuel", "Rocket Fuel"), "fuel_container") 81 + if placeRadar then -- We either have only rockets or no fuel tanks at all, uncommon for usual vessels 82 + _autoconf.displayCategoryPanel(radar, radar_size, L_TEXT("ui_lua_widget_radar", "Radar"), "radar") 83 + placeRadar = false 84 + end 85 + if antigrav ~= nil then antigrav.show() end 86 + if gyro ~= nil then gyro.show() end 87 + 88 + throttleStep = 0.25 --export: When pressing the SpeedUp/SpeedDown buttons, this step will be using to increment/decrement the throttle<br>Valid values: From 0.01 to 1 89 + throttleStep = utils.clamp(throttleStep, 0.01, 1) 90 + 91 + -- freeze the player in he is remote controlling the construct 92 + if Nav.control.isRemoteControlled() == 1 then 93 + system.freeze(1) 94 + end 95 + 96 + -- landing gear 97 + -- make sure every gears are synchonized with the first 98 + gearExtended = (Nav.control.isAnyLandingGearExtended() == 1) -- make sure it's a lua boolean 99 + if gearExtended then 100 + Nav.control.extendLandingGears() 101 + else 102 + Nav.control.retractLandingGears() 103 + end 104 + 105 + -- forward/backward functions 106 + startForward = function () 107 + if Nav:isTravelMode() then 108 + brakeInput = 0 109 + local throttle = 1 110 + if not shiftPressed then 111 + local maxGForward = Nav:maxForceForward() / (self.core.getConstructMass() * 9.81) 112 + throttle = utils.clamp(baseAcceleration / maxGForward, 0, 1) 113 + end 114 + 115 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, throttle) 116 + goingForward = true 117 + end 118 + end 119 + 120 + stopForward = function () 121 + if Nav:isTravelMode() then 122 + pitchInput = 0 123 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, 0) 124 + brakeInput = 0.5 125 + goingForward = false 126 + if goingBackward then 127 + startBackward() 128 + end 129 + end 130 + end 131 + 132 + direction = {forward=1, backward = -1} 133 + loopDirection = function (direction) 134 + if Nav:isTravelMode() then 135 + local currentVelocity = vec3(self.core.getVelocity()) 136 + local axisCRefDirection = vec3(self.core.getConstructOrientationForward()) 137 + 138 + lastCurrentSpeed = currentVelocity:dot(axisCRefDirection) 139 + 140 + if (lastCurrentSpeed * direction < 0) then 141 + brakeInput = 1 142 + autobrake = true 143 + else 144 + if autobrake == true then 145 + autobrake = false 146 + brakeInput = 0 147 + end 148 + end 149 + else 150 + Nav.axisCommandManager.axisCommands[axisCommandId.longitudinal]:updateCommandFromActionLoop(direction) 151 + end 152 + end 153 + 154 + startBackward = function () 155 + if Nav:isTravelMode() then 156 + pitchInput = 0 157 + brakeInput = 0 158 + 159 + local maxGBackward = Nav:maxForceBackward() / (self.core.getConstructMass() * 9.81) 160 + local throttle = utils.clamp(baseAcceleration / maxGBackward, -1, 0) 161 + 162 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, throttle) 163 + goingBack = true 164 + end 165 + end 166 + 167 + stopBackward = function () 168 + if Nav:isTravelMode() then 169 + pitchInput = 0 170 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, 0) 171 + brakeInput = 0.5 172 + goingBack = false 173 + if goingForward then 174 + startForward() 175 + end 176 + end 177 + end 178 + 179 + stop: 180 + lua: | 181 + _autoconf.hideCategoryPanels() 182 + if antigrav ~= nil then antigrav.hide() end 183 + if gyro ~= nil then gyro.hide() end 184 + core.hide() 185 + Nav.control.switchOffHeadlights() 186 + 187 + system: 188 + flush: 189 + lua: | 190 + -- constants: use 'myvar = defaultValue --export: description' to expose the variable in context menu<br>in degree<br>Valid values: Superior or equal to 1 191 + local rollAmplitude = 30 --export: When turning, the auto roll won't go over or under rollAmplitude<br>in degree<br>Valid values: Superior or equal to 1 192 + local pitchAmplitude = 25 --export: When pitching, the pitch won't go over or under pitchAmplitude (in degree) 193 + local yawSpeedFactor = 1.5 --export When turning, the inputs will be multiplied by this factor<br>Valid values: Superior or equal to 0.01 194 + local yawAccelerationFactor = 3 --export: When turning, the yaw response will be multiplied by this factor<br>Valid values: Superior or equal to 0.01 195 + 196 + local lateralAntiDriftFactor = 1 --export: When compensating for drift, this factor will increase/decrease the drift force requested to engines<br>Valid values: Superior or equal to 0.01 197 + local lateralStrafeFactor = 5 --export: This factor will increase/decrease the player input along the horizontal strafe axis axis<br>Valid values: Superior or equal to 0.01 198 + 199 + local brakeSpeedFactor = 1 --export: When braking, this factor will increase the brake force by brakeSpeedFactor * velocity<br>Valid values: Superior or equal to 0.01 200 + local brakeFlatFactor = 4 --export: When braking, this factor will increase the brake force by a flat brakeFlatFactor * velocity direction><br>(higher value may be unstable)<br>Valid values: Superior or equal to 0.01 201 + local autoBrakeSpeed = 15 --export: Auto brake when speed is below that value (in m/s), with no thrust 202 + 203 + -- validate params 204 + brakeSpeedFactor = math.max(brakeSpeedFactor, 0.01) 205 + brakeFlatFactor = math.max(brakeFlatFactor, 0.01) 206 + rollAmplitude = math.max(rollAmplitude, 1) 207 + pitchAmplitude = math.max(pitchAmplitude, 1) 208 + yawSpeedFactor = math.max(yawSpeedFactor, 0.01) 209 + yawAccelerationFactor = math.max(yawAccelerationFactor, 0.01) 210 + 211 + if (rollPID == nil) then 212 + rollPID = pid.new(0.2, 0, 10) 213 + pitchPID = pid.new(0.2, 0, 10) 214 + end 215 + 216 + -- final inputs 217 + if Nav.control.isMouseDirectControlActivated() then 218 + -- in direct control, we tweak the pitch to behave inbetween virtual joystick and direct control 219 + -- this helps a lot for ground construct control 220 + pitchInputFromDevice = utils.clamp(pitchInputFromDevice + system.getControlDeviceForwardInput() * system.getActionUpdateDeltaTime(), -1.0, 1.0) 221 + else 222 + pitchInputFromDevice = system.getControlDeviceForwardInput() 223 + end 224 + local finalPitchInput = pitchInput + pitchInputFromDevice 225 + local finalRollInput = rollInput + system.getControlDeviceYawInput() 226 + local finalYawInput = yawInput - system.getControlDeviceLeftRightInput() 227 + local combinedRollYawInput = utils.clamp(finalRollInput - finalYawInput, -1.0, 1.0); 228 + local finalVerticalStrafeInput = verticalStrafeInput 229 + local finalLateralStrafeInput = lateralStrafeInput; 230 + local finalBrakeInput = brakeInput 231 + 232 + -- Axis 233 + local worldVertical = vec3(core.getWorldVertical()) 234 + local constructUp = vec3(core.getConstructWorldOrientationUp()) 235 + local constructForward = vec3(core.getConstructWorldOrientationForward()) 236 + local constructRight = vec3(core.getConstructWorldOrientationRight()) 237 + local constructVelocity = vec3(core.getWorldVelocity()) 238 + local constructVelocityDir = vec3(core.getWorldVelocity()):normalize() 239 + local constructAngularVelocity = vec3(core.getWorldAngularVelocity()) 240 + local constructYawVelocity = constructAngularVelocity:dot(constructUp) 241 + 242 + -- Engine commands 243 + local keepCollinearity = 0 -- for easier reading 244 + local dontKeepCollinearity = 1 -- for easier reading 245 + local tolerancePercentToSkipOtherPriorities = 1 -- if we are within this tolerance (in%), we don't go to the next priorities 246 + 247 + -- Rotation 248 + local currentRollDeg = getRoll(worldVertical, constructForward, constructRight) 249 + local currentPitchDeg = -math.asin(constructForward:dot(worldVertical)) * constants.rad2deg 250 + local targetRollDeg = utils.clamp(combinedRollYawInput * rollAmplitude, -rollAmplitude, rollAmplitude) 251 + local targetPitchDeg = utils.clamp(finalPitchInput * pitchAmplitude, -pitchAmplitude, pitchAmplitude) 252 + rollPID:inject(targetRollDeg - currentRollDeg) 253 + pitchPID:inject(targetPitchDeg - currentPitchDeg) 254 + 255 + local constructYawTargetVelocity = -combinedRollYawInput * yawSpeedFactor 256 + local constructYawTargetAcceleration = yawAccelerationFactor * (constructYawTargetVelocity - constructYawVelocity) 257 + 258 + local constructTargetAngularVelocity = rollPID:get() * constructForward 259 + + pitchPID:get() * constructRight 260 + + constructYawTargetAcceleration * constructUp 261 + 262 + Nav:setEngineTorqueCommand('torque', constructTargetAngularVelocity, keepCollinearity, 'airfoil', '', '', tolerancePercentToSkipOtherPriorities) 263 + 264 + -- Brakes 265 + if (finalBrakeInput == 0 and autoBrakeSpeed > 0 and Nav.axisCommandManager.throttle == 0 and constructVelocity:len() < autoBrakeSpeed) then 266 + finalBrakeInput = 1 267 + end 268 + local brakeAcceleration = -finalBrakeInput * (brakeSpeedFactor * constructVelocity + brakeFlatFactor * constructVelocityDir) 269 + Nav:setEngineForceCommand('brake', brakeAcceleration) 270 + 271 + -- AutoNavigation regroups all the axis command by 'TargetSpeed' 272 + local autoNavigationEngineTags = '' 273 + local autoNavigationAcceleration = vec3() 274 + local autoNavigationUseBrake = false 275 + 276 + -- Longitudinal Translation 277 + local longitudinalEngineTags = 'thrust analog longitudinal' 278 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 279 + if (longitudinalCommandType == axisCommandType.byThrottle) then 280 + local longitudinalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(longitudinalEngineTags,axisCommandId.longitudinal) 281 + Nav:setEngineForceCommand(longitudinalEngineTags, longitudinalAcceleration, keepCollinearity) 282 + elseif (longitudinalCommandType == axisCommandType.byTargetSpeed) then 283 + local longitudinalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.longitudinal) 284 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. longitudinalEngineTags 285 + autoNavigationAcceleration = autoNavigationAcceleration + longitudinalAcceleration 286 + if (Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) == 0 or -- we want to stop 287 + Nav.axisCommandManager:getCurrentToTargetDeltaSpeed(axisCommandId.longitudinal) < - Nav.axisCommandManager:getTargetSpeedCurrentStep(axisCommandId.longitudinal) * 0.5) -- if the longitudinal velocity would need some braking 288 + then 289 + autoNavigationUseBrake = true 290 + end 291 + 292 + end 293 + 294 + -- Lateral Translation 295 + local lateralStrafeEngineTags = 'thrust analog lateral' 296 + local lateralCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.lateral) 297 + if (lateralCommandType == axisCommandType.byThrottle) then 298 + local lateralStrafeAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(lateralStrafeEngineTags,axisCommandId.lateral) 299 + Nav:setEngineForceCommand(lateralStrafeEngineTags, lateralStrafeAcceleration, keepCollinearity) 300 + elseif (lateralCommandType == axisCommandType.byTargetSpeed) then 301 + local lateralAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.lateral) 302 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. lateralStrafeEngineTags 303 + autoNavigationAcceleration = autoNavigationAcceleration + lateralAcceleration 304 + end 305 + 306 + -- Vertical Translation 307 + local verticalStrafeEngineTags = 'thrust analog vertical' 308 + local verticalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.vertical) 309 + if (verticalCommandType == axisCommandType.byThrottle) then 310 + local verticalStrafeAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromThrottle(verticalStrafeEngineTags,axisCommandId.vertical) 311 + Nav:setEngineForceCommand(verticalStrafeEngineTags, verticalStrafeAcceleration, keepCollinearity, 'airfoil', 'ground', '', tolerancePercentToSkipOtherPriorities) 312 + elseif (verticalCommandType == axisCommandType.byTargetSpeed) then 313 + local verticalAcceleration = Nav.axisCommandManager:composeAxisAccelerationFromTargetSpeed(axisCommandId.vertical) 314 + autoNavigationEngineTags = autoNavigationEngineTags .. ' , ' .. verticalStrafeEngineTags 315 + autoNavigationAcceleration = autoNavigationAcceleration + verticalAcceleration 316 + end 317 + 318 + -- Auto Navigation (Cruise Control) 319 + if (autoNavigationAcceleration:len() > constants.epsilon) then 320 + if (brakeInput ~= 0 or autoNavigationUseBrake or math.abs(constructVelocityDir:dot(constructForward)) < 0.95) -- if the velocity is not properly aligned with the forward 321 + then 322 + autoNavigationEngineTags = autoNavigationEngineTags .. ', brake' 323 + end 324 + Nav:setEngineForceCommand(autoNavigationEngineTags, autoNavigationAcceleration, dontKeepCollinearity, '', '', '', tolerancePercentToSkipOtherPriorities) 325 + end 326 + 327 + -- Rockets 328 + Nav:setBoosterCommand('rocket_engine') 329 + update: 330 + lua: | 331 + Nav:update() 332 + if system.getThrottleInputFromMouseWheel() ~= 0.0 then 333 + brakeInput = 0 334 + end 335 + 336 + if unit.isMouseControlActivated() == 0 then 337 + local currentVelocity = vec3(self.core.getVelocity()) 338 + local axisCRefDirection = vec3(self.core.getConstructOrientationForward()) 339 + local v = currentVelocity:dot(axisCRefDirection) 340 + local minv = 20 341 + local maxPitch = 0.4 342 + if v < minv or not goingForward then 343 + pitchInput = 0 344 + else 345 + if not goingBack and goingForward then 346 + pitchInput = utils.clamp((maxPitch/minv) * (v - minv), 0, maxPitch) 347 + end 348 + end 349 + end 350 + 351 + pitchInput = pitchInput + jumpDelta 352 + 353 + actionStart: 354 + args: [gear] 355 + lua: | 356 + gearExtended = not gearExtended 357 + if gearExtended then 358 + Nav.control.extendLandingGears() 359 + else 360 + Nav.control.retractLandingGears() 361 + end 362 + 363 + actionStart: 364 + args: [light] 365 + lua: | 366 + if Nav.control.isAnyHeadlightSwitchedOn() == 1 then 367 + Nav.control.switchOffHeadlights() 368 + else 369 + Nav.control.switchOnHeadlights() 370 + end 371 + 372 + actionLoop: 373 + args: [backward] 374 + lua: loopDirection(direction.backward) 375 + 376 + actionStart: 377 + args: [backward] 378 + lua: startBackward() 379 + 380 + actionStop: 381 + args: [backward] 382 + lua: stopBackward() 383 + 384 + actionLoop: 385 + args: [forward] 386 + lua: loopDirection(direction.forward) 387 + 388 + actionStart: 389 + args: [forward] 390 + lua: startForward() 391 + 392 + actionStop: 393 + args: [forward] 394 + lua: stopForward() 395 + 396 + actionStart: 397 + args: [lshift] 398 + lua: | 399 + shiftPressed = true 400 + if goingForward then 401 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, 1) 402 + end 403 + actionStop: 404 + args: [lshift] 405 + lua: | 406 + shiftPressed = false 407 + if goingForward then 408 + local maxGForward = Nav:maxForceForward() / (self.core.getConstructMass() * 9.81) 409 + local throttle = utils.clamp(baseAcceleration / maxGForward, 0, 1) 410 + Nav.axisCommandManager:setThrottleCommand(axisCommandId.longitudinal, throttle) 411 + end 412 + 413 + actionStart: 414 + args: [left] 415 + lua: rollInput = rollInput - 1 416 + actionStop: 417 + args: [left] 418 + lua: rollInput = rollInput + 1 419 + actionStart: 420 + args: [right] 421 + lua: rollInput = rollInput + 1 422 + actionStop: 423 + args: [right] 424 + lua: rollInput = rollInput - 1 425 + 426 + actionStart: 427 + args: [straferight] 428 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.lateral, 1.0) 429 + actionStop: 430 + args: [straferight] 431 + lua: Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.lateral, -1.0) 432 + 433 + actionStart: 434 + args: [strafeleft] 435 + lua: Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.lateral, -1.0) 436 + actionStop: 437 + args: [strafeleft] 438 + lua: Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.lateral, 1.0) 439 + 440 + actionStart: 441 + args: [up] 442 + lua: | 443 + baseAltitude = Nav:getTargetGroundAltitude() 444 + Nav.axisCommandManager:setTargetGroundAltitude(baseAltitude + 4) 445 + actionLoop: 446 + args: [up] 447 + lua: | 448 + if unit.isMouseControlActivated() == 0 then 449 + jumpDelta = utils.clamp(jumpDelta + 0.01, 0, 0.6) 450 + end 451 + actionStop: 452 + args: [up] 453 + lua: | 454 + Nav.axisCommandManager:setTargetGroundAltitude(baseAltitude) 455 + if unit.isMouseControlActivated() == 0 then 456 + jumpDelta = 0 457 + end 458 + actionStart: 459 + args: [down] 460 + lua: | 461 + Nav.axisCommandManager:deactivateGroundEngineAltitudeStabilization() 462 + Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.vertical, -1.0) 463 + actionStop: 464 + args: [down] 465 + lua: | 466 + Nav.axisCommandManager:updateCommandFromActionStop(axisCommandId.vertical, 1.0) 467 + Nav.axisCommandManager:activateGroundEngineAltitudeStabilization(defaultGroundAltitudeStabilization) 468 + 469 + actionStart: 470 + args: [groundaltitudeup] 471 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionStart(1.0) 472 + 473 + actionLoop: 474 + args: [groundaltitudeup] 475 + lua: | 476 + Nav.axisCommandManager:updateTargetGroundAltitudeFromActionLoop(1.0) 477 + jumpDelta = 0 478 + 479 + actionStart: 480 + args: [groundaltitudedown] 481 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionStart(-1.0) 482 + 483 + actionLoop: 484 + args: [groundaltitudedown] 485 + lua: Nav.axisCommandManager:updateTargetGroundAltitudeFromActionLoop(-1.0) 486 + actionStart: 487 + args: [yawright] 488 + lua: yawInput = yawInput - 1 489 + actionStop: 490 + args: [yawright] 491 + lua: yawInput = yawInput + 1 492 + actionStart: 493 + args: [yawleft] 494 + lua: yawInput = yawInput + 1 495 + actionStop: 496 + args: [yawleft] 497 + lua: yawInput = yawInput - 1 498 + actionStart: 499 + args: [brake] 500 + lua: | 501 + brakeInput = brakeInput + 1 502 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 503 + if (longitudinalCommandType == axisCommandType.byTargetSpeed) then 504 + local targetSpeed = Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) 505 + if (math.abs(targetSpeed) > constants.epsilon) then 506 + Nav.axisCommandManager:updateCommandFromActionStart(axisCommandId.longitudinal, - utils.sign(targetSpeed)) 507 + end 508 + end 509 + actionStop: 510 + args: [brake] 511 + lua: brakeInput = 0 512 + 513 + actionLoop: 514 + args: [brake] 515 + lua: | 516 + local longitudinalCommandType = Nav.axisCommandManager:getAxisCommandType(axisCommandId.longitudinal) 517 + if (longitudinalCommandType == axisCommandType.byTargetSpeed) then 518 + local targetSpeed = Nav.axisCommandManager:getTargetSpeed(axisCommandId.longitudinal) 519 + if (math.abs(targetSpeed) > constants.epsilon) then 520 + Nav.axisCommandManager:updateCommandFromActionLoop(axisCommandId.longitudinal, - utils.sign(targetSpeed)) 521 + end 522 + end 523 + actionStart: 524 + args: [booster] 525 + lua: Nav:toggleBoosters() 526 + actionStart: 527 + args: [stopengines] 528 + lua: Nav.axisCommandManager:resetCommand(axisCommandId.longitudinal) 529 + 530 + actionLoop: 531 + args: [speedup] 532 + lua: loopDirection(direction.forward) 533 + 534 + actionStart: 535 + args: [speedup] 536 + lua: startForward() 537 + 538 + actionStop: 539 + args: [speedup] 540 + lua: stopForward() 541 + 542 + actionStart: 543 + args: [speeddown] 544 + lua: startBackward() 545 + 546 + actionStop: 547 + args: [speeddown] 548 + lua: stopBackward() 549 + 550 + actionLoop: 551 + args: [speeddown] 552 + lua: loopDirection(direction.backward) 553 + 554 + 555 + actionStart: 556 + args: [antigravity] 557 + lua: if antigrav ~= nil then antigrav.toggle() end
+17
conf/pvp_seat.conf
··· 1 + # This is a file describing a standard autoconfiguration, do not edit. 2 + # See custom/sample.conf for a more generic template and explanation on the syntax. 3 + 4 + name: ui_cu_autoconf_pvp_seat 5 + pvp: true 6 + 7 + slots: 8 + core: 9 + class: CoreUnit 10 + weapon: 11 + class: WeaponUnit 12 + select: manual 13 + radar: 14 + class: RadarPVPUnit 15 + select: manual 16 + 17 + handlers: