@@ -32,15 +32,25 @@ export const action: objectInteractionActionHandler = (details) => {
3232 }
3333 const up = option === 'climb-up' ;
3434 const { position } = player ;
35- const level = position . level + ( up ? 1 : - 1 ) ;
36- if ( ! validate ( level ) ) return ;
35+ const newPosition = new Position ( position . x , position . y , position . level ) ;
36+ newPosition . level = position . level + ( up ? 1 : - 1 ) ;
37+ if ( position . level === 0 ) {
38+ if ( newPosition . level === 1 && position . y >= 6400 ) {
39+ newPosition . level = 0 ;
40+ newPosition . y -= 6414 ;
41+ newPosition . x ++ ;
42+ } else if ( newPosition . level === - 1 ) {
43+ newPosition . level = 0 ;
44+ newPosition . y += 6414 ;
45+ newPosition . x -- ;
46+ }
47+ }
48+ if ( ! validate ( newPosition . level ) ) return ;
3749 if ( ! details . objectConfig . name . startsWith ( 'Stair' ) ) {
3850 player . playAnimation ( up ? 828 : 827 ) ;
3951 }
4052 player . sendMessage ( `You climb ${ option . slice ( 6 ) } the ${ details . objectConfig . name . toLowerCase ( ) } .` ) ;
41- setTimeout ( ( ) => {
42- details . player . teleport ( new Position ( position . x , position . y , level ) ) ;
43- } , World . TICK_LENGTH ) ;
53+ setTimeout ( ( ) => details . player . teleport ( newPosition ) , World . TICK_LENGTH ) ;
4454
4555} ;
4656
@@ -49,7 +59,7 @@ export default {
4959 hooks : [
5060 {
5161 type : 'object_interaction' ,
52- objectIds : [ 1738 , 1739 , 1740 , 1746 , 1747 , 1748 , 12964 , 12965 , 12966 ] ,
62+ objectIds : [ 1738 , 1739 , 1740 , 1746 , 1747 , 1748 , 2147 , 2148 , 12964 , 12965 , 12966 ] ,
5363 options : [ 'climb' , 'climb-up' , 'climb-down' ] ,
5464 walkTo : true ,
5565 handler : action
0 commit comments