Пример #1
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)
            {
                PostToChatMessage.Send(playerName + " commited suicide", ChatChannel.System);                 //Killfeed
            }
            else if (killerName.EndsWith(playerName))
            {
                // chain reactions
                PostToChatMessage.Send(
                    playerName + " screwed himself up with some help (" + killerName + ")",
                    ChatChannel.System);                     //Killfeed
            }
            else
            {
                PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject);
            }
            pna.DropItem("rightHand");
            pna.DropItem("leftHand");

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

            PlayerDeathMessage.Send(gameObject);
            //syncvars for everyone
            pm.isGhost    = true;
            pm.allowInput = true;
            //consider moving into PlayerDeathMessage.Process()
            pna.RpcSpawnGhost();
            RpcPassBullets(gameObject);

            //FIXME Remove for next demo
            pna.RespawnPlayer(10);
        }
    }
Пример #2
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)
            {
                PostToChatMessage.Send(playerName + " commited suicide", ChatChannel.System);                 //Killfeed
            }
            else if (killerName.EndsWith(playerName))
            {
                // chain reactions
                PostToChatMessage.Send(
                    playerName + " screwed himself up with some help (" + killerName + ")",
                    ChatChannel.System);                     //Killfeed
            }
            else
            {
                PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject);
            }
            pna.DropItem(EquipSlot.rightHand);
            pna.DropItem(EquipSlot.leftHand);

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

            PlayerDeathMessage.Send(gameObject);
        }
    }
Пример #3
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);
            }
            pna.DropItem(EquipSlot.rightHand);
            pna.DropItem(EquipSlot.leftHand);

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

            PlayerDeathMessage.Send(gameObject);
        }
    }
Пример #4
0
    public void Uncuff()
    {
        cuffed = false;

        pna.DropItem(EquipSlot.handcuffs);
    }
Пример #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;
                }

                if (killerName == player.Name)
                {
                    PostToChatMessage.Send(player.Name + " commited suicide", ChatChannel.System);                     //Killfeed
                }
                else if (killerName.EndsWith(player.Name))
                {
                    // chain reactions
                    PostToChatMessage.Send(
                        player.Name + " screwed himself up with some help (" + killerName + ")",
                        ChatChannel.System);                         //Killfeed
                }
                else
                {
                    PlayerList.Instance.UpdateKillScore(LastDamagedBy, gameObject);

                    string departmentKillText = "";
                    if (LastDamagedBy != null)
                    {
                        JobDepartment killerDepartment =
                            SpawnPoint.GetJobDepartment(LastDamagedBy.GetComponent <PlayerScript>().JobType);
                        JobDepartment victimDepartment =
                            SpawnPoint.GetJobDepartment(gameObject.GetComponent <PlayerScript>().JobType);

                        if (killerDepartment == victimDepartment)
                        {
                            departmentKillText = ", losing " + killerDepartment.GetDescription() +
                                                 " 1 point for team killing!";
                        }
                        else
                        {
                            departmentKillText = ", 1 point to " + killerDepartment.GetDescription() + "!";
                        }
                    }

                    //TDM demo killfeed
                    PostToChatMessage.Send(killerName + " has killed " + player.Name + departmentKillText,
                                           ChatChannel.System);

                    //Combat demo killfeed
                    //PostToChatMessage.Send(killerName + " has killed " + gameObject.name, ChatChannel.System);
                }
                pna.DropItem("rightHand");
                pna.DropItem("leftHand");

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

                pna.RpcSpawnGhost();
                pm.isGhost    = true;
                pm.allowInput = true;
                RpcPassBullets(gameObject);
                PlayerDeathMessage.Send(gameObject);

                //FIXME Remove for next demo
                pna.RespawnPlayer(10);
            }
        }
Пример #6
0
    public void Uncuff()
    {
        cuffed = false;

        pna.DropItem("handcuffs");
    }