/annoy should work correctly now.
/annoy's loop has a check to make sure player hasn't changed in the mean time (hopefully what I'm doing is thread-safe)
This commit is contained in:
parent
e5a725a513
commit
5d7c38817a
2 changed files with 8 additions and 7 deletions
|
|
@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.2.6.0813")]
|
[assembly: AssemblyVersion("3.2.6.0815")]
|
||||||
[assembly: AssemblyFileVersion("3.2.6.0813")]
|
[assembly: AssemblyFileVersion("3.2.6.0815")]
|
||||||
|
|
|
||||||
|
|
@ -309,11 +309,12 @@ namespace TShockAPI
|
||||||
if (Main.player[i] != null & Main.player[i].active && i != Index)
|
if (Main.player[i] != null & Main.player[i].active && i != Index)
|
||||||
player = i;
|
player = i;
|
||||||
SendMessage("You are now being annoyed.", Color.Red);
|
SendMessage("You are now being annoyed.", Color.Red);
|
||||||
var oriinv = Main.player[0].inventory[player];
|
var oriinv = Main.player[player].inventory[0];
|
||||||
while ((DateTime.UtcNow - launch).TotalSeconds < time2)
|
var startname = Name;
|
||||||
|
while ((DateTime.UtcNow - launch).TotalSeconds < time2 && startname == Name)
|
||||||
{
|
{
|
||||||
Main.player[0].inventory[player].SetDefaults("Whoopie Cushion");
|
Main.player[player].inventory[0].SetDefaults("Whoopie Cushion");
|
||||||
Main.player[0].inventory[player].stack = 1;
|
Main.player[player].inventory[0].stack = 1;
|
||||||
SendData(PacketTypes.PlayerSlot, "Whoopie Cushion", player, 0f);
|
SendData(PacketTypes.PlayerSlot, "Whoopie Cushion", player, 0f);
|
||||||
Main.player[player].position = TPlayer.position;
|
Main.player[player].position = TPlayer.position;
|
||||||
Main.player[player].selectedItem = 0;
|
Main.player[player].selectedItem = 0;
|
||||||
|
|
@ -324,7 +325,7 @@ namespace TShockAPI
|
||||||
SendData(PacketTypes.PlayerUpdate, number: player);
|
SendData(PacketTypes.PlayerUpdate, number: player);
|
||||||
Thread.Sleep(50);
|
Thread.Sleep(50);
|
||||||
}
|
}
|
||||||
Main.player[0].inventory[0] = oriinv;
|
Main.player[player].inventory[0] = oriinv;
|
||||||
SendData(PacketTypes.PlayerSlot, oriinv.name, player, 0f);
|
SendData(PacketTypes.PlayerSlot, oriinv.name, player, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue