Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@
--------------------------------------

Allows controlling units with special 'Unit selection tool' and other tools available through the GUI.

--------------------------------------

If you do not want unit control to spawn any units from your deployers, add this remote interface:
remote.add_interface("unit-control-no-spawning",{["mod-name"] = function.returns_list_of_deployers_to_be_ignored})
You will need to input your own mod name so no conflicts will happen.
And for the funtion you need a funtion that returns an array of all the deployers you do not want unit control to spawn from.
2 changes: 1 addition & 1 deletion script/unit_control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ local on_entity_spawned = function(event)
entity = unit,
command_queue = util.copy(queue),
idle = false,
is_unit = entity.type == "unit"
is_unit = unit.type == "unit"
}
script_data.units[unit.unit_number] = unit_data

Expand Down
7 changes: 7 additions & 0 deletions script/unit_deployment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ local get_deployer_map = function()
deployer_map[name] = true
end
end
if remote.interfaces["unit-control-no-spawning"] then
for name, _ in pairs(remote.interfaces["unit-control-no-spawning"]) do
for index, name in pairs(remote.call("unit-control-no-spawning", name)) do
deployer_map[name] = nil
end
end
end
return deployer_map
end

Expand Down