Some changes to projectile cheat detection
(Redigit actually listened to some of Zidonuke's requests)
This commit is contained in:
parent
55d7b78971
commit
e06588a8de
3 changed files with 13 additions and 12 deletions
|
|
@ -1514,15 +1514,15 @@ namespace TShockAPI
|
|||
var dmg = args.Data.ReadInt16();
|
||||
var owner = args.Data.ReadInt8();
|
||||
var type = args.Data.ReadInt8();
|
||||
|
||||
var index = TShock.Utils.SearchProjectile(ident);
|
||||
owner = (byte)args.Player.Index;
|
||||
var index = TShock.Utils.SearchProjectile(ident, owner);
|
||||
|
||||
if (OnNewProjectile(ident, pos, vel, knockback, dmg, owner, type, index))
|
||||
return true;
|
||||
|
||||
if (index > Main.maxProjectiles || index < 0)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (args.Player.Index != owner)
|
||||
|
|
@ -1577,22 +1577,23 @@ namespace TShockAPI
|
|||
{
|
||||
var ident = args.Data.ReadInt16();
|
||||
var owner = args.Data.ReadInt8();
|
||||
|
||||
var index = TShock.Utils.SearchProjectile(ident);
|
||||
owner = (byte)args.Player.Index;
|
||||
var index = TShock.Utils.SearchProjectile(ident, owner);
|
||||
|
||||
if (index > Main.maxProjectiles || index < 0)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
var type = Main.projectile[index].type;
|
||||
|
||||
if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles
|
||||
// Players can no longer destroy projectiles that are not theirs as of 1.1.2
|
||||
/*if (args.Player.Index != Main.projectile[index].owner && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill) // workaround for skeletron prime projectiles
|
||||
{
|
||||
args.Player.Disable("Owner and player ID does not match to kill projectile");
|
||||
args.Player.RemoveProjectile(ident, owner);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (TShock.CheckIgnores(args.Player))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1068,7 +1068,7 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
if (proj.hostile)
|
||||
if (Main.projHostile[type])
|
||||
{
|
||||
//player.SendMessage( proj.name, Color.Yellow);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -705,14 +705,14 @@ namespace TShockAPI
|
|||
return true;
|
||||
}
|
||||
|
||||
public int SearchProjectile(short identity)
|
||||
public int SearchProjectile(short identity, int owner)
|
||||
{
|
||||
for (int i = 0; i < Main.maxProjectiles; i++)
|
||||
{
|
||||
if (Main.projectile[i].identity == identity)
|
||||
if (Main.projectile[i].identity == identity && Main.projectile[i].owner == owner)
|
||||
return i;
|
||||
}
|
||||
return 1001;
|
||||
return 1000;
|
||||
}
|
||||
|
||||
public string SanitizeString(string str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue