Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/interfaces/core/engine/classes-engine.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export interface IGameMap {
* @param metadata - Object metadata
* @returns { GameObject } - GameObject, also generates object error events, if need
*/
readonly createObject: <T = any>(obj: IGameObject, metadata?: T) => GameObject;
readonly createObject: <T = any>(obj: IGameObject<T>, metadata?: T) => GameObject;

/**
* Delete one object by id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface IChest {
readonly items: IItem[]
}

export interface IGameObject extends Pick<ITarget, 'position' | 'name'> {
export interface IGameObject<T = any> extends Pick<ITarget, 'position' | 'name'> {
/**
* Type of GameObject
*/
Expand All @@ -45,7 +45,7 @@ export interface IGameObject extends Pick<ITarget, 'position' | 'name'> {
/**
* Any object metadata for create. See CreateItemMetadata, CreateTowerMetadata, etc.
*/
readonly metadata?: any;
readonly metadata?: T;

/**
* Internal object id. Will be generated automatic
Expand Down
2 changes: 1 addition & 1 deletion src/world/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export class GameMap implements Map {
}
}

public createObject<T = any>(obj: IGameObject, metadata?: T) {
public createObject<T = any>(obj: IGameObject<T>, metadata?: T) {
const object = new GameObject(obj, this.manager, this, metadata ?? obj.metadata)

this.objects.set(object.id, object)
Expand Down
Loading