Fixed MP issue and added a beta version for develop branch
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -14,6 +14,8 @@ In the example we'll show how you can create a simple island hopping mission
|
||||
|
||||
Firstly include the script.
|
||||
<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/>
|
||||
Please do exactly as it's done below. <br/>
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user