Module SubtitleDisplay

Provides the SubtitleDisplay class, which is the base class for subtitle displays.

Class SubtitleDisplay

subtitles.SubtitleDisplay:new (username) Constructor.
subtitles.SubtitleDisplay:init () Initialises the display.
subtitles.SubtitleDisplay:register () Registers the display, making it available to use.
subtitles.SubtitleDisplay:handle_sound_play (sound) Handles a call to `minetest.sound_play()` or an equivalent event.
subtitles.SubtitleDisplay:handle_sound_stop (sound_or_handle) Handles a call to `minetest.sound_stop()` or an equivalent event.
subtitles.SubtitleDisplay:destroy () Destroys the display.
subtitles.SubtitleDisplay:get_player () Returns the display's owner.
subtitles.SubtitleDisplay:add_sound (sound) Handles a subtitle being added.
subtitles.SubtitleDisplay:remove_sound (sound) Handles a subtitle being removed.
subtitles.SubtitleDisplay:update_sound (sound) Handles a sound changing.
subtitles.SubtitleDisplay:step (dtime) Called every game tick.
subtitles.SubtitleDisplay.get_by_name (name) Returns the subtitle display class with the specified name.


Class SubtitleDisplay

The base class for subtitle displays.
subtitles.SubtitleDisplay:new (username)
Constructor.

Parameters:

  • username The username of the player.
subtitles.SubtitleDisplay:init ()
Initialises the display.
subtitles.SubtitleDisplay:register ()
Registers the display, making it available to use.
subtitles.SubtitleDisplay:handle_sound_play (sound)
Handles a call to `minetest.sound_play()` or an equivalent event.

Parameters:

  • sound A `Sound` object.
subtitles.SubtitleDisplay:handle_sound_stop (sound_or_handle)
Handles a call to `minetest.sound_stop()` or an equivalent event.

Parameters:

  • sound_or_handle The sound's numeric handle, or the `Sound` object if it's ephemeral.
subtitles.SubtitleDisplay:destroy ()
Destroys the display.
subtitles.SubtitleDisplay:get_player ()
Returns the display's owner.

Returns:

    The player's ObjectRef, or nil.
subtitles.SubtitleDisplay:add_sound (sound)
Handles a subtitle being added.

Parameters:

  • sound A `Sound` object.
subtitles.SubtitleDisplay:remove_sound (sound)
Handles a subtitle being removed.

Parameters:

  • sound A `Sound` object.
subtitles.SubtitleDisplay:update_sound (sound)
Handles a sound changing.

Parameters:

  • sound A `Sound` object.
subtitles.SubtitleDisplay:step (dtime)
Called every game tick.

Parameters:

  • dtime Seconds since the last tick.
subtitles.SubtitleDisplay.get_by_name (name)
Returns the subtitle display class with the specified name.

Parameters:

  • name A display name string.

Returns:

    A subclass of `SubtitleDisplay` or nil.
generated by LDoc 1.4.6 Last updated 2023-01-14 06:51:17