mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Bug fixes
This commit is contained in:
parent
e550af8801
commit
9591f02a10
@ -464,7 +464,7 @@ trace.f( self.ClassName )
|
|||||||
if SpawnCargo then
|
if SpawnCargo then
|
||||||
if self.CargoZone:GetCargoHostUnit() then
|
if self.CargoZone:GetCargoHostUnit() then
|
||||||
--- ReSpawn the Cargo from the CargoHost
|
--- ReSpawn the Cargo from the CargoHost
|
||||||
self.CargoGroupName = self.CargoSpawn:FromCarrier( self.CargoZone:GetCargoHostUnit(), self.CargoZone:GetCargoZoneName(), self.CargoName, false ).name
|
self.CargoGroupName = self.CargoSpawn:FromHost( self.CargoZone:GetCargoHostUnit(), 60, 30, self.CargoName, false ).name
|
||||||
else
|
else
|
||||||
--- ReSpawn the Cargo in the CargoZone without a host ...
|
--- ReSpawn the Cargo in the CargoZone without a host ...
|
||||||
self.CargoGroupName = self.CargoSpawn:InZone( self.CargoZone:GetCargoZoneName(), self.CargoName ).name
|
self.CargoGroupName = self.CargoSpawn:InZone( self.CargoZone:GetCargoZoneName(), self.CargoName ).name
|
||||||
|
|||||||
@ -335,7 +335,7 @@ trace.f( self.ClassName, UnitData )
|
|||||||
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
"(changed " .. self.Players[PlayerName].PenaltyCoalition .. " times the coalition). 50 Penalty points added.",
|
||||||
"Game Status: Penalty", 20, "/PENALTYCOALITION" .. PlayerName ):ToAll()
|
"Game Status: Penalty", 20, "/PENALTYCOALITION" .. PlayerName ):ToAll()
|
||||||
self:ScoreAdd( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, DATABASECoalition[self.Players[PlayerName].UnitCoalition], DATABASECategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
self:ScoreAdd( PlayerName, "COALITION_PENALTY", 1, -50, self.Players[PlayerName].UnitName, DATABASECoalition[self.Players[PlayerName].UnitCoalition], DATABASECategory[self.Players[PlayerName].UnitCategory], self.Players[PlayerName].UnitType,
|
||||||
UnitName, DATABASECategory[UnitData:getCoalition()], DATABASECategory[UnitData:getCategory()], UnitData:getTypeName() )
|
UnitName, DATABASECoalition[UnitData:getCoalition()], DATABASECategory[UnitData:getCategory()], UnitData:getTypeName() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.Players[PlayerName].UnitName = UnitName
|
self.Players[PlayerName].UnitName = UnitName
|
||||||
@ -358,6 +358,9 @@ trace.f( self.ClassName, { PlayerUnit, MissionName, Score } )
|
|||||||
self.Players[PlayerName].Mission[MissionName].ScoreMission = 0
|
self.Players[PlayerName].Mission[MissionName].ScoreMission = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trace.i( self.ClassName, PlayerName )
|
||||||
|
trace.i( self.ClassName, self.Players[PlayerName].Mission[MissionName] )
|
||||||
|
|
||||||
self.Players[PlayerName].Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
self.Players[PlayerName].Mission[MissionName].ScoreTask = self.Players[PlayerName].Mission[MissionName].ScoreTask + Score
|
||||||
|
|
||||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
|
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
|
||||||
@ -496,12 +499,16 @@ end
|
|||||||
|
|
||||||
function DATABASE:ReportScoreAll()
|
function DATABASE:ReportScoreAll()
|
||||||
|
|
||||||
|
env.info( "Hello World " )
|
||||||
|
|
||||||
local ScoreMessage = ""
|
local ScoreMessage = ""
|
||||||
local PlayerMessage = ""
|
local PlayerMessage = ""
|
||||||
|
|
||||||
|
trace.i( self.ClassName, "Score Report" )
|
||||||
|
|
||||||
for PlayerName, PlayerData in pairs( self.Players ) do
|
for PlayerName, PlayerData in pairs( self.Players ) do
|
||||||
if PlayerData then -- This should normally not happen, but i'll test it anyway.
|
if PlayerData then -- This should normally not happen, but i'll test it anyway.
|
||||||
trace.i( self.ClassName, "Score" )
|
trace.i( self.ClassName, "Score Player: " .. PlayerName )
|
||||||
|
|
||||||
-- Some variables
|
-- Some variables
|
||||||
local InitUnitCoalition = DATABASECoalition[PlayerData.UnitCoalition]
|
local InitUnitCoalition = DATABASECoalition[PlayerData.UnitCoalition]
|
||||||
@ -517,18 +524,22 @@ function DATABASE:ReportScoreAll()
|
|||||||
local ScoreMessageHits = ""
|
local ScoreMessageHits = ""
|
||||||
|
|
||||||
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
||||||
|
trace.i( self.ClassName, CategoryName )
|
||||||
if PlayerData.Hit[CategoryID] then
|
if PlayerData.Hit[CategoryID] then
|
||||||
local Score = 0
|
local Score = 0
|
||||||
local ScoreHit = 0
|
local ScoreHit = 0
|
||||||
local Penalty = 0
|
local Penalty = 0
|
||||||
local PenaltyHit = 0
|
local PenaltyHit = 0
|
||||||
|
trace.i( self.ClassName, "Hit scores exist for player " .. PlayerName )
|
||||||
for UnitName, UnitData in pairs( PlayerData.Hit[CategoryID] ) do
|
for UnitName, UnitData in pairs( PlayerData.Hit[CategoryID] ) do
|
||||||
Score = Score + UnitData.Score
|
Score = Score + UnitData.Score
|
||||||
ScoreHit = ScoreHit + UnitData.ScoreHit
|
ScoreHit = ScoreHit + UnitData.ScoreHit
|
||||||
Penalty = Penalty + UnitData.Penalty
|
Penalty = Penalty + UnitData.Penalty
|
||||||
PenaltyHit = UnitData.PenaltyHit
|
PenaltyHit = UnitData.PenaltyHit
|
||||||
end
|
end
|
||||||
ScoreMessageHits = ScoreMessageHits .. string.format( " %s = %d score(%d;-%d) hits(#%d;#-%d)", CategoryName, Score - Penalty, Score, Penalty, ScoreHit, PenaltyHit )
|
local ScoreMessageHit = string.format( " %s = %d score(%d;-%d) hits(#%d;#-%d)", CategoryName, Score - Penalty, Score, Penalty, ScoreHit, PenaltyHit )
|
||||||
|
trace.i( self.ClassName, ScoreMessageHit )
|
||||||
|
ScoreMessageHits = ScoreMessageHits .. ScoreMessageHit
|
||||||
PlayerScore = PlayerScore + Score
|
PlayerScore = PlayerScore + Score
|
||||||
PlayerPenalty = PlayerPenalty + Penalty
|
PlayerPenalty = PlayerPenalty + Penalty
|
||||||
else
|
else
|
||||||
@ -541,6 +552,7 @@ function DATABASE:ReportScoreAll()
|
|||||||
|
|
||||||
local ScoreMessageKills = ""
|
local ScoreMessageKills = ""
|
||||||
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
||||||
|
trace.i( self.ClassName, "Kill scores exist for player " .. PlayerName )
|
||||||
if PlayerData.Kill[CategoryID] then
|
if PlayerData.Kill[CategoryID] then
|
||||||
local Score = 0
|
local Score = 0
|
||||||
local ScoreKill = 0
|
local ScoreKill = 0
|
||||||
@ -554,7 +566,9 @@ function DATABASE:ReportScoreAll()
|
|||||||
PenaltyKill = PenaltyKill + UnitData.PenaltyKill
|
PenaltyKill = PenaltyKill + UnitData.PenaltyKill
|
||||||
end
|
end
|
||||||
|
|
||||||
ScoreMessageKills = ScoreMessageKills .. string.format( " %s = %d score(%d;-%d) hits(#%d;#-%d)", CategoryName, Score - Penalty, Score, Penalty, ScoreKill, PenaltyKill )
|
local ScoreMessageKill = string.format( " %s = %d score(%d;-%d) hits(#%d;#-%d)", CategoryName, Score - Penalty, Score, Penalty, ScoreKill, PenaltyKill )
|
||||||
|
trace.i( self.ClassName, ScoreMessageKill )
|
||||||
|
ScoreMessageKills = ScoreMessageKills .. ScoreMessageKill
|
||||||
|
|
||||||
PlayerScore = PlayerScore + Score
|
PlayerScore = PlayerScore + Score
|
||||||
PlayerPenalty = PlayerPenalty + Penalty
|
PlayerPenalty = PlayerPenalty + Penalty
|
||||||
|
|||||||
@ -90,20 +90,23 @@ end
|
|||||||
function DEPLOYTASK:AddCargoMenus( Client, Cargos, TransportRadius )
|
function DEPLOYTASK:AddCargoMenus( Client, Cargos, TransportRadius )
|
||||||
trace.f( self.ClassName )
|
trace.f( self.ClassName )
|
||||||
|
|
||||||
|
local ClientGroupID = Client:GetClientGroupID()
|
||||||
|
|
||||||
|
trace.i( self.ClassName, ClientGroupID )
|
||||||
|
|
||||||
for CargoID, Cargo in pairs( Cargos ) do
|
for CargoID, Cargo in pairs( Cargos ) do
|
||||||
|
|
||||||
trace.i( self.ClassName, { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType } )
|
trace.i( self.ClassName, { Cargo.ClassName, Cargo.CargoName, Cargo.CargoType, Cargo.CargoWeight } )
|
||||||
|
|
||||||
if Cargo:IsStatusLoaded() then
|
if Cargo:IsStatusLoaded() then
|
||||||
|
|
||||||
|
|
||||||
if Client._Menus[Cargo.CargoType] == nil then
|
if Client._Menus[Cargo.CargoType] == nil then
|
||||||
Client._Menus[Cargo.CargoType] = {}
|
Client._Menus[Cargo.CargoType] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
if not Client._Menus[Cargo.CargoType].DeployMenu then
|
if not Client._Menus[Cargo.CargoType].DeployMenu then
|
||||||
Client._Menus[Cargo.CargoType].DeployMenu = missionCommands.addSubMenuForGroup(
|
Client._Menus[Cargo.CargoType].DeployMenu = missionCommands.addSubMenuForGroup(
|
||||||
Client:GetClientGroupID(),
|
ClientGroupID,
|
||||||
self.TEXT[1],
|
self.TEXT[1],
|
||||||
nil
|
nil
|
||||||
)
|
)
|
||||||
@ -119,7 +122,7 @@ trace.f( self.ClassName )
|
|||||||
end
|
end
|
||||||
|
|
||||||
Client._Menus[Cargo.CargoType].DeploySubMenus[ #Client._Menus[Cargo.CargoType].DeploySubMenus + 1 ].MenuPath = missionCommands.addCommandForGroup(
|
Client._Menus[Cargo.CargoType].DeploySubMenus[ #Client._Menus[Cargo.CargoType].DeploySubMenus + 1 ].MenuPath = missionCommands.addCommandForGroup(
|
||||||
Client:GetClientGroupID(),
|
ClientGroupID,
|
||||||
Cargo.CargoName .. " ( " .. Cargo.CargoWeight .. "kg )",
|
Cargo.CargoName .. " ( " .. Cargo.CargoWeight .. "kg )",
|
||||||
Client._Menus[Cargo.CargoType].DeployMenu,
|
Client._Menus[Cargo.CargoType].DeployMenu,
|
||||||
self.MenuAction,
|
self.MenuAction,
|
||||||
@ -134,16 +137,19 @@ end
|
|||||||
function DEPLOYTASK:RemoveCargoMenus( Client )
|
function DEPLOYTASK:RemoveCargoMenus( Client )
|
||||||
trace.f(self.ClassName )
|
trace.f(self.ClassName )
|
||||||
|
|
||||||
|
local ClientGroupID = Client:GetClientGroupID()
|
||||||
|
trace.i( self.ClassName, ClientGroupID )
|
||||||
|
|
||||||
for MenuID, MenuData in pairs( Client._Menus ) do
|
for MenuID, MenuData in pairs( Client._Menus ) do
|
||||||
if MenuData.DeploySubMenus ~= nil then
|
if MenuData.DeploySubMenus ~= nil then
|
||||||
for SubMenuID, SubMenuData in pairs( MenuData.DeploySubMenus ) do
|
for SubMenuID, SubMenuData in pairs( MenuData.DeploySubMenus ) do
|
||||||
missionCommands.removeItemForGroup( Client:GetClientGroupID(), SubMenuData )
|
missionCommands.removeItemForGroup( ClientGroupID, SubMenuData )
|
||||||
trace.i( self.ClassName, "Removed DeploySubMenu " )
|
trace.i( self.ClassName, "Removed DeploySubMenu " )
|
||||||
SubMenuData = nil
|
SubMenuData = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if MenuData.DeployMenu then
|
if MenuData.DeployMenu then
|
||||||
missionCommands.removeItemForGroup( Client:GetClientGroupID(), MenuData.DeployMenu )
|
missionCommands.removeItemForGroup( ClientGroupID, MenuData.DeployMenu )
|
||||||
trace.i( self.ClassName, "Removed DeployMenu " )
|
trace.i( self.ClassName, "Removed DeployMenu " )
|
||||||
MenuData.DeployMenu = nil
|
MenuData.DeployMenu = nil
|
||||||
end
|
end
|
||||||
|
|||||||
@ -490,6 +490,7 @@ trace.scheduled("MISSIONSCHEDULER","Scheduler")
|
|||||||
end
|
end
|
||||||
|
|
||||||
if Task:IsDone() then
|
if Task:IsDone() then
|
||||||
|
trace.i( "MISSIONSCHEDULER", "Task " .. Task.Name .. " is Done." )
|
||||||
--env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) )
|
--env.info( 'Scheduler: Mission '.. Mission.Name .. ' Task ' .. Task.Name .. ' Stage ' .. Task.Stage.Name .. ' done. TaskComplete = ' .. string.format ( "%s", TaskComplete and "true" or "false" ) )
|
||||||
TaskComplete = true -- when a task is not yet completed, a mission cannot be completed
|
TaskComplete = true -- when a task is not yet completed, a mission cannot be completed
|
||||||
|
|
||||||
|
|||||||
@ -297,6 +297,58 @@ trace.f( self.ClassName )
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Will SPAWN a Group from a Carrier. This function is mostly advisable to be used if you want to simulate SPAWNing from air units, like helicopters, which are dropping infantry into a defined Landing Zone.
|
||||||
|
-- @tparam Group HostUnit is the AIR unit or GROUND unit dropping or unloading the Spawn group.
|
||||||
|
-- @tparam string TargetZonePrefix is the Prefix of the Zone defined in the ME where the Group should be moving to after drop.
|
||||||
|
-- @tparam string NewGroupName (forgot this).
|
||||||
|
-- @tparam bool LateActivate (optional) does the SPAWNing with Lateactivation on.
|
||||||
|
function SPAWN:FromHost( HostUnit, OuterRadius, InnerRadius, NewGroupName, LateActivate )
|
||||||
|
trace.f( self.ClassName, { HostUnit, OuterRadius, InnerRadius, NewGroupName, LateActivate } )
|
||||||
|
|
||||||
|
local SpawnTemplate
|
||||||
|
|
||||||
|
if HostUnit and HostUnit:isExist() then -- and HostUnit:getUnit(1):inAir() == false then
|
||||||
|
|
||||||
|
SpawnTemplate = self:_Prepare( NewGroupName )
|
||||||
|
|
||||||
|
if ( self.SpawnMaxGroups == 0 ) or ( self.SpawnCount <= self.SpawnMaxGroups ) then
|
||||||
|
if ( self.SpawnMaxGroupsAlive == 0 ) or ( self.AliveUnits < self.SpawnMaxGroupsAlive * #self.SpawnTemplate.units ) or self.UnControlled then
|
||||||
|
|
||||||
|
if LateActivate ~= nil then
|
||||||
|
if LateActivate == true then
|
||||||
|
SpawnTemplate.lateActivation = true
|
||||||
|
SpawnTemplate.visible = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
SpawnTemplate = self:_RandomizeRoute( SpawnTemplate )
|
||||||
|
|
||||||
|
local RouteCount = table.getn( SpawnTemplate.route.points )
|
||||||
|
trace.i( self.ClassName, "RouteCount = " .. RouteCount )
|
||||||
|
|
||||||
|
local UnitDeployPosition = HostUnit:getPoint()
|
||||||
|
for PointID, Point in pairs( SpawnTemplate.route.points ) do
|
||||||
|
Point.x = UnitDeployPosition.x
|
||||||
|
Point.y = UnitDeployPosition.z
|
||||||
|
Point.alt = nil
|
||||||
|
Point.alt_type = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
for v = 1, table.getn( SpawnTemplate.units ) do
|
||||||
|
local SpawnPos = routines.getRandPointInCircle( UnitDeployPosition, OuterRadius, InnerRadius )
|
||||||
|
SpawnTemplate.units[v].x = SpawnPos.x
|
||||||
|
SpawnTemplate.units[v].y = SpawnPos.y
|
||||||
|
trace.i( self.ClassName, 'SpawnTemplate.units['..v..'].x = ' .. SpawnTemplate.units[v].x .. ', SpawnTemplate.units['..v..'].y = ' .. SpawnTemplate.units[v].y )
|
||||||
|
end
|
||||||
|
|
||||||
|
_Database:Spawn( SpawnTemplate )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return SpawnTemplate
|
||||||
|
end
|
||||||
|
|
||||||
--- Will SPAWN a Group from a Carrier. This function is mostly advisable to be used if you want to simulate SPAWNing from air units, like helicopters, which are dropping infantry into a defined Landing Zone.
|
--- Will SPAWN a Group from a Carrier. This function is mostly advisable to be used if you want to simulate SPAWNing from air units, like helicopters, which are dropping infantry into a defined Landing Zone.
|
||||||
-- @tparam Group CarrierUnit is the AIR unit or GROUND unit dropping or unloading the Spawn group.
|
-- @tparam Group CarrierUnit is the AIR unit or GROUND unit dropping or unloading the Spawn group.
|
||||||
-- @tparam string TargetZonePrefix is the Prefix of the Zone defined in the ME where the Group should be moving to after drop.
|
-- @tparam string TargetZonePrefix is the Prefix of the Zone defined in the ME where the Group should be moving to after drop.
|
||||||
|
|||||||
@ -142,7 +142,7 @@ end
|
|||||||
--- Returns if a TASK is done.
|
--- Returns if a TASK is done.
|
||||||
-- @treturn bool
|
-- @treturn bool
|
||||||
function TASK:IsDone()
|
function TASK:IsDone()
|
||||||
trace.f(self.ClassName)
|
trace.i( self.ClassName, self.TaskDone )
|
||||||
return self.TaskDone
|
return self.TaskDone
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ end
|
|||||||
--- Returns if a TASk has failed.
|
--- Returns if a TASk has failed.
|
||||||
-- @return bool
|
-- @return bool
|
||||||
function TASK:IsFailed()
|
function TASK:IsFailed()
|
||||||
trace.f(self.ClassName)
|
trace.i( self.ClassName, self.TaskFailed )
|
||||||
return self.TaskFailed
|
return self.TaskFailed
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -278,7 +278,6 @@ end
|
|||||||
--- Returns if all the Goals of the TASK were achieved.
|
--- Returns if all the Goals of the TASK were achieved.
|
||||||
-- @treturn bool
|
-- @treturn bool
|
||||||
function TASK:IsGoalReached( )
|
function TASK:IsGoalReached( )
|
||||||
trace.f(self.ClassName)
|
|
||||||
|
|
||||||
local GoalReached = true
|
local GoalReached = true
|
||||||
|
|
||||||
@ -297,6 +296,7 @@ trace.f(self.ClassName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trace.i( self.ClassName, GoalReached )
|
||||||
return GoalReached
|
return GoalReached
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -250,8 +250,9 @@ end
|
|||||||
trace.i = function(object, variable)
|
trace.i = function(object, variable)
|
||||||
|
|
||||||
local info = debug.getinfo( 2, "nl" )
|
local info = debug.getinfo( 2, "nl" )
|
||||||
if info.name ~= trace.nametrace then
|
|
||||||
trace.nametrace = info.name
|
trace.nametrace = info.name
|
||||||
|
if trace.nametrace == nil then
|
||||||
|
trace.nametrace = "function"
|
||||||
end
|
end
|
||||||
if trace.names.all or trace.tracefunction( trace.nametrace ) or trace.classes[ object ] then
|
if trace.names.all or trace.tracefunction( trace.nametrace ) or trace.classes[ object ] then
|
||||||
local objecttrace = ""
|
local objecttrace = ""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user