@@ -15,6 +15,8 @@ import { Task, TaskScheduler } from '@engine/task';
1515import { logger } from '@runejs/common' ;
1616import { ObjectConfig } from '@runejs/filestore' ;
1717import { QueueableTask } from '@engine/action/pipe/task/queueable-task' ;
18+ import { Npc } from '@engine/world/actor/npc' ;
19+ import { Player } from '@engine/world/actor/player' ;
1820
1921
2022export type ActorType = 'player' | 'npc' ;
@@ -355,8 +357,8 @@ export abstract class Actor {
355357 return ;
356358 }
357359
358- if ( this . isNpc ) {
359- const nearbyPlayers = activeWorld . findNearbyPlayers ( this . position , 24 , this . instance ? .instanceId ) ;
360+ if ( this . isNpc ( ) ) {
361+ const nearbyPlayers = activeWorld . findNearbyPlayers ( this . position , 24 , this . instance . instanceId ) ;
360362 if ( nearbyPlayers . length === 0 ) {
361363 // No need for this actor to move if there are no players nearby to witness it, save some memory. :)
362364 return ;
@@ -483,6 +485,14 @@ export abstract class Actor {
483485 this . scheduler . tick ( ) ;
484486 }
485487
488+ public isPlayer ( ) : this is Player {
489+ return this . type === 'player' ;
490+ }
491+
492+ public isNpc ( ) : this is Npc {
493+ return this . type === 'npc' ;
494+ }
495+
486496 public get position ( ) : Position {
487497 return this . _position ;
488498 }
@@ -551,14 +561,6 @@ export abstract class Actor {
551561 this . _instance = value ;
552562 }
553563
554- public get isPlayer ( ) : boolean {
555- return this . type === 'player' ;
556- }
557-
558- public get isNpc ( ) : boolean {
559- return this . type === 'npc' ;
560- }
561-
562564 public get bonuses ( ) : { offensive : OffensiveBonuses , defensive : DefensiveBonuses , skill : SkillBonuses } {
563565 return this . _bonuses ;
564566 }
0 commit comments