Compare commits

..

2 Commits

Author SHA1 Message Date
FossFanatic a9f5efcbc0 Improve code relating to vines
This commit makes the LBM and `register_on_generated` for foliage now use the better calculation for the vines.
2023-02-24 12:22:08 +00:00
FossFanatic 8bbcb4f97a Add function for colorwallmounted node rotation
This commit adds a new utility function which helps find the rotation of `colorwallmounted` nodes.
2023-02-24 12:17:24 +00:00
3 changed files with 17 additions and 7 deletions

View File

@ -1033,3 +1033,13 @@ function mcl_util.get_palette_indexes_from_pos(pos)
return palette_indexes
end
end
function mcl_util.get_colorwallmounted_rotation(pos)
local colorwallmounted_node = minetest.get_node(pos)
for i = 0, 32, 1 do
local colorwallmounted_rotation = colorwallmounted_node.param2 - (i * 8)
if colorwallmounted_rotation < 6 then
return colorwallmounted_rotation
end
end
end

View File

@ -226,7 +226,7 @@ if mcl_weather.allow_abm then
}
for a=1, #around do
local apos = vector.add(pos, around[a])
if mcl_weather.is_outdoor(apos) and mcl_weather.has_rain(apos) then
if mcl_weather.is_outdoor(apos) then
minetest.remove_node(pos)
minetest.sound_play("fire_extinguish_flame", {pos = pos, max_hear_distance = 8, gain = 0.1}, true)
return
@ -244,7 +244,7 @@ if mcl_weather.allow_abm then
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
-- Rain is equivalent to a water bottle
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) and mcl_weather.has_rain(pos) then
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
if node.name == "mcl_cauldrons:cauldron" then
minetest.set_node(pos, {name="mcl_cauldrons:cauldron_1"})
elseif node.name == "mcl_cauldrons:cauldron_1" then
@ -267,7 +267,7 @@ if mcl_weather.allow_abm then
interval = 22.0,
chance = 3,
action = function(pos, node, active_object_count, active_object_count_wider)
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) and mcl_weather.has_rain(pos) then
if mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
if node.name == "mcl_farming:soil" then
minetest.set_node(pos, {name="mcl_farming:soil_wet"})
end

View File

@ -452,9 +452,9 @@ minetest.register_lbm({
minetest.set_node(pos, node)
elseif node.name == "mcl_core:vine" then
local biome_param2 = foliage_palette_index
local rotation_param2 = node.param2
local rotation_param2 = mcl_util.get_colorwallmounted_rotation(pos)
local final_param2 = (biome_param2 * 8) + rotation_param2
if node.param2 ~= final_param2 and rotation_param2 < 6 then
if node.param2 ~= final_param2 then
node.param2 = final_param2
minetest.set_node(pos, node)
end
@ -473,9 +473,9 @@ minetest.register_on_generated(function(minp, maxp, blockseed) -- Set correct pa
minetest.set_node(fpos, fnode)
elseif fnode.name == "mcl_core:vine" then
local biome_param2 = foliage_palette_index
local rotation_param2 = fnode.param2
local rotation_param2 = mcl_util.get_colorwallmounted_rotation(fpos)
local final_param2 = (biome_param2 * 8) + rotation_param2
if fnode.param2 ~= final_param2 and rotation_param2 < 6 then
if fnode.param2 ~= final_param2 then
fnode.param2 = final_param2
minetest.set_node(fpos, fnode)
end