diff --git a/readme.md b/readme.md index 62df756..545532a 100644 --- a/readme.md +++ b/readme.md @@ -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. \ No newline at end of file diff --git a/script/unit_control.lua b/script/unit_control.lua index 7fffb47..e048786 100644 --- a/script/unit_control.lua +++ b/script/unit_control.lua @@ -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 diff --git a/script/unit_deployment.lua b/script/unit_deployment.lua index 61ea933..93ee90f 100644 --- a/script/unit_deployment.lua +++ b/script/unit_deployment.lua @@ -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