//////////////// public void GunUseFx(Player player, bool isFiring) { if (isFiring) { SoundLibraries.PlaySound(TMRMod.Instance, "RevolverFire", player.Center, 0.2f); } else { SoundLibraries.PlaySound(TMRMod.Instance, "RevolverDryFire", player.Center, 0.2f); } }
//////////////// public bool AttemptReload(Player player) { int plrWho = player.whoAmI; string result; bool Reload() { Player plr = Main.player[plrWho]; if (!TheMadRangerItem.IsAmmoSourceAvailable(plr, true, out result)) { Main.NewText(result, Color.Yellow); return(false); } this.LoadedRounds = TheMadRangerItem.CylinderCapacity; return(true); } // if (!TheMadRangerItem.IsAmmoSourceAvailable(player, true, out result)) { Main.NewText(result, Color.Yellow); return(false); } var myplayer = player.GetModPlayer <TMRPlayer>(); if (myplayer.GunHandling.IsAnimating) { return(false); } string timerName = SpeedloaderItem.GetReloadingTimerName(plrWho); if (Timers.GetTimerTickDuration(timerName) > 0) { return(false); } SoundLibraries.PlaySound(TMRMod.Instance, "RevolverReloadBegin", player.Center, 0.5f); int duration = TMRConfig.Instance.Get <int>(nameof(TMRConfig.SpeedloaderLoadTickDuration)); Timers.SetTimer(timerName, duration, false, () => { Reload(); return(false); }); return(true); }
/// <summary> /// Begins a gun holstering sequence. Currently ignores all other sequences (needs testing). /// </summary> /// <param name="plr"></param> /// <param name="mygun"></param> public void BeginHolster(Player plr, TheMadRangerItem mygun) { this.HolsterDuration = TMRConfig.Instance.Get <int>(nameof(TMRConfig.HolsterTwirlTickDuration)); this.IsQuickDrawReady = true; if (this.HolsterDuration == 0) { return; } SoundLibraries.PlaySound(TMRMod.Instance, "RevolverTwirl", plr.Center, 0.65f); }
private bool UpdateGround(Gore gore, out bool lockFrames) { lockFrames = false; if (gore.drawOffset.X == 0f) { //Main.NewText("bounce "+gore.GetHashCode()); gore.drawOffset.X = 0.001f; SoundLibraries.PlaySound(TMRMod.Instance, "ShellBounce", gore.position); } int tileX = (int)gore.position.X >> 4; int tileY = (int)gore.position.Y >> 4; Tile tile = Main.tile[tileX, tileY]; if (TileLibraries.IsSolid(tile, false, false)) { if (tile.slope() != 0) { return(false); } tile = Main.tile[tileX, tileY - 1]; if (!TileLibraries.IsSolid(tile, false, false)) { gore.drawOffset.Y = 8f; gore.position.Y -= 16f; } else { return(false); } } gore.rotation = (float)Math.PI * 0.5f; if (gore.velocity.X == 0) { lockFrames = true; gore.frameCounter = 2; } return(true); }
//// public bool InsertRound(Player player, bool playSound = true) { bool hasInserted = false; int initPos = this.CurrentCylinderSlot; do { if (this.CylinderInsertRound()) { hasInserted = true; if (playSound) { SoundLibraries.PlaySound(TMRMod.Instance, "RevolverReloadRound", player.Center, 0.5f); } break; } } while(this.CurrentCylinderSlot != initPos); // full cylinder loop return(hasInserted); }
public void CloseCylinder(Player player) { SoundLibraries.PlaySound(TMRMod.Instance, "RevolverDryFire", player.Center, 0.2f); }
//////////////// public void OpenCylinder(Player player) { SoundLibraries.PlaySound(TMRMod.Instance, "RevolverReloadBegin", player.Center, 0.5f); }
//// public void TransferRoundsOut(Player player) { this.LoadedRounds = 0; SoundLibraries.PlaySound(TMRMod.Instance, "RevolverReloadRound", player.Center, 0.5f); }