aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testentities
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2022-04-24 21:48:50 +0000
committerGitHub <noreply@github.com>2022-04-24 22:48:50 +0100
commit77325b92fbe8235b5c2d8d1261ecd53e3385bab2 (patch)
tree6124c1069de3d126e8224f7081788042cba6e384 /games/devtest/mods/testentities
parentb55d7cd45a304a8a5b8337a3c61defb6e5c27dd9 (diff)
downloadminetest-77325b92fbe8235b5c2d8d1261ecd53e3385bab2.tar.gz
minetest-77325b92fbe8235b5c2d8d1261ecd53e3385bab2.tar.bz2
minetest-77325b92fbe8235b5c2d8d1261ecd53e3385bab2.zip
DevTest: Add more test weapons and armorball modes (#11870)
Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'games/devtest/mods/testentities')
-rw-r--r--games/devtest/mods/testentities/armor.lua30
-rw-r--r--games/devtest/mods/testentities/textures/testentities_armorball.pngbin561 -> 1301 bytes
2 files changed, 25 insertions, 5 deletions
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
--- a/games/devtest/mods/testentities/textures/testentities_armorball.png
+++ b/games/devtest/mods/testentities/textures/testentities_armorball.png
Binary files differ