mirror of
https://gitlab.com/deetmit/mesecons_x.git
synced 2024-07-15 12:19:40 +02:00
fix bug circuit.lua
This commit is contained in:
parent
279ef072d3
commit
149d73a664
@ -116,6 +116,7 @@ local function store_nodes(p1,p2,direction)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function radians_to_direction_looking_forward(rad)
|
local function radians_to_direction_looking_forward(rad)
|
||||||
|
if rad == nil then return {x=1,z=0} end
|
||||||
local pi = math.pi
|
local pi = math.pi
|
||||||
if (rad>=0) and (rad<=pi/4) or (rad<=2*pi) and (rad>=(3/2+1/4)*pi) then
|
if (rad>=0) and (rad<=pi/4) or (rad<=2*pi) and (rad>=(3/2+1/4)*pi) then
|
||||||
return {x=0, z =1 }
|
return {x=0, z =1 }
|
||||||
@ -457,9 +458,10 @@ local function on_place_circuit(itemstack, user, pointed_thing)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if( mesecons_automove.rad == nil ) then return end
|
||||||
local data = itemstack:get_meta():to_table()
|
local data = itemstack:get_meta():to_table()
|
||||||
local nodes = minetest.deserialize(data.fields.nodes)
|
local nodes = minetest.deserialize(data.fields.nodes)
|
||||||
local rad = tonumber( data.fields.rad )
|
local rad = tonumber( data.fields.rad )
|
||||||
paste_nodes(nodes,radians_to_direction_looking_forward(rad), radians_to_direction_looking_forward(mesecons_automove.rad))
|
paste_nodes(nodes,radians_to_direction_looking_forward(rad), radians_to_direction_looking_forward(mesecons_automove.rad))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user