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 self.CargoZone:GetCargoHostUnit() then
|
||||
--- 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
|
||||
--- ReSpawn the Cargo in the CargoZone without a host ...
|
||||
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.",
|
||||
"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,
|
||||
UnitName, DATABASECategory[UnitData:getCoalition()], DATABASECategory[UnitData:getCategory()], UnitData:getTypeName() )
|
||||
UnitName, DATABASECoalition[UnitData:getCoalition()], DATABASECategory[UnitData:getCategory()], UnitData:getTypeName() )
|
||||
end
|
||||
end
|
||||
self.Players[PlayerName].UnitName = UnitName
|
||||
@ -358,6 +358,9 @@ trace.f( self.ClassName, { PlayerUnit, MissionName, Score } )
|
||||
self.Players[PlayerName].Mission[MissionName].ScoreMission = 0
|
||||
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
|
||||
|
||||
MESSAGE:New( "Player '" .. PlayerName .. "' has finished another Task in Mission '" .. MissionName .. "'. " ..
|
||||
@ -496,12 +499,16 @@ end
|
||||
|
||||
function DATABASE:ReportScoreAll()
|
||||
|
||||
env.info( "Hello World " )
|
||||
|
||||
local ScoreMessage = ""
|
||||
local PlayerMessage = ""
|
||||
|
||||
trace.i( self.ClassName, "Score Report" )
|
||||
|
||||
for PlayerName, PlayerData in pairs( self.Players ) do
|
||||
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
|
||||
local InitUnitCoalition = DATABASECoalition[PlayerData.UnitCoalition]
|
||||
@ -517,18 +524,22 @@ function DATABASE:ReportScoreAll()
|
||||
local ScoreMessageHits = ""
|
||||
|
||||
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
||||
trace.i( self.ClassName, CategoryName )
|
||||
if PlayerData.Hit[CategoryID] then
|
||||
local Score = 0
|
||||
local ScoreHit = 0
|
||||
local Penalty = 0
|
||||
local PenaltyHit = 0
|
||||
trace.i( self.ClassName, "Hit scores exist for player " .. PlayerName )
|
||||
for UnitName, UnitData in pairs( PlayerData.Hit[CategoryID] ) do
|
||||
Score = Score + UnitData.Score
|
||||
ScoreHit = ScoreHit + UnitData.ScoreHit
|
||||
Penalty = Penalty + UnitData.Penalty
|
||||
PenaltyHit = UnitData.PenaltyHit
|
||||
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
|
||||
PlayerPenalty = PlayerPenalty + Penalty
|
||||
else
|
||||
@ -541,6 +552,7 @@ function DATABASE:ReportScoreAll()
|
||||
|
||||
local ScoreMessageKills = ""
|
||||
for CategoryID, CategoryName in pairs( DATABASECategory ) do
|
||||
trace.i( self.ClassName, "Kill scores exist for player " .. PlayerName )
|
||||
if PlayerData.Kill[CategoryID] then
|
||||
local Score = 0
|
||||
local ScoreKill = 0
|
||||
@ -554,7 +566,9 @@ function DATABASE:ReportScoreAll()
|
||||
PenaltyKill = PenaltyKill + UnitData.PenaltyKill
|
||||
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
|
||||
PlayerPenalty = PlayerPenalty + Penalty
|
||||
|
||||
@ -90,20 +90,23 @@ end
|
||||
function DEPLOYTASK:AddCargoMenus( Client, Cargos, TransportRadius )
|
||||
trace.f( self.ClassName )
|
||||
|
||||
local ClientGroupID = Client:GetClientGroupID()
|
||||
|
||||
trace.i( self.ClassName, ClientGroupID )
|
||||
|
||||
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 Client._Menus[Cargo.CargoType] == nil then
|
||||
Client._Menus[Cargo.CargoType] = {}
|
||||
end
|
||||
|
||||
if not Client._Menus[Cargo.CargoType].DeployMenu then
|
||||
Client._Menus[Cargo.CargoType].DeployMenu = missionCommands.addSubMenuForGroup(
|
||||
Client:GetClientGroupID(),
|
||||
ClientGroupID,
|
||||
self.TEXT[1],
|
||||
nil
|
||||
)
|
||||
@ -119,7 +122,7 @@ trace.f( self.ClassName )
|
||||
end
|
||||
|
||||
Client._Menus[Cargo.CargoType].DeploySubMenus[ #Client._Menus[Cargo.CargoType].DeploySubMenus + 1 ].MenuPath = missionCommands.addCommandForGroup(
|
||||
Client:GetClientGroupID(),
|
||||
ClientGroupID,
|
||||
Cargo.CargoName .. " ( " .. Cargo.CargoWeight .. "kg )",
|
||||
Client._Menus[Cargo.CargoType].DeployMenu,
|
||||
self.MenuAction,
|
||||
@ -134,16 +137,19 @@ end
|
||||
function DEPLOYTASK:RemoveCargoMenus( Client )
|
||||
trace.f(self.ClassName )
|
||||
|
||||
local ClientGroupID = Client:GetClientGroupID()
|
||||
trace.i( self.ClassName, ClientGroupID )
|
||||
|
||||
for MenuID, MenuData in pairs( Client._Menus ) do
|
||||
if MenuData.DeploySubMenus ~= nil then
|
||||
for SubMenuID, SubMenuData in pairs( MenuData.DeploySubMenus ) do
|
||||
missionCommands.removeItemForGroup( Client:GetClientGroupID(), SubMenuData )
|
||||
missionCommands.removeItemForGroup( ClientGroupID, SubMenuData )
|
||||
trace.i( self.ClassName, "Removed DeploySubMenu " )
|
||||
SubMenuData = nil
|
||||
end
|
||||
end
|
||||
if MenuData.DeployMenu then
|
||||
missionCommands.removeItemForGroup( Client:GetClientGroupID(), MenuData.DeployMenu )
|
||||
missionCommands.removeItemForGroup( ClientGroupID, MenuData.DeployMenu )
|
||||
trace.i( self.ClassName, "Removed DeployMenu " )
|
||||
MenuData.DeployMenu = nil
|
||||
end
|
||||
|
||||
@ -490,6 +490,7 @@ trace.scheduled("MISSIONSCHEDULER","Scheduler")
|
||||
end
|
||||
|
||||
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" ) )
|
||||
TaskComplete = true -- when a task is not yet completed, a mission cannot be completed
|
||||
|
||||
|
||||
@ -297,6 +297,58 @@ trace.f( self.ClassName )
|
||||
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.
|
||||
-- @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.
|
||||
|
||||
@ -142,7 +142,7 @@ end
|
||||
--- Returns if a TASK is done.
|
||||
-- @treturn bool
|
||||
function TASK:IsDone()
|
||||
trace.f(self.ClassName)
|
||||
trace.i( self.ClassName, self.TaskDone )
|
||||
return self.TaskDone
|
||||
end
|
||||
|
||||
@ -155,7 +155,7 @@ end
|
||||
--- Returns if a TASk has failed.
|
||||
-- @return bool
|
||||
function TASK:IsFailed()
|
||||
trace.f(self.ClassName)
|
||||
trace.i( self.ClassName, self.TaskFailed )
|
||||
return self.TaskFailed
|
||||
end
|
||||
|
||||
@ -278,7 +278,6 @@ end
|
||||
--- Returns if all the Goals of the TASK were achieved.
|
||||
-- @treturn bool
|
||||
function TASK:IsGoalReached( )
|
||||
trace.f(self.ClassName)
|
||||
|
||||
local GoalReached = true
|
||||
|
||||
@ -297,6 +296,7 @@ trace.f(self.ClassName)
|
||||
end
|
||||
end
|
||||
|
||||
trace.i( self.ClassName, GoalReached )
|
||||
return GoalReached
|
||||
end
|
||||
|
||||
|
||||
@ -250,8 +250,9 @@ end
|
||||
trace.i = function(object, variable)
|
||||
|
||||
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
|
||||
if trace.names.all or trace.tracefunction( trace.nametrace ) or trace.classes[ object ] then
|
||||
local objecttrace = ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user