@@ -768,8 +768,8 @@ private static void DisPlace(Player player, CommandReader cmd) {
768
768
if ( cmd . CountRemaining < 2 ) {
769
769
CdDisPlace . PrintUsage ( player ) ;
770
770
return ;
771
- }
772
-
771
+ }
772
+
773
773
Block block ;
774
774
if ( ! cmd . NextBlock ( player , false , out block ) ) return ;
775
775
int dis ;
@@ -925,74 +925,45 @@ private static void CenterCallback(Player player, Vector3I[] marks, object tag)
925
925
player . Message ( "&WCannot deduce desired block. Click a block or type out the block name." ) ;
926
926
return ;
927
927
}
928
- int sx = Math . Min ( marks [ 0 ] . X , marks [ 1 ] . X ) , ex = Math . Max ( marks [ 0 ] . X , marks [ 1 ] . X ) ,
929
- sy = Math . Min ( marks [ 0 ] . Y , marks [ 1 ] . Y ) , ey = Math . Max ( marks [ 0 ] . Y , marks [ 1 ] . Y ) ,
930
- sz = Math . Min ( marks [ 0 ] . Z , marks [ 1 ] . Z ) , ez = Math . Max ( marks [ 0 ] . Z , marks [ 1 ] . Z ) ;
931
-
932
- BoundingBox bounds = new BoundingBox ( sx , sy , sz , ex , ey , ez ) ;
933
- int blocksDrawn = 0 ,
934
- blocksSkipped = 0 ;
928
+
929
+ BoundingBox bounds = new BoundingBox ( marks [ 0 ] , marks [ 1 ] ) ;
930
+ int blocksDrawn = 0 , blocksSkipped = 0 ;
935
931
UndoState undoState = player . DrawBegin ( null ) ;
936
932
937
933
World playerWorld = player . World ;
938
934
if ( playerWorld == null )
939
935
PlayerOpException . ThrowNoWorld ( player ) ;
940
936
941
- Map map = player . WorldMap ;
942
- if ( ( ( bounds . XMin + bounds . XMax ) % 2 ) == 1 )
943
- {
944
- Vector3I cPos = new Vector3I ( bounds . XCentre + 1 , bounds . YCentre , bounds . ZCentre ) ;
945
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
946
- BlockChangeContext . Drawn ,
947
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
948
- }
949
- if ( ( ( bounds . XMin + bounds . XMax ) % 2 ) == 1 && ( ( bounds . YMin + bounds . YMax ) % 2 ) == 1 )
950
- {
951
- Vector3I cPos = new Vector3I ( bounds . XCentre + 1 , bounds . YCentre + 1 , bounds . ZCentre ) ;
952
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
953
- BlockChangeContext . Drawn ,
954
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
937
+ Vector3I [ ] coords = new Vector3I [ 8 ] ;
938
+ int count = 0 , cenX = bounds . XCentre , cenY = bounds . YCentre , cenZ = bounds . ZCentre ;
939
+
940
+ if ( ( bounds . Width % 2 ) == 0 ) {
941
+ coords [ count ] = new Vector3I ( cenX + 1 , cenY , cenZ ) ; count ++ ;
955
942
}
956
- if ( ( ( bounds . XMin + bounds . XMax ) % 2 ) == 1 && ( ( bounds . ZMin + bounds . ZMax ) % 2 ) == 1 )
957
- {
958
- Vector3I cPos = new Vector3I ( bounds . XCentre + 1 , bounds . YCentre , bounds . ZCentre + 1 ) ;
959
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
960
- BlockChangeContext . Drawn ,
961
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
943
+ if ( ( bounds . Width % 2 ) == 0 && ( bounds . Length % 2 ) == 0 ) {
944
+ coords [ count ] = new Vector3I ( cenX + 1 , cenY + 1 , cenZ ) ; count ++ ;
962
945
}
963
- if ( ( ( bounds . XMin + bounds . XMax ) % 2 ) == 1 && ( ( bounds . YMin + bounds . YMax ) % 2 ) == 1 && ( ( bounds . ZMin + bounds . ZMax ) % 2 ) == 1 )
964
- {
965
- Vector3I cPos = new Vector3I ( bounds . XCentre + 1 , bounds . YCentre + 1 , bounds . ZCentre + 1 ) ;
966
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
967
- BlockChangeContext . Drawn ,
968
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
946
+ if ( ( bounds . Width % 2 ) == 0 && ( bounds . Height % 2 ) == 0 ) {
947
+ coords [ count ] = new Vector3I ( cenX + 1 , cenY , cenZ + 1 ) ; count ++ ;
969
948
}
970
- if ( ( ( bounds . YMin + bounds . YMax ) % 2 ) == 1 )
971
- {
972
- Vector3I cPos = new Vector3I ( bounds . XCentre , bounds . YCentre + 1 , bounds . ZCentre ) ;
973
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
974
- BlockChangeContext . Drawn ,
975
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
949
+ if ( ( bounds . Width % 2 ) == 0 && ( bounds . Length % 2 ) == 0 && ( bounds . Height % 2 ) == 0 ) {
950
+ coords [ count ] = new Vector3I ( cenX + 1 , cenY + 1 , cenZ + 1 ) ; count ++ ;
976
951
}
977
- if ( ( ( bounds . YMin + bounds . YMax ) % 2 ) == 1 && ( ( bounds . ZMin + bounds . ZMax ) % 2 ) == 1 )
978
- {
979
- Vector3I cPos = new Vector3I ( bounds . XCentre , bounds . YCentre + 1 , bounds . ZCentre + 1 ) ;
980
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
981
- BlockChangeContext . Drawn ,
982
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
952
+ if ( ( bounds . Length % 2 ) == 0 ) {
953
+ coords [ count ] = new Vector3I ( cenX , cenY + 1 , cenZ ) ; count ++ ;
983
954
}
984
- if ( ( ( bounds . ZMin + bounds . ZMax ) % 2 ) == 1 )
985
- {
986
- Vector3I cPos = new Vector3I ( bounds . XCentre , bounds . YCentre , bounds . ZCentre + 1 ) ;
987
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPos ,
988
- BlockChangeContext . Drawn ,
989
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
955
+ if ( ( bounds . Length % 2 ) == 0 && ( bounds . Height % 2 ) == 0 ) {
956
+ coords [ count ] = new Vector3I ( cenX , cenY + 1 , cenZ + 1 ) ; count ++ ;
990
957
}
958
+ if ( ( bounds . Height % 2 ) == 0 ) {
959
+ coords [ count ] = new Vector3I ( cenX , cenY , cenZ + 1 ) ; count ++ ;
960
+ }
961
+ coords [ count ] = new Vector3I ( cenX , cenY , cenZ ) ; count ++ ;
991
962
992
- Vector3I cPoso = new Vector3I ( bounds . XCentre , bounds . YCentre , bounds . ZCentre ) ;
993
- DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , cPoso ,
994
- BlockChangeContext . Drawn ,
995
- ref blocksDrawn , ref blocksSkipped , undoState ) ;
963
+ for ( int i = 0 ; i < count ; i ++ ) {
964
+ DrawOneBlock ( player , player . World . Map , player . LastUsedBlockType , coords [ i ] ,
965
+ BlockChangeContext . Drawn , ref blocksDrawn , ref blocksSkipped , undoState ) ;
966
+ }
996
967
DrawingFinished ( player , "Placed" , blocksDrawn , blocksSkipped ) ;
997
968
}
998
969
#endregion
0 commit comments