Add files via upload

This commit is contained in:
Thomas
2022-11-03 09:07:16 +01:00
committed by GitHub
parent 29219cd988
commit 5f6f0a9971
4 changed files with 75 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
-------------------------------------------------------------------------
-- SET-SCENERY-100 - Scenery Set From Zone
-------------------------------------------------------------------------
-- Documentation
--
-- SET_SCENERY: https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Set.html##(SET_SCENERY)
--
-------------------------------------------------------------------------
-- Join the game master slot initially, and then the Tank in
-- Combined Arms after a few seconds. Shoot and destroy on of the tanks
-- ahead.
-------------------------------------------------------------------------
-- Date: November 2022
-------------------------------------------------------------------------
-- Get our ZONE object and draw it
local zone = ZONE:FindByName("OilTankZone")
zone:DrawZone(-1,{0,0,1},nil,nil,nil,1)
-- Create a SET_SCENERY from the map objects in the zone
local oilstation = SET_SCENERY:NewFromZone(zone)
-- we'll use this SET for further filtering
local oiltanks = SET_SCENERY:New()
-- An Airbase has a lot of map objects, but we only want to have tanks
oilstation:ForEachScenery(
function(object)
local scenery = object --Wrapper.Scenery#SCENERY
local name = scenery:GetName()
local desc = scenery:GetDesc()
BASE:I({desc.typeName})
if string.find(string.lower(desc.typeName),"tank") then
oiltanks:AddObject(scenery)
end
end
)
-- Count how many we have
local NumberTanks0 = oiltanks:CountAlive()
-- user flag OilTanks will be zero initially
local flag = USERFLAG:New("OilTanks")
flag:Set(0)
-- Function to check number of alive tanks regularly
function CheckOnOilTanks(TankSet,InitialNo,Threshold)
local NumberTanks = TankSet:CountAlive()
MESSAGE:New("Oil Tanks alive: "..NumberTanks,15,"OilTanks"):ToAll()
if NumberTanks <= InitialNo*Threshold then
-- Success!
MESSAGE:New("Success! Oil Tanks have been diminished!",15,"OilTanks"):ToAll()
-- Set a Flag in Mission Editor
flag:Set(999)
end
end
-- Create a timer to run the check function
local TankTimer = TIMER:New(CheckOnOilTanks,oiltanks,NumberTanks0,0.2)
-- check every minute
TankTimer:Start(10,30,3600)

View File

@@ -0,0 +1,10 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
$dir
$file
cd "_unpacked"
. 7z a -r -y -tzip "..\$file.miz" *
cd ..

View File

@@ -0,0 +1,7 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
Remove-Item .\_unpacked -Force -Recurse
md "_unpacked"
cd "_unpacked"
. 7z x -r -y "..\$file.miz" *