コード例 #1
0
 private void RemoveLimbExternalBleeding(LivingHealthMasterBase livingHealth, HandApply interaction)
 {
     foreach (var bodyPart in livingHealth.BodyPartList)
     {
         if (bodyPart.BodyPartType == interaction.TargetBodyPart)
         {
             if (bodyPart.IsBleedingExternally)
             {
                 bodyPart.StopExternalBleeding();
                 if (interaction.Performer.Player().GameObject == interaction.TargetObject.Player().GameObject)
                 {
                     Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                             $"You stopped your {interaction.TargetObject.Player().Script.visibleName}'s bleeding.",
                                             $"{interaction.PerformerPlayerScript.visibleName} stopped their own bleeding from their {interaction.TargetObject.ExpensiveName()}.");
                 }
                 else
                 {
                     Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                             $"You stopped {interaction.TargetObject.Player().Script.visibleName}'s bleeding.",
                                             $"{interaction.PerformerPlayerScript.visibleName} stopped {interaction.TargetObject.Player().Script.visibleName}'s bleeding.");
                 }
             }
         }
     }
 }
コード例 #2
0
        public override void OnPlayerBodyDeserialise(BodyPart Body_Part, string InData,
                                                     LivingHealthMasterBase LivingHealthMasterBase)
        {
            Body_Part.SetCustomisationData = InData;
            var ColourAnd_Selected = JsonConvert.DeserializeObject <ColourAndSelected>(InData);

            ColorUtility.TryParseHtmlString(ColourAnd_Selected.color, out BodyPartColour);
            BodyPartColour.a = 1;
            Body_Part.RelatedPresentSprites[0].baseSpriteHandler.SetColor(BodyPartColour);
            if (ColourAppliesToItemsSprite)
            {
                Body_Part.BodyPartItemSprite.SetColor(BodyPartColour);
            }

            OptionalSprites = OptionalSprites.OrderBy(pcd => pcd.DisplayName == "" ? pcd.name : pcd.DisplayName).ToList();
            if (ColourAnd_Selected.Chosen != 0)
            {
                if (ColourAnd_Selected.Chosen >= OptionalSprites.Count + 1)
                {
                    Body_Part.RelatedPresentSprites[0].baseSpriteHandler.Empty();
                    return;
                }

                Body_Part.RelatedPresentSprites[0].baseSpriteHandler
                .SetSpriteSO(OptionalSprites[ColourAnd_Selected.Chosen - 1]);
                if (AppliesToItemsSprite)
                {
                    Body_Part.BodyPartItemSprite.SetSpriteSO(OptionalSprites[ColourAnd_Selected.Chosen - 1]);
                }
            }
            else
            {
                Body_Part.RelatedPresentSprites[0].baseSpriteHandler.Empty();
            }
        }
コード例 #3
0
    public static void OnPlayerBodyDeserialise(BodyPart Body_Part, RootBodyPartContainer RootBodyPartContainer, string InData,
                                               LivingHealthMasterBase LivingHealthMasterBase)
    {
        dynamic Actual = null;

        if (RootBodyPartContainer != null)
        {
            Actual = RootBodyPartContainer;
        }
        if (Body_Part != null)
        {
            Actual = Body_Part;
        }

        var PreviousOptions = JsonConvert.DeserializeObject <List <bool> >(InData);

        for (int i = 0; i < PreviousOptions.Count; i++)
        {
            if (PreviousOptions[i])
            {
                var spawned = Spawn.ServerPrefab(Body_Part.OptionalOrgans[i].gameObject);
                Actual.Storage.ServerTryAdd(spawned.GameObject);
            }
        }
    }
コード例 #4
0
        /// <summary>
        /// Check if we should trigger due symptoms
        /// </summary>
        private void CheckSymptomOccurence(SicknessAffliction sicknessAffliction, LivingHealthMasterBase playerHealth)
        {
            Sickness sickness = sicknessAffliction.Sickness;

            // Loop on each reached stage to see if a symptom should trigger
            for (int stage = 0; stage < sickness.SicknessStages.Count; stage++)
            {
                if (stage < sicknessAffliction.CurrentStage)
                {
                    float?stageNextOccurence = sicknessAffliction.GetStageNextOccurence(stage);
                    if ((stageNextOccurence != null) && (startedTime > stageNextOccurence))
                    {
                        SicknessStage sicknessStage = sickness.SicknessStages[stage];

                        // Since many symptoms need to be called within the main thread, we invoke it
                        sicknessManager.blockingCollectionSymptoms.Add(new SymptomManifestation(sicknessAffliction, stage, playerHealth));

                        if (sicknessStage.RepeatSymptom)
                        {
                            ScheduleStageSymptom(sicknessAffliction, stage);
                        }
                    }
                }
            }
        }
コード例 #5
0
        private void CreateRecord(LivingHealthMasterBase livingHealth, PlayerScript playerScript)
        {
            var record = new CloningRecord();

            record.UpdateRecord(livingHealth, playerScript);
            cloningRecords.Add(record);
        }
コード例 #6
0
 private void RemoveLimbExternalBleeding(LivingHealthMasterBase targetBodyPart, HandApply interaction)
 {
     foreach (var container in targetBodyPart.RootBodyPartContainers)
     {
         if (container.BodyPartType == interaction.TargetBodyPart)
         {
             foreach (BodyPart limb in container.ContainsLimbs)
             {
                 if (limb.IsBleedingExternally)
                 {
                     limb.StopExternalBleeding();
                     if (interaction.Performer.Player().GameObject == interaction.TargetObject.Player().GameObject)
                     {
                         Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                                 $"You stopped your {interaction.TargetObject.Player().Script.visibleName}'s bleeding.",
                                                 $"{interaction.PerformerPlayerScript.visibleName} stopped their own bleeding from their {interaction.TargetObject.ExpensiveName()}.");
                     }
                     else
                     {
                         Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                                 $"You stopped {interaction.TargetObject.Player().Script.visibleName}'s bleeding.",
                                                 $"{interaction.PerformerPlayerScript.visibleName} stopped {interaction.TargetObject.Player().Script.visibleName}'s bleeding.");
                     }
                 }
             }
         }
     }
 }
コード例 #7
0
 protected void HurtFeet(LivingHealthMasterBase health)
 {
     if (ignoresFootwear == false)
     {
         foreach (var slot in health.playerScript.DynamicItemStorage.GetNamedItemSlots(NamedSlot.feet))
         {
             if (slot.IsEmpty == false)
             {
                 //Check if the footwear we have on has any protective traits against the floor hazard.
                 if (slot.ItemAttributes.GetTraits().Any(trait => protectiveItemTraits.Contains(trait)))
                 {
                     return;
                 }
             }
         }
     }
     if (hurtsOneFootOnly)
     {
         ApplyDamageToPartyType(health, limbsToHurt.PickRandom());
         return;
     }
     foreach (BodyPart limb in health.BodyPartList)
     {
         if (!limbsToHurt.Contains(limb.BodyPartType))
         {
             continue;
         }
         ApplyDamageToPartyType(health, limb.BodyPartType);
     }
 }
コード例 #8
0
 /// <summary>
 /// Things to trigger for attached items if found + hurting peoples hands.
 /// </summary>
 /// <param name="health"></param>
 public void TriggerTrapFromContainer(LivingHealthMasterBase health)
 {
     if (health != null)
     {
         HurtHand(health);
     }
     //TODO : Add the ability to attach items to mousetraps and trigger them.
 }
コード例 #9
0
        protected override void ActOnLivingV2(Vector3 dir, LivingHealthMasterBase healthBehaviour)
        {
            var ctc = healthBehaviour.connectionToClient;
            var rtt = healthBehaviour.RTT;
            var pos = healthBehaviour.RegisterTile.WorldPositionServer;

            _ = AttackFleshRoutine(dir, null, healthBehaviour, pos, ctc, rtt);
        }
コード例 #10
0
        public virtual void OnStep(GameObject eventData)
        {
            LivingHealthMasterBase health = eventData.GetComponent <LivingHealthMasterBase>();

            HurtFeet(health);             //Moving this to it's own function to keep things clean.
            //Text and Audio feedback.
            Chat.AddActionMsgToChat(gameObject, $"You step on the {gameObject.ExpensiveName()}!",
                                    $"{health.playerScript.visibleName} steps on the {gameObject.ExpensiveName()}!");
            PlayStepAudio();
        }
コード例 #11
0
 protected void HealTraumaDamage(LivingHealthMasterBase livingHealthMasterBase, HandApply interaction)
 {
     if (livingHealthMasterBase.HasTraumaDamage(interaction.TargetBodyPart))
     {
         livingHealthMasterBase.HealTraumaDamage(TraumaDamageToHeal, interaction.TargetBodyPart, TraumaTypeToHeal);
         Chat.AddActionMsgToChat(interaction,
                                 $"You apply the {gameObject.ExpensiveName()} to {livingHealthMasterBase.playerScript.visibleName}",
                                 $"{interaction.Performer.ExpensiveName()} applies {name} to {livingHealthMasterBase.playerScript.visibleName}.");
     }
 }
コード例 #12
0
ファイル: Horn.cs プロジェクト: AlexTheM8/unitystation
    private IEnumerator CritHonk(PositionalHandApply clickData, LivingHealthMasterBase livingHealth)
    {
        yield return(WaitFor.Seconds(0.02f));

        AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: -1f);         //This plays it backwards, is that what you wanted?
        ShakeParameters       shakeParameters       = new ShakeParameters(true, 20, 5);

        SoundManager.PlayNetworkedAtPos(CommonSounds.Instance.ClownHonk, gameObject.AssumedWorldPosServer(), audioSourceParameters, true, sourceObj: GetHonkSoundObject(), shakeParameters: shakeParameters);
        livingHealth.ApplyDamageToBodyPart(clickData.Performer, CritDamage, AttackType.Energy, DamageType.Brute, BodyPartType.Head);
    }
コード例 #13
0
    private void ServerSelfHeal(GameObject originator, LivingHealthMasterBase livingHealthMasterBase, HandApply interaction)
    {
        void ProgressComplete()
        {
            ServerApplyHeal(livingHealthMasterBase, interaction);
        }

        StandardProgressAction.Create(ProgressConfig, ProgressComplete)
        .ServerStartProgress(originator.RegisterTile(), 5f, originator);
    }
コード例 #14
0
 protected bool CheckForBleedingBodyContainers(LivingHealthMasterBase livingHealth, HandApply interaction)
 {
     foreach (var bodyPart in livingHealth.BodyPartList)
     {
         if (bodyPart.BodyPartType == interaction.TargetBodyPart && bodyPart.IsBleeding == true)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #15
0
 protected bool CheckForBleedingBodyContainers(LivingHealthMasterBase targetBodyPart, HandApply interaction)
 {
     foreach (var container in targetBodyPart.RootBodyPartContainers)
     {
         if (container.BodyPartType == interaction.TargetBodyPart && container.IsBleeding == true)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #16
0
 public void UpdateRecord(LivingHealthMasterBase livingHealth, PlayerScript playerScript)
 {
     mobID             = livingHealth.mobID;
     mind              = playerScript.mind;
     name              = playerScript.playerName;
     characterSettings = playerScript.characterSettings;
     oxyDmg            = livingHealth.GetOxyDamage();
     burnDmg           = livingHealth.GetTotalBurnDamage();
     toxinDmg          = 0;
     bruteDmg          = livingHealth.GetTotalBruteDamage();
     uniqueIdentifier  = "35562Eb18150514630991";
 }
コード例 #17
0
 protected void RemoveLimbLossBleed(LivingHealthMasterBase livingHealth, HandApply interaction)
 {
     foreach (var bodyPart in livingHealth.BodyPartList)
     {
         if (bodyPart.BodyPartType == interaction.TargetBodyPart && bodyPart.IsBleeding == true)
         {
             bodyPart.IsBleeding = false;
             Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                     $"You stopped {interaction.TargetObject.ExpensiveName()}'s bleeding.",
                                     $"{interaction.PerformerPlayerScript.visibleName} stopped {interaction.TargetObject.ExpensiveName()}'s bleeding.");
         }
     }
 }
コード例 #18
0
        public static void PlayerBodyDeserialise(BodyPart Body_Part, string InData, LivingHealthMasterBase LivingHealthMasterBase)
        {
            var PreviousOptions = JsonConvert.DeserializeObject <List <bool> >(InData);

            for (int i = 0; i < PreviousOptions.Count; i++)
            {
                if (PreviousOptions[i])
                {
                    var spawned = Spawn.ServerPrefab(Body_Part.OptionalOrgans[i].gameObject);
                    LivingHealthMasterBase.BodyPartStorage.ServerTryAdd(spawned.GameObject);
                }
            }
        }
コード例 #19
0
 private void ServerApplyHeal(LivingHealthMasterBase targetBodyPart, HandApply interaction)
 {
     targetBodyPart.HealDamage(null, 40, healType, interaction.TargetBodyPart);
     if (StopsExternalBleeding)
     {
         RemoveLimbLossBleed(targetBodyPart, interaction);
     }
     if (HealsTraumaDamage)
     {
         HealTraumaDamage(targetBodyPart, interaction);
     }
     stackable.ServerConsume(1);
 }
コード例 #20
0
 protected void RemoveLimbLossBleed(LivingHealthMasterBase targetBodyPart, HandApply interaction)
 {
     foreach (var container in targetBodyPart.RootBodyPartContainers)
     {
         if (container.BodyPartType == interaction.TargetBodyPart && container.IsBleeding == true)
         {
             container.IsBleeding = false;
             Chat.AddActionMsgToChat(interaction.Performer.gameObject,
                                     $"You stopped {interaction.TargetObject.ExpensiveName()}'s bleeding.",
                                     $"{interaction.PerformerPlayerScript.visibleName} stopped {interaction.TargetObject.ExpensiveName()}'s bleeding.");
         }
     }
 }
コード例 #21
0
ファイル: DNAscanner.cs プロジェクト: ewy0/unitystation
 protected override void ServerHandleContentsOnStatusChange(bool willClose)
 {
     base.ServerHandleContentsOnStatusChange(willClose);
     if (ServerHeldPlayers.Any())
     {
         var mob = ServerHeldPlayers.First();
         occupant = mob.GetComponent <LivingHealthMasterBase>();
     }
     else
     {
         occupant = null;
     }
 }
コード例 #22
0
 private bool CanDefibrillate(LivingHealthMasterBase livingHealthMaster, GameObject performer)
 {
     if (livingHealthMaster.brain == null || livingHealthMaster.brain.RelatedPart.Health < -100)
     {
         Chat.AddExamineMsgFromServer(performer, "It appears they're missing their brain or Their brain is too damaged");
         return(false);
     }
     if (livingHealthMaster.IsDead == false)
     {
         Chat.AddExamineMsgFromServer(performer, "The target is alive!");
         return(false);
     }
     return(true);
 }
コード例 #23
0
 private bool CheckForBleedingLimbs(LivingHealthMasterBase livingHealth, HandApply interaction)
 {
     foreach (var bodyPart in livingHealth.BodyPartList)
     {
         if (bodyPart.BodyPartType == interaction.TargetBodyPart)
         {
             if (bodyPart.IsBleedingExternally)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #24
0
 /// <summary>
 /// for triggering traps when inside storage containers
 /// </summary>
 /// <param name="health"></param>
 private void HurtHand(LivingHealthMasterBase health)
 {
     foreach (var hand in health.playerScript.DynamicItemStorage.GetNamedItemSlots(NamedSlot.hands))
     {
         if (ignoresHandwear == false && hand.IsEmpty == false)
         {
             continue;
         }
         ApplyDamageToPartyType(health, handTypes.PickRandom());
     }
     Chat.AddActionMsgToChat(gameObject, $"You are surprised with a {gameObject.ExpensiveName()} biting your hand!",
                             $"{health.playerScript.visibleName} screams in pain and surprise as {gameObject.ExpensiveName()} " +
                             $"bites {health.playerScript.characterSettings.TheirPronoun(health.playerScript)} hand!");
     PlayStepAudio();
 }
コード例 #25
0
ファイル: DNAScanner.cs プロジェクト: Fortune117/unitystation
        private void UpdateState()
        {
            if (closet.IsOpen)
            {
                closet.SetDoor(ClosetControl.Door.Closed);                 // store items on tile
                container.GetStoredObjects().FirstOrDefault(obj => obj.TryGetComponent(out occupant));
            }
            else
            {
                occupant = null;
                closet.SetDoor(ClosetControl.Door.Opened);                 // release contents
            }

            UpdateSprites();
        }
コード例 #26
0
 private bool CheckForBleedingLimbs(LivingHealthMasterBase targetBodyPart, HandApply interaction)
 {
     foreach (var container in targetBodyPart.RootBodyPartContainers)
     {
         if (container.BodyPartType == interaction.TargetBodyPart)
         {
             foreach (BodyPart limb in container.ContainsLimbs)
             {
                 if (limb.IsBleedingExternally)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #27
0
        public static void OnPlayerBodyDeserialise(BodyPart Body_Part, string InData,
                                                   LivingHealthMasterBase LivingHealthMasterBase)
        {
            var PreviousOptions = JsonConvert.DeserializeObject <int>(InData);

            if (PreviousOptions >= Body_Part.OptionalReplacementOrgan.Count)
            {
                return;
            }

            var spawned = Spawn.ServerPrefab(Body_Part.OptionalReplacementOrgan[PreviousOptions].gameObject);
            var Parent  = Body_Part.GetParent();

            if (Parent != null)
            {
                Parent.Storage.ServerTryAdd(spawned.GameObject);
                Parent.Storage.ServerTryRemove(Body_Part.gameObject);
            }
        }
コード例 #28
0
        private void TryFacehug(Vector3 dir, LivingHealthMasterBase player)
        {
            var playerInventory = player.gameObject.GetComponent <PlayerScript>()?.Equipment;

            if (playerInventory == null)
            {
                return;
            }

            string verb;
            bool   success;

            if (HasAntihuggerItem(playerInventory))
            {
                verb    = "tried to hug";
                success = false;
            }
            else
            {
                verb    = "hugged";
                success = true;
            }

            ServerDoLerpAnimation(dir);

            Chat.AddAttackMsgToChat(
                gameObject,
                player.gameObject,
                BodyPartType.Head,
                null,
                verb);

            AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: 1f);

            SoundManager.PlayNetworkedAtPos(bite, player.gameObject.RegisterTile().WorldPositionServer,
                                            audioSourceParameters, true, player.gameObject);

            if (success)
            {
                RegisterPlayer registerPlayer = player.gameObject.GetComponent <RegisterPlayer>();
                Facehug(playerInventory, registerPlayer);
            }
        }
コード例 #29
0
        private void OnStartPlayerCremation()
        {
            var containsConsciousPlayer = false;

            foreach (ObjectBehaviour player in serverHeldPlayers)
            {
                LivingHealthMasterBase playerLHB = player.GetComponent <LivingHealthMasterBase>();
                if (playerLHB.ConsciousState == ConsciousState.CONSCIOUS ||
                    playerLHB.ConsciousState == ConsciousState.BARELY_CONSCIOUS)
                {
                    containsConsciousPlayer = true;
                }
            }

            if (containsConsciousPlayer)
            {
                // This is an incredibly brutal SFX... it also needs chopping up.
                // SoundManager.PlayNetworkedAtPos("ShyguyScream", DrawerWorldPosition, sourceObj: gameObject);
            }
        }
コード例 #30
0
    public void DoHeartBeat(LivingHealthMasterBase healthMaster)
    {
        //If we actually have a circulatory system.
        if (HeartAttack)
        {
            if (SecondsOfRevivePulse < CurrentPulse)
            {
                return;
            }
            var RNGInt = RNGesus.Next(0, 10000);
            if (RNGInt > 9990)
            {
                HeartAttack = false;
            }

            return;
        }

        Heartbeat(RelatedPart.TotalModified);
    }