diff --git a/internal.lua b/internal.lua index 86d87db..74ff65c 100644 --- a/internal.lua +++ b/internal.lua @@ -12,6 +12,17 @@ local V = { 6, 6, 6, 6, } +local color_values = { + [0] = "#ffffff", + "#d94257", + "#405fdc", + "#9c40dc", + "#dc6540", + "#f7d96e", + "#86d942", + "#42d9b6", +} + local function roll_dice(pos, node) if not node then node = minetest.get_node(pos) @@ -28,6 +39,8 @@ local function roll_dice(pos, node) node.param2 = color * 32 + facedir minetest.swap_node(pos, node) + local color_string = color_values[color] + local spawner_def = { size = 0.6, amount = 42, @@ -48,7 +61,7 @@ local function roll_dice(pos, node) }, exptime = { min = 0.2, max = 0.5, }, vertical = false, - texture = "yl_dice_6sides.png", + texture = "yl_dice_6sides.png^[multiply:" .. color_string, animation = { type = "sheet_2d", frames_w = 2, @@ -65,7 +78,7 @@ local function roll_dice(pos, node) pos = vector.add(pos, vector.new(0.0, 0.8, 0.0)), velocity = { x = 0, y = 0.1, z = 0 }, glow = 14, - texture = ("yl_dice_%d.png"):format(val), + texture = ("yl_dice_%d.png^[multiply:" .. color_string):format(val), size = 4, } minetest.add_particle(particle_def)