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 = {}
|
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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue