This commit is contained in:
Applevangelist 2022-12-21 12:52:24 +01:00
parent 3564843e1b
commit 669e55d435
3 changed files with 31 additions and 3 deletions

View File

@ -6991,6 +6991,28 @@ do -- SET_SCENERY
return CountU
end
--- Get a table of alive objects.
-- @param #SET_GROUP self
-- @return #table Table of alive objects
-- @return Core.Set#SET_SCENERY SET of alive objects
function SET_SCENERY:GetAliveSet()
self:F2()
local AliveSet = SET_SCENERY:New()
-- Clean the Set before returning with only the alive Groups.
for GroupName, GroupObject in pairs( self.Set ) do
local GroupObject = GroupObject -- Wrapper.Group#GROUP
if GroupObject then
if GroupObject:IsAlive() then
AliveSet:Add( GroupName, GroupObject )
end
end
end
return AliveSet.Set or {}, AliveSet
end
--- Iterate the SET_SCENERY and call an iterator function for each **alive** SCENERY, providing the SCENERY and optional parameters.
-- @param #SET_SCENERY self
-- @param #function IteratorFunction The function that will be called when there is an alive SCENERY in the SET_SCENERY. The function needs to accept a SCENERY parameter.

View File

@ -2821,6 +2821,7 @@ function PLAYERTASKCONTROLLER:_JoinTask(Group, Client, Task, Force)
Task:AddClient(Client)
local joined = self.gettext:GetEntry("PILOTJOINEDTASK",self.locale)
-- PILOTJOINEDTASK = "%s, %s. You have been assigned %s task %03d",
--self:I(string.format("Task %s | TaskType %s | Number %s | Type %s",self.MenuName or self.Name, Task.TTSType, tonumber(Task.PlayerTaskNr),type(Task.PlayerTaskNr)))
local text = string.format(joined,ttsplayername, self.MenuName or self.Name, Task.TTSType, Task.PlayerTaskNr)
self:T(self.lid..text)
if not self.NoScreenOutput then

View File

@ -617,7 +617,7 @@ function TARGET:onafterStatus(From, Event, To)
-- Log output verbose=1.
if self.verbose>=1 then
local text=string.format("%s: Targets=%d/%d Life=%.1f/%.1f Damage=%.1f", fsmstate, self:CountTargets(), self.N0, self:GetLife(), self:GetLife0(), self:GetDamage())
if self:CountTargets() == 0 then
if self:CountTargets() == 0 or self:GetDamage() >= 100 then
text=text.." Dead!"
elseif damaged then
text=text.." Damaged!"
@ -636,7 +636,7 @@ function TARGET:onafterStatus(From, Event, To)
self:I(self.lid..text)
end
if self:CountTargets() == 0 then
if self:CountTargets() == 0 or self:GetDamage() >= 100 then
self:Dead()
end
@ -935,6 +935,9 @@ function TARGET:_AddObject(Object)
target.Coordinate=scenery:GetCoordinate()
target.Life0=scenery:GetLife0()
if target.Life0==0 then target.Life0 = 1 end
target.Life=scenery:GetLife()
target.N0=target.N0+1
@ -1071,7 +1074,9 @@ function TARGET:GetTargetLife(Target)
elseif Target.Type==TARGET.ObjectType.STATIC then
if Target.Object and Target.Object:IsAlive() then
return 1
local life=Target.Object:GetLife()
return life
--return 1
else
return 0
end