@ -29,6 +29,7 @@ struct GodStatus
var bool unmovable;
var bool unmovable;
};
};
var private bool connectedToSignal;
var private array<GodStatus> godhoodList;
var private array<GodStatus> godhoodList;
var private ACommandGod_Announcer announcer;
var private ACommandGod_Announcer announcer;
@ -37,8 +38,9 @@ var private const int TDAMAGE, TMOMENTUM;
protected function Finalizer()
protected function Finalizer()
{
{
_.memory.Free(announcer) ;
connectedToSignal = false ;
_server.kf.health.OnDamage(self).Disconnect();
_server.kf.health.OnDamage(self).Disconnect();
_.memory.Free(announcer);
super.Finalizer();
super.Finalizer();
}
}
@ -62,7 +64,6 @@ protected function BuildData(CommandDataBuilder builder)
@ "affected by the momentum trasnferred from damaging attacks."));
@ "affected by the momentum trasnferred from damaging attacks."));
announcer = ACommandGod_Announcer(
announcer = ACommandGod_Announcer(
_.memory.Allocate(class'ACommandGod_Announcer'));
_.memory.Allocate(class'ACommandGod_Announcer'));
_server.kf.health.OnDamage(self).connect = ProtectDivines;
}
}
protected function ExecutedFor(
protected function ExecutedFor(
@ -157,6 +158,7 @@ private final function MakeGod(
newGodStatus.target.NewRef();
newGodStatus.target.NewRef();
godhoodList[godhoodList.length] = newGodStatus;
godhoodList[godhoodList.length] = newGodStatus;
}
}
UpdateHealthSignalConnection();
}
}
private final function RemoveGod(EPlayer target)
private final function RemoveGod(EPlayer target)
@ -173,6 +175,7 @@ private final function RemoveGod(EPlayer target)
announcer.AnnounceRemoveGod(godhoodList[i]);
announcer.AnnounceRemoveGod(godhoodList[i]);
godhoodList[i].target.FreeSelf();
godhoodList[i].target.FreeSelf();
godhoodList.Remove(i, 1);
godhoodList.Remove(i, 1);
UpdateHealthSignalConnection();
return;
return;
}
}
}
}
@ -196,6 +199,20 @@ private final function GodStatus BorrowGodStatus(EPlayer target)
return emptyStatus;
return emptyStatus;
}
}
private final function UpdateHealthSignalConnection()
{
if (connectedToSignal && godhoodList.length <= 0)
{
_server.kf.health.OnDamage(self).Disconnect();
connectedToSignal = false;
}
if (!connectedToSignal && godhoodList.length > 0)
{
connectedToSignal = true;
_server.kf.health.OnDamage(self).connect = ProtectDivines;
}
}
defaultproperties
defaultproperties
{
{
TDAMAGE = 0
TDAMAGE = 0