Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions script/construction_drone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ local get_prototype = function(name)
return prototype
end

local player_physical_position = function(player)
if player.controller_type == 7 then -- remote map view
return player.physical_position
else
return player.position
end
end

local get_beam_orientation = function(source_position, target_position)
-- Angle in rads
Expand Down Expand Up @@ -379,7 +386,7 @@ local make_path_request = function(drone_data, player, target)
local path_id = player.surface.request_path {
bounding_box = prototype.collision_box,
collision_mask = prototype.collision_mask,
start = player.position,
start = player_physical_position(player),
goal = target.position,
force = player.force,
radius = target.get_radius() + 4,
Expand Down Expand Up @@ -426,9 +433,10 @@ end


local make_player_drone = function(player)
-- make sure we spawn the drone from the player, not map view
local position = player.surface.find_non_colliding_position(
names.units.construction_drone,
player.position,
player_physical_position(player),
5,
0.5,
false
Expand Down