diff --git a/mods/CORE/vl_tuning/init.lua b/mods/CORE/vl_tuning/init.lua index 3991f8ccf..b3122e584 100644 --- a/mods/CORE/vl_tuning/init.lua +++ b/mods/CORE/vl_tuning/init.lua @@ -1,4 +1,5 @@ local modname = minetest.get_current_modname() +local modpath = minetest.get_modpath(modname) local S = minetest.get_translator(modname) local storage = minetest.get_mod_storage() local mod = {} @@ -57,6 +58,8 @@ function mod.setting(setting, setting_type, def ) -- return the existing setting if it was previously registered. Don't update the definition local tunable = tunables[setting] if tunable then return tunable end + assert(setting_type) + assert(def) -- Setup the tunable data tunable = table.copy(def) @@ -149,3 +152,4 @@ minetest.register_chatcommand("gamerule", { end }) +dofile(modpath.."/settings.lua") diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index 47e48d36c..f31f177e0 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -237,8 +237,9 @@ minetest.register_on_leaveplayer(function(player) caches[player] = nil end) +local keep_inventory = vl_tuning.setting("gamerule:keepInventory") minetest.register_on_dieplayer(function(player) - if not minetest.settings:get_bool("mcl_keepInventory", false) then + if not keep_inventory[1] then mcl_experience.throw_xp(player:get_pos(), mcl_experience.get_xp(player)) mcl_experience.set_xp(player, 0) end diff --git a/mods/HUD/mcl_experience/mod.conf b/mods/HUD/mcl_experience/mod.conf index 1e0c09c31..49089f01d 100644 --- a/mods/HUD/mcl_experience/mod.conf +++ b/mods/HUD/mcl_experience/mod.conf @@ -1,4 +1,4 @@ name = mcl_experience author = oilboi -description = eXPerience mod -depends = mcl_gamemode, mcl_luck +description = eXPerience mod +depends = mcl_gamemode, mcl_luck, vl_tuning diff --git a/mods/ITEMS/mcl_farming/mod.conf b/mods/ITEMS/mcl_farming/mod.conf index fe4bc1564..963ead198 100644 --- a/mods/ITEMS/mcl_farming/mod.conf +++ b/mods/ITEMS/mcl_farming/mod.conf @@ -1,3 +1,3 @@ name = mcl_farming -depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors, mcl_init +depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors, mcl_init, vl_tuning optional_depends = mcl_armor, doc diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index 998a82c18..2957ade12 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -175,8 +175,9 @@ if minetest.get_modpath("mcl_armor") then add_pumpkin_hud(player) end end) + local keep_inventory = vl_tuning.setting("gamerule:keepInventory") minetest.register_on_dieplayer(function(player) - if not minetest.settings:get_bool("mcl_keepInventory") then + if not keep_inventory[1] then remove_pumpkin_hud(player) end end) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index e1b790049..50d417b28 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -434,9 +434,10 @@ minetest.register_globalstep(function(dtime) end end) +local keep_inventory = vl_tuning.setting("gamerule:keepInventory") minetest.register_on_dieplayer(function(player) remove_shield_hud(player) - if not minetest.settings:get_bool("mcl_keepInventory") then + if not keep_inventory[1] then remove_shield_entity(player, 1) remove_shield_entity(player, 2) end diff --git a/mods/ITEMS/mcl_shields/mod.conf b/mods/ITEMS/mcl_shields/mod.conf index 8aded6a62..7743d4701 100644 --- a/mods/ITEMS/mcl_shields/mod.conf +++ b/mods/ITEMS/mcl_shields/mod.conf @@ -1,3 +1,3 @@ name = mcl_shields author = NO11 -depends = mcl_damage, mcl_enchanting, mcl_banners, mcl_util, playerphysics +depends = mcl_damage, mcl_enchanting, mcl_banners, mcl_util, playerphysics, vl_tuning diff --git a/mods/PLAYER/mcl_death_drop/init.lua b/mods/PLAYER/mcl_death_drop/init.lua index 9b1bad75f..0e29b1938 100644 --- a/mods/PLAYER/mcl_death_drop/init.lua +++ b/mods/PLAYER/mcl_death_drop/init.lua @@ -6,6 +6,8 @@ mcl_death_drop = {} mcl_death_drop.registered_dropped_lists = {} +local keep_inventory = vl_tuning.setting("gamerule:keepInventory") + function mcl_death_drop.register_dropped_list(inv, listname, drop) table.insert(mcl_death_drop.registered_dropped_lists, {inv = inv, listname = listname, drop = drop}) end @@ -16,8 +18,7 @@ mcl_death_drop.register_dropped_list("PLAYER", "armor", true) mcl_death_drop.register_dropped_list("PLAYER", "offhand", true) minetest.register_on_dieplayer(function(player) - local keep = minetest.settings:get_bool("mcl_keepInventory", false) - if keep == false then + if not keep_inventory[1] then -- Drop inventory, crafting grid and armor local playerinv = player:get_inventory() local pos = player:get_pos() diff --git a/mods/PLAYER/mcl_death_drop/mod.conf b/mods/PLAYER/mcl_death_drop/mod.conf index 09a8c61fa..b708d2596 100644 --- a/mods/PLAYER/mcl_death_drop/mod.conf +++ b/mods/PLAYER/mcl_death_drop/mod.conf @@ -1,4 +1,4 @@ name = mcl_death_drop author = Wuzzy description = Makes all items in inventory drop after player death. -depends = mcl_armor, mcl_enchanting +depends = mcl_armor, mcl_enchanting, vl_tuning diff --git a/mods/PLAYER/mcl_skins/edit_skin.lua b/mods/PLAYER/mcl_skins/edit_skin.lua index 2128986e4..fdaeb6baf 100644 --- a/mods/PLAYER/mcl_skins/edit_skin.lua +++ b/mods/PLAYER/mcl_skins/edit_skin.lua @@ -735,8 +735,10 @@ end init() -if not minetest.settings:get_bool("mcl_keepInventory", false) then - minetest.register_on_respawnplayer(function(player) +local keep_inventory = vl_tuning.setting("gamerule:keepInventory") +minetest.register_on_respawnplayer(function(player) + if not keep_inventory[1] then mcl_skins.update_player_skin(player) -- ensures players have their cape again after dying with an elytra - end) -end + end +end) + diff --git a/mods/PLAYER/mcl_skins/mod.conf b/mods/PLAYER/mcl_skins/mod.conf index bd2191097..46d01b6b3 100644 --- a/mods/PLAYER/mcl_skins/mod.conf +++ b/mods/PLAYER/mcl_skins/mod.conf @@ -1,4 +1,4 @@ name = mcl_skins author = MrRar description = Advanced player skin customization. -depends = mcl_player +depends = mcl_player, vl_tuning