@@ -84,12 +84,13 @@ class House {
84
84
85
85
86
86
const instance1 = new Position ( 6400 , 6400 ) ;
87
- const instance1PohSpawn = new Position ( 6432 , 6432 ) ;
88
- const instance1Max = new Position ( 6464 , 6464 ) ;
87
+ const instance1PohSpawn = new Position ( 6400 + 36 , 6400 + 36 ) ;
88
+ const instance1Max = new Position ( 6400 + 64 , 6400 + 64 ) ;
89
+
90
+ const instance2 = new Position ( 6400 , 6464 ) ;
91
+ const instance2PohSpawn = new Position ( 6400 + 36 , 6464 + 36 ) ;
92
+ const instance2Max = new Position ( 6400 + 64 , 6464 + 64 ) ;
89
93
90
- const instance2 = new Position ( 6464 , 6400 ) ;
91
- const instance2PohSpawn = new Position ( 6496 , 6432 ) ;
92
- const instance2Max = new Position ( 6528 , 6464 ) ;
93
94
94
95
95
96
const openHouse = async ( player : Player ) : Promise < void > => {
@@ -104,39 +105,35 @@ const openHouse = async (player: Player): Promise<void> => {
104
105
105
106
for ( let x = 0 ; x < MAX_HOUSE_SIZE ; x ++ ) {
106
107
for ( let y = 0 ; y < MAX_HOUSE_SIZE ; y ++ ) {
107
- if ( x <= 1 || y <= 1 || x >= 11 || y >= 11 ) {
108
- continue ;
109
- }
110
-
111
108
if ( x === 6 && y === 6 ) {
112
109
house . rooms [ 0 ] [ x ] [ y ] = gardenPortal ;
113
110
} else if ( ( x === 7 && y === 6 ) || ( x === 6 && y === 7 ) || ( x === 5 && y === 6 ) ) {
114
111
house . rooms [ 0 ] [ x ] [ y ] = firstParlor ;
115
- } else {
116
- house . rooms [ 0 ] [ x ] [ y ] = emptySpace ;
117
112
}
118
113
}
119
114
}
120
115
121
- let pohPosition : Position = instance1PohSpawn ;
116
+ let pohPosition : Position = instance1 ;
117
+ let playerSpawn : Position = instance1PohSpawn ;
122
118
123
119
if ( player . position . within ( instance1 , instance1Max , false ) ) {
124
- player . teleport ( player . position . copy ( ) . setX ( player . position . x + 64 ) ) ;
125
- pohPosition = instance2PohSpawn ;
120
+ playerSpawn = player . position . copy ( ) . setY ( player . position . y + 64 ) ;
121
+ pohPosition = instance2 ;
126
122
} else if ( player . position . within ( instance2 , instance2Max , false ) ) {
127
- player . teleport ( player . position . copy ( ) . setX ( player . position . x - 64 ) ) ;
128
- } else {
129
- player . teleport ( instance1PohSpawn ) ;
123
+ playerSpawn = player . position . copy ( ) . setY ( player . position . y - 64 ) ;
130
124
}
131
125
132
- player . sendMessage ( player . position . key ) ;
133
- player . sendMessage ( `${ player . position . chunkLocalX } ,${ player . position . chunkLocalY } ` ) ;
126
+ player . teleport ( playerSpawn ) ;
134
127
135
128
player . metadata . customMap = {
136
129
position : pohPosition ,
130
+ emptySpace : emptySpace . roomData ,
137
131
tileData : house . getRoomData ( )
138
132
} as ConstructedMap ;
139
133
134
+ player . sendMessage ( player . position . key ) ;
135
+ player . sendMessage ( `${ player . position . chunkLocalX } ,${ player . position . chunkLocalY } ` ) ;
136
+
140
137
player . sendMessage ( `Welcome home.` ) ;
141
138
} ;
142
139
0 commit comments