Skip to content

Commit

Permalink
Show allowed instead of RankTooLow with allowed colour in /ztest, for…
Browse files Browse the repository at this point in the history
… special affect zones.
  • Loading branch information
UnknownShadow200 committed Jan 27, 2018
1 parent daa5cc5 commit 21f482f
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions fCraft/Commands/ZoneCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -912,17 +912,24 @@ static void SignRemoveHandler(Player player, CommandReader cmd)
}

static void ZoneTestCallback( Player player, Vector3I[] marks, object tag ) {
Zone[] allowed, denied;
if( player.WorldMap.Zones.CheckDetailed( marks[0], player, out allowed, out denied ) ) {
foreach( Zone zone in allowed ) {
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, Color.Lime, status );
}
foreach( Zone zone in denied ) {
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, Color.Red, status );
Zone[] zones = player.WorldMap.Zones.Cache;
bool found = false;
for( int i = 0; i < zones.Length; i++ ) {
Zone zone = zones[i];
if( !zone.Bounds.Contains( marks[0] ) ) continue;

found = true;
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
if( SpecialZone.IsSpecialAffect( zone.Name ) ) {
status = SecurityCheckResult.Allowed;
}
} else {

bool allowed = status == SecurityCheckResult.Allowed || status == SecurityCheckResult.WhiteListed;
string color = allowed ? Color.Lime : Color.Red;
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, color, status );
}

if( !found ) {
player.Message( "No zones affect this block." );
}
}
Expand Down

0 comments on commit 21f482f

Please sign in to comment.