From 1f5800ce7718fd3fb318471b3dd546cf5ac1d028 Mon Sep 17 00:00:00 2001 From: whosit Date: Thu, 15 Feb 2024 17:05:07 +0300 Subject: [PATCH] move static table outside of func --- init.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/init.lua b/init.lua index 52cd0d2..f00a815 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,17 @@ local COOLDOWN = 1.8 local PARTICLE_TIME = COOLDOWN - 0.2 +-- can't be bothered to figure out math for this +-- map from param2 rotation to the face value +local V = { + 1, 1, 1, 1, + 2, 3, 4, 5, + 4, 5, 2, 3, + 5, 2, 3, 4, + 3, 4, 5, 2, + 6, 6, 6, 6, +} + local function roll_dice(pos, node) if not node then node = minetest.get_node(pos) @@ -46,16 +57,6 @@ local function roll_dice(pos, node) } } - -- can't be bothered to figure out math for this - local V = { - 1, 1, 1, 1, - 2, 3, 4, 5, - 4, 5, 2, 3, - 5, 2, 3, 4, - 3, 4, 5, 2, - 6, 6, 6, 6, - } - minetest.add_particlespawner(spawner_def) local val = V[facedir + 1] or 0