コード例 #1
0
        public static void Postfix(Humanoid __instance, ItemDrop.ItemData item, Inventory ___m_inventory)
        {
            if (!EquipmentAndQuickSlots.EquipmentSlotsEnabled.Value)
            {
                return;
            }

            if (_shouldDrop)
            {
                _dropping   = true;
                _shouldDrop = false;

                __instance.DropItem(___m_inventory, item, 1);
                _dropping = false;
            }
        }
コード例 #2
0
ファイル: Table.cs プロジェクト: DmitryMI/TileEngine
        public void ApplyItemClient(Item.Item item)
        {
            //Debug.Log("Table was clicked!");

            PlayerActionController controller = PlayerActionController.Current;
            Humanoid localPlayer = controller.LocalPlayerMob as Humanoid;

            if (localPlayer == null)
            {
                return;
            }


            Item.Item heldItem = localPlayer.GetItemBySlot(controller.ActiveHand);

            if (heldItem == item)
            {
                // Calculating item offset
                Vector2 mousePosition = controller.MouseWorldPosition;
                Vector2 tablePosition = transform.position;
                Vector2 offset        = mousePosition - tablePosition;
                localPlayer.DropItem(controller.ActiveHand, Cell, offset);
            }
        }