コード例 #1
0
        /// <summary>
        /// Turns this body part into ash while protecting items inside of that cannot be ashed.
        /// </summary>
        private void AshBodyPart()
        {
            if (currentBurnDamageLevel >= TraumaDamageLevel.CRITICAL)
            {
                if (this.BodyPartType == BodyPartType.Chest || this.BodyPartType == BodyPartType.Head)
                {
                    return;                                                                                                    //TODO is temporary weighting on Trauma discussion
                }
                IEnumerable <ItemSlot> internalItemList = OrganStorage.GetItemSlots();
                foreach (ItemSlot item in internalItemList)
                {
                    Integrity itemObject = item.ItemObject.OrNull()?.GetComponent <Integrity>();
                    if (itemObject != null)                    //Incase this is an empty slot
                    {
                        if (itemObject.Resistances.FireProof || itemObject.Resistances.Indestructable)
                        {
                            Inventory.ServerDrop(item);
                        }
                    }
                }

                _ = Spawn.ServerPrefab(OrganStorage.AshPrefab, HealthMaster.RegisterTile.WorldPosition);
                HealthMaster.DismemberBodyPart(this);
                _ = Despawn.ServerSingle(gameObject);
            }
        }
コード例 #2
0
        public void TakeBluntDamage()
        {
            void TakeBluntLogic(BodyPart bodyPart)
            {
                if (bodyPart.currentBluntDamageLevel == TraumaDamageLevel.SMALL && DMMath.Prob(dislocationAutoHealPercent))
                {
                    bodyPart.currentBluntDamageLevel = TraumaDamageLevel.NONE;
                    AnnounceJointHealEvent();
                    return;
                }
                bodyPart.currentBluntDamageLevel += 1;
                AnnounceJointDislocationEvent();
            }

            foreach (ItemSlot slot in OrganStorage.GetIndexedSlots())
            {
                if (slot.IsEmpty)
                {
                    return;
                }
                if (slot.Item.gameObject.TryGetComponent <BodyPart>(out var bodyPart))
                {
                    if (bodyPart.CanBeBroken)
                    {
                        TakeBluntLogic(bodyPart);
                    }
                }
            }
        }
コード例 #3
0
        public void TakeBluntDamage()
        {
            void TakeBluntLogic(BodyPart bodyPart)
            {
                bodyPart.currentBluntDamageLevel += 1;
                Chat.AddActionMsgToChat(HealthMaster.gameObject,
                                        $"You hear a loud crack from your {BodyPartReadableName}.",
                                        $"A loud crack can be heard from {HealthMaster.playerScript.visibleName}.");
            }

            foreach (ItemSlot slot in OrganStorage.GetIndexedSlots())
            {
                if (slot.IsEmpty)
                {
                    return;
                }
                if (slot.Item.gameObject.TryGetComponent <BodyPart>(out var bodyPart))
                {
                    if (bodyPart.CanBeBroken)
                    {
                        TakeBluntLogic(bodyPart);
                    }
                }
            }
        }
コード例 #4
0
 public void TakeBluntDamage()
 {
     foreach (ItemSlot slot in OrganStorage.GetIndexedSlots())
     {
         if (slot.IsEmpty)
         {
             return;
         }
         if (slot.Item.gameObject.TryGetComponent <BodyPart>(out var bodyPart))
         {
             if (bodyPart.CanBeBroken)
             {
                 bodyPart.TakeBluntLogic(HealthMaster, this);
             }
         }
     }
 }
コード例 #5
0
        /// <summary>
        /// Turns this body part into ash while protecting items inside of that cannot be ashed.
        /// </summary>
        private void AshBodyPart()
        {
            if (currentBurnDamageLevel >= TraumaDamageLevel.CRITICAL)
            {
                IEnumerable <ItemSlot> internalItemList = OrganStorage.GetItemSlots();
                foreach (ItemSlot item in internalItemList)
                {
                    Integrity itemObject = item.ItemObject.OrNull()?.GetComponent <Integrity>();
                    if (itemObject != null)                    //Incase this is an empty slot
                    {
                        if (itemObject.CannotBeAshed || itemObject.Resistances.Indestructable)
                        {
                            Inventory.ServerDrop(item);
                        }
                    }
                    var organ = item.ItemObject.OrNull()?.GetComponent <BodyPart>();
                    if (organ != null)
                    {
                        if (organ.gibsEntireBodyOnRemoval)
                        {
                            HealthMaster.Gib();
                            return;
                        }
                        if (organ.DeathOnRemoval)
                        {
                            HealthMaster.Death();
                        }
                    }
                }
                if (DeathOnRemoval && HealthMaster != null)
                {
                    HealthMaster.Death();
                }

                try
                {
                    _ = Spawn.ServerPrefab(OrganStorage.AshPrefab,
                                           HealthMaster.gameObject.RegisterTile().WorldPosition);
                    _ = Despawn.ServerSingle(this.gameObject);
                }
                catch (NullReferenceException exception)
                {
                    Logger.LogError("Caught a NRE in BodyPartTraumaDamage.AshBodyPart() ", Category.Health);
                }
            }
        }
コード例 #6
0
        public void TakeBluntDamage(float damage)
        {
            void TakeBluntLogic(BodyPart bodyPart)
            {
                bodyPart.health -= damage;
                bodyPart.CheckIfBroken(true);
            }

            foreach (ItemSlot slot in OrganStorage.GetIndexedSlots())
            {
                if (slot.IsEmpty)
                {
                    return;
                }
                if (slot.Item.gameObject.TryGetComponent <BodyPart>(out var bodyPart))
                {
                    if (bodyPart.CanBeBroken)
                    {
                        TakeBluntLogic(bodyPart);
                    }
                }
            }
        }