stash
This commit is contained in:
30
src/stores/zone.ts
Normal file
30
src/stores/zone.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
export const useZoneStore = defineStore('zone', {
|
||||
state: () => ({
|
||||
loaded: false,
|
||||
tiles: undefined,
|
||||
players: {}
|
||||
}),
|
||||
getters: {
|
||||
isLoaded: (state) => state.loaded,
|
||||
getTiles: (state) => state.tiles,
|
||||
getPlayers: (state) => state.players
|
||||
},
|
||||
actions: {
|
||||
loadTiles(tiles) {
|
||||
this.tiles = tiles;
|
||||
this.loaded = true;
|
||||
},
|
||||
addPlayers(player: any) {
|
||||
this.players = player;
|
||||
},
|
||||
addPlayer(player: any) {
|
||||
this.players[player.id] = player;
|
||||
console.log('Player added:', player);
|
||||
},
|
||||
removePlayer(playerId: any) {
|
||||
delete this.players[playerId];
|
||||
}
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user