fix(world): link the player to the right input source

This commit is contained in:
Kazhnuz 2019-09-07 21:34:52 +02:00
parent 8d524fb4db
commit 47c6bab698

View file

@ -239,7 +239,7 @@ function BaseWorld:addPlayer(x, y, z, id)
local player = {} local player = {}
if id <= self.playerNumber then if id <= self.playerNumber then
player.actor = self:newPlayer(x, y, z) player.actor = self:newPlayer(x, y, z)
player.sourceid = sourceid or 1 player.sourceid = id or 1
table.insert(self.players, player) table.insert(self.players, player)
@ -252,10 +252,9 @@ function BaseWorld:newPlayer(x, y, z)
end end
function BaseWorld:sendInputToPlayers(actor) function BaseWorld:sendInputToPlayers(actor)
for i,v in ipairs(self.players) do for i, player in ipairs(self.players) do
--TODO: make the player get from a selected source inputs local keys = self.scene.sources[player.sourceid].keys
local keys = self.scene.sources[v.sourceid].keys player.actor:getInput(keys)
v.actor:getInput(keys)
end end
end end