fix(world): link the player to the right input source
This commit is contained in:
parent
8d524fb4db
commit
47c6bab698
1 changed files with 4 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue