diff options
| author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-26 14:00:57 +0100 |
|---|---|---|
| committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-26 14:00:57 +0100 |
| commit | 880c9768a9323800ca8d44cc4b73e92278e58743 (patch) | |
| tree | cf5b0b340e7a02bff8e13ae364901b324114228b /games/devtest/mods/testentities/visuals.lua | |
| parent | 83d09ffaf688aac9f2de67d06420572e4d0664dc (diff) | |
| parent | 437d01196899f85bbc77d71123018aa26be337da (diff) | |
| download | dragonfireclient-880c9768a9323800ca8d44cc4b73e92278e58743.tar.xz | |
Merge branch 'master' of https://github.com/minetest/minetest
Diffstat (limited to 'games/devtest/mods/testentities/visuals.lua')
| -rw-r--r-- | games/devtest/mods/testentities/visuals.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua index e3b758329..e382ec44c 100644 --- a/games/devtest/mods/testentities/visuals.lua +++ b/games/devtest/mods/testentities/visuals.lua @@ -103,23 +103,35 @@ minetest.register_entity("testentities:nametag", { on_activate = function(self, staticdata) if staticdata ~= "" then - self.color = minetest.deserialize(staticdata).color + local data = minetest.deserialize(staticdata) + self.color = data.color + self.bgcolor = data.bgcolor else self.color = { r = math.random(0, 255), g = math.random(0, 255), b = math.random(0, 255), } + + if math.random(0, 10) > 5 then + self.bgcolor = { + r = math.random(0, 255), + g = math.random(0, 255), + b = math.random(0, 255), + a = math.random(0, 255), + } + end end assert(self.color) self.object:set_properties({ nametag = tostring(math.random(1000, 10000)), nametag_color = self.color, + nametag_bgcolor = self.bgcolor, }) end, get_staticdata = function(self) - return minetest.serialize({ color = self.color }) + return minetest.serialize({ color = self.color, bgcolor = self.bgcolor }) end, }) |
