From 77325b92fbe8235b5c2d8d1261ecd53e3385bab2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 24 Apr 2022 21:48:50 +0000 Subject: DevTest: Add more test weapons and armorball modes (#11870) Co-authored-by: sfan5 --- games/devtest/mods/basetools/init.lua | 105 +++++++++++++++++++-- .../basetools/textures/basetools_bloodsword.png | Bin 0 -> 225 bytes .../textures/basetools_elementalsword.png | Bin 0 -> 252 bytes .../basetools/textures/basetools_healdagger.png | Bin 0 -> 262 bytes .../basetools/textures/basetools_healsword.png | Bin 0 -> 229 bytes .../basetools/textures/basetools_mesesword.png | Bin 0 -> 225 bytes .../textures/basetools_superhealsword.png | Bin 0 -> 272 bytes .../basetools/textures/basetools_titaniumsword.png | Bin 0 -> 225 bytes .../mods/basetools/textures/basetools_usespick.png | Bin 0 -> 230 bytes .../basetools/textures/basetools_usessword.png | Bin 0 -> 248 bytes .../basetools/textures/basetools_wooddagger.png | Bin 0 -> 248 bytes games/devtest/mods/testentities/armor.lua | 30 +++++- .../textures/testentities_armorball.png | Bin 561 -> 1301 bytes games/devtest/mods/unittests/itemdescription.lua | 28 ++---- .../textures/unittests_description_test.png | Bin 0 -> 268 bytes 15 files changed, 129 insertions(+), 34 deletions(-) create mode 100644 games/devtest/mods/basetools/textures/basetools_bloodsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_elementalsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_healdagger.png create mode 100644 games/devtest/mods/basetools/textures/basetools_healsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_mesesword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_superhealsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_titaniumsword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_usespick.png create mode 100644 games/devtest/mods/basetools/textures/basetools_usessword.png create mode 100644 games/devtest/mods/basetools/textures/basetools_wooddagger.png create mode 100644 games/devtest/mods/unittests/textures/unittests_description_test.png (limited to 'games/devtest') diff --git a/games/devtest/mods/basetools/init.lua b/games/devtest/mods/basetools/init.lua index fd83b82eb..3ec69d39f 100644 --- a/games/devtest/mods/basetools/init.lua +++ b/games/devtest/mods/basetools/init.lua @@ -279,50 +279,135 @@ minetest.register_tool("basetools:sword_wood", { }) minetest.register_tool("basetools:sword_stone", { description = "Stone Sword".."\n".. - "Damage: fleshy=4", + "Damage: fleshy=5", inventory_image = "basetools_stonesword.png", tool_capabilities = { full_punch_interval = 1.0, max_drop_level=0, - damage_groups = {fleshy=4}, + damage_groups = {fleshy=5}, } }) minetest.register_tool("basetools:sword_steel", { description = "Steel Sword".."\n".. - "Damage: fleshy=6", + "Damage: fleshy=10", inventory_image = "basetools_steelsword.png", tool_capabilities = { full_punch_interval = 1.0, max_drop_level=1, - damage_groups = {fleshy=6}, + damage_groups = {fleshy=10}, + } +}) +minetest.register_tool("basetools:sword_titanium", { + description = "Titanium Sword".."\n".. + "Damage: fleshy=100", + inventory_image = "basetools_titaniumsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + damage_groups = {fleshy=100}, + } +}) +minetest.register_tool("basetools:sword_blood", { + description = "Blood Sword".."\n".. + "Damage: fleshy=1000", + inventory_image = "basetools_bloodsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + damage_groups = {fleshy=1000}, + } +}) + +-- Max. damage sword +minetest.register_tool("basetools:sword_mese", { + description = "Mese Sword".."\n".. + "Damage: fleshy=32767, fiery=32767, icy=32767".."\n".. + "Full Punch Interval: 0.0s", + inventory_image = "basetools_mesesword.png", + tool_capabilities = { + full_punch_interval = 0.0, + max_drop_level=1, + damage_groups = {fleshy=32767, fiery=32767, icy=32767}, } }) -- Fire/Ice sword: Deal damage to non-fleshy damage groups minetest.register_tool("basetools:sword_fire", { description = "Fire Sword".."\n".. - "Damage: icy=6", + "Damage: icy=10", inventory_image = "basetools_firesword.png", tool_capabilities = { full_punch_interval = 1.0, max_drop_level=0, - damage_groups = {icy=6}, + damage_groups = {icy=10}, } }) minetest.register_tool("basetools:sword_ice", { description = "Ice Sword".."\n".. - "Damage: fiery=6", + "Damage: fiery=10", inventory_image = "basetools_icesword.png", tool_capabilities = { full_punch_interval = 1.0, max_drop_level=0, - damage_groups = {fiery=6}, + damage_groups = {fiery=10}, + } +}) +minetest.register_tool("basetools:sword_elemental", { + description = "Elemental Sword".."\n".. + "Damage: fiery=10, icy=10", + inventory_image = "basetools_elementalsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + damage_groups = {fiery=10, icy=10}, } }) +-- Healing weapons: heal HP +minetest.register_tool("basetools:dagger_heal", { + description = "Healing Dagger".."\n".. + "Heal: fleshy=1".."\n".. + "Full Punch Interval: 0.5s", + inventory_image = "basetools_healdagger.png", + tool_capabilities = { + full_punch_interval = 0.5, + damage_groups = {fleshy=-1}, + } +}) +minetest.register_tool("basetools:sword_heal", { + description = "Healing Sword".."\n".. + "Heal: fleshy=10", + inventory_image = "basetools_healsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + damage_groups = {fleshy=-10}, + } +}) +minetest.register_tool("basetools:sword_heal_super", { + description = "Super Healing Sword".."\n".. + "Heal: fleshy=32768, fiery=32768, icy=32768", + inventory_image = "basetools_superhealsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + damage_groups = {fleshy=-32768, fiery=-32768, icy=-32768}, + } +}) + + -- -- Dagger: Low damage, fast punch interval -- +minetest.register_tool("basetools:dagger_wood", { + description = "Wooden Dagger".."\n".. + "Damage: fleshy=1".."\n".. + "Full Punch Interval: 0.5s", + inventory_image = "basetools_wooddagger.png", + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level=0, + damage_groups = {fleshy=1}, + } +}) minetest.register_tool("basetools:dagger_steel", { description = "Steel Dagger".."\n".. "Damage: fleshy=2".."\n".. @@ -343,7 +428,7 @@ for i=1, #uses do minetest.register_tool("basetools:pick_uses_"..string.format("%05d", u), { description = u.."-Uses Pickaxe".."\n".. "Digs cracky=3", - inventory_image = "basetools_steelpick.png^[colorize:"..color..":127", + inventory_image = "basetools_usespick.png^[colorize:"..color..":127", tool_capabilities = { max_drop_level=0, groupcaps={ @@ -355,7 +440,7 @@ for i=1, #uses do minetest.register_tool("basetools:sword_uses_"..string.format("%05d", u), { description = u.."-Uses Sword".."\n".. "Damage: fleshy=1", - inventory_image = "basetools_woodsword.png^[colorize:"..color..":127", + inventory_image = "basetools_usessword.png^[colorize:"..color..":127", tool_capabilities = { damage_groups = {fleshy=1}, punch_attack_uses = u, diff --git a/games/devtest/mods/basetools/textures/basetools_bloodsword.png b/games/devtest/mods/basetools/textures/basetools_bloodsword.png new file mode 100644 index 000000000..047adfef7 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_bloodsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_elementalsword.png b/games/devtest/mods/basetools/textures/basetools_elementalsword.png new file mode 100644 index 000000000..b72821192 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_elementalsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_healdagger.png b/games/devtest/mods/basetools/textures/basetools_healdagger.png new file mode 100644 index 000000000..f1ceaeb43 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_healdagger.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_healsword.png b/games/devtest/mods/basetools/textures/basetools_healsword.png new file mode 100644 index 000000000..e9d6dafee Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_healsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_mesesword.png b/games/devtest/mods/basetools/textures/basetools_mesesword.png new file mode 100644 index 000000000..2aecc167c Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_mesesword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_superhealsword.png b/games/devtest/mods/basetools/textures/basetools_superhealsword.png new file mode 100644 index 000000000..ca8bd0df8 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_superhealsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_titaniumsword.png b/games/devtest/mods/basetools/textures/basetools_titaniumsword.png new file mode 100644 index 000000000..f34ab9f4d Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_titaniumsword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_usespick.png b/games/devtest/mods/basetools/textures/basetools_usespick.png new file mode 100644 index 000000000..5aa3a960c Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_usespick.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_usessword.png b/games/devtest/mods/basetools/textures/basetools_usessword.png new file mode 100644 index 000000000..9742b9b81 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_usessword.png differ diff --git a/games/devtest/mods/basetools/textures/basetools_wooddagger.png b/games/devtest/mods/basetools/textures/basetools_wooddagger.png new file mode 100644 index 000000000..67e37ee71 Binary files /dev/null and b/games/devtest/mods/basetools/textures/basetools_wooddagger.png differ diff --git a/games/devtest/mods/testentities/armor.lua b/games/devtest/mods/testentities/armor.lua index 306953d50..3887c75fd 100644 --- a/games/devtest/mods/testentities/armor.lua +++ b/games/devtest/mods/testentities/armor.lua @@ -4,10 +4,19 @@ local phasearmor = { [0]={icy=100}, [1]={fiery=100}, - [2]={fleshy=100}, - [3]={immortal=1}, - [4]={punch_operable=1}, + [2]={icy=100, fiery=100}, + [3]={fleshy=-100}, + [4]={fleshy=1}, + [5]={fleshy=10}, + [6]={fleshy=50}, + [7]={fleshy=100}, + [8]={fleshy=200}, + [9]={fleshy=1000}, + [10]={fleshy=32767}, + [11]={immortal=1}, + [12]={punch_operable=1}, } +local max_phase = 12 minetest.register_entity("testentities:armorball", { initial_properties = { @@ -21,7 +30,7 @@ minetest.register_entity("testentities:armorball", { initial_sprite_basepos = {x=0, y=0}, }, - _phase = 2, + _phase = 7, on_activate = function(self, staticdata) minetest.log("action", "[testentities] armorball.on_activate") @@ -32,10 +41,21 @@ minetest.register_entity("testentities:armorball", { on_rightclick = function(self, clicker) -- Change armor group and sprite self._phase = self._phase + 1 - if self._phase >= 5 then + if self._phase >= max_phase + 1 then self._phase = 0 end self.object:set_sprite({x=0, y=self._phase}) self.object:set_armor_groups(phasearmor[self._phase]) end, + + on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) + if not puncher then + return + end + local name = puncher:get_player_name() + if not name then + return + end + minetest.chat_send_player(name, "time_from_last_punch="..string.format("%.3f", time_from_last_punch).."; damage="..tostring(damage)) + end, }) diff --git a/games/devtest/mods/testentities/textures/testentities_armorball.png b/games/devtest/mods/testentities/textures/testentities_armorball.png index 88147bd1f..ffe33fbad 100644 Binary files a/games/devtest/mods/testentities/textures/testentities_armorball.png and b/games/devtest/mods/testentities/textures/testentities_armorball.png differ diff --git a/games/devtest/mods/unittests/itemdescription.lua b/games/devtest/mods/unittests/itemdescription.lua index dc62de7f0..b4c218c98 100644 --- a/games/devtest/mods/unittests/itemdescription.lua +++ b/games/devtest/mods/unittests/itemdescription.lua @@ -1,17 +1,7 @@ -local full_description = "Colorful Pickaxe\nThe best pick." -minetest.register_tool("unittests:colorful_pick", { +local full_description = "Description Test Item\nFor testing item decription" +minetest.register_tool("unittests:description_test", { description = full_description, - inventory_image = "basetools_mesepick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, - crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, - snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3} - }, - damage_groups = {fleshy=4}, - }, + inventory_image = "unittests_description_test.png", }) minetest.register_chatcommand("item_description", { @@ -30,18 +20,18 @@ local function test_short_desc() return ItemStack(item):get_short_description() end - local stack = ItemStack("unittests:colorful_pick") - assert(stack:get_short_description() == "Colorful Pickaxe") - assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe") - assert(minetest.registered_items["unittests:colorful_pick"].short_description == nil) + local stack = ItemStack("unittests:description_test") + assert(stack:get_short_description() == "Description Test Item") + assert(get_short_description("unittests:description_test") == "Description Test Item") + assert(minetest.registered_items["unittests:description_test"].short_description == nil) assert(stack:get_description() == full_description) - assert(stack:get_description() == minetest.registered_items["unittests:colorful_pick"].description) + assert(stack:get_description() == minetest.registered_items["unittests:description_test"].description) stack:get_meta():set_string("description", "Hello World") assert(stack:get_short_description() == "Hello World") assert(stack:get_description() == "Hello World") assert(get_short_description(stack) == "Hello World") - assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe") + assert(get_short_description("unittests:description_test") == "Description Test Item") stack:get_meta():set_string("short_description", "Foo Bar") assert(stack:get_short_description() == "Foo Bar") diff --git a/games/devtest/mods/unittests/textures/unittests_description_test.png b/games/devtest/mods/unittests/textures/unittests_description_test.png new file mode 100644 index 000000000..a6be43314 Binary files /dev/null and b/games/devtest/mods/unittests/textures/unittests_description_test.png differ -- cgit v1.2.3