mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Suppression Fire
This commit is contained in:
parent
da0bf650fa
commit
cbc0579c79
@ -1331,7 +1331,9 @@ function CARGO_GROUP:onenterUnLoaded( From, Event, To, ToPointVec2, ... )
|
||||
-- For each Cargo object within the CARGO_GROUP, route each object to the CargoLoadPointVec2
|
||||
self.CargoSet:ForEach(
|
||||
function( Cargo )
|
||||
Cargo:UnLoad( ToPointVec2 )
|
||||
--Cargo:UnLoad( ToPointVec2 )
|
||||
local RandomVec2=ToPointVec2:GetRandomPointVec2InRadius(10)
|
||||
Cargo:UnLoad( RandomVec2 )
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
139
Moose Development/Moose/Functional/SuppressionFire.lua
Normal file
139
Moose Development/Moose/Functional/SuppressionFire.lua
Normal file
@ -0,0 +1,139 @@
|
||||
---
|
||||
-- @module AI_Suppression
|
||||
|
||||
--- @type AI_Suppression
|
||||
-- @extends Core.Fsm#FSM_CONTROLLABLE
|
||||
--
|
||||
|
||||
--TODO: Figure out who was shooting and move away from him.
|
||||
--TODO: Move behind a scenery building if there is one nearby.
|
||||
--TODO: Retreat to a given zone or point.
|
||||
--TODO:
|
||||
|
||||
-- @field AI_Suppression
|
||||
AI_Suppression={}
|
||||
|
||||
--- Creates a new AI_suppression object
|
||||
-- @param #AI_Suppression self
|
||||
-- @param Wrapper.Group#GROUP Group The GROUP object for which suppression should be applied.
|
||||
-- @return #AI_Suppression
|
||||
function AI_Suppression:New(Group)
|
||||
env.info("Suppression Fire for group "..Group:GetName())
|
||||
|
||||
-- Inherits from FSM_CONTROLLABLE
|
||||
local self=BASE:Inherit(self, FSM_CONTROLLABLE:New()) -- #AI_Suppression
|
||||
|
||||
self:SetControllable(Group)
|
||||
|
||||
self.life=self.Controllable:GetLife()
|
||||
|
||||
self.Tsuppressed=0
|
||||
|
||||
-- Time the group is suppressed after being hit.
|
||||
self.Tsuppress=40
|
||||
|
||||
self:SetStartState("CombatReady")
|
||||
|
||||
self:AddTransition("*", "Status", "*")
|
||||
|
||||
self:AddTransition("*", "Hit", "Suppressed")
|
||||
|
||||
self:AddTransition("Suppressed", "Recovered", "CombatReady")
|
||||
|
||||
self:AddTransition("*", "Hit", "TakeCover")
|
||||
|
||||
-- Handle the event hit.
|
||||
self:HandleEvent(EVENTS.Hit, self.OnEventHit)
|
||||
|
||||
-- Handle the event dead.
|
||||
self:HandleEvent(EVENTS.Dead, self.OnEventDead)
|
||||
|
||||
--self:AddTransition("Suppressed", "Status", "CombatReady")
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- Before status event.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnBeforeStatus()
|
||||
return self.CheckStatus
|
||||
end
|
||||
|
||||
--- After status event.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnBeforeStatus()
|
||||
self:__Status(10)
|
||||
end
|
||||
|
||||
--- After hit event.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnAfterHit(From, Event, To)
|
||||
|
||||
end
|
||||
|
||||
--- After hit event.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnAfterRecover(From, Event, To)
|
||||
local Tnow=timer.getTime()
|
||||
if Tnow-self.Tsuppressed > self.Tsuppress then
|
||||
self:CombatReady()
|
||||
end
|
||||
end
|
||||
|
||||
--- After hit event.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnEnterCombatReady(From, Event, To)
|
||||
-- Group can fight again.
|
||||
self.Controllable:OptionROEOpenFire()
|
||||
end
|
||||
|
||||
--- Entering suppressed state.
|
||||
-- @param #AI_Suppression self
|
||||
function AI_Suppression:OnEnterSuppressed(From, Event, To)
|
||||
|
||||
local Tnow=timer.getTime()
|
||||
|
||||
-- Group will hold their weapons.
|
||||
self.Controllable:OptionROEHoldFire()
|
||||
|
||||
|
||||
-- Recovery will be in Tsuppress seconds.
|
||||
self:__Recover(self.Tsuppress)
|
||||
|
||||
|
||||
if From=="CombatReady" then
|
||||
|
||||
|
||||
elseif From=="Suppressed" then
|
||||
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- @param #AI_Suppression self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_Suppression:OnEventHit(EventData)
|
||||
self:E({"EventHit", EventData })
|
||||
env.info("Hitevent")
|
||||
|
||||
if EventData.IniDCSUnit then
|
||||
|
||||
--self:Hit()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
--- @param #AI_Suppression self
|
||||
-- @param Core.Event#EVENTDATA EventData
|
||||
function AI_Suppression:OnEventDead(EventData)
|
||||
self:E({"EventHit", EventData })
|
||||
env.info("Deadevent")
|
||||
if EventData.IniDCSUnit then
|
||||
--blabla
|
||||
end
|
||||
end
|
||||
|
||||
@ -47,6 +47,7 @@ Functional/RAT.lua
|
||||
Functional/ZoneGoal.lua
|
||||
Functional/ZoneGoalCoalition.lua
|
||||
Functional/ZoneCaptureCoalition.lua
|
||||
Functional/SuppressionFire.lua
|
||||
|
||||
AI/AI_Balancer.lua
|
||||
AI/AI_A2A.lua
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20171010_2141' )
|
||||
env.info( 'Moose Generation Timestamp: 20171010_2216' )
|
||||
|
||||
local base = _G
|
||||
|
||||
@ -67,6 +67,7 @@ __Moose.Include( 'Functional/RAT.lua' )
|
||||
__Moose.Include( 'Functional/ZoneGoal.lua' )
|
||||
__Moose.Include( 'Functional/ZoneGoalCoalition.lua' )
|
||||
__Moose.Include( 'Functional/ZoneCaptureCoalition.lua' )
|
||||
__Moose.Include( 'Functional/SuppressionFire.lua' )
|
||||
__Moose.Include( 'AI/AI_Balancer.lua' )
|
||||
__Moose.Include( 'AI/AI_A2A.lua' )
|
||||
__Moose.Include( 'AI/AI_A2A_Patrol.lua' )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user