mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-23 02:08:17 +00:00
CTLD Ability to fire an event on injection
This commit is contained in:
@@ -763,17 +763,21 @@ do
|
|||||||
--
|
--
|
||||||
-- function CTLD_Cargotransport:OnAfterCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
-- function CTLD_Cargotransport:OnAfterCratesDropped(From, Event, To, Group, Unit, Cargotable)
|
||||||
-- local points = 10
|
-- local points = 10
|
||||||
|
-- if Unit then
|
||||||
-- local PlayerName = Unit:GetPlayerName()
|
-- local PlayerName = Unit:GetPlayerName()
|
||||||
-- my_scoring:_AddPlayerFromUnit( Unit )
|
-- my_scoring:_AddPlayerFromUnit( Unit )
|
||||||
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for transporting cargo crates!", PlayerName, points), points)
|
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for transporting cargo crates!", PlayerName, points), points)
|
||||||
-- end
|
-- end
|
||||||
|
-- end
|
||||||
--
|
--
|
||||||
-- function CTLD_Cargotransport:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
-- function CTLD_Cargotransport:OnAfterCratesBuild(From, Event, To, Group, Unit, Vehicle)
|
||||||
-- local points = 5
|
-- local points = 5
|
||||||
|
-- if Unit then
|
||||||
-- local PlayerName = Unit:GetPlayerName()
|
-- local PlayerName = Unit:GetPlayerName()
|
||||||
-- my_scoring:_AddPlayerFromUnit( Unit )
|
-- my_scoring:_AddPlayerFromUnit( Unit )
|
||||||
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for the construction of Units!", PlayerName, points), points)
|
-- my_scoring:AddGoalScore(Unit, "CTLD", string.format("Pilot %s has been awarded %d points for the construction of Units!", PlayerName, points), points)
|
||||||
-- end
|
-- end
|
||||||
|
-- end
|
||||||
--
|
--
|
||||||
-- ## 4. F10 Menu structure
|
-- ## 4. F10 Menu structure
|
||||||
--
|
--
|
||||||
@@ -842,6 +846,7 @@ do
|
|||||||
-- my_ctld.saveinterval = 600 -- save every 10 minutes
|
-- my_ctld.saveinterval = 600 -- save every 10 minutes
|
||||||
-- my_ctld.filename = "missionsave.csv" -- example filename
|
-- my_ctld.filename = "missionsave.csv" -- example filename
|
||||||
-- my_ctld.filepath = "C:\\Users\\myname\\Saved Games\\DCS\Missions\\MyMission" -- example path
|
-- my_ctld.filepath = "C:\\Users\\myname\\Saved Games\\DCS\Missions\\MyMission" -- example path
|
||||||
|
-- my_ctld.eventoninject = true -- fire OnAfterCratesBuild and OnAfterTroopsDeployed events when loading (uses Inject functions)
|
||||||
--
|
--
|
||||||
-- Then use an initial load at the beginning of your mission:
|
-- Then use an initial load at the beginning of your mission:
|
||||||
--
|
--
|
||||||
@@ -957,7 +962,7 @@ CTLD.UnitTypes = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="0.2.1a1"
|
CTLD.version="0.2.1a2"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -1108,6 +1113,8 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self.enableLoadSave = false
|
self.enableLoadSave = false
|
||||||
self.filepath = nil
|
self.filepath = nil
|
||||||
self.saveinterval = 600
|
self.saveinterval = 600
|
||||||
|
self.eventoninject = true
|
||||||
|
|
||||||
local AliaS = string.gsub(self.alias," ","_")
|
local AliaS = string.gsub(self.alias," ","_")
|
||||||
self.filename = string.format("CTLD_%s_Persist.csv",AliaS)
|
self.filename = string.format("CTLD_%s_Persist.csv",AliaS)
|
||||||
|
|
||||||
@@ -1149,6 +1156,24 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param #number delay Delay in seconds.
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Load".
|
||||||
|
-- @function [parent=#CTLD] Load
|
||||||
|
-- @param #CTLD self
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Load" after a delay.
|
||||||
|
-- @function [parent=#CTLD] __Load
|
||||||
|
-- @param #CTLD self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Save".
|
||||||
|
-- @function [parent=#CTLD] Load
|
||||||
|
-- @param #CTLD self
|
||||||
|
|
||||||
|
--- Triggers the FSM event "Save" after a delay.
|
||||||
|
-- @function [parent=#CTLD] __Save
|
||||||
|
-- @param #CTLD self
|
||||||
|
-- @param #number delay Delay in seconds.
|
||||||
|
|
||||||
--- FSM Function OnAfterTroopsPickedUp.
|
--- FSM Function OnAfterTroopsPickedUp.
|
||||||
-- @function [parent=#CTLD] OnAfterTroopsPickedUp
|
-- @function [parent=#CTLD] OnAfterTroopsPickedUp
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@@ -3602,6 +3627,9 @@ end
|
|||||||
else
|
else
|
||||||
--self:I(string.format("%s Injected Troops %s into action!",self.lid, name))
|
--self:I(string.format("%s Injected Troops %s into action!",self.lid, name))
|
||||||
end
|
end
|
||||||
|
if self.eventoninject then
|
||||||
|
self:__TroopsDeployed(1,nil,nil,self.DroppedTroops[self.TroopCounter])
|
||||||
|
end
|
||||||
end -- if type end
|
end -- if type end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@@ -3670,6 +3698,9 @@ end
|
|||||||
if self.movetroopstowpzone and canmove then
|
if self.movetroopstowpzone and canmove then
|
||||||
self:_MoveGroupToZone(self.DroppedTroops[self.TroopCounter])
|
self:_MoveGroupToZone(self.DroppedTroops[self.TroopCounter])
|
||||||
end
|
end
|
||||||
|
if self.eventoninject then
|
||||||
|
self:__CratesBuild(1,nil,nil,self.DroppedTroops[self.TroopCounter])
|
||||||
|
end
|
||||||
end -- end loop
|
end -- end loop
|
||||||
end -- if type end
|
end -- if type end
|
||||||
return self
|
return self
|
||||||
@@ -4147,6 +4178,7 @@ end
|
|||||||
vec2.x = dataset[2]
|
vec2.x = dataset[2]
|
||||||
vec2.y = dataset[4]
|
vec2.y = dataset[4]
|
||||||
local cargoname = dataset[5]
|
local cargoname = dataset[5]
|
||||||
|
if type(cargoname) == "string" then
|
||||||
local cargotemplates = dataset[6]
|
local cargotemplates = dataset[6]
|
||||||
cargotemplates = string.gsub(cargotemplates,"{","")
|
cargotemplates = string.gsub(cargotemplates,"{","")
|
||||||
cargotemplates = string.gsub(cargotemplates,"}","")
|
cargotemplates = string.gsub(cargotemplates,"}","")
|
||||||
@@ -4165,6 +4197,7 @@ end
|
|||||||
self:InjectTroops(dropzone,injecttroops)
|
self:InjectTroops(dropzone,injecttroops)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user