Skip to content

Commit 3c8b9bc

Browse files
authored
Merge pull request #36 from Myggski/lobby-max-players
fix max-players in lobby
2 parents 7c4bf75 + 5d15e14 commit 3c8b9bc

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

code/game/systems/bubble_controller_system.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
local bubble_controller = require "code.game.entities.bubble_controller"
2+
local player = require "code.game.entities.player"
23
local helper = require "code.game.systems.bubble_controller_system_helper"
34
local player_input = require "code.game.player_input"
45
local system = require "code.engine.ecs.system"
56

6-
77
-- Is being called every frame
88
local bubble_controller_system = system(function(self, dt)
99
local entities = helper.sort_entities(self:to_list(bubble_controller.get_archetype()))
@@ -12,8 +12,11 @@ local bubble_controller_system = system(function(self, dt)
1212
local expected_number_of_bubbles = number_available_joysticks + 1 - number_active_controllers
1313

1414
-- Remove all bubbles if max players is reached
15-
if number_active_controllers >= GAME.MAX_PLAYERS then
16-
helper.destroy_all(entities)
15+
if #self:to_list(player.get_archetype()) >= GAME.MAX_PLAYERS then
16+
if #entities > 0 then
17+
helper.destroy_all(entities)
18+
end
19+
1720
return
1821
end
1922

main.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ function love.keypressed(key, scancode, is_repeat)
8686
if key == "escape" then
8787
love.event.quit()
8888
end
89-
90-
if key == "f2" then --set to whatever key you want to use
91-
os.execute("cls")
92-
end
9389
end
9490

9591
function love.keyreleased(key, scancode)

0 commit comments

Comments
 (0)