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...
MOOSE framework
MOOSE is a Mission Object Oriented Scripting Environment, and is meant for mission designers and mission hosters. It allows to quickly setup complex missions using pre-scripted scenarios using the available classes within the MOOSE Framework. MOOSE works with DCS world 1.5. and 2.0.
MOOSE Framework Goal
The goal of MOOSE is to allow mission designers to enhance their scripting with mission orchestration objects, which can be instantiated from defined classes within the framework. This will allow to write mission scripts with minimal code embedded. Of course, the richness of the framework will determine the richness of the misson scenarios. The MOOSE is a service that is produced while being consumed ... , it will evolve further as more classes are developed for the framework, and as more users are using it. MOOSE is not a one-man show, it is a collaborative effort and meant to evolve within a growing community around the framework. Within the community, key users will start supporting, documenting, explaining and even creating new classes for the framework. It is the ambition to grow this framework as a de-facto standard for mission designers to use.
MOOSE Main Site
Click on this link to browse to the MOOSE main web page. Documentation on the MOOSE class hierarchy, usage guides and background information can be found here for normal users, beta testers and contributors.
MOOSE Missions
MOOSE comes with demonstration missions that you can use to understand the mechanisms how to use the classes within MOOSE.
MOOSE Youtube Channel
MOOSE has a broadcast and training channel on YouTube with various channels that you can watch.
MOOSE on Slack.Com
MOOSE has a living (chat and video) community of users, beta testers and contributors. The gathering point is a service provided by slack.com. If you want to join this community, send an email to flightcontrol_moose@outlook.com. You'll receive the invitation from slack, follow the process and you'll be on board in no time.