コード例 #1
0
        // PlayerLoot.StartLootingItem()
        public static void On_LootingItem(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent <BasePlayer>();
            var        ile    = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource);

            OnNext("On_LootingItem", ile);

            if (ile.Cancel)
            {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason));
            }
        }
コード例 #2
0
        // PlayerLoot.StartLootingPlayer()
        public static void StartLootingPlayer(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent <BasePlayer>();
            var        ple    = new Events.PlayerLootEvent(playerLoot, Server.GetPlayer(looter), Server.GetPlayer(playerLoot.entitySource as BasePlayer));

            OnLootingPlayer.OnNext(ple);

            if (ple.Cancel)
            {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ple.cancelReason));
            }
        }
コード例 #3
0
ファイル: Hooks.cs プロジェクト: Notulp/Pluton.Rust
        /// <summary>
        /// Called from <c>PlayerLoot.StartLootingItem(BasePlayer)</c> .
        /// </summary>
        public static void On_LootingPlayer(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent<BasePlayer>();
            var ple = new PlayerLootEvent(playerLoot,
                                          Server.GetPlayer(looter),
                                          Server.GetPlayer(playerLoot.entitySource as BasePlayer));

            OnNext("On_LootingPlayer", ple);

            if (ple.Cancel) {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add",
                                          0,
                                          String.Format("{0}: {1}",
                                                        Server.server_message_name.ColorText("fa5"),
                                                        ple.cancelReason));
            }
        }
コード例 #4
0
ファイル: Hooks.cs プロジェクト: Viproz/Pluton
        // PlayerLoot.StartLootingItem()
        public static void StartLootingItem(PlayerLoot playerLoot)
        {
            BasePlayer looter = playerLoot.GetComponent<BasePlayer>();
            var ile = new Events.ItemLootEvent(playerLoot, Server.GetPlayer(looter), playerLoot.itemSource);
            OnLootingItem.OnNext(ile);

            if (ile.Cancel) {
                playerLoot.Clear();
                looter.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), ile.cancelReason));
            }
        }