From f0d9c5c83cf673d4a8814bf37a1bc26405f7b200 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 73aefb509..c1e5f46c6 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 @@ -933,7 +939,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 @@ -947,7 +953,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 9ff2605df..80e760bdb 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", @@ -139,14 +145,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