46 lines
1.7 KiB
C#
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);
|
|
}*/
|
|
}
|
|
}
|