コード例 #1
0
 private void Awake()
 {
     healthMaster          = GetComponent <LivingHealthMasterBase>();
     playerScript          = GetComponent <PlayerScript>();
     objectBehaviour       = GetComponent <ObjectBehaviour>();
     healthStateController = GetComponent <HealthStateController>();
 }
コード例 #2
0
        protected void AnnounceJointDislocationEvent(LivingHealthMasterBase healthMaster, BodyPart containedIn)
        {
            if (healthMaster == null)
            {
                healthMaster = HealthMaster;
            }
            if (containedIn == null)
            {
                containedIn = ContainedIn;
            }
            PlayerScript script = healthMaster.playerScript;

            if (IsSurface)
            {
                Chat.AddActionMsgToChat(healthMaster.gameObject,
                                        $"Your {BodyPartReadableName} dislocates from it's place!",
                                        $"{script.visibleName}'s {BodyPartReadableName} becomes visibly out of place!");
            }
            else
            {
                Chat.AddActionMsgToChat(healthMaster.gameObject,
                                        $"You wince and hold on to your {BodyPartReadableName} as it dislocates from your " +
                                        $"{containedIn.gameObject.ExpensiveName()}.",
                                        $"{script.visibleName} holds onto " +
                                        $"{script.characterSettings.TheirPronoun(script)} {containedIn.gameObject.ExpensiveName()} in pain.");
            }
        }
コード例 #3
0
        protected void AnnounceJointHealEvent(LivingHealthMasterBase healthMaster, BodyPart containedIn)
        {
            if (healthMaster == null)
            {
                healthMaster = HealthMaster;
            }
            if (containedIn == null)
            {
                containedIn = ContainedIn;
            }
            PlayerScript script = healthMaster.playerScript;

            if (IsSurface)
            {
                Chat.AddActionMsgToChat(healthMaster.gameObject,
                                        $"Your {BodyPartReadableName} pops back into place!",
                                        $"{script.visibleName}'s {BodyPartReadableName} returns to it's original state!");
            }
            else
            {
                Chat.AddActionMsgToChat(healthMaster.gameObject,
                                        $"You scream out loud as your {BodyPartReadableName} pops back into place.",
                                        $"{script.visibleName} screams out in pain as " +
                                        $"a loud crack can be heard from {script.characterSettings.TheirPronoun(script)} {containedIn.gameObject.ExpensiveName()}.");
            }
        }
コード例 #4
0
ファイル: Limb.cs プロジェクト: Unity-Marines/Unity-Marines
 public override void HealthMasterSet(LivingHealthMasterBase livingHealth)
 {
     bodyPart                 = GetComponent <BodyPart>();
     playerHealth             = bodyPart.HealthMaster as PlayerHealthV2;
     bodyPart.ModifierChange += ModifierChanged;
     playerHealth.OrNull()?.PlayerMove.AddModifier(this);
 }
コード例 #5
0
 /// <summary>
 /// Removes this body part from its host body system
 /// </summary>
 /// <param name="livingHealthMasterBase">Body to be removed from</param>
 public virtual void RemovedFromBody(LivingHealthMasterBase livingHealthMasterBase)
 {
     SubBodyPartRemoved(this);
     foreach (var bodyPartModification in BodyPartModifications)
     {
         bodyPartModification.RemovedFromBody(livingHealthMasterBase);
     }
 }
コード例 #6
0
 /// <summary>
 /// Removes this body part from its host body system
 /// </summary>
 /// <param name="livingHealthMasterBase">Body to be removed from</param>
 public virtual void RemovedFromBody(LivingHealthMasterBase livingHealthMasterBase)
 {
     SubBodyPartRemoved(this);
     foreach (var organ in OrganList)
     {
         organ.RemovedFromBody(livingHealthMasterBase);
     }
 }
コード例 #7
0
ファイル: ImplantBase.cs プロジェクト: ewy0/unitystation
        public virtual void ImplantUpdate(LivingHealthMasterBase healthMaster)
        {
            foreach (ImplantProperty prop in properties)
            {
                //prop.ImplantUpdate(this, healthMaster);
            }

            bloodReagentStored -= Time.deltaTime * bloodReagentConsumed;
        }
コード例 #8
0
        public override void RemovedFromBody(LivingHealthMasterBase livingHealthMasterBase)
        {
            var dynamicItemStorage = livingHealthMasterBase.GetComponent <DynamicItemStorage>();

            if (dynamicItemStorage != null)
            {
                dynamicItemStorage.Remove(this);
            }
        }
コード例 #9
0
        public override void RemovedFromBody(LivingHealthMasterBase livingHealthMasterBase)
        {
            StartCoroutine(RelatedStorageAddRemove(false, livingHealthMasterBase));
            var dynamicItemStorage = livingHealthMasterBase.GetComponent <DynamicItemStorage>();

            if (dynamicItemStorage != null)
            {
                dynamicItemStorage.Remove(this);
            }
        }
コード例 #10
0
ファイル: BodyFat.cs プロジェクト: ZeroDayDaemon/unitystation
        public override void RemovedFromBody(LivingHealthMasterBase livingHealth)
        {
            base.RemovedFromBody(livingHealth);
            var playerHealthV2 = livingHealth as PlayerHealthV2;

            if (playerHealthV2 != null)
            {
                playerHealthV2.PlayerMove.RemoveModifier(this);
            }
        }
コード例 #11
0
 public override void HealthMasterSet(LivingHealthMasterBase livingHealth)
 {
     if (InitialFatSpawned == false)
     {
         var Added = Spawn.ServerPrefab(BodyFatToInstantiate.gameObject).GameObject.GetComponent <BodyFat>();
         BodyFats.Add(Added);
         Added.RelatedStomach = this;
         RelatedPart.OrganStorage.ServerTryAdd(Added.gameObject);
     }
 }
コード例 #12
0
        public override void HealthMasterSet(LivingHealthMasterBase livingHealth)
        {
            base.HealthMasterSet(livingHealth);
            var playerHealthV2 = RelatedPart.HealthMaster as PlayerHealthV2;

            if (playerHealthV2 != null)
            {
                playerHealthV2.PlayerMove.AddModifier(this);
            }
        }
コード例 #13
0
 public void TakeBluntLogic(LivingHealthMasterBase healthmaster, BodyPart containedIn)
 {
     if (currentBluntDamageLevel == TraumaDamageLevel.SMALL && DMMath.Prob(dislocationAutoHealPercent))
     {
         currentBluntDamageLevel = TraumaDamageLevel.NONE;
         AnnounceJointHealEvent(healthmaster, containedIn);
         return;
     }
     currentBluntDamageLevel += 1;
     AnnounceJointDislocationEvent(healthmaster, containedIn);
 }
コード例 #14
0
        private IEnumerator RelatedStorageAddRemove(bool ToAdd, LivingHealthMasterBase livingHealthMasterBase)
        {
            yield return(null);

            if (ToAdd)
            {
                RelatedStorage.ServerAddObserverPlayer(livingHealthMasterBase.gameObject);
            }
            else
            {
                RelatedStorage.ServerRemoveObserverPlayer(livingHealthMasterBase.gameObject);
            }
        }
コード例 #15
0
        public void SetHealthMaster(LivingHealthMasterBase livingHealth)
        {
            HealthMaster = livingHealth;
            if (livingHealth)
            {
                playerSprites = livingHealth.GetComponent <PlayerSprites>();
            }

            if (BodySpriteSet == false)
            {
                //If gendered part then set the sprite limb data to it
                if (isDimorphic)
                {
                    LimbSpriteData             = new ListSpriteDataSOWithOrder();
                    LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder;
                    LimbSpriteData.Sprites     = BodyTypesSprites.BodyTypes[(int)HealthMaster.BodyType].Sprites;
                }
                else
                {
                    LimbSpriteData             = new ListSpriteDataSOWithOrder();
                    LimbSpriteData.SpriteOrder = BodyTypesSprites.SpriteOrder;
                    if (BodyTypesSprites.BodyTypes.Count > 0)
                    {
                        LimbSpriteData.Sprites = BodyTypesSprites.BodyTypes[(int)BodyType.NonBinary].Sprites;
                    }
                }

                BodySpriteSet = true;
            }


            UpdateIcons();
            SetUpSystemsThis();

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

            if (dynamicItemStorage != null)
            {
                var bodyPartUISlots = GetComponent <BodyPartUISlots>();
                if (bodyPartUISlots != null)
                {
                    dynamicItemStorage.Add(bodyPartUISlots);
                }
            }


            //TODO Make this generic \/ for mobs
            OrganStorage.SetRegisterPlayer(HealthMaster?.GetComponent <RegisterPlayer>());
        }
コード例 #16
0
 private void RemoveSprites(PlayerSprites sprites, LivingHealthMasterBase livingHealth)
 {
     for (var i = RelatedPresentSprites.Count - 1; i >= 0; i--)
     {
         var bodyPartSprite = RelatedPresentSprites[i];
         if (IsSurface)
         {
             sprites.SurfaceSprite.Remove(bodyPartSprite);
         }
         RelatedPresentSprites.Remove(bodyPartSprite);
         sprites.Addedbodypart.Remove(bodyPartSprite);
         Destroy(bodyPartSprite.gameObject);
     }
     livingHealth.InternalNetIDs.Remove(intName);
 }
コード例 #17
0
        /// <summary>
        /// Body part was added to the body
        /// </summary>
        public void BodyPartAdded(LivingHealthMasterBase livingHealth)
        {
            livingHealth.BodyPartList.Add(this);
            SetHealthMaster(livingHealth);
            livingHealth.ServerCreateSprite(this);

            //legs and arms getting ready to affect speed
            if (TryGetComponent <Limb>(out var limb))
            {
                limb.Initialize();
            }

            //TODO: horrible, remove -- organ prefabs have bodyparts
            foreach (var organ in OrganList)
            {
                var organBodyPart = organ.GetComponent <BodyPart>();
                livingHealth.ServerCreateSprite(organBodyPart);
            }
        }
コード例 #18
0
        private void RemoveSprites(PlayerSprites sprites, LivingHealthMasterBase livingHealth)
        {
            for (var i = RelatedPresentSprites.Count - 1; i >= 0; i--)
            {
                var bodyPartSprite = RelatedPresentSprites[i];
                if (IsSurface || BodyPartItemInheritsSkinColor)
                {
                    sprites.SurfaceSprite.Remove(bodyPartSprite);
                }

                RelatedPresentSprites.Remove(bodyPartSprite);
                sprites.Addedbodypart.Remove(bodyPartSprite);
                SpriteHandlerManager.UnRegisterHandler(sprites.GetComponent <NetworkIdentity>(),
                                                       bodyPartSprite.baseSpriteHandler);
                Destroy(bodyPartSprite.gameObject);
            }

            livingHealth.InternalNetIDs.Remove(intName);
        }
コード例 #19
0
        /// <summary>
        /// Body part was added to the body
        /// </summary>
        public void BodyPartAddHealthMaster(LivingHealthMasterBase livingHealth)
        {
            if (livingHealth.BodyPartList.Contains(this) == false)
            {
                livingHealth.BodyPartList.Add(this);
            }

            SetHealthMaster(livingHealth);
            livingHealth.ServerCreateSprite(this);

            foreach (var organ in OrganList)
            {
                organ.HealthMasterSet(HealthMaster);
            }

            foreach (var organ in containBodyParts)
            {
                organ.BodyPartAddHealthMaster(livingHealth);
            }
        }
コード例 #20
0
        void Awake()
        {
            healthMaster = GetComponentInParent <LivingHealthMasterBase>();
            foreach (BodyPartSprites b in GetComponentsInParent <BodyPartSprites>())
            {
                if (b.BodyPartType.Equals(BodyPartType))
                {
                    Debug.Log(b);
                }

                //TODO: Do we need to add listeners for implant removal
            }

            if (Storage == null)
            {
                Storage = GetComponent <ItemStorage>();
            }

            Storage.ServerInventoryItemSlotSet += ImplantAdded;
        }
コード例 #21
0
 private void Awake()
 {
     healthMaster = GetComponent <LivingHealthMasterBase>();
     AddFreshBlood(ReadyBloodPool, 5);
 }
コード例 #22
0
ファイル: BodyPart.cs プロジェクト: Zeropol/unitystation
 /// <summary>
 /// Removes this body part from its host body system
 /// </summary>
 /// <param name="livingHealthMasterBase">Body to be removed from</param>
 public virtual void RemovedFromBody(LivingHealthMasterBase livingHealthMasterBase)
 {
     SubBodyPartRemoved(this);
 }
コード例 #23
0
ファイル: Brain.cs プロジェクト: Unity-Marines/Unity-Marines
        //Ensure removal of brain

        public override void RemovedFromBody(LivingHealthMasterBase livingHealth)
        {
            livingHealth.brain = null;
        }
コード例 #24
0
        //Ensure removal of brain

        public override void HealthMasterSet(LivingHealthMasterBase livingHealth)
        {
            livingHealth.Setbrain(this);
        }
コード例 #25
0
ファイル: ImplantBase.cs プロジェクト: ewy0/unitystation
 public virtual void AddedToBody(LivingHealthMasterBase livingHealthMasterBase)
 {
 }
コード例 #26
0
 public void OnSpawnServer(SpawnInfo info)
 {
     healthMaster  = GetComponentInParent <LivingHealthMasterBase>();
     PlayerSprites = GetComponentInParent <PlayerSprites>();
 }
コード例 #27
0
 public override void RemovedFromBody(LivingHealthMasterBase livingHealth)
 {
     base.RemovedFromBody(livingHealth);
     BodyFats.Clear();
 }
コード例 #28
0
 public virtual void HealthMasterSet(LivingHealthMasterBase livingHealth)
 {
 }
コード例 #29
0
 private void Awake()
 {
     CurrentHealthDollStorage.DollStates = new List <HealthDollStorage.HealthDollState>();
     livingHealthMasterBase = GetComponent <LivingHealthMasterBase>();
     overallHealthSync      = livingHealthMasterBase.MaxHealth;
 }
コード例 #30
0
 public virtual void RemovedFromBody(LivingHealthMasterBase livingHealth)
 {
 }