diff --git a/mods/CORE/pyutest/util.lua b/mods/CORE/pyutest/util.lua index cc8acf4..abeeb27 100644 --- a/mods/CORE/pyutest/util.lua +++ b/mods/CORE/pyutest/util.lua @@ -271,3 +271,10 @@ PyuTest.give_item_or_drop = function(stack, inventory, listname, pos) minetest.add_item(pos, leftover) end end + +PyuTest.get_biome_def = function(pos) + local data = minetest.get_biome_data(pos) + if not data then return end + + return minetest.registered_biomes[minetest.get_biome_name(data.biome)] +end diff --git a/mods/ENTITIES/pyutest_entities/api.lua b/mods/ENTITIES/pyutest_entities/api.lua index 60f9071..161234f 100644 --- a/mods/ENTITIES/pyutest_entities/api.lua +++ b/mods/ENTITIES/pyutest_entities/api.lua @@ -6,7 +6,7 @@ PATH_FIND_ALGORITHM = "Dijkstra" PyuTest.ENTITY_BLOOD_AMOUNT = 6 PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25} -PyuTest.get_nearest_entity = function (entity, pos, range, only_player) +PyuTest.get_nearest_entity = function (entity, pos, range, only_player, dont_ignore_allies) local closet_distance = math.huge local nearest @@ -28,7 +28,15 @@ PyuTest.get_nearest_entity = function (entity, pos, range, only_player) -- Ignore items if e then if e.name ~= "__builtin:item" then - set_nearest_and_distance(obj, dist) + if not dont_ignore_allies then + local self = entity:get_luaentity() + + if self then + if self.name ~= e.name then + set_nearest_and_distance(obj, dist) + end + end + end end else set_nearest_and_distance(obj, dist) @@ -94,7 +102,7 @@ local class = {} function class:do_physics() local obj = self.object - local data = self.data + local state = self.state local cfg = self.options local moveresult = self.moveresult local pos = obj:get_pos() @@ -109,31 +117,31 @@ end function class:path_find_nearest_entity(follow_only_player) local obj = self.object - local data = self.data + local state = self.state local cfg = self.options local pos = obj:get_pos() - if data.target.path == nil then - data.target.object = PyuTest.get_nearest_entity(obj, pos, cfg.sight_range, follow_only_player) + if state.target.path == nil then + state.target.object = PyuTest.get_nearest_entity(obj, pos, cfg.sight_range, follow_only_player) - if data.target.object == nil then + if state.target.object == nil then return end - data.target.position = data.target.object:get_pos() - data.target.path = minetest.find_path(pos, data.target.position, cfg.view_range, cfg.max_jump, cfg.max_drop, PATH_FIND_ALGORITHM) - data.target.pathindex = 1 + state.target.position = state.target.object:get_pos() + state.target.path = minetest.find_path(pos, state.target.position, cfg.view_range, cfg.max_jump, cfg.max_drop, PATH_FIND_ALGORITHM) + state.target.pathindex = 1 else - if data.target.pathindex == #data.target.path then - data.target.path = nil - data.target.object = nil - data.target.position = nil - data.target.pathindex = nil + if state.target.pathindex == #state.target.path then + state.target.path = nil + state.target.object = nil + state.target.position = nil + state.target.pathindex = nil else - local p = data.target.path[data.target.pathindex] + local p = state.target.path[state.target.pathindex] -- obj:set_velocity(p * dtime) obj:move_to(p, true) - data.target.pathindex = data.target.pathindex + 1 + state.target.pathindex = state.target.pathindex + 1 end end end @@ -182,7 +190,7 @@ PyuTest.make_mob = function (name, properties, options) infotext = "", }), options = cfg, - data = { + state = { target = { object = nil, position = nil, diff --git a/mods/ITEMS/pyutest_blocks/basic.lua b/mods/ITEMS/pyutest_blocks/basic.lua index 6999513..9943eeb 100644 --- a/mods/ITEMS/pyutest_blocks/basic.lua +++ b/mods/ITEMS/pyutest_blocks/basic.lua @@ -152,7 +152,7 @@ PyuTest.make_building_blocks("pyutest_blocks:ice", "Ice", { "pyutest-ice.png" }, acid_vulnerable = 1, slippery = 4, cracky = PyuTest.BLOCK_FAST, - thawable = 1 + thawable = 1, }) PyuTest.make_building_blocks("pyutest_blocks:molten_rock", "Molten Rock", { "pyutest-molten-rock.png" }, nil, { diff --git a/mods/ITEMS/pyutest_blocks/special.lua b/mods/ITEMS/pyutest_blocks/special.lua index 8086e90..cbb354c 100644 --- a/mods/ITEMS/pyutest_blocks/special.lua +++ b/mods/ITEMS/pyutest_blocks/special.lua @@ -196,6 +196,14 @@ PyuTest.make_node("pyutest_blocks:bedrock", "Bedrock", { is_ground_content = false }) +PyuTest.make_node("pyutest_blocks:weak_ice", "Weak Ice", { + cracky = PyuTest.BLOCK_FAST +}, {"pyutest-ice.png"}, { + on_walk_over = function(pos) + minetest.set_node(pos, {name = "pyutest_blocks:water_source"}) + end +}) + minetest.register_abm({ label = "Sponge Loop", nodenames = { "pyutest_blocks:sponge" }, diff --git a/mods/WORLD/pyutest_environment/init.lua b/mods/WORLD/pyutest_environment/init.lua index ab8fc74..da6a092 100644 --- a/mods/WORLD/pyutest_environment/init.lua +++ b/mods/WORLD/pyutest_environment/init.lua @@ -1,19 +1,39 @@ minetest.register_abm({ - label = "Water freezing", + label = "Water freezing/evaporating", nodenames = {"group:water"}, interval = 3, chance = 2.5, catch_up = true, action = function (pos) - local heat = minetest.get_heat(pos) or 50 + local def = PyuTest.get_biome_def(pos) + if not def then return end + + local heat = def.heat_point or 50 local found = minetest.find_node_near(pos, 2, {"group:emits_heat"}) ~= nil - if heat < 12 and not found then + if heat <= 12 and not found then minetest.set_node(pos, {name = "pyutest_blocks:ice_block"}) end end }) +minetest.register_abm({ + label = "Water evaporating", + nodenames = {"group:water"}, + interval = 0.1, + chance = 1, + action = function (pos) + local def = PyuTest.get_biome_def(pos) + if not def then return end + + local heat = def.heat_point or 50 + + if heat >= 100 then + minetest.remove_node(pos) + end + end +}) + minetest.register_abm({ label = "Ice thawing", nodenames = {"group:thawable"}, diff --git a/mods/WORLD/pyutest_mapgen/biomes.lua b/mods/WORLD/pyutest_mapgen/biomes.lua index 95b19ca..d103562 100644 --- a/mods/WORLD/pyutest_mapgen/biomes.lua +++ b/mods/WORLD/pyutest_mapgen/biomes.lua @@ -158,7 +158,7 @@ if PyuTest.is_flat() then heat_point = 50, humidity_point = 50, - }, true) + }) return end diff --git a/textures/pyutest-crystal-lantern.png b/textures/pyutest-crystal-lantern.png index 07c38c8..6e263c0 100644 Binary files a/textures/pyutest-crystal-lantern.png and b/textures/pyutest-crystal-lantern.png differ diff --git a/textures/pyutest-ice-old.png b/textures/pyutest-ice-old.png new file mode 100644 index 0000000..5feebd0 Binary files /dev/null and b/textures/pyutest-ice-old.png differ