From 5d2866ddf23dbe51774a6d449dffa27e5682023a Mon Sep 17 00:00:00 2001 From: IamPyu Date: Fri, 1 Nov 2024 23:10:36 -0600 Subject: [PATCH] Various different changes --- CHANGELOG.md | 3 +++ mods/CORE/pyutest/util.lua | 27 +++++++++++++++++++++++---- mods/ITEMS/pyutest_blocks/basic.lua | 2 +- mods/ITEMS/pyutest_grass/init.lua | 7 +++++++ mods/ITEMS/pyutest_magic/init.lua | 3 ++- mods/PLAYER/pyutest_home/init.lua | 8 ++++++++ 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 964142f..a51ea7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ - Added Calcite - Added Pumpkins - Removed Frying Pans, why did I even add them for cooking food when we can just use furnaces? +- Since obsidian in real life is not that strong, make obsidian the same level as stone +- Added ability to delete homes with `/deletehome` +- Added a way to duplicate grass by combining it with dirt - A lot of other changes that I forgot to document ## [Oct 19th 2024] Bugfix Update diff --git a/mods/CORE/pyutest/util.lua b/mods/CORE/pyutest/util.lua index 9d68036..7766ff2 100644 --- a/mods/CORE/pyutest/util.lua +++ b/mods/CORE/pyutest/util.lua @@ -92,7 +92,7 @@ PyuTest.node_beside_group = function(pos, group) return false end -PyuTest.create_explosion = function (pos, range, rm_pos, dmg) +PyuTest.create_explosion = function (pos, range, rm_pos, dmg, damage_whitelist) if rm_pos then minetest.remove_node(pos) end @@ -109,9 +109,28 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg) end) for _, v in pairs(minetest.get_objects_inside_radius(pos, range)) do - v:punch(v, nil, { - damage_groups = {fleshy = dmg} - }, nil) + local function damage() + v:punch(v, nil, { + damage_groups = {fleshy = dmg} + }, nil) + end + + if damage_whitelist ~= nil then + local unsafe = true + + for _, v2 in pairs(damage_whitelist) do + if v == v2 then + unsafe = false + break + end + end + + if unsafe then + damage() + end + else + damage() + end end diff --git a/mods/ITEMS/pyutest_blocks/basic.lua b/mods/ITEMS/pyutest_blocks/basic.lua index a832d16..35db89c 100644 --- a/mods/ITEMS/pyutest_blocks/basic.lua +++ b/mods/ITEMS/pyutest_blocks/basic.lua @@ -172,7 +172,7 @@ PyuTest.make_building_blocks("pyutest_blocks:basalt", "Basalt", { "pyutest-basal }, { is_ground_content = false }) PyuTest.make_building_blocks("pyutest_blocks:obsidian", "Obsidian", { "pyutest-obsidian.png" }, nil, { - cracky = PyuTest.BLOCK_SLOW, + cracky = PyuTest.BLOCK_NORMAL, }, { is_ground_content = false }) PyuTest.make_building_blocks("pyutest_blocks:crystal_lantern", "Crystal Lantern", { "pyutest-crystal-lantern.png" }, nil, { diff --git a/mods/ITEMS/pyutest_grass/init.lua b/mods/ITEMS/pyutest_grass/init.lua index 57ab042..6177a5b 100644 --- a/mods/ITEMS/pyutest_grass/init.lua +++ b/mods/ITEMS/pyutest_grass/init.lua @@ -20,6 +20,13 @@ PyuTest.make_grass = function (name, desc, groups, color, ttex, stex, dtex, econ }) minetest.override_item(name.."_block", econf or {}) + minetest.register_craft({ + output = name.."_block 2", + recipe = { + name.."_block", "pyutest_blocks:dirt_block" + }, + type = "shapeless" + }) end PyuTest.make_grass("pyutest_grass:grass", "Grass", { diff --git a/mods/ITEMS/pyutest_magic/init.lua b/mods/ITEMS/pyutest_magic/init.lua index 229c8b3..9912486 100644 --- a/mods/ITEMS/pyutest_magic/init.lua +++ b/mods/ITEMS/pyutest_magic/init.lua @@ -33,7 +33,8 @@ PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action) end PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_tools:bomb", function (itemstack, user) - PyuTest.create_explosion(user:get_pos(), 3, false, 7, user) + PyuTest.create_explosion(user:get_pos(), 3, false, 7, {user}) + end) PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_blocks:magma", function (itemstack, user) diff --git a/mods/PLAYER/pyutest_home/init.lua b/mods/PLAYER/pyutest_home/init.lua index e86b6e7..e016c39 100644 --- a/mods/PLAYER/pyutest_home/init.lua +++ b/mods/PLAYER/pyutest_home/init.lua @@ -45,6 +45,14 @@ minetest.register_chatcommand("listhomes", { end }) +minetest.register_chatcommand("deletehome", { + description = "Delete a home", + func = function (name, param) + homes[name][param] = nil + return true, string.format("Home `%s` has been deleted", param) + end +}) + local function save_data() storage:set_string("player_homes", minetest.serialize(homes)) end