Files
zzz_REBIRTH__Utils/Scripts/MinEvents/MinEventActionDespawnEntity.cs
2025-06-04 16:44:53 +09:30

50 lines
1.7 KiB
C#

//using static RebirthManager;
public class MinEventActionDespawnEntity : MinEventActionTargetedBase
{
public override void Execute(MinEventParams _params)
{
//Log.Out("MinEventActionDespawnEntity-Execute START");
EntityAlive entity = _params.Self as EntityAlive;
if (entity == null)
{
//Log.Out("MinEventActionDespawnEntity-Execute 1");
return;
}
if (entity is EntityTurret)
{
//Log.Out("MinEventActionDespawnEntity-Execute 2");
EntityTurret entityTurret = (EntityTurret)entity;
entity.Buffs.SetCustomVar("$FR_Turret_Temp", 2f);
entity.bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Killed);
}
else
{
//Log.Out("MinEventActionDespawnEntity-Execute 3");
RebirthUtilities.DespawnEntity(entity);
/*entity.bIsChunkObserver = false;
if (entity is EntityNPCRebirth)
{
EntityNPCRebirth npc = (EntityNPCRebirth)entity;
if (npc != null && npc.LeaderUtils.Owner != null)
{
npc.LeaderUtils.Owner.Companions.Remove(npc);
//Log.Out("MinEventActionDespawnEntity-Execute REMOVE HIRE/OWNED ENTITY, hire: " + npc.entityId);
RebirthManager.RemoveHire(npc.entityId, true);
}
}
entity.bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Despawned);*/
}
//Log.Out("MinEventActionDespawnEntity-Execute 4");
}
}