OsuRoom

Represents a multiplayer lobby in osu! Automatically does ratelimiting by not sending more than a message every 2 seconds.

All slot indices are 0 based.

class OsuRoom {}

Members

Functions

abortMatch
void abortMatch()

Aborts a running match

abortTimer
void abortTimer()

Aborts any running countdown

channel
string channel()

Returns the channel name as on IRC

clearhost
void clearhost()

Makes nobody host (make it system/bog managed)

close
void close()

Closes the room

hasPlayer
bool hasPlayer(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
host
void host(string player)

Gives host to a player

invite
void invite(string player)

Invites a player to the room

kick
void kick(string player)

Kicks a player from the room

locked
void locked(bool locked)

Property to lock slots (disallow changing slots & joining)

map
void map(string id)

Changes the map to a beatmap ID (b/ url)

mods
void mods(Mod[] mods)

Changes the mods in this lobby (pass FreeMod first if you want FreeMod)

move
void move(string player, int slot)

Moves a player to another slot

mpid
string mpid()

Returns the game ID as usable in osu://mp/ID urls

password
void password(string pw)

Sets the match password (password will be visible to existing players)

playerByName
Settings.Player playerByName(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
playerByName
Settings.Player playerByName(string name, size_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
playerSlotByName
ubyte playerSlotByName(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
processClosed
void processClosed()

Processes a room closed event

processFinishPlaying
void processFinishPlaying(string player, long score, bool pass)

Processes a user finish playing event & updates the state

processHost
void processHost(string user)

Processes a user host event & updates the state

processJoin
void processJoin(string user, ubyte slot)

Processes a user join event & updates the state

processLeave
void processLeave(string user)

Processes a user leave event & updates the state

processMatchFinish
void processMatchFinish()

Processes a match end event & updates the state

processMove
void processMove(string user, ubyte slot)

Processes a user move event & updates the state

processSize
void processSize(ubyte numSlots)

Processes a room size change event & updates the state

processTeam
void processTeam(string user, Team team)

Processes a user team switch event & updates the state

ratelimit
void ratelimit(HighPriority highPriority)

Manually wait until you can send a message again

room
string room()

Returns the room ID as usable in the mp history URL or IRC joinable via #mp_ID

sendMessage
void sendMessage(char[] message, HighPriority highPriority)

Sends a message with a 2 second ratelimit

set
void set(TeamMode teammode, ScoreMode scoremode, ubyte size)

Sets up teammode, scoremode & lobby size

setTeam
void setTeam(string user, Team team)

Changes a user's team

setTimer
void setTimer(Duration d)

Sets a timer using !mp timer

settings
Settings settings()

Returns the current mp settings

size
void size(ubyte slots)

Changes the slot limit of this lobby

slot
Settings.Player slot(int index)
Undocumented in source. Be warned that the author may not have intended to support it.
start
void start(Duration after)

Starts a match after a specified amount of seconds. If after is <= 0 the game will be started immediately. The timeout can be canceled using abortTimer.

waitForJoin
string waitForJoin(Duration timeout)

Waits for a player to join the room & return the username

waitForTimer
void waitForTimer(Duration timeout)

Waits for an existing timer/countdown to finish (wont start one)

Structs

Settings
struct Settings

Returned by !mp settings

Variables

onBeatmapChanged
Event!BeatmapInfo onBeatmapChanged;

Host changed map

onBeatmapPending
Event!() onBeatmapPending;

Host is changing beatmap

onClosed
Event!() onClosed;

The room has been closed

onCountdownFinished
Event!() onCountdownFinished;

A timer finished

onMatchEnd
Event!() onMatchEnd;

Match has ended (all players finished)

onMatchStart
Event!() onMatchStart;

Match has started

onMessage
Event!Message onMessage;

A message by anyone has been sent

onPlayerFinished
Event!(string, long, bool) onPlayerFinished;

A user finished playing. username + score + passed

onPlayersReady
Event!() onPlayersReady;

emitted when all players are ready

onUserHost
Event!string onUserHost;

username as argument

onUserJoin
Event!(string, ubyte) onUserJoin;

username + slot (0 based) as argument

onUserLeave
Event!string onUserLeave;

username as argument

onUserMove
Event!(string, ubyte) onUserMove;

username + slot (0 based) as argument

onUserTeamChange
Event!(string, Team) onUserTeamChange;

username & team as argument

slots
Settings.Player[16] slots;

Automatically managed state of player slots, empty slots are Player.init

Meta