Fixed MP issue and added a beta version for develop branch

This commit is contained in:
2024-11-06 08:03:58 +01:00
parent 5c8c2e2707
commit 0534a6e066
5 changed files with 64 additions and 11 deletions
+8 -2
View File
@@ -1,10 +1,11 @@
#start #start
name: update newsletters name: Release
on: on:
push: push:
branches: branches:
- main - main
- develop
jobs: jobs:
buildandpush: buildandpush:
@@ -61,8 +62,13 @@ jobs:
- run: npm i markdown-to-html-cli -g - 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/$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: 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: 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/ - run: cp -a ./spearhead/_docs/img/. ./$repo/Spearhead/img/
- name: ls - name: ls
run: ls run: ls
+2
View File
@@ -14,6 +14,8 @@ In the example we'll show how you can create a simple island hopping mission
Firstly include the script. Firstly include the script.
<a download="spearhead.lua" href="./spearhead.lua" target="_blank" rel="noopener noreferrer">Download Script</a> <a download="spearhead.lua" href="./spearhead.lua" target="_blank" rel="noopener noreferrer">Download Script</a>
<br/>Or if you want to use the latest beta version:
<a download="spearhead.lua" href="./beta/spearhead.lua" target="_blank" rel="noopener noreferrer">Download Beta Script</a>
Then run the script in the mission. <br/> Then run the script in the mission. <br/>
Please do exactly as it's done below. <br/> Please do exactly as it's done below. <br/>
+1
View File
@@ -323,6 +323,7 @@ do -- DB
functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, 1)" functionString = functionString .. "{0,1,0,1}, {0,1,0,1}, 1)"
env.info(functionString) env.info(functionString)
---@diagnostic disable-next-line: deprecated
local f, err = loadstring(functionString) local f, err = loadstring(functionString)
if f then if f then
f() f()
+28 -2
View File
@@ -298,10 +298,36 @@ do
end end
end end
if event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then local AI_GROUPS = {}
env.info("blaat player entering unit")
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() local groupId = event.initiator:getGroup():getID()
SpearheadEvents.AddCommandsToGroup(groupId) SpearheadEvents.AddCommandsToGroup(groupId)
SpearheadEvents.TriggerPlayerEntersUnit(event.initiator)
end
end end
end end
+23 -5
View File
@@ -183,17 +183,35 @@ do -- INIT Mission Class
timer.scheduleFunction(CheckAndUpdate, self, timer.getTime() + 300) timer.scheduleFunction(CheckAndUpdate, self, timer.getTime() + 300)
end end
local CleanupDelayedAsync = function (self, time)
self:Cleanup()
return nil
end
---comment ---comment
---@param self table ---@param self table
---@param checkUnitHealth boolean? ---@param checkUnitHealth boolean?
o.CheckAndUpdateSelf = function(self, checkUnitHealth) o.CheckAndUpdateSelf = function(self, checkUnitHealth)
if not checkUnitHealth then checkUnitHealth = false end 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 if self.missionState == Mission.MissionState.COMPLETED then
return return
end end