We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c23939b commit f799ebbCopy full SHA for f799ebb
src/game-engine/world/index.ts
@@ -149,8 +149,13 @@ export class World {
149
* @param objectPosition The position of the copied object to find the template of.
150
*/
151
public findCustomMapObject(actor: Actor, objectId: number, objectPosition: Position): LandscapeObject | null {
152
+ const map = actor?.metadata?.customMap as ConstructedMap || null;
153
+
154
+ if(!map) {
155
+ return null;
156
+ }
157
158
const objectChunk = this.chunkManager.getChunkForWorldPosition(objectPosition);
- const map = actor.metadata.customMap as ConstructedMap;
159
const mapChunk = world.chunkManager.getChunkForWorldPosition(map.position);
160
161
const chunkIndexX = objectChunk.position.x - (mapChunk.position.x - 2);
0 commit comments