From 47c6bab698a1cadf5b77bc4678d4ef59b56e3df4 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 7 Sep 2019 21:34:52 +0200 Subject: [PATCH] fix(world): link the player to the right input source --- gamecore/modules/world/baseworld.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gamecore/modules/world/baseworld.lua b/gamecore/modules/world/baseworld.lua index 2ad0dce..f7c53f5 100644 --- a/gamecore/modules/world/baseworld.lua +++ b/gamecore/modules/world/baseworld.lua @@ -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