diff --git a/CHANGELOG.md b/CHANGELOG.md index c905cac..048c8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Other Game Changes: - Added Peach color - Replaced single Haybales blocks spawning in Plains biome with Haybale and Pumpkin pastures - Re-added Barriers +- Fixed lava-water collisions Code Changes: diff --git a/mods/PLAYER/pyutest_cmds/init.lua b/mods/PLAYER/pyutest_cmds/init.lua index c67e498..4b7adf1 100644 --- a/mods/PLAYER/pyutest_cmds/init.lua +++ b/mods/PLAYER/pyutest_cmds/init.lua @@ -64,7 +64,8 @@ core.register_chatcommand("teleport", { description = "Teleport to ", privs = {teleport = true}, func = function(name, param) - local found, _, player, x, y, z = param:find("^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+([^%s]+)$") + local found, _, player, x, y, z = PyuTest.parse_command_functions(name, param) + :find("^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+([^%s]+)$") if found == nil then core.chat_send_player(name, "Invalid usage: " .. param) diff --git a/mods/WORLD/pyutest_environment/init.lua b/mods/WORLD/pyutest_environment/init.lua index b1c1b3d..78e81dd 100644 --- a/mods/WORLD/pyutest_environment/init.lua +++ b/mods/WORLD/pyutest_environment/init.lua @@ -54,33 +54,40 @@ core.register_abm({ core.register_abm({ nodenames = { "group:lava" }, - interval = 0.25, + interval = 1, chance = 1, action = function(pos) local function is_water(p) local name = core.get_node(p).name - if core.get_item_group(name, "water") ~= 0 then - return true - end - - return false + return core.get_item_group(name, "water") ~= 0 end local function replace(name, p) core.set_node(p or pos, { name = name }) end - PyuTest.dorange(pos, 1, function(p) - if is_water(p) then - if p.y > pos.y then - replace("pyutest_blocks:obsidian_block") - elseif p.y < pos.y then - replace("pyutest_blocks:stone_block", p) - else - replace("pyutest_blocks:stone_block") + local p1 = vector.new(pos.x, pos.y + 1, pos.z) + local p2 = vector.new(pos.x, pos.y - 1, pos.z) + + if is_water(p1) then + replace("pyutest_blocks:obsidian_block") + return + end + + if is_water(p2) then + replace("pyutest_blocks:stone_block", p2) + return + end + + for dx = -1, 1 do + for dz = -1, 1 do + local p3 = vector.new(pos.x + dx, pos.y, pos.z + dz) + if is_water(p3) then + replace("pyutest_blocks:cobblestone_block") + return end end - end) + end end })