diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 11b0142..5559f05 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -1,10 +1,11 @@
#start
-name: update newsletters
+name: Release
on:
push:
branches:
- main
+ - develop
jobs:
buildandpush:
@@ -61,8 +62,13 @@ jobs:
- run: npm i markdown-to-html-cli -g
- run: markdown-to-html --title 'Spearhead' --dark-mode auto --keywords "dcs,spearhead,tdcs,mission,campaign,tactical dcs,tactical" --no-dark-mode --markdown-style-theme dark --source ./spearhead/_docs/$sourcefileA.md --output ./$repo/Spearhead/$sourcefileA.html
- run: markdown-to-html --title 'Spearhead' --dark-mode auto --keywords "dcs,spearhead,tdcs,mission,campaign,tactical dcs,tactical" --no-dark-mode --markdown-style-theme dark --source ./spearhead/_docs/$sourcefileB.md --output ./$repo/Spearhead/$sourcefileB.html
+
- run: python3 ./spearhead/SpearheadCompile.py "./spearhead" "./$repo/Spearhead/spearhead.lua"
- - run: cp "./spearhead/config.lua" "./$repo/Spearhead/spearheadConfig.lua"
+ if: github.ref == 'refs/heads/master'
+
+ - run: python3 ./spearhead/SpearheadCompile.py "./spearhead" "./$repo/Spearhead/beta/spearhead.lua"
+ if: github.ref == 'refs/heads/develop'
+
- run: cp -a ./spearhead/_docs/img/. ./$repo/Spearhead/img/
- name: ls
run: ls
diff --git a/_docs/GetStarted.md b/_docs/GetStarted.md
index 795632a..cf7b631 100644
--- a/_docs/GetStarted.md
+++ b/_docs/GetStarted.md
@@ -14,6 +14,8 @@ In the example we'll show how you can create a simple island hopping mission
Firstly include the script.
Download Script
+
Or if you want to use the latest beta version:
+Download Beta Script
Then run the script in the mission.
Please do exactly as it's done below.
diff --git a/classes/spearhead_db.lua b/classes/spearhead_db.lua
index 62ddd46..f7f08c1 100644
--- a/classes/spearhead_db.lua
+++ b/classes/spearhead_db.lua
@@ -323,6 +323,7 @@ do -- DB
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, 1)"
env.info(functionString)
+---@diagnostic disable-next-line: deprecated
local f, err = loadstring(functionString)
if f then
f()
diff --git a/classes/spearhead_events.lua b/classes/spearhead_events.lua
index e3d8052..cb933ad 100644
--- a/classes/spearhead_events.lua
+++ b/classes/spearhead_events.lua
@@ -298,10 +298,36 @@ do
end
end
- if event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then
- env.info("blaat player entering unit")
- local groupId = event.initiator:getGroup():getID()
- SpearheadEvents.AddCommandsToGroup(groupId)
+ local AI_GROUPS = {}
+
+ if event.id == world.event.S_EVENT_BIRTH then
+
+ local function isPlayer(unit)
+ if Spearhead.DcsUtil.IsGroupStatic(unit:getName()) == true then
+ return false
+ end
+
+ if AI_GROUPS[unit:getGroup():getName()] == true then
+ return false
+ end
+
+ local players = Spearhead.DcsUtil.getAllPlayerUnits()
+ local unitName = unit:getName()
+ for i, unit in (players) do
+ if unit:getName() == unitName then
+ return true
+ end
+ end
+
+ AI_GROUPS[unit:getGroup():getName()] = true
+ return false
+ end
+
+ if isPlayer(event.initiator) == true then
+ local groupId = event.initiator:getGroup():getID()
+ SpearheadEvents.AddCommandsToGroup(groupId)
+ SpearheadEvents.TriggerPlayerEntersUnit(event.initiator)
+ end
end
end
diff --git a/classes/stageClasses/Mission.lua b/classes/stageClasses/Mission.lua
index 9409d5b..aadc136 100644
--- a/classes/stageClasses/Mission.lua
+++ b/classes/stageClasses/Mission.lua
@@ -183,17 +183,35 @@ do -- INIT Mission Class
timer.scheduleFunction(CheckAndUpdate, self, timer.getTime() + 300)
end
- local CleanupDelayedAsync = function (self, time)
- self:Cleanup()
- return nil
- end
-
---comment
---@param self table
---@param checkUnitHealth boolean?
o.CheckAndUpdateSelf = function(self, checkUnitHealth)
if not checkUnitHealth then checkUnitHealth = false end
+ if checkUnitHealth == true then
+ local function unitAliveState(unitName)
+ local unit = Unit.getByName(unitName)
+ return unit ~= nil and unit:isExist() == true and unit:getLife() > 0.1
+ end
+
+ for groupName, unitNameDict in pairs(self.groupUnitAliveDict) do
+ for unitName, isAlive in pairs(unitNameDict) do
+ if isAlive == true then
+ self.groupUnitAliveDict[groupName][unitName] = unitAliveState(unitName)
+ end
+ end
+ end
+
+ for groupName, unitNameDict in pairs(self.targetAliveStates) do
+ for unitName, isAlive in pairs(unitNameDict) do
+ if isAlive == true then
+ self.targetAliveStates[groupName][unitName] = unitAliveState(unitName)
+ end
+ end
+ end
+ end
+
if self.missionState == Mission.MissionState.COMPLETED then
return
end