/// <summary>
        /// Limb bleed logic, continues on until isBleedingExternally is false.
        /// </summary>
        private IEnumerator Bleedout()
        {
            while (isBleedingExternally)
            {
                //Add 1 bleedstack every 10 seconds until the wound is closed
                yield return(WaitFor.Seconds(10f));

                if (IsBleeding == false)
                {
                    continue;
                }

                HealthMaster.OrNull()?.ChangeBleedStacks(1f);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Server only - Tries to remove a body part
        /// </summary>
        public void TryRemoveFromBody(bool beingGibbed = false)
        {
            bool alreadyBleeding = false;

            SetRemovedColor();
            foreach (var bodyPart in HealthMaster.BodyPartList)
            {
                if (bodyPart.BodyPartType == BodyPartType.Chest && alreadyBleeding == false)
                {
                    bodyPart.IsBleeding = true;
                    alreadyBleeding     = true;
                    HealthMaster.ChangeBleedStacks(limbLossBleedingValue);
                }
            }

            DropItemsOnDismemberment(this);


            var bodyPartUISlot     = GetComponent <BodyPartUISlots>();
            var dynamicItemStorage = HealthMaster.GetComponent <DynamicItemStorage>();

            dynamicItemStorage.Remove(bodyPartUISlot);
            //Fixes an error where externally bleeding body parts would continue to try bleeding even after their removal.
            if (IsBleedingExternally)
            {
                StopExternalBleeding();
            }
            //this kills the crab
            if (DeathOnRemoval)
            {
                HealthMaster.Death();
            }
            if (gibsEntireBodyOnRemoval && beingGibbed == false)
            {
                HealthMaster.Gib();
            }
            if (ContainedIn != null)
            {
                ContainedIn.OrganStorage.ServerTryRemove(gameObject);
            }
            else
            {
                HealthMaster.OrNull()?.BodyPartStorage.OrNull()?.ServerTryRemove(gameObject);
            }
        }