Experimental

An early preview: docs, the API and the dashboard may change or break.

Report a problem
Module

@std/round

A waiting room, a countdown, a timed round and a results screen, built on the core modules.

local round = require("@std/round")

Functions

round.start(options: round.Options) -> round.Round
#

Starts a round: it waits for minPlayers, counts down, then fires started and runs until finish.

local round = require("@std/round")
local world = require("@ember/world")

-- A whole match flow: wait for 2 players, count down 5 seconds, run for 3 minutes.
local game = round.start({
	minPlayers = 2,
	countdown = 5,
	duration = 180,
	title = "<red>Last One Standing",
})

-- `started` hands over the players in the round.
game.started:connect(function(contenders)
	for _, player in contenders do
		player:teleport(world.markers.single("arena").position)
		player.died:once(function()
			player:setGameMode("spectator")
		end)
	end
end)

-- Out of time: everyone still alive wins together. `finish` shows the result and sends everyone home.
game.timedOut:connect(function()
	local survivors = {}
	for _, player in world.regions.single("arena").players do
		table.insert(survivors, player)
	end
	game:finish({ winners = survivors, reason = "Time's up" })
end)

Types