Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with drone distance chechs in >0.18.43 #17

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions script/construction_drone.lua
Expand Up @@ -1207,8 +1207,13 @@ local move_to_order_target = function(drone_data, target, range)
return
end

if in_construction_range(drone, target, range) then
if
(drone_data.mtot_prev_pos ~= nil and distance(drone.position, drone_data.mtot_prev_pos) <= 0.01) or
in_construction_range(drone, target, range)
then
return true
else
drone_data.mtot_prev_pos = drone.position
end

drone.set_command
Expand All @@ -1231,8 +1236,13 @@ local move_to_player = function(drone_data, player, range)
return
end

if distance(drone.position, player.position) < 1 then
if
(drone_data.mtp_prev_pos ~= nil and distance(drone.position, drone_data.mtp_prev_pos) <= 0.01) or
distance(drone.position, player.position) < 1
then
return true
else
drone_data.mtp_prev_pos = drone.position
end

drone.set_command
Expand Down