From f881682777bfa774395cebc9fabce166ba8c4bad Mon Sep 17 00:00:00 2001 From: IamPyu Date: Sun, 27 Oct 2024 16:57:04 -0600 Subject: [PATCH] Various different changes --- mods/CORE/pyutest/util.lua | 7 ++++ mods/ENTITIES/pyutest_entities/api.lua | 44 ++++++++++++++---------- mods/ITEMS/pyutest_blocks/basic.lua | 2 +- mods/ITEMS/pyutest_blocks/special.lua | 8 +++++ mods/WORLD/pyutest_environment/init.lua | 26 ++++++++++++-- mods/WORLD/pyutest_mapgen/biomes.lua | 2 +- textures/pyutest-crystal-lantern.png | Bin 191 -> 192 bytes textures/pyutest-ice-old.png | Bin 0 -> 188 bytes 8 files changed, 66 insertions(+), 23 deletions(-) create mode 100644 textures/pyutest-ice-old.png 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 07c38c8a59ea1fe2534538e937a23c2d0cd6f7ae..6e263c008c017f92f8cf4aec794dd5c8f58e055e 100644 GIT binary patch delta 164 zcmV;V09*gR0l)!}B!7oVL_t(IjkQui4!|G?W5$Dt|9{gyut)3zCLE00iKXCV%gjhP zNTpWjvTpl96A@;biHM>t`HO%Y5F z(Ir6np9tQB%WvoKzXI7Y*Z%LK#v1K9*&TD$i5MEG^MSZ+6dkUW?=C#W^bk*UD?G4< S;9V8~0000JW6)} delta 163 zcmV;U09^mT0lxu|B!7lUL_t(IjkQui4uBvGn}iJi|0zGH}12LzEkM|%)Mm&O5-bG5H)k2x8E;URVf z(EcZZH`UembNJtZ?l{->@9M?}?R4OGoU1*EVUU^}Xxi?o8yw}U3r{sX!~+}uJh19% RIN$&P002ovPDHLkV1fo(Ntgft diff --git a/textures/pyutest-ice-old.png b/textures/pyutest-ice-old.png new file mode 100644 index 0000000000000000000000000000000000000000..5feebd099197413eea0612c4bc89b512bbf41a6e GIT binary patch literal 188 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`&7LlfAr`&KHnqRc*Rydk2&>Lw z-^sW>Zl8)*59{o-z;paOJdYkp%sP7E$Ofqoubz7IoV~%*!sxcjZL!94_BCA-j$XXF zK;px%-3-jk%vlM0t9}aU^{ruB&1k^8;lLr$0t;S;>kaE9qfHh`FkEiX)hXD?mhI&9 mUEOZIz|<)pTbYkmGBTWEw6y2uZfFBKhr!d;&t;ucLK6VZ&O(U* literal 0 HcmV?d00001