Merge branch 'general-devel' into fix-portal-rangecheck
This commit is contained in:
commit
4ad64ff5c9
5 changed files with 369 additions and 312 deletions
|
|
@ -1308,6 +1308,35 @@ namespace TShockAPI
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Portal Gun Gate projectiles must meet several validation criteria:
|
||||||
|
// 1. The angle must be within valid discrete directions (45 degree increments)
|
||||||
|
// 2. Must have an active PortalGunBolt projectile associated
|
||||||
|
if (type == ProjectileID.PortalGunGate)
|
||||||
|
{
|
||||||
|
// Validate the gate angle is one of 8 possible cardinal directions (every 45 degrees)
|
||||||
|
var wrappedAngle = MathHelper.WrapAngle(ai[0]);
|
||||||
|
var discreteDirection = (int)Math.Round(wrappedAngle / (MathF.PI / 4f));
|
||||||
|
if (discreteDirection is < -3 or > 4)
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from portal gate from {0} (invalid angle: {1})", args.Player.Name, discreteDirection));
|
||||||
|
args.Player.RemoveProjectile(ident, owner);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate we found an active bolt projectile
|
||||||
|
var boltProjectileData = args.Player.RecentlyCreatedProjectiles.FirstOrDefault(p => Main.projectile[p.Index].type == ProjectileID.PortalGunBolt);
|
||||||
|
if (boltProjectileData.Type == 0 || boltProjectileData.Killed)
|
||||||
|
{
|
||||||
|
TShock.Log.ConsoleDebug(GetString("Bouncer / OnNewProjectile rejected from portal gate from {0} (missing active Portal Gun bolt)", args.Player.Name, discreteDirection));
|
||||||
|
args.Player.RemoveProjectile(ident, owner);
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boltProjectileData.Killed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!TShock.Config.Settings.IgnoreProjUpdate && !args.Player.HasPermission(Permissions.ignoreprojectiledetection))
|
if (!TShock.Config.Settings.IgnoreProjUpdate && !args.Player.HasPermission(Permissions.ignoreprojectiledetection))
|
||||||
{
|
{
|
||||||
if (type == ProjectileID.BlowupSmokeMoonlord
|
if (type == ProjectileID.BlowupSmokeMoonlord
|
||||||
|
|
|
||||||
|
|
@ -565,7 +565,7 @@ namespace TShockAPI.DB
|
||||||
permissions.ForEach(p => group.AddPermission(p));
|
permissions.ForEach(p => group.AddPermission(p));
|
||||||
|
|
||||||
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", group.Permissions, name) == 1)
|
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", group.Permissions, name) == 1)
|
||||||
return "Group " + name + " has been modified successfully.";
|
return GetString($"Group {name} has been modified successfully.");
|
||||||
|
|
||||||
// Restore old permissions so DB and internal object are in a consistent state
|
// Restore old permissions so DB and internal object are in a consistent state
|
||||||
group.Permissions = oldperms;
|
group.Permissions = oldperms;
|
||||||
|
|
@ -588,7 +588,7 @@ namespace TShockAPI.DB
|
||||||
permissions.ForEach(p => group.RemovePermission(p));
|
permissions.ForEach(p => group.RemovePermission(p));
|
||||||
|
|
||||||
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", group.Permissions, name) == 1)
|
if (database.Query("UPDATE GroupList SET Commands=@0 WHERE GroupName=@1", group.Permissions, name) == 1)
|
||||||
return "Group " + name + " has been modified successfully.";
|
return GetString($"Group {name} has been modified successfully.");
|
||||||
|
|
||||||
// Restore old permissions so DB and internal object are in a consistent state
|
// Restore old permissions so DB and internal object are in a consistent state
|
||||||
group.Permissions = oldperms;
|
group.Permissions = oldperms;
|
||||||
|
|
|
||||||
|
|
@ -2734,8 +2734,11 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (OnPlayerSpawn(args.Player, args.Data, player, spawnX, spawnY, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context))
|
if (OnPlayerSpawn(args.Player, args.Data, player, spawnX, spawnY, respawnTimer, numberOfDeathsPVE, numberOfDeathsPVP, context))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
args.Player.Dead = respawnTimer > 0;
|
if (!Main.ServerSideCharacter || context != PlayerSpawnContext.SpawningIntoWorld)
|
||||||
|
{
|
||||||
|
args.Player.Dead = respawnTimer > 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (Main.ServerSideCharacter)
|
if (Main.ServerSideCharacter)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1263,6 +1263,11 @@ namespace TShockAPI
|
||||||
/// <returns>True if allowed, otherwise false</returns>
|
/// <returns>True if allowed, otherwise false</returns>
|
||||||
private bool OnCreep(int tileType)
|
private bool OnCreep(int tileType)
|
||||||
{
|
{
|
||||||
|
if (WorldGen.generatingWorld)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Config.Settings.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.CrimsonGrass
|
if (!Config.Settings.AllowCrimsonCreep && (tileType == TileID.Dirt || tileType == TileID.CrimsonGrass
|
||||||
|| TileID.Sets.Crimson[tileType]))
|
|| TileID.Sets.Crimson[tileType]))
|
||||||
{
|
{
|
||||||
|
|
@ -1456,7 +1461,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (!tsplr.FinishedHandshake)
|
if (!tsplr.FinishedHandshake)
|
||||||
{
|
{
|
||||||
tsplr.Kick(GetString("Your client didn't send the right connection information."), true);
|
tsplr.Kick(GetString("Your client didn't send the right connection information."), true, true);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue