Skip to content

Commit

Permalink
add movement radius as optional param to spawn_npc_command
Browse files Browse the repository at this point in the history
  • Loading branch information
Promises committed Nov 24, 2022
1 parent 5d3dade commit 5cc90ab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/commands/spawn-npc-command.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ const action: commandActionHandler = ({ player, args }) => {
npcKey = npcDetails.gameId;
}

const movementRadius: number = args.movementRadius as number;

const npc = new Npc(npcDetails ? npcDetails : npcKey,
new NpcSpawn(npcDetails ? npcDetails.key : `unknown-${npcKey}`,
player.position.clone(), 0, 'WEST'), player.instance);
player.position.clone(), movementRadius, 'WEST'), player.instance);

activeWorld.registerNpc(npc);
};
Expand All @@ -41,6 +43,11 @@ export default {
{
name: 'npcKey',
type: 'either'
},
{
name: 'movementRadius',
type: 'number',
defaultValue: 0
}
],
handler: action
Expand Down

0 comments on commit 5cc90ab

Please sign in to comment.