Feature: World-specific config autocreating.
parent
d01886b9ac
commit
5f80a1e5d9
|
@ -1,4 +1,4 @@
|
|||
-- Per-world config feature is available. To create per-world config,
|
||||
-- World-specific configs are available. To create world-specific config,
|
||||
-- copy this file to `worlds/<worldname>/mod_minetest_wadsprint_config.lua`
|
||||
-- Common config values.
|
||||
minetest_wadsprint.HIDE_HUD_BARS = false
|
||||
|
|
26
init.lua
26
init.lua
|
@ -8,28 +8,32 @@ minetest_wadsprint =
|
|||
api = { events = EventEmitter:new() },
|
||||
stats = -- Online players' stats.
|
||||
{
|
||||
-- <playername>:
|
||||
-- obj: <player object>
|
||||
-- name: <playername>
|
||||
-- stamina:
|
||||
-- is_walking:
|
||||
-- is_sprinting:
|
||||
-- is_ready_to_sprint:
|
||||
-- is_sprinting_physics_on:
|
||||
-- <playername string>:
|
||||
-- obj: <player object>
|
||||
-- name: <playername string>
|
||||
-- stamina: <float>
|
||||
-- is_walking: <boolean>
|
||||
-- is_sprinting: <boolean>
|
||||
-- is_ready_to_sprint: <boolean>
|
||||
-- is_sprinting_physics_on: <boolean>
|
||||
},
|
||||
offline_stats = -- Offline stats aren't processed in the main cycle.
|
||||
{
|
||||
-- <playername>:
|
||||
-- stamina:
|
||||
-- <playername string>:
|
||||
-- stamina: <float>
|
||||
},
|
||||
version = io.open(minetest.get_modpath(minetest.get_current_modname()).."/VERSION","r"):read("*all"),
|
||||
savepath = minetest.get_worldpath().."/mod_minetest_wadsprint_saved_players_stats.dat",
|
||||
worldconfig = minetest.get_worldpath().."/mod_minetest_wadsprint_config.lua",
|
||||
}
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/config.lua") -- Load default config.
|
||||
if file_exists(minetest_wadsprint.worldconfig) then -- Load world config (if present).
|
||||
if file_exists(minetest_wadsprint.worldconfig) then -- Load world-specific config (if present).
|
||||
print("Loading minetest_wadsprint world-specific config: "..minetest_wadsprint.worldconfig)
|
||||
dofile(minetest_wadsprint.worldconfig)
|
||||
else
|
||||
print("Creating minetest_wadsprint world-specific config: "..minetest_wadsprint.worldconfig)
|
||||
io.open(minetest_wadsprint.worldconfig,"w") -- Create empty world config (for user's convenience).
|
||||
:write("-- World-specific config. Copy here values from `mods/minetest_wadsprint/config.lua`:\n")
|
||||
end
|
||||
dofile(minetest.get_modpath(minetest.get_current_modname()).."/init_hudbars.lua")
|
||||
----------------------------------------------------------------------------------------------------
|
||||
|
|
BIN
util/version.png
BIN
util/version.png
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue