Skip to content

Commit 21f482f

Browse files
Show allowed instead of RankTooLow with allowed colour in /ztest, for special affect zones.
1 parent daa5cc5 commit 21f482f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

fCraft/Commands/ZoneCommands.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -912,17 +912,24 @@ static void ZoneTestHandler( Player player, CommandReader cmd ) {
912912
}
913913

914914
static void ZoneTestCallback( Player player, Vector3I[] marks, object tag ) {
915-
Zone[] allowed, denied;
916-
if( player.WorldMap.Zones.CheckDetailed( marks[0], player, out allowed, out denied ) ) {
917-
foreach( Zone zone in allowed ) {
918-
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
919-
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, Color.Lime, status );
920-
}
921-
foreach( Zone zone in denied ) {
922-
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
923-
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, Color.Red, status );
915+
Zone[] zones = player.WorldMap.Zones.Cache;
916+
bool found = false;
917+
for( int i = 0; i < zones.Length; i++ ) {
918+
Zone zone = zones[i];
919+
if( !zone.Bounds.Contains( marks[0] ) ) continue;
920+
921+
found = true;
922+
SecurityCheckResult status = zone.Controller.CheckDetailed( player.Info );
923+
if( SpecialZone.IsSpecialAffect( zone.Name ) ) {
924+
status = SecurityCheckResult.Allowed;
924925
}
925-
} else {
926+
927+
bool allowed = status == SecurityCheckResult.Allowed || status == SecurityCheckResult.WhiteListed;
928+
string color = allowed ? Color.Lime : Color.Red;
929+
player.Message( "> Zone {0}&S: {1}{2}", zone.ClassyName, color, status );
930+
}
931+
932+
if( !found ) {
926933
player.Message( "No zones affect this block." );
927934
}
928935
}

0 commit comments

Comments
 (0)