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