Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Scripts/Dialog/DialogActionDespawnEntityRebirth.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

46 lines
1.7 KiB
C#

public class DialogActionDespawnEntityRebirth : DialogActionAddBuff
{
public override BaseDialogAction.ActionTypes ActionType => BaseDialogAction.ActionTypes.AddBuff;
public override void PerformAction(EntityPlayer player)
{
var entityId = -1;
if (player.Buffs.HasCustomVar("CurrentNPC"))
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 1");
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
}
if (entityId == -1)
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 2");
return;
}
var myEntity = GameManager.Instance.World.GetEntity(entityId) as EntityNPCRebirth;
if (myEntity == null)
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 3");
return;
}
RebirthUtilities.DespawnEntity(myEntity);
/*player.Companions.Remove(myEntity);
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 5");
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageDespawnEntityRebirth>().Setup(myEntity.entityId), false);
}
else
{
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 6");
////Log.Out("DialogActionDespawnEntityRebirth-PerformAction REMOVE HIRE/OWNED ENTITY, hire: " + myEntity.entityId);
RebirthManager.RemoveHire(myEntity.entityId, true);
myEntity.bWillRespawn = false;
GameManager.Instance.World.RemoveEntity(myEntity.entityId, EnumRemoveEntityReason.Unloaded);
}*/
}
}