@@ -32,15 +32,26 @@ 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+ console . log ( newPosition ) ;
49+ if ( ! validate ( newPosition . level ) ) return ;
3750 if ( ! details . objectConfig . name . startsWith ( 'Stair' ) ) {
3851 player . playAnimation ( up ? 828 : 827 ) ;
3952 }
4053 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 ) ;
54+ setTimeout ( ( ) => details . player . teleport ( newPosition ) , World . TICK_LENGTH ) ;
4455
4556} ;
4657
@@ -49,7 +60,7 @@ export default {
4960 hooks : [
5061 {
5162 type : 'object_interaction' ,
52- objectIds : [ 1738 , 1739 , 1740 , 1746 , 1747 , 1748 , 12964 , 12965 , 12966 ] ,
63+ objectIds : [ 1738 , 1739 , 1740 , 1746 , 1747 , 1748 , 2147 , 2148 , 12964 , 12965 , 12966 ] ,
5364 options : [ 'climb' , 'climb-up' , 'climb-down' ] ,
5465 walkTo : true ,
5566 handler : action
0 commit comments