Input system's seat link is now being updated on change
This commit is contained in:
parent
7cbdea15b4
commit
f55c30c4d3
@ -21,3 +21,11 @@ local input = Input:new(options)
|
||||
hook.add('tick', 'InputUpdate', function()
|
||||
input:update()
|
||||
end)
|
||||
|
||||
if SERVER then
|
||||
hook.add('input', 'wire_input_update', function(key, value)
|
||||
if key == 'Seat' then
|
||||
input:updateSeat()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@ -104,13 +104,18 @@ function Input:initialize(options)
|
||||
|
||||
self:_setupAxles(axles)
|
||||
|
||||
self.seat = wire.ports.Seat
|
||||
self:updateSeat()
|
||||
|
||||
self.driver = self:getDriver()
|
||||
|
||||
-- in case chip was reset
|
||||
self:_syncDriver(self.driver)
|
||||
end
|
||||
|
||||
function Input:updateSeat()
|
||||
self.seat = wire.ports.Seat or NULL_ENTITY
|
||||
end
|
||||
|
||||
function Input:getDriver()
|
||||
if self.seat == nil or self.seat:isValid() == false then
|
||||
return NULL_ENTITY
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user