1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-01 17:38:41 +00:00

Automatic item and node colorization (#5640)

* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
This commit is contained in:
Dániel Juhász 2017-06-20 09:19:56 +00:00 committed by SmallJoker
parent 03bc584f57
commit 322e5aaf92
8 changed files with 114 additions and 38 deletions

View file

@ -93,7 +93,7 @@ core.register_entity(":__builtin:falling_node", {
core.remove_node(np)
if nd and nd.buildable_to == false then
-- Add dropped items
local drops = core.get_node_drops(n2.name, "")
local drops = core.get_node_drops(n2, "")
for _, dropped_item in pairs(drops) do
core.add_item(np, dropped_item)
end
@ -145,9 +145,9 @@ function core.spawn_falling_node(pos)
end
local function drop_attached_node(p)
local nn = core.get_node(p).name
local n = core.get_node(p)
core.remove_node(p)
for _, item in pairs(core.get_node_drops(nn, "")) do
for _, item in pairs(core.get_node_drops(n, "")) do
local pos = {
x = p.x + math.random()/2 - 0.25,
y = p.y + math.random()/2 - 0.25,