Merge pull request #10 from spencershepard/develop

Develop
This commit is contained in:
spencershepard 2022-01-12 06:57:41 -08:00 committed by GitHub
commit 5a2d96b1f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,5 @@
RotorOps = {} RotorOps = {}
RotorOps.version = "1.0.11"
--RotorOps settings that are safe to change dynamically (ideally from the mission editor in DO SCRIPT for ease of use) --RotorOps settings that are safe to change dynamically (ideally from the mission editor in DO SCRIPT for ease of use)
RotorOps.voice_overs = true RotorOps.voice_overs = true
@ -29,8 +30,8 @@ RotorOps.ai_red_vehicle_groups = {}
RotorOps.ai_blue_vehicle_groups = {} RotorOps.ai_blue_vehicle_groups = {}
RotorOps.ai_tasks = {} RotorOps.ai_tasks = {}
trigger.action.outText("ROTOR OPS STARTED", 5) trigger.action.outText("ROTOR OPS STARTED: "..RotorOps.version, 5)
env.info("ROTOR OPS STARTED") env.info("ROTOR OPS STARTED: "..RotorOps.version)
local staged_units --table of ground units that started in the staging zone local staged_units --table of ground units that started in the staging zone
local commandDB = {} local commandDB = {}
@ -218,7 +219,7 @@ end
----USEFUL PUBLIC FUNCTIONS FOR THE MISSION EDITOR--- ----USEFUL PUBLIC FUNCTIONS FOR THE MISSION EDITOR---
--Spawn/clone a group onto the location of one unit in the group. This is similar to deployTroops, but it does not use CTLD. You must provide a source group to copy. --Spawn/clone a group onto the location of one unit in the group. This is similar to deployTroops, but it does not use CTLD. You must provide a source group to copy.
function RotorOps.spawnInfantryOnGrp(grp, src_grp_name, ai_task) --allow to spawn on other group units function RotorOps.spawnGroupOnGroup(grp, src_grp_name, ai_task) --allow to spawn on other group units
local valid_unit = RotorOps.getValidUnitFromGroup(grp) local valid_unit = RotorOps.getValidUnitFromGroup(grp)
if not valid_unit then return end if not valid_unit then return end
local vars = {} local vars = {}
@ -231,7 +232,7 @@ function RotorOps.spawnInfantryOnGrp(grp, src_grp_name, ai_task) --allow to spaw
local new_grp_table = mist.teleportToPoint(vars) local new_grp_table = mist.teleportToPoint(vars)
if new_grp_table then if new_grp_table then
RotorOps.aiTask({grp = new_grp, ai_task=ai_task}) RotorOps.aiTask(new_grp_table, ai_task)
else debugMsg("Infantry failed to spawn. ") else debugMsg("Infantry failed to spawn. ")
end end
end end
@ -438,9 +439,9 @@ function RotorOps.aiExecute(vars)
local last_task = vars.last_task local last_task = vars.last_task
local group_name = vars.group_name local group_name = vars.group_name
local task = RotorOps.ai_tasks[group_name].ai_task local task = RotorOps.ai_tasks[group_name].ai_task
local zone = vars.zone local zone = RotorOps.ai_tasks[group_name].zone
if vars.zone then zone = vars.zone end -- if vars.zone then zone = vars.zone end
--debugMsg("tasking: "..group_name.." : "..task .." zone:"..zone) --debugMsg("tasking: "..group_name.." : "..task .." zone:"..zone)
if Group.isExist(Group.getByName(group_name)) ~= true or #Group.getByName(group_name):getUnits() < 1 then if Group.isExist(Group.getByName(group_name)) ~= true or #Group.getByName(group_name):getUnits() < 1 then
@ -568,7 +569,7 @@ function RotorOps.assessUnitsInZone(var)
--is the game finished? --is the game finished?
if all_zones_clear then if all_zones_clear then
changeGameState(RotorOps.game_states.won) RotorOps.changeGameState(RotorOps.game_states.won)
gameMsg(gameMsgs.success) gameMsg(gameMsgs.success)
return --we won't reset our timer to fire this function again return --we won't reset our timer to fire this function again
end end
@ -654,7 +655,7 @@ end
local function changeGameState(new_state) function RotorOps.changeGameState(new_state)
RotorOps.game_state = new_state RotorOps.game_state = new_state
trigger.action.setUserFlag(RotorOps.game_state_flag, new_state) trigger.action.setUserFlag(RotorOps.game_state_flag, new_state)
end end
@ -677,13 +678,13 @@ function RotorOps.setActiveZone(new_index)
ctld.activatePickupZone(RotorOps.zones[old_index].name) ctld.activatePickupZone(RotorOps.zones[old_index].name)
end end
ctld.deactivatePickupZone(RotorOps.zones[new_index].name) ctld.deactivatePickupZone(RotorOps.zones[new_index].name)
changeGameState(new_index) RotorOps.changeGameState(new_index)
if new_index < old_index then gameMsg(gameMsgs.fallback, new_index) end if new_index < old_index then gameMsg(gameMsgs.fallback, new_index) end
if new_index > old_index then gameMsg(gameMsgs.get_troops_to_zone, new_index) end if new_index > old_index then gameMsg(gameMsgs.get_troops_to_zone, new_index) end
local staged_groups = RotorOps.groupsFromUnits(staged_units) local staged_groups = RotorOps.groupsFromUnits(staged_units)
for index, group in pairs(staged_groups) do for index, group in pairs(staged_groups) do
RotorOps.aiTask(group,"move_to_active_zone", RotorOps.zones[RotorOps.active_zone_index].name) --send vehicles to next zone RotorOps.aiTask(group,"move_to_active_zone", RotorOps.zones[RotorOps.active_zone_index].name) --send vehicles to next zone; use move_to_active_zone so units don't get stuck if the active zone moves before they arrive
end end
end end
@ -770,7 +771,7 @@ function RotorOps.setupConflict(_game_state_flag)
RotorOps.setupCTLD() RotorOps.setupCTLD()
--RotorOps.setupRadioMenu() --RotorOps.setupRadioMenu()
RotorOps.game_state_flag = _game_state_flag RotorOps.game_state_flag = _game_state_flag
changeGameState(RotorOps.game_states.not_started) RotorOps.changeGameState(RotorOps.game_states.not_started)
trigger.action.outText("ALL TROOPS GET TO TRANSPORT AND PREPARE FOR DEPLOYMENT!" , 10, false) trigger.action.outText("ALL TROOPS GET TO TRANSPORT AND PREPARE FOR DEPLOYMENT!" , 10, false)
end end

View File

@ -1,5 +1,5 @@
--[[ This is handy for development, so that you don't need to delete and re-add the individual scripts in the ME when you make a change. These will not be packaged with the .miz, so you shouldn't use this script loader for packaging .miz files for other machines/users. You'll want to add each script individually with a DO SCRIPT FILE ]]-- --[[ This is handy for development, so that you don't need to delete and re-add the individual scripts in the ME when you make a change. These will not be packaged with the .miz, so you shouldn't use this script loader for packaging .miz files for other machines/users. You'll want to add each script individually with a DO SCRIPT FILE ]]--
assert(loadfile("C:\\RotorOps\\mist_4_4_90.lua"))() assert(loadfile("C:\\RotorOps\\mist_4_4_90.lua"))()
assert(loadfile("C:\\RotorOps\\Splash_Damage_2_0.lua"))()
assert(loadfile("C:\\RotorOps\\CTLD.lua"))() assert(loadfile("C:\\RotorOps\\CTLD.lua"))()
assert(loadfile("C:\\RotorOps\\RotorOps.lua"))() assert(loadfile("C:\\RotorOps\\RotorOps.lua"))()
assert(loadfile("C:\\RotorOps\\Splash_Damage_2_0.lua"))()