Remove happiness.
http://rubyonrails.org/doctrine The problem with most programmers is that they refuse to see any logic in thinking about a problem from the other side, even just once. You can't argue with someone over what opinionated "programmer happiness" things are because logically you'll always be outmatched with "well you can just do it this other way." Take this example. How is !args.Player.HasProjectilePermission any easier to understand than args.Player.LacksProjectilePermission? -> One is direct: it focuses on what a player doesn't have. -> The other is indirect: it's the inverse of have. You can read one in a sentence and think "so if a player lacks a permission then this happens" whereas the other is like "invert if a player has a permission." In this soupy mess of a codebase where you're trying to sort out what 300 magic numbers mean and what everything else is trying to do, then it's kinda nice to be able to read something and understand it immediately.
This commit is contained in:
parent
0afcf0d248
commit
c1de974e16
2 changed files with 1 additions and 10 deletions
|
|
@ -2366,7 +2366,7 @@ namespace TShockAPI
|
|||
var type = Main.projectile[index].type;
|
||||
|
||||
// TODO: This needs to be moved somewhere else.
|
||||
if (args.Player.LacksProjectilePermission(index, type) && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill)
|
||||
if (!args.Player.HasProjectilePermission(index, type) && type != 102 && type != 100 && !TShock.Config.IgnoreProjKill)
|
||||
{
|
||||
args.Player.Disable("Does not have projectile permission to kill projectile.", DisableFlags.WriteToLogAndConsole);
|
||||
args.Player.RemoveProjectile(ident, owner);
|
||||
|
|
|
|||
|
|
@ -804,15 +804,6 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Checks to see if this player object lacks access rights to a given projectile. Used by projectile bans.</summary>
|
||||
/// <param name="index">The projectile index from Main.projectiles (NOT from a packet directly).</param>
|
||||
/// <param name="type">The type of projectile, from Main.projectiles.</param>
|
||||
/// <returns>If the player has lacks access rights to the projectile.</returns>
|
||||
public bool LacksProjectilePermission(int index, int type)
|
||||
{
|
||||
return !HasProjectilePermission(index, type);
|
||||
}
|
||||
|
||||
/// <summary>Checks to see if this player object has access rights to a given projectile. Used by projectile bans.</summary>
|
||||
/// <param name="index">The projectile index from Main.projectiles (NOT from a packet directly).</param>
|
||||
/// <param name="type">The type of projectile, from Main.projectiles.</param>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue