1
0
forked from noxious/client
This commit is contained in:
2024-05-09 22:03:57 +02:00
parent f038b6787f
commit 70d7371351
6 changed files with 60 additions and 55 deletions

View File

@ -5,7 +5,7 @@
* https://pinia.vuejs.org/
*/
import { defineStore } from 'pinia';
import {useMapStore} from '@/stores/map'
import {useZoneStore} from '@/stores/zone'
import { io, Socket } from 'socket.io-client';
import config from '@/config';
import axios from 'axios';

View File

@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
export const useMapStore = defineStore('gameMap', {
export const useZoneStore = defineStore('zone', {
state: () => ({
loaded: false,
tiles: undefined,
@ -16,14 +16,14 @@ export const useMapStore = defineStore('gameMap', {
this.tiles = tiles;
this.loaded = true;
},
addPlayers(player) {
addPlayers(player: any) {
this.players = player;
},
addPlayer(player) {
addPlayer(player: any) {
this.players[player.id] = player;
console.log('Player added:', player);
},
removePlayer(playerId) {
removePlayer(playerId: any) {
delete this.players[playerId];
}
}