Creating new steering
This commit is contained in:
parent
4c12c9d9ed
commit
03f68e85e5
33
koptilnya/steering/main.txt
Normal file
33
koptilnya/steering/main.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
-- @name Grip steering
|
||||||
|
-- @author DarkSupah
|
||||||
|
-- @server
|
||||||
|
local frontWheelsConfig = {
|
||||||
|
Camber = -5,
|
||||||
|
Caster = 5,
|
||||||
|
Ackermann = 1.1,
|
||||||
|
Lock = 50
|
||||||
|
}
|
||||||
|
|
||||||
|
local rearWheelsConfig = {
|
||||||
|
Camber = -5,
|
||||||
|
Caster = -5,
|
||||||
|
Ackermann = 1.2,
|
||||||
|
Lock = 5
|
||||||
|
}
|
||||||
|
|
||||||
|
local NULL_ENTITY = entity(0)
|
||||||
|
|
||||||
|
local INPUTS = {
|
||||||
|
Seat = "entity"
|
||||||
|
}
|
||||||
|
local OUTPUTS = {
|
||||||
|
Steer = "number"
|
||||||
|
}
|
||||||
|
|
||||||
|
wire.adjustPorts(INPUTS, OUTPUTS)
|
||||||
|
|
||||||
|
local steeringController = SteeringController:new()
|
||||||
|
|
||||||
|
hook.add("think", "steeringUpdate", function()
|
||||||
|
steeringController.steeringController:update()
|
||||||
|
end)
|
||||||
1
koptilnya/steering/steer_axle.txt
Normal file
1
koptilnya/steering/steer_axle.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
||||||
26
koptilnya/steering/steering_controller.txt
Normal file
26
koptilnya/steering/steering_controller.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
SteeringController = class("SteeringController")
|
||||||
|
|
||||||
|
function SteeringController:initialize()
|
||||||
|
self.seat = NULL_ENTITY
|
||||||
|
self.driver = NULL_ENTITY
|
||||||
|
|
||||||
|
hook.add("PlayerEnteredVehicle", "", function(ply, veh)
|
||||||
|
if veh == self.seat then
|
||||||
|
self.driver = ply
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
hook.add("PlayerLeaveVehicle", "", function(ply, veh)
|
||||||
|
if veh == self.seat then
|
||||||
|
self.driver = NULL_ENTITY
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SteeringController:update()
|
||||||
|
-- print()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SteeringController:setDriver(ply)
|
||||||
|
self.driver = ply
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user