Beispiel #1
0
        public static void ReviveSinglePlayer(ClientSide.Player player)
        {
            GameObject triggerObject = player.DeadTriggerObject;

            if (triggerObject != null && triggerObject.activeSelf)
            {
                RespawnDeadTrigger trigger = triggerObject.GetComponent <RespawnDeadTrigger>();

                // Send revive packet
                PlayerHealed playerHealed = PlayerHealed.Create(GlobalTargets.Others);
                playerHealed.HealingItemId = trigger._healItemId;
                playerHealed.HealTarget    = player.Entity;
                //PacketQueue.Add(playerHealed);
                playerHealed.Send();

                // Set revive trigger inactive
                trigger.SendMessage("SetActive", false);
            }
        }
        protected override void Update()
        {
            try
            {
                if (Menu.Values.Other.InstaRevive && RespawnDeadTrigger != null && RespawnDeadTrigger.activeSelf && RespawnDeadTrigger.GetComponent <RespawnDeadTrigger>() != null)
                {
                    LocalPlayer.Tuts.HideReviveMP();
                    var playerHealed = PlayerHealed.Create(GlobalTargets.Others);
                    playerHealed.HealingItemId = RespawnDeadTrigger.GetComponent <RespawnDeadTrigger>()._healItemId;
                    playerHealed.HealTarget    = entity;
                    playerHealed.Send();
                    RespawnDeadTrigger.SetActive(false);
                }
            }
            catch (Exception e)
            {
                Logger.Exception("Exception while reviving player '{0}'", e, entity?.GetState <IPlayerState>()?.name);
            }

            base.Update();
        }