mirror of
https://github.com/minetest-mods/mesecons.git
synced 2025-04-20 10:40:26 +02:00
do some arithmetic instead of if
This commit is contained in:
parent
e37d530f90
commit
1f53849df9
@ -143,11 +143,7 @@ plg.register_nodes({
|
|||||||
if o and o.type == "io" then
|
if o and o.type == "io" then
|
||||||
local num = abcd2[o.port]
|
local num = abcd2[o.port]
|
||||||
num = num + dir
|
num = num + dir
|
||||||
if num > 4 then
|
num = (2 ^ num % 2) * 4 + num + math.floor(num / 5)
|
||||||
num = 1
|
|
||||||
elseif num < 1 then
|
|
||||||
num = 4
|
|
||||||
end
|
|
||||||
instr[i][op].port = abcd1[num]
|
instr[i][op].port = abcd1[num]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user