@@ -19,7 +19,7 @@ import { loadActionFiles } from '@engine/world/action';
19
19
import { LandscapeObject } from '@runejs/filestore' ;
20
20
import { lastValueFrom , Subject } from 'rxjs' ;
21
21
import { take } from 'rxjs/operators' ;
22
- import { ConstructedRegion , getRotatedLocalX , getRotatedLocalY } from '@engine/world/map/region' ;
22
+ import { ConstructedRegion , getTemplateLocalX , getTemplateLocalY } from '@engine/world/map/region' ;
23
23
import { Chunk } from '@engine/world/map/chunk' ;
24
24
25
25
@@ -174,10 +174,23 @@ export class World {
174
174
const mapTemplateWorldY = tileY ;
175
175
const mapTemplateChunk = world . chunkManager . getChunkForWorldPosition ( new Position ( mapTemplateWorldX , mapTemplateWorldY , objectPosition . level ) ) ;
176
176
177
- const templateObjectPosition = new Position ( mapTemplateWorldX + getRotatedLocalX ( tileOrientation , objectLocalX , objectLocalY ) ,
178
- mapTemplateWorldY + getRotatedLocalY ( tileOrientation , objectLocalX , objectLocalY ) , objectPosition . level ) ;
177
+ const templateObjectPosition = new Position ( mapTemplateWorldX + getTemplateLocalX ( tileOrientation , objectLocalX , objectLocalY ) ,
178
+ mapTemplateWorldY + getTemplateLocalY ( tileOrientation , objectLocalX , objectLocalY ) , objectPosition . level ) ;
179
179
const realObject = mapTemplateChunk . getFilestoreLandscapeObject ( objectId , templateObjectPosition ) ;
180
180
181
+ realObject . x = objectPosition . x ;
182
+ realObject . y = objectPosition . y ;
183
+ realObject . level = objectPosition . level ;
184
+
185
+ let rotation = realObject . orientation + objectTile . rotation ;
186
+ if ( rotation > 3 ) {
187
+ rotation -= 4 ;
188
+ }
189
+
190
+ console . log ( realObject . orientation , rotation ) ;
191
+
192
+ realObject . orientation = rotation ;
193
+
181
194
return realObject || null ;
182
195
}
183
196
0 commit comments