Builtin: Make dropped light_source nodes glow (#9200)
authorWuzzy <wuzzy2@mail.ru>
Thu, 19 Dec 2019 18:41:44 +0000 (18:41 +0000)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Thu, 19 Dec 2019 18:41:44 +0000 (19:41 +0100)
builtin/game/item_entity.lua

index 87fec93ea5349532a757a79a06faf2f2b15ba09f..1d66799f64d5c18e528164a79f814969676ceb69 100644 (file)
@@ -58,6 +58,8 @@ core.register_entity(":__builtin:item", {
                local count = math.min(stack:get_count(), max_count)
                local size = 0.2 + 0.1 * (count / max_count) ^ (1 / 3)
                local coll_height = size * 0.75
+               local def = core.registered_nodes[itemname]
+               local glow = def and def.light_source
 
                self.object:set_properties({
                        is_visible = true,
@@ -69,6 +71,7 @@ core.register_entity(":__builtin:item", {
                        selectionbox = {-size, -size, -size, size, size, size},
                        automatic_rotate = math.pi * 0.5 * 0.2 / size,
                        wield_item = self.itemstring,
+                       glow = glow,
                })
 
        end,