forked from noxious/server
movement shit
This commit is contained in:
parent
f791f1d5d8
commit
2728a9faf7
@ -30,7 +30,7 @@ class CommandManager {
|
||||
}
|
||||
|
||||
private async processCommand(command: string): Promise<void> {
|
||||
const [cmd, ...args] = command.trim().toLowerCase().split(' ');
|
||||
const [cmd, ...args] = command.trim().split(' ');
|
||||
if (this.commands.has(cmd)) {
|
||||
this.commands.get(cmd)?.(args, this.io as Server);
|
||||
} else {
|
||||
|
@ -44,10 +44,8 @@ class ZoneManager {
|
||||
}
|
||||
|
||||
// Getter for loaded zones
|
||||
public getLoadedZones(): Zone[] {
|
||||
return this.loadedZones.map((loadedZone) => {
|
||||
return loadedZone.zone;
|
||||
});
|
||||
public getLoadedZones(): TLoadedZone[] {
|
||||
return this.loadedZones;
|
||||
}
|
||||
|
||||
public addCharacterToZone(zoneId: number, character: Character) {
|
||||
@ -61,9 +59,11 @@ class ZoneManager {
|
||||
|
||||
public removeCharacterFromZone(zoneId: number, characterId: number) {
|
||||
const loadedZone = this.loadedZones.find((loadedZone) => {
|
||||
console.log('Checking zone', loadedZone.zone.id, zoneId);
|
||||
return loadedZone.zone.id === zoneId;
|
||||
});
|
||||
if (loadedZone) {
|
||||
console.log('Removing character from zone', characterId);
|
||||
loadedZone.characters = loadedZone.characters.filter((character) => {
|
||||
return character.id !== characterId;
|
||||
});
|
||||
|
8
src/app/commands/listZones.ts
Normal file
8
src/app/commands/listZones.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { Server } from "socket.io";
|
||||
import ZoneManager from "../ZoneManager";
|
||||
|
||||
type CommandInput = string[]
|
||||
|
||||
export default function (input: CommandInput, io: Server) {
|
||||
console.log(ZoneManager.getLoadedZones())
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user