Master 405 event handling
I have reworked event handling:
-- Avoid events not being handled whey they should.
-- Clean up the subscriptions when Groups or Units are dead.
-- Reinitiate the subscriptions when Groups or Units are respawned.
-- EVENT_HIT is only for Targets when the subscription is on UNIT or GROUP level.
-- MISSION_END should work now too ...
-- When a subscribed object is nillified, and the collectgarbage() is executed, it should clean the subscription.
-- Reworked and cleaned the event handling...
-- Cleaned up the code
-- Added:FilterCategories() method to DETECTION_BASE.
-- Reviewed documentation
-- Added documentation for FilterCategories method
-- Default detection methods are all ON. (They were only set to visual).
-- Created test missions. DET-30x
Master enh 327 spawnstatic
SPAWNSTATIC is ADDED....
Try the new mission SPS-100 in the MOOSE_MISSIONS repository. Open the SPS-100 - Simple Spawning.lua and check the code (I listed it here):
local ZonePosition = ZONE:New( "Position" )
local SpawnBuilding = SPAWNSTATIC:NewFromStatic( "Building", country.id.GERMANY )
local SpawnBarrack = SPAWNSTATIC:NewFromStatic( "Barrack", country.id.GERMANY )
local ZonePointVec2 = ZonePosition:GetPointVec2()
local Building = SpawnBuilding:SpawnFromZone( ZonePosition, 0 )
for Heading = 0, 360,60 do
local Radial = Heading * ( math.pi*2 ) / 360
local x = ZonePointVec2:GetLat() + math.cos( Radial ) * 150
local y = ZonePointVec2:GetLon() + math.sin( Radial ) * 150
SpawnBarrack:SpawnFromPointVec2( POINT_VEC2:New( x, y ), Heading + 90 )
end
What this code does is:
It identifies the Zone "Position" where to do the spawning.
It creates two SPAWNSTATIC objects, one for a building and one for barracks.
A building is created in the center of the Zone.
Barracks are created around the center of the Zone.
A couple of points I would like to ask you to consider:
For simplicity, I think it is the best to have one SPAWNSTATIC object per Static you want to spawn. => Is this ok?
The only SPAWNSTATIC constructor working at this moment is NewFromStatic. The other planned constructor is NewFromType, but this will need more work to make.
Two Spawn methods are created: SpawnFromPointVec2() and SpawnFromZone(). => Is this sufficient???
There won't be any Init methods... => Is this ok???
There won't be any Respawn methods... => Is this ok???
What other Spawn APIs would you like to see... => Please think of the process or things you want to do with Statics....
The naming of the created statics is the TemplateName#nnnnn, where nnnnn is the index of the static spawned. In the Spawn methods, you can give optionally a new name of the Static, overriding the template name.
There is a question on Country. Each Static has a country. I can set it for default at the constructor, and optionally, if you really want that, I can allow to give an override CountryID parameter when Spawning (not my preference though, because then you'll get two optional parameters in the Spawn methods, one for the new name, and one for the country => confusing ).
I see Pikey is looking for an additional check of the ground. To be honest, not so easy to implement and also, what is the value if the MD defines a wrong position???
pls test and consider the questions...
SPAWN Delay implementation
-- New methods SPAWN:InitDelayOnOff(), SPAWN:InitDelayOn(), SPAWN:InitDelayOff()
-- Default is delay is on, but only for :SpawnScheduled()
-- Did a large review of the SPAWN documentation (for dummies).
-- Moved the SPAWN class documentation to the SPAWN object, so that it becomes visible in intellisense.
-- Added Demo Mission links
-- Added Youtube channel links
-- New methods SPAWN:InitDelayOnOff(), SPAWN:InitDelayOn(),
SPAWN:InitDelayOff()
-- Default is delay is on, but only for :SpawnScheduled()
-- Did a large review of the SPAWN documentation (for dummies).
-- Moved the SPAWN class documentation to the SPAWN object, so that it
becomes visible in intellisense.
-- Added Demo Mission links
-- Added Youtube channel links
* Installs luarocks WITH it's executable (easy to install other rocks if necessary)
* Use Lua supplied with luarocks
* Create Utils/luadocumentor.bat, which works with RELATIVE PATH ! -> Everybody can generate the doc
* Updated launch files accordingly
* Add a Utils folder with 7-Zip and lua
* Changes Moose \Mission Setup\Moose Mission Update\Moose_Update_Missions.bat to use 7-Zip in Utils
* Removes 7-Zip in \Mission Setup\Moose Mission Update\
* Changes every .lauch file to use \Utils\lua\5.1\bin\lua.exe instead of PATH
Known Issue : Moose Development\LDT External Tools\Moose DOCUMENTATION Generate.launch does NOT work for contrbutors other than @FlightControl-Master , need to update \Utils\lua\5.1\bin\luadocumentor.bat with new paths