mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed glitch in EVENT with new EventPriority logic
The Init method was wrong. It is fixed now. SPAWN and other event handling will now be correctly processed!
This commit is contained in:
parent
0adf349066
commit
a530cea326
@ -18,6 +18,7 @@
|
||||
--- The EVENT structure
|
||||
-- @type EVENT
|
||||
-- @field #EVENT.Events Events
|
||||
-- @extends Core.Base#BASE
|
||||
EVENT = {
|
||||
ClassName = "EVENT",
|
||||
ClassID = 0,
|
||||
@ -134,14 +135,15 @@ function EVENT:Init( EventID, EventClass )
|
||||
|
||||
-- Each event has a subtable of EventClasses, ordered by EventPriority.
|
||||
local EventPriority = EventClass:GetEventPriority()
|
||||
self:E(EventPriority)
|
||||
if not self.Events[EventID][EventPriority] then
|
||||
self.Events[EventID][EventPriority] = {}
|
||||
end
|
||||
|
||||
if not self.Events[EventID][EventClass] then
|
||||
self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
if not self.Events[EventID][EventPriority][EventClass] then
|
||||
self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
end
|
||||
return self.Events[EventID][EventClass]
|
||||
return self.Events[EventID][EventPriority][EventClass]
|
||||
end
|
||||
|
||||
--- Removes an Events entry
|
||||
@ -799,12 +801,14 @@ function EVENT:onEvent( Event )
|
||||
Event.WeaponName = Event.Weapon:getTypeName()
|
||||
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
||||
end
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
|
||||
|
||||
local Order = _EVENTORDER[Event.id]
|
||||
self:E( { Order = Order } )
|
||||
local PriorityOrder = _EVENTORDER[Event.id]
|
||||
local PriorityBegin = PriorityOrder == -1 and 5 or 1
|
||||
local PriorityEnd = PriorityOrder == -1 and 1 or 5
|
||||
|
||||
for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order do
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
|
||||
|
||||
for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
|
||||
|
||||
if self.Events[Event.id][EventPriority] then
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170205_0829' )
|
||||
env.info( 'Moose Generation Timestamp: 20170205_1023' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -4229,6 +4229,7 @@ end
|
||||
--- The EVENT structure
|
||||
-- @type EVENT
|
||||
-- @field #EVENT.Events Events
|
||||
-- @extends Core.Base#BASE
|
||||
EVENT = {
|
||||
ClassName = "EVENT",
|
||||
ClassID = 0,
|
||||
@ -4345,14 +4346,15 @@ function EVENT:Init( EventID, EventClass )
|
||||
|
||||
-- Each event has a subtable of EventClasses, ordered by EventPriority.
|
||||
local EventPriority = EventClass:GetEventPriority()
|
||||
self:E(EventPriority)
|
||||
if not self.Events[EventID][EventPriority] then
|
||||
self.Events[EventID][EventPriority] = {}
|
||||
end
|
||||
|
||||
if not self.Events[EventID][EventClass] then
|
||||
self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
if not self.Events[EventID][EventPriority][EventClass] then
|
||||
self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
end
|
||||
return self.Events[EventID][EventClass]
|
||||
return self.Events[EventID][EventPriority][EventClass]
|
||||
end
|
||||
|
||||
--- Removes an Events entry
|
||||
@ -5010,12 +5012,14 @@ function EVENT:onEvent( Event )
|
||||
Event.WeaponName = Event.Weapon:getTypeName()
|
||||
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
||||
end
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
|
||||
|
||||
local Order = _EVENTORDER[Event.id]
|
||||
self:E( { Order = Order } )
|
||||
local PriorityOrder = _EVENTORDER[Event.id]
|
||||
local PriorityBegin = PriorityOrder == -1 and 5 or 1
|
||||
local PriorityEnd = PriorityOrder == -1 and 1 or 5
|
||||
|
||||
for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order do
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
|
||||
|
||||
for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
|
||||
|
||||
if self.Events[Event.id][EventPriority] then
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE STATIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20170205_0829' )
|
||||
env.info( 'Moose Generation Timestamp: 20170205_1023' )
|
||||
local base = _G
|
||||
|
||||
Include = {}
|
||||
@ -4229,6 +4229,7 @@ end
|
||||
--- The EVENT structure
|
||||
-- @type EVENT
|
||||
-- @field #EVENT.Events Events
|
||||
-- @extends Core.Base#BASE
|
||||
EVENT = {
|
||||
ClassName = "EVENT",
|
||||
ClassID = 0,
|
||||
@ -4345,14 +4346,15 @@ function EVENT:Init( EventID, EventClass )
|
||||
|
||||
-- Each event has a subtable of EventClasses, ordered by EventPriority.
|
||||
local EventPriority = EventClass:GetEventPriority()
|
||||
self:E(EventPriority)
|
||||
if not self.Events[EventID][EventPriority] then
|
||||
self.Events[EventID][EventPriority] = {}
|
||||
end
|
||||
|
||||
if not self.Events[EventID][EventClass] then
|
||||
self.Events[EventID][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
if not self.Events[EventID][EventPriority][EventClass] then
|
||||
self.Events[EventID][EventPriority][EventClass] = setmetatable( {}, { __mode = "k" } )
|
||||
end
|
||||
return self.Events[EventID][EventClass]
|
||||
return self.Events[EventID][EventPriority][EventClass]
|
||||
end
|
||||
|
||||
--- Removes an Events entry
|
||||
@ -5010,12 +5012,14 @@ function EVENT:onEvent( Event )
|
||||
Event.WeaponName = Event.Weapon:getTypeName()
|
||||
--Event.WeaponTgtDCSUnit = Event.Weapon:getTarget()
|
||||
end
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName } )
|
||||
|
||||
local Order = _EVENTORDER[Event.id]
|
||||
self:E( { Order = Order } )
|
||||
local PriorityOrder = _EVENTORDER[Event.id]
|
||||
local PriorityBegin = PriorityOrder == -1 and 5 or 1
|
||||
local PriorityEnd = PriorityOrder == -1 and 1 or 5
|
||||
|
||||
for EventPriority = Order == -1 and 5 or 1, Order == -1 and 1 or 5, Order do
|
||||
self:E( { _EVENTCODES[Event.id], Event, Event.IniDCSUnitName, Event.TgtDCSUnitName, PriorityOrder } )
|
||||
|
||||
for EventPriority = PriorityBegin, PriorityEnd, PriorityOrder do
|
||||
|
||||
if self.Events[Event.id][EventPriority] then
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,47 @@
|
||||
---
|
||||
-- Name: SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 05 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- Multiple airplanes will be spawned at a scheduled interval.
|
||||
-- There is a limit on how many airplanes can be alive at the same time.
|
||||
-- Upon landing, the airplanes will respawn at Kutaisi.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the spawning of the airplanes
|
||||
-- 2. There should not be more airplanes alive than there are set by InitLimit.
|
||||
-- 3. Upon landing, the planes should respawn.
|
||||
-- 4. The KA-50 and the C-101EB should respawn itself directly when landed.
|
||||
-- 5. the MI-8MTV2 and the A-10C should respawn itself when the air unit has parked at the ramp.
|
||||
|
||||
|
||||
do
|
||||
|
||||
-- Declare SPAWN objects
|
||||
local Spawn_KA_50 = SPAWN:New("KA-50"):InitLimit( 2, 10 )
|
||||
local Spawn_MI_8MTV2 = SPAWN:New("MI-8MTV2"):InitLimit( 2, 10 )
|
||||
local Spawn_C_101EB = SPAWN:New("C-101EB"):InitLimit( 2, 10 )
|
||||
local Spawn_A_10C = SPAWN:New("A-10C"):InitLimit( 2, 10 )
|
||||
|
||||
-- Choose repeat functionality
|
||||
|
||||
-- Repeat on landing
|
||||
Spawn_KA_50:InitRepeatOnLanding()
|
||||
Spawn_C_101EB:InitRepeatOnLanding()
|
||||
|
||||
-- Repeat on enging shutdown (when landed on the airport)
|
||||
Spawn_MI_8MTV2:InitRepeatOnEngineShutDown()
|
||||
Spawn_A_10C:InitRepeatOnEngineShutDown()
|
||||
|
||||
-- Now SPAWN the GROUPs
|
||||
Spawn_KA_50:SpawnScheduled(30,0)
|
||||
Spawn_C_101EB:SpawnScheduled(30,0)
|
||||
Spawn_MI_8MTV2:SpawnScheduled(30,0)
|
||||
Spawn_A_10C:SpawnScheduled(30,0)
|
||||
|
||||
-- Now run the mission and observe the behaviour.
|
||||
|
||||
end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user