Pulled from master, fixed conflict
This commit is contained in:
5
koptilnya/steering/input.txt
Normal file
5
koptilnya/steering/input.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
Input = class("Input")
|
||||
|
||||
function Input:initialize(keyMap)
|
||||
|
||||
end
|
||||
@@ -14,39 +14,43 @@ local frontConfig = {
|
||||
Camber = -5,
|
||||
Caster = 5,
|
||||
Ackermann = 1.1,
|
||||
Lock = 50
|
||||
Lock = 50,
|
||||
CorrectionOn = 0.8,
|
||||
CorrectionOff = 0.2
|
||||
}
|
||||
local rearConfig = {
|
||||
Camber = -5,
|
||||
Caster = -5,
|
||||
Ackermann = 1.2,
|
||||
Lock = 5
|
||||
Lock = 5,
|
||||
CorrectionOn = 0.8,
|
||||
CorrectionOff = 0.2
|
||||
}
|
||||
|
||||
-- Fucking slaves, get you ass back here
|
||||
local SLAVES = {
|
||||
local _slaves = {
|
||||
E1 = "entity",
|
||||
E2 = "entity",
|
||||
E3 = "entity",
|
||||
E4 = "entity"
|
||||
}
|
||||
|
||||
local AXLES = {SteerAxle:new(frontConfig, wire.ports.E1, wire.ports.E2),
|
||||
SteerAxle:new(rearConfig, wire.ports.E3, wire.ports.E4)}
|
||||
local _axles = {SteerAxle:new(frontConfig, wire.ports.E1, wire.ports.E2),
|
||||
SteerAxle:new(rearConfig, wire.ports.E3, wire.ports.E4)}
|
||||
|
||||
local INPUTS = {
|
||||
local _inputs = {
|
||||
Base = "entity",
|
||||
Seat = "entity"
|
||||
}
|
||||
|
||||
local OUTPUTS = {
|
||||
local _outputs = {
|
||||
SteerNormalized = "number",
|
||||
Driver = "entity"
|
||||
}
|
||||
|
||||
local ALL_INPUTS = table.merge(INPUTS, SLAVES)
|
||||
local _allInputs = table.merge(_inputs, _slaves)
|
||||
|
||||
wire.adjustPorts(ALL_INPUTS, OUTPUTS)
|
||||
wire.adjustPorts(_allInputs, _outputs)
|
||||
|
||||
local steeringController = SteeringController:new(wire.ports.Base)
|
||||
|
||||
|
||||
@@ -9,5 +9,15 @@ function SteerAxle:initialize(config, leftWheel, rightWheel)
|
||||
end
|
||||
|
||||
function SteerAxle:update()
|
||||
|
||||
self:_updateSlave(self.leftWheel)
|
||||
self:_updateSlave(self.rightWheel)
|
||||
end
|
||||
|
||||
function SteerAxle:_updateSlave(slave)
|
||||
if slave:isValid() and not slave:isPlayerHolding() then
|
||||
slave:setAngles(base:localToWorldAngles(Angle(0, 0, 0)))
|
||||
if not slave:isFrozen() then
|
||||
slave:setFrozen()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user