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

View file

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

View file

@ -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 mob_class = mcl_mobs.mob_class
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 DEATH_DELAY = 0.5
local DEFAULT_FALL_SPEED = -9.81*1.5
@ -903,7 +909,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[1]
local ncram = {}
for _,l in pairs(mobs) do
if l then
@ -917,7 +923,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[1] then
l.cram = true
else
l.cram = nil

View file

@ -1,10 +1,16 @@
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 = 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 = {
"ColdTaiga_underground",
@ -141,6 +147,7 @@ minetest.register_abm({
if node.name:find("snow") then
local l = node.name:sub(-1)
l = tonumber(l)
if l < gamerule_snowAccumulationHeight[1] then
if node.name == "mcl_core:snow" then
nn={name = "mcl_core:snow_2"}
elseif l and l < 7 then
@ -149,6 +156,7 @@ minetest.register_abm({
nn={name = "mcl_core:snowblock"}
end
if nn then minetest.set_node(pos,nn) end
end
else
minetest.set_node(above,{name = "mcl_core:snow"})
end