~jadedctrl/gem-xwx-moe

~jadedctrl/gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/subtitles/init.lua
 ..
0 --[[
1 Subtitles — adds subtitles to Minetest.
2
3 Copyright © 2022‒2023, Silver Sandstone <@SilverSandstone@craftodon.social>
4
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included
13 in all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 DEALINGS IN THE SOFTWARE.
22 ]]
23
24
25 --- Mod entry point.
26
27
28 local S = minetest.get_translator('subtitles');
29
30
31 subtitles = {S = S};
32
33 subtitles.TITLE = 'Subtitles';
34 subtitles.VERSION = '0.3.0';
35 subtitles.AUTHOR = 'Silver Sandstone';
36 subtitles.ABOUT = S('@1 v@2 by @3', subtitles.TITLE, subtitles.VERSION, subtitles.AUTHOR);
37
38 subtitles.DEFAULT_DISPLAY_NAME = 'corner';
39
40 subtitles.DEFAULT_DURATION = 3;
41 subtitles.EPHEMERAL_DURATION = 1;
42 subtitles.FOOTSTEP_DURATION = 0.5;
43 subtitles.DEFAULT_MAX_HEAR_DISTANCE = 32;
44 subtitles.FOOTSTEP_HEAR_DISTANCE = 16;
45 subtitles.FOOTSTEP_INTERVAL = 0.25;
46
47
48 --- Mod settings.
49 subtitles.settings =
50 {
51 default_enable_singleplayer = minetest.settings:get_bool('subtitles.default_enable_singleplayer', true); -- Subtitles enabled by default in singleplayer.
52 default_enable_multiplayer = minetest.settings:get_bool('subtitles.default_enable_multiplayer', false); -- Subtitles enabled by default in multiplayer.
53 default_enable = nil; -- Subtitles enabled by default in the current mode.
54 show_introduction = minetest.settings:get_bool('subtitles.show_introduction', true); -- Show introduction message to new players.
55 inventory_integration = minetest.settings:get_bool('subtitles.inventory_integration', true); -- Enable subtitles button in supported inventories.
56 };
57
58 if minetest.is_singleplayer() then
59 subtitles.settings.default_enable = subtitles.settings.default_enable_singleplayer;
60 else
61 subtitles.settings.default_enable = subtitles.settings.default_enable_multiplayer;
62 end;
63
64
65 local modpath = minetest.get_modpath(minetest.get_current_modname());
66
67 --- The root of the class hierarchy.
68 -- @type Object
69 subtitles.Object = dofile(modpath .. '/classic.lua');
70
71 dofile(modpath .. '/util.lua');
72 dofile(modpath .. '/api.lua');
73 dofile(modpath .. '/listeners.lua');
74 dofile(modpath .. '/descriptions.lua');
75 dofile(modpath .. '/chatcommands.lua');
76 dofile(modpath .. '/menu.lua');
77 dofile(modpath .. '/Agent.lua');
78 dofile(modpath .. '/Sound.lua');
79 dofile(modpath .. '/SubtitleDisplay.lua');
80 dofile(modpath .. '/BaseTextSubtitleDisplay.lua');
81 dofile(modpath .. '/CornerSubtitleDisplay.lua');
82 dofile(modpath .. '/ClassicSubtitleDisplay.lua');
83 dofile(modpath .. '/ChatSubtitleDisplay.lua');
84 dofile(modpath .. '/WaypointSubtitleDisplay.lua');