Tabletop Simulator

Tabletop Simulator

FTC Competitive 40k Map Base 10th - v2.66 (2025-07-13)
Make passTurn more verbose
Hi! Thanks for the great work on providing us with this amazing tool to play 40k. My friend and I recently encountered an issue where we thought the start menu was broken.

Since I have some coding experience, I looked into the Lua code and realized that this isn’t actually a bug — it’s a feature! It seems that only the player whose turn it currently is can pass the turn to the next player.

To make this behavior clearer to users, I’d like to propose a small change to the passTurn function in the “Start Menu” code. This adjustment would help explain why the turn doesn’t change when someone other than the active player tries to do so.

´´´
function nextPhase(obj, player_color_click, alt_click)
resetActivationTokens()
if alt_click then
passTurn(obj, player_color_click, alt_click)
return
end
currentPhase = currentPhase + 1
if currentPhase > #phases then
currentPhase = 1
passTurn(obj, player_color_click, alt_click)
end
broadcastToAll(phases[currentPhase].." phase", "Yellow")
writeMenus()
end

function passTurn(obj, player_color_click, alt_click)
if player_color_click ~= currentTurn then
if simulation then
broadcastToAll("INTRUDER", "Pink")
return
else
broadcastToAll("Not passing the turn to the next player", "Red")
return
end
end
broadcastToAll("Passing turn to next player", "Yellow")
currentPhase = 1
if currentTurn == "Red" then
currentTurn = "Blue" -- it has to be the opposite
blueTurnCounter.call("increaseSelf")
blueCpCounter.Counter.increment()
if cpEveryTurn then
redCpCounter.Counter.increment()
Wait.time(function() broadcastToAll("Both CPs incremented!", "White") end, 0.3)
else
Wait.time(function() broadcastToAll("Blue CPs incremented!", "Blue") end, 0.3)
end
else
currentTurn = "Red"
redTurnCounter.call("increaseSelf")
redCpCounter.Counter.increment()
if cpEveryTurn then
blueCpCounter.Counter.increment()
Wait.time(function() broadcastToAll("Both CPs incremented!", "White") end, 0.3)
else
Wait.time(function() broadcastToAll("Red CPs incremented!", "Red") end, 0.3)
end
end
if simulation then
broadcastToAll("It's "..currentTurn.." turn", currentTurn)
else
if Player[currentTurn].steam_name then
broadcastToAll("It's "..Player[currentTurn].steam_name.." turn", currentTurn)
else
broadcastToAll("It's "..currentTurn.." turn", currentTurn)
end
end
writeMenus()
end
´´´