//////////////// private static void AttemptSoundEmitterPickup(Vector2 worldPos) { if (SoundEmitterItem.AttemptSoundEmitterRemove(worldPos)) { ItemHelpers.CreateItem(Main.LocalPlayer.position, ModContent.ItemType <SoundEmitterItem>(), 1, 16, 16); } }
//////////////// /*public override bool CanRightClick() { * return true; * } * * public override bool ConsumeItem( Player player ) { * SoundEmitterItem.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 = "SoundEmitterPlace_" + player.whoAmI; if (Timers.GetTimerTickDuration(timerName) > 0) { return(base.UseItem(player)); } Timers.SetTimer(timerName, 15, false, () => false); if (this.Def == null) { Main.NewText("Sound Emitter settings must be first specified (click item's button)."); return(base.UseItem(player)); } if (SoundEmitterItem.AttemptSoundEmitterPlacementForCurrentPlayer(this.Def)) { PlayerItemHelpers.RemoveInventoryItemQuantity(player, this.item.type, 1); } else { //SoundEmitterItem.AttemptSoundEmitterToggle( Main.MouseWorld ); } return(base.UseItem(player)); }
private void UpdateForCurrentPlayer() { if (SoundEmitterItem.CanViewSoundEmitters(Main.LocalPlayer, false)) { this.UpdateInterface(); } }
//// private void UpdateInterface() { if (Main.mouseLeft && Main.mouseLeftRelease) { // this.AttemptEmitterToggle( Main.MouseWorld ); } else if (Main.mouseRight && Main.mouseRightRelease) { SoundEmitterItem.AttemptSoundEmitterPickup(Main.MouseWorld); } }