diff options
| author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-01-07 12:35:04 +0100 |
|---|---|---|
| committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-01-07 12:35:04 +0100 |
| commit | cca4254f7c502b3e75691c6a3087da7cfcd72e28 (patch) | |
| tree | e71b47442e77e09ca17e2c9c121a455f9deeace2 /games | |
| parent | 4fedc3a31ee20813e4c81377b3bd2af05a26b858 (diff) | |
| parent | 58a709096ef8ff17644cf201f25b1831d9506514 (diff) | |
| download | dragonfireclient-cca4254f7c502b3e75691c6a3087da7cfcd72e28.tar.xz | |
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'games')
| -rw-r--r-- | games/devtest/mods/testentities/callbacks.lua | 3 | ||||
| -rw-r--r-- | games/devtest/mods/testentities/visuals.lua | 29 | ||||
| -rw-r--r-- | games/devtest/mods/testfood/init.lua | 7 | ||||
| -rw-r--r-- | games/devtest/mods/testfood/textures/testfood_replace.png | bin | 0 -> 135 bytes |
4 files changed, 39 insertions, 0 deletions
diff --git a/games/devtest/mods/testentities/callbacks.lua b/games/devtest/mods/testentities/callbacks.lua index 711079f87..320690b39 100644 --- a/games/devtest/mods/testentities/callbacks.lua +++ b/games/devtest/mods/testentities/callbacks.lua @@ -31,6 +31,9 @@ minetest.register_entity("testentities:callback", { on_activate = function(self, staticdata, dtime_s) message("Callback entity: on_activate! pos="..spos(self).."; dtime_s="..dtime_s) end, + on_deactivate = function(self) + message("Callback entity: on_deactivate! pos="..spos(self)) + end, on_punch = function(self, puncher, time_from_last_punch, tool_capabilities, dir, damage) local name = get_object_name(puncher) message( diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua index 8848ba49f..e3b758329 100644 --- a/games/devtest/mods/testentities/visuals.lua +++ b/games/devtest/mods/testentities/visuals.lua @@ -94,3 +94,32 @@ minetest.register_entity("testentities:upright_animated", { self.object:set_sprite({x=0, y=0}, 4, 1.0, false) end, }) + +minetest.register_entity("testentities:nametag", { + initial_properties = { + visual = "sprite", + textures = { "testentities_sprite.png" }, + }, + + on_activate = function(self, staticdata) + if staticdata ~= "" then + self.color = minetest.deserialize(staticdata).color + else + self.color = { + r = math.random(0, 255), + g = math.random(0, 255), + b = math.random(0, 255), + } + end + + assert(self.color) + self.object:set_properties({ + nametag = tostring(math.random(1000, 10000)), + nametag_color = self.color, + }) + end, + + get_staticdata = function(self) + return minetest.serialize({ color = self.color }) + end, +}) diff --git a/games/devtest/mods/testfood/init.lua b/games/devtest/mods/testfood/init.lua index a6236ff68..39b121306 100644 --- a/games/devtest/mods/testfood/init.lua +++ b/games/devtest/mods/testfood/init.lua @@ -22,3 +22,10 @@ minetest.register_craftitem("testfood:bad5", { on_use = minetest.item_eat(-5), }) +minetest.register_craftitem("testfood:replace1", { + description = S("Replacing Food (+1)").."\n".. + S("Replaced with 'Good Food (+1)' when eaten"), + inventory_image = "testfood_replace.png", + on_use = minetest.item_eat(1, "testfood:good1"), +}) + diff --git a/games/devtest/mods/testfood/textures/testfood_replace.png b/games/devtest/mods/testfood/textures/testfood_replace.png Binary files differnew file mode 100644 index 000000000..1ef6876e5 --- /dev/null +++ b/games/devtest/mods/testfood/textures/testfood_replace.png |
