////////////////

        private static void AttemptHologramPickup(Vector2 worldPos)
        {
            if (HologramItem.AttemptHologramRemove(worldPos))
            {
                ItemHelpers.CreateItem(Main.LocalPlayer.position, ModContent.ItemType <HologramItem>(), 1, 16, 16);
            }
        }
Ejemplo n.º 2
0
 private void UpdateForCurrentPlayer()
 {
     if (HologramItem.CanViewHolograms(Main.LocalPlayer, false))
     {
         this.UpdateInterface();
     }
 }
        ////////////////

        /*public override bool CanRightClick() {
         *      return true;
         * }
         *
         * public override bool ConsumeItem( Player player ) {
         *      HologramItem.OpenUI( this.item );
         *
         *      return false;
         * }*/


        ////////////////

        public override bool UseItem(Player player)
        {
            if (Main.netMode == NetmodeID.Server || player.whoAmI != Main.myPlayer)
            {
                return(base.UseItem(player));
            }

            string timerName = "HologramPlace_" + player.whoAmI;

            if (Timers.GetTimerTickDuration(timerName) > 0)
            {
                return(base.UseItem(player));
            }
            Timers.SetTimer(timerName, 15, false, () => false);

            if (this.Def == null)
            {
                Main.NewText("Hologram settings must be first set.");
                return(base.UseItem(player));
            }

            if (HologramItem.AttemptHologramPlacementForCurrentPlayer(this.Def))
            {
                PlayerItemHelpers.RemoveInventoryItemQuantity(player, this.item.type, 1);
            }
            else
            {
                //HologramItem.AttemptHologramToggle( Main.MouseWorld );
            }

            return(base.UseItem(player));
        }
Ejemplo n.º 4
0
        ////

        private void UpdateInterface()
        {
            if (Main.mouseLeft && Main.mouseLeftRelease)
            {
                //	this.AttemptHologramToggle( Main.MouseWorld );
            }
            else if (Main.mouseRight && Main.mouseRightRelease)
            {
                HologramItem.AttemptHologramPickup(Main.MouseWorld);
            }
        }