Flux.Player classserver
Part of Flow
Sends notifications and sounds from the server to the players. Flux.Player:notify
notifies one player and Flux.Player:broadcast notifies everyone. The message can be a
language phrase with arguments; it is translated on the client of each recipient and
displayed there with Flux.Notification. Player:notify is the shorter way to notify a
single player.
Flux.Player:play_sound plays a sound once on the clients of the given players, and
Flux.Player:start_sound and Flux.Player:stop_sound control named looping sounds
there, such as an ambience or an alarm that only some players should hear. Player has
methods of the same names for a single player.
Summary
Methods
Methods
Sends a notification to every player and writes it to the server log.
Parameters
- message String text or language phrase
- arguments Map optional, defaults to
nilvalues to substitute into the phrase
Sends a notification to a player. If the player is not valid (e.g. the server console) the message is written to the server log instead.
Parameters
- target Player
- message String text or language phrase
- arguments Map optional, defaults to
nilvalues to substitute into the phrase - color Color optional, defaults to
nil
Plays a sound once on the clients of the given players. The sound has no position in the world and is heard at full volume, like an interface sound.
Flux.Player:play_sound(target, 'buttons/button15.wav')
Parameters
- target Player/List<Player> who hears the sound; everyone if nil
- path String path of the sound file, relative to the sound/ folder
Starts a named looping sound on the clients of the given players. The sound keeps
playing until it is stopped with Flux.Player:stop_sound under the same name. Starting
another sound under a name that is in use replaces the old one, and starting the same
sound again does nothing. Whether the sound loops is up to the sound file: a file
without loop points plays once.
Flux.Player:start_sound(target, 'heartbeat', 'player/heartbeat1.wav', 0.5)
Parameters
- target Player/List<Player> who hears the sound; everyone if nil
- id String name to stop the sound by
- path String path of the sound file, relative to the sound/ folder
- volume Number optional, defaults to
0.75volume from 0 to 1
Stops a named sound on the clients of the given players. Does nothing for players who do not have a sound under that name.
Flux.Player:stop_sound(target, 'heartbeat', 2)
Parameters
- target Player/List<Player> whose sound stops; everyone if nil
- id String name the sound was started under
- fade_out Number optional, defaults to
0seconds over which the sound fades out; 0 cuts it off