Exemplo n.º 1
0
    protected override void Gib()
    {
        EffectsFactory.BloodSplat(transform.position, BloodSplatSize.large, bloodColor);
        //drop clothes, gib... but don't destroy actual player, a piece should remain

        //drop everything
        foreach (var slot in itemStorage.GetItemSlots())
        {
            Inventory.ServerDrop(slot);
        }

        if (!playerMove.PlayerScript.IsGhost)
        {         //dirty way to follow gibs. change this when implementing proper gibbing, perhaps make it follow brain
            var gibsToFollow = MatrixManager.GetAt <RawMeat>(transform.position.CutToInt(), true);
            if (gibsToFollow.Count > 0)
            {
                var gibs = gibsToFollow[0];
                FollowCameraMessage.Send(gameObject, gibs.gameObject);
                var gibsIntegrity = gibs.GetComponent <Integrity>();
                if (gibsIntegrity != null)
                {                       //Stop cam following gibs if they are destroyed
                    gibsIntegrity.OnWillDestroyServer.AddListener(x => FollowCameraMessage.Send(gameObject, null));
                }
            }
        }
        playerMove.PlayerScript.pushPull.VisibleState = false;
    }
Exemplo n.º 2
0
    private void LoseBlood(float amount)
    {
        if (amount <= 0)
        {
            return;
        }
        Logger.LogTraceFormat("{0} lost blood: {1}->{2}", Category.Health, this.gameObject.name, BloodLevel, BloodLevel - amount);
        BloodLevel -= amount;
        BloodSplatSize scaleOfTragedy;

        if (amount > 0 && amount < 15)
        {
            scaleOfTragedy = BloodSplatSize.small;
        }
        else if (amount >= 15 && amount < 40)
        {
            scaleOfTragedy = BloodSplatSize.medium;
        }
        else
        {
            scaleOfTragedy = BloodSplatSize.large;
        }


        EffectsFactory.BloodSplat(transform.position, scaleOfTragedy, bloodSplatColor);
    }
Exemplo n.º 3
0
    protected override void OnDeathActions()
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            ConnectedPlayer player = PlayerList.Instance.Get(gameObject);

            string killerName = null;
            if (LastDamagedBy != null)
            {
                killerName = PlayerList.Instance.Get(LastDamagedBy)?.Name;
            }

            if (killerName == null)
            {
                killerName = "Stressful work";
            }

            string playerName = player?.Name ?? "dummy";
            if (killerName == playerName)
            {
                Chat.AddActionMsgToChat(gameObject, "You committed suicide, what a waste.", $"{playerName} committed suicide.");
            }
            else if (killerName.EndsWith(playerName))
            {
                // chain reactions
                Chat.AddActionMsgToChat(gameObject, $" You screwed yourself up with some help from {killerName}",
                                        $"{playerName} screwed himself up with some help from {killerName}");
            }
            else
            {
                PlayerList.Instance.TrackKill(LastDamagedBy, gameObject);
            }

            //drop items in hand
            if (itemStorage != null)
            {
                Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.leftHand));
                Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.rightHand));
            }

            if (isServer)
            {
                EffectsFactory.BloodSplat(transform.position, BloodSplatSize.large, bloodColor);
                string descriptor = null;
                if (player != null)
                {
                    descriptor = player?.Script?.characterSettings?.PossessivePronoun();
                }

                if (descriptor == null)
                {
                    descriptor = "their";
                }

                Chat.AddLocalMsgToChat($"<b>{playerName}</b> seizes up and falls limp, {descriptor} eyes dead and lifeless...", (Vector3)registerPlayer.WorldPositionServer);
            }

            PlayerDeathMessage.Send(gameObject);
        }
    }
Exemplo n.º 4
0
        protected override void Gib()
        {
            Death();
            EffectsFactory.BloodSplat(RegisterTile.WorldPositionServer, BloodSplatSize.large, BloodSplatType.red);
            //drop clothes, gib... but don't destroy actual player, a piece should remain

            //drop everything
            foreach (var slot in itemStorage.GetItemSlots())
            {
                Inventory.ServerDrop(slot);
            }

            PlayerMove.PlayerScript.pushPull.VisibleState = false;
            playerNetworkActions.ServerSpawnPlayerGhost();
        }
Exemplo n.º 5
0
    protected override void OnDeathActions()
    {
        if (CustomNetworkManager.Instance._isServer)
        {
            PlayerNetworkActions pna = gameObject.GetComponent <PlayerNetworkActions>();
            PlayerMove           pm  = gameObject.GetComponent <PlayerMove>();

            ConnectedPlayer player = PlayerList.Instance.Get(gameObject);

            string killerName = "Stressful work";
            if (LastDamagedBy != null)
            {
                killerName = PlayerList.Instance.Get(LastDamagedBy).Name;
            }

            string playerName = player.Name ?? "dummy";
            if (killerName == playerName)
            {
                Chat.AddActionMsgToChat(gameObject, "You committed suicide, what a waste.", $"{playerName} committed suicide.");
            }
            else if (killerName.EndsWith(playerName))
            {
                // chain reactions
                Chat.AddActionMsgToChat(gameObject, $" You screwed yourself up with some help from {killerName}",
                                        $"{playerName} screwed himself up with some help from {killerName}");
            }
            else
            {
                PlayerList.Instance.TrackKill(LastDamagedBy, gameObject);
            }

            //drop items in hand
            Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.leftHand));
            Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.rightHand));

            if (isServer)
            {
                EffectsFactory.BloodSplat(transform.position, BloodSplatSize.large, bloodColor);
            }

            PlayerDeathMessage.Send(gameObject);
        }
    }
Exemplo n.º 6
0
 public void PaintBlood(Vector3Int worldPosInt, ReagentMix reagents)
 {
     EffectsFactory.BloodSplat(worldPosInt, reagents);
     BloodDry(worldPosInt);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Actions the server performs when the player dies
        /// </summary>
        protected override void OnDeathActions()
        {
            if (CustomNetworkManager.Instance._isServer)
            {
                ConnectedPlayer player = PlayerList.Instance.Get(gameObject);

                string killerName = null;
                if (LastDamagedBy != null)
                {
                    var lastDamager = PlayerList.Instance.Get(LastDamagedBy);
                    if (lastDamager != null)
                    {
                        killerName = lastDamager.Name;
                        AutoMod.ProcessPlayerKill(lastDamager, player);
                    }
                }

                if (killerName == null)
                {
                    killerName = "stressful work";
                }

                string playerName = player?.Name ?? "dummy";
                if (killerName == playerName)
                {
                    Chat.AddActionMsgToChat(gameObject, "You committed suicide, what a waste.", $"{playerName} committed suicide.");
                }
                else if (killerName.EndsWith(playerName))
                {
                    string themself = null;
                    if (player != null)
                    {
                        themself = player.CharacterSettings?.ThemselfPronoun(player.Script);
                    }
                    if (themself == null)
                    {
                        themself = "themself";
                    }
                    //chain reactions
                    Chat.AddActionMsgToChat(gameObject, $"You screwed yourself up with some help from {killerName}",
                                            $"{playerName} screwed {themself} up with some help from {killerName}");
                }
                else
                {
                    PlayerList.Instance.TrackKill(LastDamagedBy, gameObject);
                }

                //drop items in hand
                if (itemStorage != null)
                {
                    Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.leftHand));
                    Inventory.ServerDrop(itemStorage.GetNamedItemSlot(NamedSlot.rightHand));
                }

                if (isServer)
                {
                    EffectsFactory.BloodSplat(RegisterTile.WorldPositionServer, BloodSplatSize.large, BloodSplatType.red);
                    string their = null;
                    if (player != null)
                    {
                        their = player.CharacterSettings?.TheirPronoun(player.Script);
                    }

                    if (their == null)
                    {
                        their = "their";
                    }

                    Chat.AddLocalMsgToChat($"<b>{player.Name}</b> seizes up and falls limp, {their} eyes dead and lifeless...", gameObject);
                }

                TriggerEventMessage.SendTo(gameObject, EVENT.PlayerDied);
            }
        }