Remove debug print(), add game rules maxEntityCramming, snowAccumulationHeight

This commit is contained in:
teknomunk 2024-05-31 06:25:47 -05:00
parent fdd52bda90
commit 38ed457211
3 changed files with 24 additions and 11 deletions

@ -45,7 +45,6 @@ function tunable_class:set(value)
end end
end end
function tunable_class:get_string() function tunable_class:get_string()
print(dump(self))
return self.type.to_string(self[1]) return self.type.to_string(self[1])
end end

@ -1,8 +1,14 @@
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs local math, vector, minetest, mcl_mobs = math, vector, minetest, mcl_mobs
local mob_class = mcl_mobs.mob_class local mob_class = mcl_mobs.mob_class
local validate_vector = mcl_util.validate_vector local validate_vector = mcl_util.validate_vector
local ENTITY_CRAMMING_MAX = 24 local gamerule_maxEntityCramming = 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,
})
local CRAMMING_DAMAGE = 3 local CRAMMING_DAMAGE = 3
local DEATH_DELAY = 0.5 local DEATH_DELAY = 0.5
local DEFAULT_FALL_SPEED = -9.81*1.5 local DEFAULT_FALL_SPEED = -9.81*1.5
@ -903,7 +909,7 @@ function mob_class:check_entity_cramming()
local l = o:get_luaentity() local l = o:get_luaentity()
if l and l.is_mob and l.health > 0 then table.insert(mobs,l) end if l and l.is_mob and l.health > 0 then table.insert(mobs,l) end
end end
local clear = #mobs < ENTITY_CRAMMING_MAX local clear = #mobs < gamerule_maxEntityCramming[1]
local ncram = {} local ncram = {}
for _,l in pairs(mobs) do for _,l in pairs(mobs) do
if l then if l then
@ -917,7 +923,7 @@ function mob_class:check_entity_cramming()
end end
end end
for i,l in pairs(ncram) do for i,l in pairs(ncram) do
if i > ENTITY_CRAMMING_MAX then if i > gamerule_maxEntityCramming[1] then
l.cram = true l.cram = true
else else
l.cram = nil l.cram = nil

@ -1,10 +1,16 @@
local get_connected_players = minetest.get_connected_players local get_connected_players = minetest.get_connected_players
local modname = minetest.get_current_modname()
local S = minetest.get_translator(modname)
mcl_weather.snow = {} mcl_weather.snow = {}
local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100 local PARTICLES_COUNT_SNOW = tonumber(minetest.settings:get("mcl_weather_snow_particles")) or 100
mcl_weather.snow.init_done = false mcl_weather.snow.init_done = false
local mgname = minetest.get_mapgen_setting("mg_name") local mgname = minetest.get_mapgen_setting("mg_name")
local gamerule_snowAccumulationHeight = 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
})
local snow_biomes = { local snow_biomes = {
"ColdTaiga_underground", "ColdTaiga_underground",
@ -141,14 +147,16 @@ minetest.register_abm({
if node.name:find("snow") then if node.name:find("snow") then
local l = node.name:sub(-1) local l = node.name:sub(-1)
l = tonumber(l) l = tonumber(l)
if node.name == "mcl_core:snow" then if l < gamerule_snowAccumulationHeight[1] then
nn={name = "mcl_core:snow_2"} if node.name == "mcl_core:snow" then
elseif l and l < 7 then nn={name = "mcl_core:snow_2"}
nn={name="mcl_core:snow_"..tostring(math.min(8,l + 1))} elseif l and l < 7 then
elseif l and l >= 7 then nn={name="mcl_core:snow_"..tostring(math.min(8,l + 1))}
nn={name = "mcl_core:snowblock"} elseif l and l >= 7 then
nn={name = "mcl_core:snowblock"}
end
if nn then minetest.set_node(pos,nn) end
end end
if nn then minetest.set_node(pos,nn) end
else else
minetest.set_node(above,{name = "mcl_core:snow"}) minetest.set_node(above,{name = "mcl_core:snow"})
end end