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."); } } } } }
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(); } }
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); } } }
/// <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); } } } } }
private void CreateRecord(LivingHealthMasterBase livingHealth, PlayerScript playerScript) { var record = new CloningRecord(); record.UpdateRecord(livingHealth, playerScript); cloningRecords.Add(record); }
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."); } } } } } }
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); } }
/// <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. }
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); }
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(); }
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}."); } }
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); }
private void ServerSelfHeal(GameObject originator, LivingHealthMasterBase livingHealthMasterBase, HandApply interaction) { void ProgressComplete() { ServerApplyHeal(livingHealthMasterBase, interaction); } StandardProgressAction.Create(ProgressConfig, ProgressComplete) .ServerStartProgress(originator.RegisterTile(), 5f, originator); }
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); }
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); }
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"; }
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."); } } }
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); } } }
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); }
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."); } } }
protected override void ServerHandleContentsOnStatusChange(bool willClose) { base.ServerHandleContentsOnStatusChange(willClose); if (ServerHeldPlayers.Any()) { var mob = ServerHeldPlayers.First(); occupant = mob.GetComponent <LivingHealthMasterBase>(); } else { occupant = null; } }
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); }
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); }
/// <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(); }
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(); }
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); }
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); } }
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); } }
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); } }
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); }