Ejemplo n.º 1
0
    public bool ServerTryRemove(GameObject InGameObject, bool Destroy = false, Vector3?DroppedAtWorldPositionOrThrowVector = null,
                                bool Throw = false)
    {
        ItemAttributesV2 item = InGameObject.GetComponent <ItemAttributesV2>();

        if (item == null)
        {
            return(false);
        }
        IEnumerable <ItemSlot> slots = GetItemSlots();

        HealthV2.BodyPart mobHealth = InGameObject.GetComponent <HealthV2.BodyPart>();
        foreach (var slot in slots)
        {
            if (slot.Item.OrNull()?.gameObject == InGameObject)
            {
                if (mobHealth != null)
                {
                    if (mobHealth.CurrentBurnDamageLevel == TraumaDamageLevel.CRITICAL)
                    {
                        _ = Spawn.ServerPrefab(ashPrefab, mobHealth.HealthMaster.gameObject.RegisterTile().WorldPosition);
                        _ = Despawn.ServerSingle(slot.Item.gameObject);
                        return(true);
                    }
                }
                if (Destroy)
                {
                    return(Inventory.ServerDespawn(slot));
                }
                else
                {
                    if (Throw)
                    {
                        if (DroppedAtWorldPositionOrThrowVector != null)
                        {
                            return(Inventory.ServerThrow(slot, DroppedAtWorldPositionOrThrowVector.GetValueOrDefault()));
                        }
                        else
                        {
                            return(Inventory.ServerThrow(slot, Vector2.zero));
                        }
                    }
                    else
                    {
                        if (DroppedAtWorldPositionOrThrowVector != null)
                        {
                            return(Inventory.ServerDrop(slot, DroppedAtWorldPositionOrThrowVector.GetValueOrDefault()));
                        }
                        else
                        {
                            return(Inventory.ServerDrop(slot));
                        }
                    }
                }
            }
        }

        return(false);
    }
Ejemplo n.º 2
0
    public bool ServerTryRemove(GameObject InGameObject, bool Destroy = false)
    {
        ItemAttributesV2 item = InGameObject.GetComponent <ItemAttributesV2>();

        if (item == null)
        {
            return(false);
        }
        IEnumerable <ItemSlot> slots = GetItemSlots();

        HealthV2.BodyPart mobHealth = InGameObject.GetComponent <HealthV2.BodyPart>();
        foreach (var slot in slots)
        {
            if (slot.Item.OrNull()?.gameObject == InGameObject)
            {
                if (mobHealth != null)
                {
                    if (mobHealth.GetCurrentBurnDamage() > mobHealth.BodyPartAshesAboveThisDamage)
                    {
                        _ = Spawn.ServerPrefab(ashPrefab, mobHealth.HealthMaster.gameObject.RegisterTile().WorldPosition);
                        _ = Despawn.ServerSingle(slot.Item.gameObject);
                        return(true);
                    }
                }
                if (Destroy)
                {
                    return(Inventory.ServerDespawn(slot));
                }
                else
                {
                    return(Inventory.ServerDrop(slot));
                }
            }
        }

        return(false);
    }
Ejemplo n.º 3
0
 public override void UnsuccessfulStep(BodyPart OnBodyPart, PositionalHandApply interaction,
                                       Dissectible.PresentProcedure PresentProcedure)
 {
     OnBodyPart.TakeDamage(interaction.UsedObject, HeelStrength * 0.1f, FailAttackType, Affects);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a specified body part contained within this body part container to the host body system.
 /// Called by contained body parts. See BodyPart's "Body Part Storage Methods" for more info
 /// </summary>
 /// <param name="implant">Body Part to be added</param>
 public virtual void SubBodyPartAdded(BodyPart implant)
 {
     SetupSpritesNID(implant);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes a specified body part contained within this body part container from the host body system.
 /// Called by contained body parts. See BodyPart's "Body Part Storage Methods" for more info
 /// </summary>
 /// <param name="implant">Body Part to be removed</param>
 public virtual void SubBodyPartRemoved(BodyPart implant)
 {
     RemoveSpritesNID(implant);
     IsBleeding = true;
 }
Ejemplo n.º 6
0
        public void ServerCheck(SurgeryProcedureBase SurgeryProcedureBase, BodyPart ONBodyPart)
        {
            if (ProcedureInProgress)
            {
                return;                 //Defer to server
            }
            if (BodyPartIsOn != null)
            {
                if (BodyPartIsopen)
                {
                    foreach (var organBodyPart in BodyPartIsOn.ContainBodyParts)
                    {
                        if (organBodyPart == ONBodyPart)
                        {
                            foreach (var Procedure in organBodyPart.SurgeryProcedureBase)
                            {
                                if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                                {
                                    continue;
                                }
                                if (SurgeryProcedureBase == Procedure)
                                {
                                    this.currentlyOn = organBodyPart.gameObject;
                                    this.ThisPresentProcedure.SetupProcedure(this, organBodyPart, Procedure);
                                    return;
                                }
                            }

                            return;
                        }
                    }

                    if (currentlyOn == ONBodyPart.gameObject)
                    {
                        foreach (var Procedure in BodyPartIsOn.SurgeryProcedureBase)
                        {
                            if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                            {
                                if (SurgeryProcedureBase == Procedure)
                                {
                                    this.currentlyOn = currentlyOn;
                                    this.ThisPresentProcedure.SetupProcedure(this, BodyPartIsOn, Procedure);
                                    return;
                                }
                            }
                        }

                        return;
                    }
                }
                else
                {
                    if (ONBodyPart.gameObject == currentlyOn)
                    {
                        foreach (var Procedure in BodyPartIsOn.SurgeryProcedureBase)
                        {
                            if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                            {
                                continue;
                            }
                            if (SurgeryProcedureBase == Procedure)
                            {
                                this.currentlyOn = currentlyOn;
                                this.ThisPresentProcedure.SetupProcedure(this, BodyPartIsOn, Procedure);
                                return;
                            }
                        }

                        return;
                    }
                }
            }
            else
            {
                foreach (var bodyPart in LivingHealthMasterBase.BodyPartList)
                {
                    if (bodyPart == ONBodyPart)
                    {
                        foreach (var Procedure in bodyPart.SurgeryProcedureBase)
                        {
                            if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                            {
                                continue;
                            }
                            if (SurgeryProcedureBase == Procedure)
                            {
                                this.currentlyOn = bodyPart.gameObject;
                                this.ThisPresentProcedure.SetupProcedure(this, bodyPart, Procedure);
                                return;
                            }
                        }
                    }
                }

                if (LivingHealthMasterBase.GetComponent <PlayerSprites>().RaceBodyparts.Base.RootImplantProcedure ==
                    SurgeryProcedureBase)
                {
                    this.currentlyOn = LivingHealthMasterBase.gameObject;
                    this.ThisPresentProcedure.SetupProcedure(this, null, SurgeryProcedureBase);
                }
            }
        }
Ejemplo n.º 7
0
        public void ServerCheck(SurgeryProcedureBase SurgeryProcedureBase, BodyPart ONBodyPart)
        {
            if (ProcedureInProgress == false)             //Defer to server
            {
                if (BodyPartIsOn != null)
                {
                    if (BodyPartIsopen)
                    {
                        foreach (var inBodyPart in BodyPartIsOn.ContainBodyParts)
                        {
                            if (inBodyPart == ONBodyPart)
                            {
                                foreach (var Procedure in inBodyPart.SurgeryProcedureBase)
                                {
                                    if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                                    {
                                        continue;
                                    }
                                    if (SurgeryProcedureBase == Procedure)
                                    {
                                        this.currentlyOn = inBodyPart.gameObject;
                                        this.ThisPresentProcedure.SetupProcedure(this, inBodyPart, Procedure);
                                        return;
                                    }
                                }

                                return;
                            }
                        }

                        if (currentlyOn == ONBodyPart.gameObject)
                        {
                            foreach (var Procedure in BodyPartIsOn.SurgeryProcedureBase)
                            {
                                if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                                {
                                    if (SurgeryProcedureBase == Procedure)
                                    {
                                        this.currentlyOn = currentlyOn;
                                        this.ThisPresentProcedure.SetupProcedure(this, BodyPartIsOn, Procedure);
                                        return;
                                    }
                                }
                            }

                            return;
                        }
                    }
                    else
                    {
                        if (ONBodyPart.gameObject == currentlyOn)
                        {
                            foreach (var Procedure in BodyPartIsOn.SurgeryProcedureBase)
                            {
                                if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                                {
                                    continue;
                                }
                                if (SurgeryProcedureBase == Procedure)
                                {
                                    this.currentlyOn = currentlyOn;
                                    this.ThisPresentProcedure.SetupProcedure(this, BodyPartIsOn, Procedure);
                                    return;
                                }
                            }

                            return;
                        }
                    }
                }
                else
                {
                    foreach (var RouteBody in LivingHealthMasterBase.RootBodyPartContainers)
                    {
                        foreach (var Limb in RouteBody.ContainsLimbs)
                        {
                            if (Limb == ONBodyPart)
                            {
                                foreach (var Procedure in Limb.SurgeryProcedureBase)
                                {
                                    if (Procedure is CloseProcedure || Procedure is ImplantProcedure)
                                    {
                                        continue;
                                    }
                                    if (SurgeryProcedureBase == Procedure)
                                    {
                                        this.currentlyOn = Limb.gameObject;
                                        this.ThisPresentProcedure.SetupProcedure(this, Limb, Procedure);
                                        return;
                                    }
                                }
                            }
                        }
                    }

                    if (LivingHealthMasterBase.GetComponent <PlayerSprites>().RaceBodyparts.Base.RootImplantProcedure ==
                        SurgeryProcedureBase)
                    {
                        this.currentlyOn = LivingHealthMasterBase.gameObject;
                        this.ThisPresentProcedure.SetupProcedure(this, null, SurgeryProcedureBase);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Removes a specified body part contained within this body part container from the host body system.
 /// Called by contained body parts. See BodyPart's "Body Part Storage Methods" for more info
 /// </summary>
 /// <param name="implant">Body Part to be removed</param>
 public virtual void SubBodyPartRemoved(BodyPart implant)
 {
     RemoveSpritesNID(implant);
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     bodyPart = GetComponent <BodyPart>();
 }
Ejemplo n.º 10
0
 public override void FinnishSurgeryProcedure(BodyPart OnBodyPart, HandApply interaction,
                                              Dissectible.PresentProcedure PresentProcedure)
 {
     base.FinnishSurgeryProcedure(OnBodyPart, interaction, PresentProcedure);
     PresentProcedure.ISon.SetBodyPartIsOpen(true, true);
 }
Ejemplo n.º 11
0
 public override void UnsuccessfulStep(BodyPart OnBodyPart, HandApply interaction,
                                       Dissectible.PresentProcedure PresentProcedure)
 {
     base.UnsuccessfulStep(OnBodyPart, interaction, PresentProcedure);
 }
Ejemplo n.º 12
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.");
            }
        }
Ejemplo n.º 13
0
 public virtual void UnsuccessfulStep(BodyPart OnBodyPart, PositionalHandApply interaction,
                                      Dissectible.PresentProcedure PresentProcedure)
 {
 }
Ejemplo n.º 14
0
 public virtual void FinnishSurgeryProcedure(BodyPart OnBodyPart, PositionalHandApply interaction,
                                             Dissectible.PresentProcedure PresentProcedure)
 {
 }
Ejemplo n.º 15
0
 public abstract void ImplantUpdate(BodyPart implant, LivingHealthMasterBase healthMaster);
Ejemplo n.º 16
0
 /// <summary>
 /// Ensures the health master of all sub body parts are the same as their parent, and that the
 /// health master and body part containers know of all contained body parts
 /// </summary>
 /// <param name="implant">Body Part to be initialized</param>
 public void SetUpBodyPart(BodyPart implant)
 {
     implant.HealthMaster = HealthMaster;
     HealthMaster.AddNewImplant(implant);
     SubBodyPartAdded(implant);
 }