More thorough fix

This commit is contained in:
James Lyne 2021-05-20 01:51:46 +01:00
parent f419915808
commit ee96be7665
3 changed files with 23 additions and 1 deletions

View File

@ -133,7 +133,8 @@ export default defineComponent({
store.commit(MutationTypes.CLEAR_PLAYERS, undefined); store.commit(MutationTypes.CLEAR_PLAYERS, undefined);
store.commit(MutationTypes.CLEAR_CURRENT_MAP, undefined); store.commit(MutationTypes.CLEAR_CURRENT_MAP, undefined);
store.commit(MutationTypes.CLEAR_PARSED_URL, undefined); store.commit(MutationTypes.CLEAR_PARSED_URL, undefined);
store.commit(MutationTypes.SET_WORLDS, []); store.commit(MutationTypes.CLEAR_WORLDS, undefined);
store.commit(MutationTypes.CLEAR_MARKER_SETS, undefined);
window.history.replaceState({}, '', newServer); window.history.replaceState({}, '', newServer);
loadConfiguration(); loadConfiguration();

View File

@ -21,8 +21,10 @@ export enum MutationTypes {
CLEAR_CONFIGURATION_HASH = 'clearConfigurationHash', CLEAR_CONFIGURATION_HASH = 'clearConfigurationHash',
SET_MESSAGES = 'setMessages', SET_MESSAGES = 'setMessages',
SET_WORLDS = 'setWorlds', SET_WORLDS = 'setWorlds',
CLEAR_WORLDS = 'clearWorlds',
SET_COMPONENTS = 'setComponents', SET_COMPONENTS = 'setComponents',
SET_MARKER_SETS = 'setMarkerSets', SET_MARKER_SETS = 'setMarkerSets',
CLEAR_MARKER_SETS = 'clearMarkerSets',
ADD_WORLD = 'addWorld', ADD_WORLD = 'addWorld',
SET_WORLD_STATE = 'setWorldState', SET_WORLD_STATE = 'setWorldState',
SET_UPDATE_TIMESTAMP = 'setUpdateTimestamp', SET_UPDATE_TIMESTAMP = 'setUpdateTimestamp',

View File

@ -46,8 +46,10 @@ export type Mutations<S = State> = {
[MutationTypes.CLEAR_CONFIGURATION_HASH](state: S): void [MutationTypes.CLEAR_CONFIGURATION_HASH](state: S): void
[MutationTypes.SET_MESSAGES](state: S, messages: DynmapMessageConfig): void [MutationTypes.SET_MESSAGES](state: S, messages: DynmapMessageConfig): void
[MutationTypes.SET_WORLDS](state: S, worlds: Array<DynmapWorld>): void [MutationTypes.SET_WORLDS](state: S, worlds: Array<DynmapWorld>): void
[MutationTypes.CLEAR_WORLDS](state: S): void
[MutationTypes.SET_COMPONENTS](state: S, worlds: DynmapComponentConfig): void [MutationTypes.SET_COMPONENTS](state: S, worlds: DynmapComponentConfig): void
[MutationTypes.SET_MARKER_SETS](state: S, worlds: Map<string, DynmapMarkerSet>): void [MutationTypes.SET_MARKER_SETS](state: S, worlds: Map<string, DynmapMarkerSet>): void
[MutationTypes.CLEAR_MARKER_SETS](state: S): void
[MutationTypes.ADD_WORLD](state: S, world: DynmapWorld): void [MutationTypes.ADD_WORLD](state: S, world: DynmapWorld): void
[MutationTypes.SET_WORLD_STATE](state: S, worldState: DynmapWorldState): void [MutationTypes.SET_WORLD_STATE](state: S, worldState: DynmapWorldState): void
[MutationTypes.SET_UPDATE_TIMESTAMP](state: S, time: Date): void [MutationTypes.SET_UPDATE_TIMESTAMP](state: S, time: Date): void
@ -148,6 +150,18 @@ export const mutations: MutationTree<State> & Mutations = {
} }
}, },
[MutationTypes.CLEAR_WORLDS](state: State) {
state.worlds.clear();
state.maps.clear();
state.followTarget = undefined;
state.panTarget = undefined;
state.currentWorldState.timeOfDay = 0;
state.currentWorldState.raining = false;
state.currentWorldState.thundering = false;
},
//Sets the state and settings of optional components, from the initial config fetch //Sets the state and settings of optional components, from the initial config fetch
[MutationTypes.SET_COMPONENTS](state: State, components: DynmapComponentConfig) { [MutationTypes.SET_COMPONENTS](state: State, components: DynmapComponentConfig) {
state.components = Object.assign(state.components, components); state.components = Object.assign(state.components, components);
@ -169,6 +183,11 @@ export const mutations: MutationTree<State> & Mutations = {
} }
}, },
[MutationTypes.CLEAR_MARKER_SETS](state: State) {
state.markerSets.clear();
state.pendingSetUpdates.clear();
},
[MutationTypes.ADD_WORLD](state: State, world: DynmapWorld) { [MutationTypes.ADD_WORLD](state: State, world: DynmapWorld) {
state.worlds.set(world.name, world); state.worlds.set(world.name, world);
}, },