mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2026-06-29 14:53:23 +09:00
.
This commit is contained in:
@@ -46,15 +46,7 @@ function main.calc(entity)
|
|||||||
|
|
||||||
if pickup_length > 0 and drop_length > 0 then
|
if pickup_length > 0 and drop_length > 0 then
|
||||||
local ratio = ((entity.pickup_position.x - entity.position.x) * (entity.drop_position.x - entity.position.x) + (entity.pickup_position.y - entity.position.y) * (entity.drop_position.y - entity.position.y)) / (pickup_length * drop_length)
|
local ratio = ((entity.pickup_position.x - entity.position.x) * (entity.drop_position.x - entity.position.x) + (entity.pickup_position.y - entity.position.y) * (entity.drop_position.y - entity.position.y)) / (pickup_length * drop_length)
|
||||||
|
angle = math.acos(math.max(-1, math.min(1, ratio)))
|
||||||
if ratio > 1 then
|
|
||||||
ratio = 1
|
|
||||||
|
|
||||||
elseif ratio < -1 then
|
|
||||||
ratio = -1
|
|
||||||
end
|
|
||||||
|
|
||||||
angle = math.acos(ratio)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local ticks_per_cycle = 2 * math.ceil((angle / (math.pi * 2) - 0.001) / prototype.get_inserter_rotation_speed(entity.quality))
|
local ticks_per_cycle = 2 * math.ceil((angle / (math.pi * 2) - 0.001) / prototype.get_inserter_rotation_speed(entity.quality))
|
||||||
|
|||||||
Reference in New Issue
Block a user