@@ -3635,7 +3635,7 @@ private static void MaxPWHandler(Player player, CommandReader cmd) {
36353635 Help = "Controls portals, options are: create, remove, list, info, enable, disable&N&S" +
36363636 "See &H/Help portal <option>&S for details about each option." ,
36373637 HelpSections = new Dictionary < string , string > ( ) {
3638- { "create" , "&H/portal create [world] [liquid] [portal name] [x y z r l]&N&S" +
3638+ { "create" , "&H/portal create [world] [liquid] [portal name] ( [x y z r l] or [#ZoneName]) &N&S" +
36393639 "Creates a portal with specified options" } ,
36403640 { "remove" , "&H/portal remove [portal name]&N&S" +
36413641 "Removes specified portal." } ,
@@ -3690,14 +3690,29 @@ private static void PortalH(Player player, CommandReader cmd) {
36903690 }
36913691 World tpWorld = WorldManager . FindWorldExact ( addWorld ) ;
36923692 if ( cmd . HasNext ) {
3693- int x , y , z , rot = player . Position . R , lot = player . Position . L ;
3694- if ( cmd . NextInt ( out x ) && cmd . NextInt ( out y ) && cmd . NextInt ( out z ) ) {
3693+ int x , y , z , rot = player . Position . R , lot = player . Position . L ;
3694+ string next = cmd . Next ( ) ;
3695+ if ( next != null && next . StartsWith ( "#" ) ) {
3696+ if ( tpWorld . Map == null ) tpWorld . LoadMap ( ) ;
3697+ Zone tpzone = tpWorld . map . Zones . FindExact ( next . Remove ( 0 , 1 ) ) ;
3698+ if ( tpzone != null ) {
3699+ player . PortalTPPos = new Position ( tpzone . Bounds . XCentre * 32 + 16 ,
3700+ tpzone . Bounds . YCentre * 32 + 16 , tpzone . Bounds . ZCentre * 32 + Player . CharacterHeight ,
3701+ player . Position . R , player . Position . L ) ;
3702+ player . Message ( "Players will be teleported to zone: " + tpzone . Name ) ;
3703+ player . Message ( "At: " + player . PortalTPPos . ToString ( ) ) ;
3704+ player . Message ( "On: " + tpWorld . Name ) ;
3705+ } else {
3706+ player . PortalTPPos = tpWorld . map == null ? new Position ( 0 , 0 , 0 ) : tpWorld . map . Spawn ;
3707+ }
3708+ if ( tpWorld . map == null ) tpWorld . UnloadMap ( false ) ;
3709+ } else if ( int . TryParse ( next , out x ) && cmd . NextInt ( out y ) && cmd . NextInt ( out z ) ) {
36953710 if ( cmd . CountRemaining >= 2 && cmd . NextInt ( out rot ) && cmd . NextInt ( out lot ) ) {
36963711 if ( rot > 255 || rot < 0 ) {
36973712 player . Message ( "R must be inbetween 0 and 255. Set to player R" ) ;
36983713 rot = player . Position . R ;
3699- }
3700-
3714+ }
3715+
37013716 if ( lot > 255 || lot < 0 ) {
37023717 player . Message ( "L must be inbetween 0 and 255. Set to player L" ) ;
37033718 lot = player . Position . L ;
0 commit comments