From 38ed457211179ccbe358364778f26b6a00f34cc7 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Fri, 31 May 2024 06:25:47 -0500 Subject: [PATCH] Remove debug print(), add game rules maxEntityCramming, snowAccumulationHeight --- mods/CORE/vl_tuning/init.lua | 1 - mods/ENTITIES/mcl_mobs/physics.lua | 12 +++++++++--- mods/ENVIRONMENT/mcl_weather/snow.lua | 22 +++++++++++++++------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/mods/CORE/vl_tuning/init.lua b/mods/CORE/vl_tuning/init.lua index 3c5e3a2cc..5555b9c1d 100644 --- a/mods/CORE/vl_tuning/init.lua +++ b/mods/CORE/vl_tuning/init.lua @@ -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 diff --git a/mods/ENTITIES/mcl_mobs/physics.lua b/mods/ENTITIES/mcl_mobs/physics.lua index 441156a1d..430eda24d 100644 --- a/mods/ENTITIES/mcl_mobs/physics.lua +++ b/mods/ENTITIES/mcl_mobs/physics.lua @@ -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 diff --git a/mods/ENVIRONMENT/mcl_weather/snow.lua b/mods/ENVIRONMENT/mcl_weather/snow.lua index 73c65c3da..c5d024c73 100644 --- a/mods/ENVIRONMENT/mcl_weather/snow.lua +++ b/mods/ENVIRONMENT/mcl_weather/snow.lua @@ -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,14 +147,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[1] 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