forked from VoxeLibre/VoxeLibre
Compare commits
25 Commits
master
...
add-dynami
Author | SHA1 | Date |
---|---|---|
teknomunk | cb5869f4fb | |
teknomunk | 49bf10b6c7 | |
teknomunk | 26b16b412e | |
teknomunk | 0c258b3680 | |
teknomunk | d19246b590 | |
teknomunk | 882e00b819 | |
teknomunk | 4c0bc279af | |
teknomunk | 2553f681a0 | |
teknomunk | 4ff8268948 | |
teknomunk | 95cb4b7bb5 | |
teknomunk | 45bdc892f2 | |
teknomunk | a9577162f1 | |
teknomunk | 9e8297c0fd | |
teknomunk | 7c27cd395e | |
teknomunk | 814a3337f3 | |
teknomunk | 58d7ac65c7 | |
teknomunk | f819b31613 | |
teknomunk | 75565e7118 | |
teknomunk | d8af2d4ced | |
teknomunk | 38ed457211 | |
teknomunk | fdd52bda90 | |
teknomunk | 387101fc8e | |
teknomunk | ee2c878160 | |
teknomunk | f1f4ebff3f | |
teknomunk | 80ca5fa0c0 |
|
@ -34,7 +34,30 @@ mcl_damage = {
|
|||
}
|
||||
}
|
||||
|
||||
local damage_enabled = minetest.settings:get_bool("enabled_damage",true)
|
||||
local damage_enabled = true
|
||||
vl_tuning.setting("damage_enabled", "bool",{
|
||||
default = minetest.settings:get_bool("enabled_damage",true),
|
||||
set = function(val) damage_enabled = val end,
|
||||
get = function() return damage_enabled end,
|
||||
})
|
||||
local fall_damage_enabled = true
|
||||
vl_tuning.setting("gamerule:fallDamage", "bool", {
|
||||
default = true,
|
||||
set = function(val) fall_damage_enabled = val end,
|
||||
get = function() return fall_damage_enabled end,
|
||||
})
|
||||
local drowning_damage_enabled = true
|
||||
vl_tuning.setting("gamerule:drowningDamage", "bool", {
|
||||
default = true,
|
||||
set = function(val) drowning_damage_enabled = val end,
|
||||
get = function() return drowning_damage_enabled end,
|
||||
})
|
||||
local fire_damage_enabled
|
||||
vl_tuning.setting("gamerule:fireDamage", "bool", {
|
||||
default = true,
|
||||
set = function(val) fire_damage_enabled = val end,
|
||||
get = function() return fire_damage_enabled end,
|
||||
})
|
||||
|
||||
function mcl_damage.register_modifier(func, priority)
|
||||
table.insert(mcl_damage.modifiers, {func = func, priority = priority or 0})
|
||||
|
@ -153,10 +176,18 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|||
end, true)
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
-- Check if damage is enabled
|
||||
if not damage_enabled then return 0 end
|
||||
local mcl_reason = mcl_damage.from_mt(mt_reason)
|
||||
if not fire_damage_enabled and mcl_reason.type == "fire" then return 0 end
|
||||
--if not drowning_damage_enabled and mcl_reason.type == "drown" then return 0 end
|
||||
--if not fall_damage_enabled and mcl_reason.type == "fall" then return 0 end
|
||||
|
||||
--minetest.log("action", "mcl_reason = "..dump(mcl_reason)..", mt_reason = "..dump(mt_reason))
|
||||
|
||||
if player:get_hp() > 0 then
|
||||
if hp_change < 0 then
|
||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_reason)
|
||||
end
|
||||
end
|
||||
end, false)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
name = mcl_damage
|
||||
author = Fleckenstein
|
||||
description = Minecraft-like damage reason system
|
||||
depends = vl_tuning
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
local modname = "vl_tuning"
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
local F = function(f) return minetest.formspec_escape(S(f)) end
|
||||
local FE = minetest.formspec_escape
|
||||
local mod = vl_tuning
|
||||
|
||||
local function bool_to_string(value)
|
||||
if value then return "true" end
|
||||
return "false"
|
||||
end
|
||||
|
||||
local function formspec_for_setting(y, name)
|
||||
local setting = mod.registered_settings[name]
|
||||
if not setting then return "" end
|
||||
|
||||
local setting_type = setting.setting_type
|
||||
|
||||
local fs = {}
|
||||
table.insert(fs, "label[0,"..(y+0.15)..";"..FE(name).."]")
|
||||
table.insert(fs, "hypertext[0.15,"..(y+0.25)..";14.85,0.65;;"..FE("<style color=black>"..(setting.description or "").."</style>").."]")
|
||||
|
||||
if setting_type == "bool" then
|
||||
table.insert(fs, "checkbox[17,"..(y+0.15)..";"..FE(name)..";;"..bool_to_string(setting[1]).."]")
|
||||
elseif setting_type == "number" then
|
||||
table.insert(fs, "field[15,"..y..";2.5,0.75;"..FE(name)..";;"..string.format("%.4g", setting[1]).."]")
|
||||
table.insert(fs, "field_close_on_enter["..FE(name)..";false]")
|
||||
elseif setting_type == "string" then
|
||||
end
|
||||
|
||||
return table.concat(fs)
|
||||
end
|
||||
|
||||
function vl_tuning.show_formspec(player_name, tab)
|
||||
if not tab then tab = "1" end
|
||||
|
||||
local settings = {}
|
||||
local y = 0.5
|
||||
for name,_ in pairs(vl_tuning.registered_settings) do
|
||||
if name:sub(0,#"gamerule:") == "gamerule:" then
|
||||
if tab == "1" then
|
||||
table.insert(settings, formspec_for_setting(y,name))
|
||||
y = y + 1
|
||||
end
|
||||
else
|
||||
if tab == "2" then
|
||||
table.insert(settings, formspec_for_setting(y,name))
|
||||
y = y + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local formspec = table.concat({
|
||||
"formspec_version[4]",
|
||||
"size[20,10.5,true]",
|
||||
"tabheader[0,0;tab;"..
|
||||
F("Game Rules")..","..
|
||||
F("Settings")..
|
||||
";"..tab..";false;false]",
|
||||
"field[0,0;0,0;old_tab;;"..tab.."]",
|
||||
|
||||
"scroll_container[1,0.5;18,9.25;settings;vertical;]",
|
||||
table.concat(settings),
|
||||
"scroll_container_end[]",
|
||||
"scrollbaroptions[min=0;max="..tostring(10 * math.max(#settings - 9, 0))..";smallstep=1;largestep=1]",
|
||||
"scrollbar[18.75,0.75;0.75,9.25;vertical;settings;0]",
|
||||
})
|
||||
|
||||
minetest.show_formspec(player_name, "vl_tuning:settings", formspec)
|
||||
end
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "vl_tuning:settings" then return end
|
||||
|
||||
minetest.log("action",dump({
|
||||
player = player,
|
||||
fields = fields,
|
||||
formname = formname,
|
||||
}))
|
||||
|
||||
for k,value in pairs(fields) do
|
||||
local setting = mod.registered_settings[k]
|
||||
if setting then
|
||||
setting:set(value)
|
||||
end
|
||||
end
|
||||
|
||||
if fields.quit or (not fields.tab or fields.old_tab == fields.tab) then return end
|
||||
|
||||
minetest.log("Seting settings formspec")
|
||||
mod.show_formspec(player:get_player_name(), fields.tab)
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("settings",{
|
||||
func = function(player_name, param)
|
||||
dofile(modpath.."/gui.lua")
|
||||
mod.show_formspec(player_name)
|
||||
end
|
||||
})
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
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 = {}
|
||||
vl_tuning = mod
|
||||
|
||||
local DEBUG = false
|
||||
|
||||
-- All registered tunable parameters
|
||||
local tunables = {}
|
||||
vl_tuning.registered_settings = tunables
|
||||
|
||||
-- Supported variable types
|
||||
local tunable_types = {
|
||||
bool = {
|
||||
to_string = tostring,
|
||||
from_string = function(value)
|
||||
return (value == "true")
|
||||
end
|
||||
},
|
||||
number = {
|
||||
to_string = tostring,
|
||||
from_string = tonumber,
|
||||
},
|
||||
string = {
|
||||
to_string = function(v) return v end,
|
||||
from_string = function(v) return v end,
|
||||
},
|
||||
}
|
||||
|
||||
-- Tunable metatable functions
|
||||
local tunable_class = {}
|
||||
function tunable_class:set(value, no_hook)
|
||||
local self_type = self.type
|
||||
if type(value) == "string" then
|
||||
local new_value = self_type.from_string(value)
|
||||
if new_value == nil then new_value = self.default end
|
||||
|
||||
self.setter(new_value)
|
||||
else
|
||||
self.setter(value)
|
||||
end
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("action", "[vl_tuning] Set "..self.setting.." to "..dump(self.getter()))
|
||||
end
|
||||
|
||||
-- Call on_change hook
|
||||
if not no_hook then
|
||||
local hook = self.on_change
|
||||
if hook then hook(self) end
|
||||
end
|
||||
|
||||
-- Persist value
|
||||
storage:set_string(self.setting,self_type.to_string(self.getter()))
|
||||
end
|
||||
function tunable_class:get_string()
|
||||
return self.type.to_string(self.getter())
|
||||
end
|
||||
|
||||
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)
|
||||
assert(type(def.set) == "function", "Tunable requires set method")
|
||||
assert(type(def.get) == "function", "Tunable required get method")
|
||||
|
||||
-- Setup the tunable data
|
||||
tunable = table.copy(def)
|
||||
tunable.setting = setting
|
||||
tunable.setter = def.set
|
||||
tunable.getter = def.get
|
||||
tunable.type = tunable_types[setting_type]
|
||||
tunable.setting_type = setting_type
|
||||
if tunable.default then
|
||||
tunable.set(tunable.default)
|
||||
end
|
||||
setmetatable(tunable, {__index=tunable_class})
|
||||
|
||||
-- Load the setting value from mod storage
|
||||
local setting_value = storage:get_string(setting)
|
||||
if setting_value and setting_value ~= "" then
|
||||
tunable:set(setting_value, true)
|
||||
if DEBUG then
|
||||
minetest.log("action", "[vl_tuning] Loading "..setting.." = "..dump(setting_value).." ("..dump(tunable[1])..")")
|
||||
end
|
||||
end
|
||||
|
||||
-- Add to the list of all available settings
|
||||
tunables[setting] = tunable
|
||||
|
||||
-- Provide it so that the current value in [1] can be accessed without having to call into this API again
|
||||
return tunable
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("set_setting", {
|
||||
description = S("Admin tool to tune settings and game rules"),
|
||||
params = S("<setting> <value>"),
|
||||
privs = { debug = true },
|
||||
func = function(name, params_raw)
|
||||
-- Split apart the params
|
||||
local params = {}
|
||||
for str in string.gmatch(params_raw, "([^ ]+)") do
|
||||
params[#params + 1] = str
|
||||
end
|
||||
|
||||
if #params ~= 2 then
|
||||
return false, S("Usage: /tune <setting> <value>")
|
||||
end
|
||||
|
||||
local tunable = tunables[params[1]]
|
||||
if not tunable then
|
||||
return false, S("Setting @1 doesn't exist", params[1])
|
||||
end
|
||||
|
||||
if DEBUG then
|
||||
minetest.log("action", "[vl_tuning] "..name.." set ".. params[1] .." to "..params[2])
|
||||
end
|
||||
tunable:set(params[2])
|
||||
return true
|
||||
end
|
||||
})
|
||||
minetest.register_chatcommand("get_setting", {
|
||||
description = S("Admin tool to view settings and game rules"),
|
||||
params = S("<setting>"),
|
||||
privs = { debug = true },
|
||||
func = function(name, param)
|
||||
local tunable = tunables[param]
|
||||
if tunable then
|
||||
return true, tunable:get_string()
|
||||
else
|
||||
return false, S("Setting @1 doesn't exist", param)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("gamerule", {
|
||||
description = S("Display or set customizable options"),
|
||||
params = S("<rule> [<value>]"),
|
||||
privs = { server = true },
|
||||
func = function(name, params_raw)
|
||||
-- Split apart the params
|
||||
local params = {}
|
||||
for str in string.gmatch(params_raw, "([^ ]+)") do
|
||||
params[#params + 1] = str
|
||||
end
|
||||
|
||||
if #params < 1 or #params > 2 then
|
||||
return false, S("Usage: /gamerule <rule> [<value>]")
|
||||
end
|
||||
|
||||
local tunable = tunables["gamerule:"..params[1]]
|
||||
if not tunable then
|
||||
return false, S("Game rule @1 doesn't exist", params[1])
|
||||
end
|
||||
|
||||
local value = params[2]
|
||||
if value then
|
||||
if DEBUG then
|
||||
minetest.log("action", "[vl_tuning] Setting game rule "..params[1].." to "..params[2])
|
||||
end
|
||||
tunable:set(params[2])
|
||||
return true
|
||||
else
|
||||
return true, tunable:get_string()
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
dofile(modpath.."/settings.lua")
|
||||
dofile(modpath.."/gui.lua")
|
||||
|
||||
mod.setting("debug:vl_tuning:report_value_changes", "bool", {
|
||||
default = false,
|
||||
set = function(val) DEBUG = val end,
|
||||
get = function() return DEBUG end,
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
name = vl_tuning
|
||||
author = teknomunk
|
||||
description = Framework for dynamic tuning and game rules
|
|
@ -0,0 +1,18 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local mod = vl_tuning
|
||||
|
||||
mod.keep_inventory = {}
|
||||
vl_tuning.setting("gamerule:keepInventory", "bool", {
|
||||
default = minetest.settings:get_bool("mcl_keepInventory", false),
|
||||
set = function(val) mod.keep_inventory[1] = val end,
|
||||
get = function() return mod.keep_inventory[1] end,
|
||||
})
|
||||
mod.respawn_blocks_explode = {}
|
||||
vl_tuning.setting("gamerule:respawnBlocksExplode", "bool", {
|
||||
description = S("Prevents beds/respawn anchors from exploding in other dimensions."),
|
||||
default = true,
|
||||
set = function(val) mod.respawn_blocks_explode[1] = val end,
|
||||
get = function() return mod.respawn_blocks_explode[1] end,
|
||||
})
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_mobs
|
||||
author = PilzAdam
|
||||
description = Adds a mob API for mods to add animals or monsters, etc.
|
||||
depends = mcl_particles, mcl_luck
|
||||
depends = mcl_particles, mcl_luck, vl_tuning
|
||||
optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor, mcl_portals, mcl_experience, mcl_sculk
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||
local mob_class = mcl_mobs.mob_class
|
||||
local validate_vector = mcl_util.validate_vector
|
||||
|
||||
local ENTITY_CRAMMING_MAX = 24
|
||||
local gamerule_maxEntityCramming = 24
|
||||
vl_tuning.setting("gamerule:maxEntityCramming", "number", {
|
||||
description = S("The maximum number of pushable entities a mob or player can push, before taking 6♥♥♥ entity cramming damage per half-second."),
|
||||
default = 24,
|
||||
set = function(val) gamerule_maxEntityCramming = val end,
|
||||
get = function() return gamerule_maxEntityCramming end,
|
||||
})
|
||||
local gamerule_doMobLoot
|
||||
vl_tuning.setting("gamerule:doMobLoot", "bool", {
|
||||
description = S("Whether mobs should drop items and experience orbs."),
|
||||
default = true,
|
||||
set = function(val) gamerule_doMobLoot = val end,
|
||||
get = function() return gamerule_doMobLoot end,
|
||||
})
|
||||
|
||||
local CRAMMING_DAMAGE = 3
|
||||
local DEATH_DELAY = 0.5
|
||||
local DEFAULT_FALL_SPEED = -9.81*1.5
|
||||
|
@ -472,6 +488,8 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
-- TODO other env damage shouldn't drop xp
|
||||
-- "rain", "water", "drowning", "suffocation"
|
||||
|
||||
if not gamerule_doMobLoot then return end
|
||||
|
||||
-- dropped cooked item if mob died in fire or lava
|
||||
if cause == "lava" or cause == "fire" then
|
||||
self:item_drop(true, 0)
|
||||
|
@ -501,13 +519,10 @@ function mob_class:check_for_death(cause, cmi_cause)
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- execute custom death function
|
||||
if self.on_die then
|
||||
|
||||
local pos = self.object:get_pos()
|
||||
local on_die_exit = self.on_die(self, pos, cmi_cause)
|
||||
if on_die_exit ~= true then
|
||||
|
@ -903,7 +918,7 @@ function mob_class:check_entity_cramming()
|
|||
local l = o:get_luaentity()
|
||||
if l and l.is_mob and l.health > 0 then table.insert(mobs,l) end
|
||||
end
|
||||
local clear = #mobs < ENTITY_CRAMMING_MAX
|
||||
local clear = #mobs < gamerule_maxEntityCramming
|
||||
local ncram = {}
|
||||
for _,l in pairs(mobs) do
|
||||
if l then
|
||||
|
@ -917,7 +932,7 @@ function mob_class:check_entity_cramming()
|
|||
end
|
||||
end
|
||||
for i,l in pairs(ncram) do
|
||||
if i > ENTITY_CRAMMING_MAX then
|
||||
if i > gamerule_maxEntityCramming then
|
||||
l.cram = true
|
||||
else
|
||||
l.cram = nil
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
--lua locals
|
||||
local S = minetest.get_translator("mcl_mobs")
|
||||
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
|
||||
local mob_class = mcl_mobs.mob_class
|
||||
|
||||
local gamerule_doMobSpawning = true
|
||||
vl_tuning.setting("gamerule:doMobSpawning", "bool", {
|
||||
description = S("Whether mobs should spawn naturally, or via global spawning logic, such as for cats, phantoms, patrols, wandering traders, or zombie sieges. Does not affect special spawning attempts, like monster spawners, raids, or iron golems."), default = true,
|
||||
set = function(val) gamerule_doMobSpawning = val end,
|
||||
get = function() return gamerule_doMobSpawning end,
|
||||
})
|
||||
|
||||
local modern_lighting = minetest.settings:get_bool("mcl_mobs_modern_lighting", true)
|
||||
local nether_threshold = tonumber(minetest.settings:get("mcl_mobs_nether_threshold")) or 11
|
||||
local end_threshold = tonumber(minetest.settings:get("mcl_mobs_end_threshold")) or 0
|
||||
|
@ -728,8 +736,6 @@ end
|
|||
|
||||
mcl_mobs.spawn_group = spawn_group
|
||||
|
||||
local S = minetest.get_translator("mcl_mobs")
|
||||
|
||||
minetest.register_chatcommand("spawn_mob",{
|
||||
privs = { debug = true },
|
||||
description=S("spawn_mob is a chatcommand that allows you to type in the name of a mob without 'typing mobs_mc:' all the time like so; 'spawn_mob spider'. however, there is more you can do with this special command, currently you can edit any number, boolean, and string variable you choose with this format: spawn_mob 'any_mob:var<mobs_variable=variable_value>:'. any_mob being your mob of choice, mobs_variable being the variable, and variable value being the value of the chosen variable. and example of this format: \n spawn_mob skeleton:var<passive=true>:\n this would spawn a skeleton that wouldn't attack you. REMEMBER-THIS> when changing a number value always prefix it with 'NUM', example: \n spawn_mob skeleton:var<jump_height=NUM10>:\n this setting the skelly's jump height to 10. if you want to make multiple changes to a mob, you can, example: \n spawn_mob skeleton:var<passive=true>::var<jump_height=NUM10>::var<fly_in=air>::var<fly=true>:\n etc."),
|
||||
|
@ -1010,6 +1016,7 @@ if mobs_spawn then
|
|||
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if not gamerule_doMobSpawning then return end
|
||||
|
||||
timer = timer + dtime
|
||||
if timer < WAIT_FOR_SPAWN_ATTEMPT then return end
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
mcl_raids = {}
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local gamerule_disableRaids = false
|
||||
vl_tuning.setting("gamerule:disableRaids", "bool", {
|
||||
description = S("Whether raids are disabled"), default = false,
|
||||
set = function(val) gamerule_disableRaids = val end,
|
||||
get = function() return gamerule_disableRaids end,
|
||||
})
|
||||
|
||||
-- Define the amount of illagers to spawn each wave.
|
||||
local waves = {
|
||||
{
|
||||
|
@ -291,6 +298,8 @@ mcl_events.register_event("raid",{
|
|||
exclusive_to_area = 128,
|
||||
enable_bossbar = true,
|
||||
cond_start = function(self)
|
||||
if gamerule_disableRaids then return false end
|
||||
|
||||
--minetest.log("Cond start raid")
|
||||
local r = {}
|
||||
for _,p in pairs(minetest.get_connected_players()) do
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = mcl_raids
|
||||
author = PrairieWind
|
||||
depends = mcl_events, mobs_mc, mcl_potions, mcl_bells, mcl_achievements
|
||||
depends = mcl_events, mobs_mc, mcl_potions, mcl_bells, mcl_achievements, vl_tuning
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_weather
|
||||
author = xeranas
|
||||
description = Weather and sky handling: Rain, snow, thunderstorm, End and Nether ambience
|
||||
depends = mcl_init, mcl_worlds, mcl_playerinfo, mcl_util
|
||||
depends = mcl_init, mcl_worlds, mcl_playerinfo, mcl_util, vl_tuning
|
||||
optional_depends = lightning
|
||||
|
|
|
@ -1,15 +1,51 @@
|
|||
-- Constants
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
local mods_loaded = false
|
||||
local NIGHT_VISION_RATIO = 0.45
|
||||
local DEBUG = false
|
||||
|
||||
-- Settings
|
||||
local minimum_update_interval = { 250e3 }
|
||||
local minimum_update_interval = 250e3
|
||||
vl_tuning.setting("minimum_sky_update_interval", "number", {
|
||||
default = 0.25,
|
||||
set = function(val) minimum_update_interval = val * 1e6 end,
|
||||
get = function() return minimum_update_interval * 1e-6 end,
|
||||
})
|
||||
|
||||
-- Module state
|
||||
local mods_loaded = false
|
||||
|
||||
-- Daylight cycle handling
|
||||
local fixed_time = 0.5
|
||||
local fixed_time_setting = vl_tuning.setting("fixed_daylight_time", "number", {
|
||||
description = S("Time of day to use when gamerule:doDaylightCycle == false"),
|
||||
default = 0.5,
|
||||
set = function(val) fixed_time = val end,
|
||||
get = function() return fixed_time end,
|
||||
})
|
||||
local gamerule_doDaylightCycle = true
|
||||
vl_tuning.setting("gamerule:doDaylightCycle", "bool",{
|
||||
description = S("Whether the daylight cycle and moon phases progress"),
|
||||
default = true,
|
||||
set = function(val) gamerule_doDaylightCycle = val end,
|
||||
get = function() return gamerule_doDaylightCycle end,
|
||||
on_change = function(self)
|
||||
if not self[1] then
|
||||
fixed_time_setting:set(minetest.get_timeofday())
|
||||
end
|
||||
end
|
||||
})
|
||||
local function daylightCycle()
|
||||
if not gamerule_doDaylightCycle and fixed_time then
|
||||
minetest.set_timeofday(fixed_time)
|
||||
end
|
||||
minetest.after(1, daylightCycle)
|
||||
end
|
||||
minetest.after(1, daylightCycle)
|
||||
|
||||
function mcl_weather.set_sky_box_clear(player, sky, fog)
|
||||
-- Make sure the player's head isn't in water before changing the skybox
|
||||
local node_head = mcl_playerinfo[player:get_player_name()].node_head
|
||||
|
@ -145,7 +181,7 @@ function skycolor.update_player_sky_color(player)
|
|||
local skycolor_data = get_skycolor_info(player)
|
||||
local last_update = skycolor_data.last_update or 0
|
||||
local now_us = minetest.get_us_time()
|
||||
if (now_us - last_update) < minimum_update_interval[1] then return end
|
||||
if (now_us - last_update) < minimum_update_interval then return end
|
||||
skycolor_data.last_update = now_us
|
||||
|
||||
local sky_data = {
|
||||
|
|
|
@ -1,10 +1,19 @@
|
|||
local get_connected_players = minetest.get_connected_players
|
||||
local modname = minetest.get_current_modname()
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
mcl_weather.snow = {}
|
||||
|
||||
local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100
|
||||
mcl_weather.snow.init_done = false
|
||||
local mgname = minetest.get_mapgen_setting("mg_name")
|
||||
local gamerule_snowAccumulationHeight = 1
|
||||
vl_tuning.setting("gamerule:snowAccumulationHeight", "number", {
|
||||
description = S("The maximum number of snow layers that can be accumulated on each block"),
|
||||
default = 1, min = 0, max = 8,
|
||||
set = function(val) gamerule_snowAccumulationHeight = val end,
|
||||
get = function() return gamerule_snowAccumulationHeight end,
|
||||
})
|
||||
|
||||
local snow_biomes = {
|
||||
"ColdTaiga_underground",
|
||||
|
@ -141,14 +150,16 @@ minetest.register_abm({
|
|||
if node.name:find("snow") then
|
||||
local l = node.name:sub(-1)
|
||||
l = tonumber(l)
|
||||
if node.name == "mcl_core:snow" then
|
||||
nn={name = "mcl_core:snow_2"}
|
||||
elseif l and l < 7 then
|
||||
nn={name="mcl_core:snow_"..tostring(math.min(8,l + 1))}
|
||||
elseif l and l >= 7 then
|
||||
nn={name = "mcl_core:snowblock"}
|
||||
if l < gamerule_snowAccumulationHeight then
|
||||
if node.name == "mcl_core:snow" then
|
||||
nn={name = "mcl_core:snow_2"}
|
||||
elseif l and l < 7 then
|
||||
nn={name="mcl_core:snow_"..tostring(math.min(8,l + 1))}
|
||||
elseif l and l >= 7 then
|
||||
nn={name = "mcl_core:snowblock"}
|
||||
end
|
||||
if nn then minetest.set_node(pos,nn) end
|
||||
end
|
||||
if nn then minetest.set_node(pos,nn) end
|
||||
else
|
||||
minetest.set_node(above,{name = "mcl_core:snow"})
|
||||
end
|
||||
|
|
|
@ -2,6 +2,13 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
|||
|
||||
local math = math
|
||||
|
||||
local gamerule_doWeatherCycle = true
|
||||
vl_tuning.setting("gamerule:doWeatherCycle", "bool", {
|
||||
description = S("Whether the weather can change naturally. The /weather command can still change weather."), default = true,
|
||||
set = function(val) gamerule_doWeatherCycle = val end,
|
||||
get = function() return gamerule_doWeatherCycle end,
|
||||
})
|
||||
|
||||
-- weather states, 'none' is default, other states depends from active mods
|
||||
mcl_weather.state = "none"
|
||||
|
||||
|
@ -126,6 +133,8 @@ end
|
|||
local t, wci = 0, mcl_weather.check_interval
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if not gamerule_doWeatherCycle then return end
|
||||
|
||||
t = t + dtime
|
||||
if t < wci then return end
|
||||
t = 0
|
||||
|
|
|
@ -18,6 +18,21 @@ local modname = minetest.get_current_modname()
|
|||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
-- Tunable parameters
|
||||
local notif_delay = 3
|
||||
vl_tuning.setting("award_display_time", "number", {
|
||||
description = S("Amount of time award notification are displayed"), default = 3, min = 2, max = 10,
|
||||
set = function(val) notif_delay = val end,
|
||||
get = function() return notif_delay end,
|
||||
})
|
||||
local announce_in_chat = true
|
||||
vl_tuning.setting("gamerule:announceAdvancements", "bool", {
|
||||
description = S("Whether advancements should be announced in chat"),
|
||||
default = minetest.settings:get_bool("mcl_showAdvancementMessages", true),
|
||||
set = function(val) announce_in_chat = val end,
|
||||
get = function() return announce_in_chat end,
|
||||
})
|
||||
|
||||
-- The global award namespace
|
||||
awards = {
|
||||
show_mode = "hud",
|
||||
|
@ -217,7 +232,7 @@ function awards.unlock(name, award)
|
|||
|
||||
-- Get award
|
||||
minetest.log("action", name.." has gotten award "..award)
|
||||
if minetest.settings:get_bool("mcl_showAdvancementMessages", true) then
|
||||
if announce_in_chat then
|
||||
minetest.chat_send_all(S("@1 has made the advancement @2", name, minetest.colorize(mcl_colors.GREEN, "[" .. (awdef.title or award) .. "]")))
|
||||
end
|
||||
data.unlocked[award] = award
|
||||
|
@ -362,7 +377,7 @@ function awards.unlock(name, award)
|
|||
direction = 0,
|
||||
z_index = 102,
|
||||
})
|
||||
minetest.after(3, function(name)
|
||||
minetest.after(notif_delay, function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not player then
|
||||
return
|
||||
|
|
|
@ -6,4 +6,4 @@ license = LGPL 2.1 or later
|
|||
forum = https://forum.minetest.net/viewtopic.php?t=4870
|
||||
version = 2.3.0
|
||||
optional_depends = sfinv, unified_inventory
|
||||
depends = mcl_colors
|
||||
depends = mcl_colors, vl_tuning
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local ASSIST_TIMEOUT_SEC = 5
|
||||
local gamerule_showDeathMessages = true
|
||||
vl_tuning.setting("gamerule:showDeathMessages", "bool", {
|
||||
description = S("Whether death messages are put into chat when a player dies. Also affects whether a message is sent to the pet's owner when the pet dies."),
|
||||
default = minetest.settings:get_bool("mcl_showDeathMessages", true),
|
||||
set = function(val) gamerule_showDeathMessages = val end,
|
||||
get = function() return gamerule_showDeathMessages end,
|
||||
})
|
||||
|
||||
mcl_death_messages = {
|
||||
assist = {},
|
||||
|
@ -204,9 +211,7 @@ local function fallback_translator(s)
|
|||
end
|
||||
|
||||
mcl_damage.register_on_death(function(obj, reason)
|
||||
if not minetest.settings:get_bool("mcl_showDeathMessages", true) then
|
||||
return
|
||||
end
|
||||
if not gamerule_showDeathMessages then return end
|
||||
|
||||
local send_to
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_death_messages
|
||||
author = 4Evergreen4
|
||||
description = Shows messages in chat when a player dies.
|
||||
depends = mcl_colors, mcl_damage
|
||||
depends = mcl_colors, mcl_damage, vl_tuning
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -10,6 +10,8 @@ local explosions_mod = minetest.get_modpath("mcl_explosions")
|
|||
local spawn_mod = minetest.get_modpath("mcl_spawn")
|
||||
local pos_to_dim = minetest.get_modpath("mcl_worlds") and mcl_worlds.pos_to_dimension or function(pos) return "overworld" end
|
||||
|
||||
local gamerule_respawnBlocksExplode = vl_tuning.respawn_blocks_explode
|
||||
|
||||
local function mcl_log (message)
|
||||
mcl_util.mcl_log (message, "[Beds]")
|
||||
end
|
||||
|
@ -384,7 +386,7 @@ function mcl_beds.on_rightclick(pos, player, is_top)
|
|||
|
||||
minetest.remove_node(pos)
|
||||
minetest.remove_node(string.sub(node.name, -4) == "_top" and vector.subtract(pos, dir) or vector.add(pos, dir))
|
||||
if explosions_mod then
|
||||
if explosions_mod and gamerule_respawnBlocksExplode[1] then
|
||||
mcl_explosions.explode(pos, 5, {drop_chance = 1.0, fire = true})
|
||||
end
|
||||
return
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_beds
|
||||
author = BlockMen
|
||||
description =
|
||||
depends = playerphysics
|
||||
depends = playerphysics, vl_tuning
|
||||
optional_depends = mcl_sounds, mcl_worlds, mcl_wool, mcl_dye, mcl_explosions, mcl_weather, mcl_spawn, doc, mesecons, mesecons_mvps
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
--Nether roof at y -28933
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
--local mod_doc = minetest.get_modpath("doc") -> maybe add documentation ?
|
||||
local gamerule_respawnBlocksExplode = vl_tuning.respawn_blocks_explode
|
||||
|
||||
for i=0,4 do
|
||||
|
||||
|
@ -12,7 +13,7 @@ for i=0,4 do
|
|||
minetest.set_node(pos, {name="mcl_beds:respawn_anchor_charged_" .. i+1})
|
||||
itemstack:take_item()
|
||||
elseif mcl_worlds.pos_to_dimension(pos) ~= "nether" then
|
||||
if node.name ~= "mcl_beds:respawn_anchor" then --only charged respawn anchors are exploding in the overworld & end in minecraft
|
||||
if gamerule_respawnBlocksExplode[1] and node.name ~= "mcl_beds:respawn_anchor" then --only charged respawn anchors are exploding in the overworld & end in minecraft
|
||||
mcl_explosions.explode(pos, 5, {drop_chance = 0, fire = true})
|
||||
end
|
||||
elseif string.match(node.name, "mcl_beds:respawn_anchor_charged_") then
|
||||
|
|
|
@ -126,7 +126,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
|||
local node = minetest.get_node(dpos)
|
||||
|
||||
if self._stuck then
|
||||
self._stucktimer = self._stucktimer + dtime
|
||||
self._stucktimer = self._stucktimer or 0 + dtime
|
||||
self._stuckrechecktimer = self._stuckrechecktimer + dtime
|
||||
if self._stucktimer > ARROW_TIMEOUT then
|
||||
mcl_burning.extinguish(self.object)
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
--
|
||||
-- Lava vs water interactions
|
||||
--
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
local mg_name = minetest.get_mapgen_setting("mg_name")
|
||||
|
||||
local random = math.random
|
||||
|
@ -1192,12 +1199,24 @@ local function vine_spread_horizontal(origin, dir, node)
|
|||
end
|
||||
end
|
||||
|
||||
---------------------
|
||||
-- Vine generating --
|
||||
---------------------
|
||||
local do_vines_spread = true
|
||||
vl_tuning.setting("gamerule:doVinesSpread", "bool", {
|
||||
description = S("Whether vines can spread to other blocks. Cave vines, weeping vines, and twisting vines are not affected."),
|
||||
default = true,
|
||||
set = function(val) do_vines_spread = val end,
|
||||
get = function() return do_vines_spread end,
|
||||
})
|
||||
minetest.register_abm({
|
||||
label = "Vine growth",
|
||||
nodenames = {"mcl_core:vine"},
|
||||
interval = 47,
|
||||
chance = 4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if not do_vines_spread then return end
|
||||
|
||||
-- First of all, check if we are even supported, otherwise, decay.
|
||||
if not mcl_core.check_vines_supported(pos, node) then
|
||||
minetest.remove_node(pos)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_core
|
||||
description = Core items of MineClone 2: Basic biome blocks (dirt, sand, stones, etc.), derived items, glass, sugar cane, cactus, barrier, mining tools, hand, craftitems, and misc. items which don't really fit anywhere else.
|
||||
depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting, mcl_colors, mcl_stonecutter
|
||||
depends = mcl_autogroup, mcl_init, mcl_sounds, mcl_particles, mcl_util, mcl_worlds, doc_items, mcl_enchanting, mcl_colors, mcl_stonecutter, vl_tuning
|
||||
optional_depends = doc
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -7,6 +7,12 @@ local modpath = minetest.get_modpath(modname)
|
|||
local S = minetest.get_translator(modname)
|
||||
|
||||
local has_mcl_portals = minetest.get_modpath("mcl_portals")
|
||||
local gamerule_doFireTick = true
|
||||
vl_tuning.setting("gamerule:doFireTick", "bool", {
|
||||
description = S("Whether fire should spread and naturally extinguish"), default = true,
|
||||
set = function(val) gamerule_doFireTick = val end,
|
||||
get = function() return gamerule_doFireTick end,
|
||||
})
|
||||
|
||||
local set_node = minetest.set_node
|
||||
local get_node = minetest.get_node
|
||||
|
@ -366,6 +372,8 @@ else -- Fire enabled
|
|||
chance = 12,
|
||||
catch_up = false,
|
||||
action = function(pos)
|
||||
if not gamerule_doFireTick then return end
|
||||
|
||||
local p = get_ignitable(pos)
|
||||
if p then
|
||||
spawn_fire(p)
|
||||
|
@ -383,6 +391,8 @@ else -- Fire enabled
|
|||
chance = 9,
|
||||
catch_up = false,
|
||||
action = function(pos)
|
||||
if not gamerule_doFireTick then return end
|
||||
|
||||
local p=get_ignitable_by_lava(pos)
|
||||
if p then
|
||||
spawn_fire(p)
|
||||
|
@ -397,6 +407,8 @@ else -- Fire enabled
|
|||
chance = 3,
|
||||
catch_up = false,
|
||||
action = function(pos)
|
||||
if not gamerule_doFireTick then return end
|
||||
|
||||
local p=has_flammable(pos)
|
||||
if p then
|
||||
local n=minetest.get_node_or_nil(p)
|
||||
|
@ -418,6 +430,8 @@ else -- Fire enabled
|
|||
chance = 18,
|
||||
catch_up = false,
|
||||
action = function(pos)
|
||||
if not gamerule_doFireTick then return end
|
||||
|
||||
local p = has_flammable(pos)
|
||||
if not p then
|
||||
return
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = mcl_fire
|
||||
depends = mcl_core, mcl_worlds, mcl_sounds, mcl_particles, mcl_util
|
||||
optional_depends = mcl_portals
|
||||
optional_depends = mcl_portals, vl_tuning
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_portals
|
||||
description = Adds buildable portals to the Nether and End dimensions.
|
||||
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits, mcl_structures
|
||||
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits, mcl_structures, vl_tuning
|
||||
optional_depends = awards, doc
|
||||
|
|
|
@ -85,7 +85,20 @@ local LIM_MIN, LIM_MAX = mcl_vars.mapgen_edge_min, mcl_vars.mapgen_edge_max
|
|||
local PLAYER_COOLOFF, MOB_COOLOFF = 3, 14 -- for this many seconds they won't teleported again
|
||||
local TOUCH_CHATTER_TIME = 1 -- prevent multiple teleportation attempts caused by multiple portal touches, for this number of seconds
|
||||
local CHATTER_US = TOUCH_CHATTER_TIME * 1000000
|
||||
local DELAY = 3 -- seconds before teleporting in Nether portal in Survival mode (4 minus ABM interval time)
|
||||
|
||||
local nether_portal_creative_delay = 0
|
||||
vl_tuning.setting("gamerule:playersNetherPortalCreativeDelay", "number", {
|
||||
default = 0,
|
||||
set = function(val) nether_portal_creative_delay = val end,
|
||||
get = function() return nether_portal_creative_delay end,
|
||||
})
|
||||
local nether_portal_survival_delay = 4
|
||||
vl_tuning.setting("gamerule:playersNetherPortalDefaultDelay", "number", {
|
||||
default = 4,
|
||||
set = function(val) nether_portal_survival_delay = val end,
|
||||
get = function() return nether_portal_survive_delay end,
|
||||
})
|
||||
|
||||
-- Speeds up the search by allowing some non-air nodes to be replaced when
|
||||
-- looking for acceptable portal locations. Setting this lower means the
|
||||
-- algorithm will do more searching. Even at 0, there is no risk of finding
|
||||
|
@ -1477,12 +1490,16 @@ local function teleport(obj, portal_pos)
|
|||
|
||||
if cooloff[obj] then return end
|
||||
|
||||
local delay = math.max(0, nether_portal_survival_delay - 1)
|
||||
if minetest.is_creative_enabled(name) then
|
||||
teleport_no_delay(obj, portal_pos)
|
||||
return
|
||||
delay = math.max(0, nether_portal_creative_delay - 1)
|
||||
end
|
||||
|
||||
minetest.after(DELAY, teleport_no_delay, obj, portal_pos)
|
||||
if delay == 0 then
|
||||
teleport_no_delay(obj, portal_pos)
|
||||
else
|
||||
minetest.after(delay, teleport_no_delay, obj, portal_pos)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_abm({
|
||||
|
|
|
@ -148,7 +148,7 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
|||
local node = minetest.get_node(dpos)
|
||||
|
||||
if self._stuck then
|
||||
self._stucktimer = self._stucktimer + dtime
|
||||
self._stucktimer = self._stucktimer or 0 + dtime
|
||||
self._stuckrechecktimer = self._stuckrechecktimer + dtime
|
||||
if self._stucktimer > ARROW_TIMEOUT then
|
||||
self.object:remove()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,6 +3,19 @@ local modpath = minetest.get_modpath(modname)
|
|||
|
||||
local S = minetest.get_translator(modname)
|
||||
|
||||
local max_tick_timer
|
||||
vl_tuning.setting("health_regen_delay", "number", {
|
||||
default = tonumber(minetest.settings:get("mcl_health_regen_delay")) or 0.5,
|
||||
set = function(val) max_tick_timer = val end,
|
||||
get = function() return max_tick_timer end,
|
||||
})
|
||||
local natural_regeneration = true
|
||||
vl_tuning.setting("gamerule:naturalRegeneration", "bool", {
|
||||
default = true,
|
||||
set = function(val) natural_regeneration = val end,
|
||||
get = function() return natural_regeneration end,
|
||||
})
|
||||
|
||||
mcl_hunger = {}
|
||||
|
||||
--[[ This variable tells you if the hunger gameplay mechanic is active.
|
||||
|
@ -241,7 +254,6 @@ minetest.register_globalstep(function(dtime)
|
|||
local food_level = mcl_hunger.get_hunger(player)
|
||||
local food_saturation_level = mcl_hunger.get_saturation(player)
|
||||
local player_health = player:get_hp()
|
||||
local max_tick_timer = tonumber(minetest.settings:get("mcl_health_regen_delay")) or 0.5
|
||||
|
||||
if food_tick_timer > 4 then
|
||||
food_tick_timer = 0
|
||||
|
@ -253,7 +265,7 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
if food_level >= 18 then -- slow regeneration
|
||||
if player_health > 0 and player_health < player:get_properties().hp_max then
|
||||
if natural_regeneration and player_health > 0 and player_health < player:get_properties().hp_max then
|
||||
player:set_hp(player_health+1)
|
||||
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
|
||||
mcl_hunger.update_exhaustion_hud(player)
|
||||
|
@ -270,7 +282,7 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
|
||||
elseif food_tick_timer > max_tick_timer and food_level == 20 and food_saturation_level > 0 then -- fast regeneration
|
||||
if player_health > 0 and player_health < player:get_properties().hp_max then
|
||||
if natural_regeneration and player_health > 0 and player_health < player:get_properties().hp_max then
|
||||
food_tick_timer = 0
|
||||
player:set_hp(player_health+1)
|
||||
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_hunger
|
||||
author = BlockMen
|
||||
description = Adds a simple hunger meachanic with satiation, food poisoning and different healing.
|
||||
depends = hudbars
|
||||
depends = hudbars, vl_tuning
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_skins
|
||||
author = MrRar
|
||||
description = Advanced player skin customization.
|
||||
depends = mcl_player
|
||||
depends = mcl_player, vl_tuning
|
||||
|
|
Loading…
Reference in New Issue