Add server player to initial player list
This commit is contained in:
parent
69f9cb6843
commit
8e519d0a34
1 changed files with 4 additions and 7 deletions
|
@ -1,15 +1,12 @@
|
||||||
|
import { ChatMessage, LocalClient, PeerClient, PeerServer } from "@/network";
|
||||||
import { MutationTree } from "vuex";
|
import { MutationTree } from "vuex";
|
||||||
import {
|
|
||||||
NetworkState,
|
import { ClientNetworkState, ConnectionStatus, NetworkState, ServerNetworkState } from "./types";
|
||||||
ServerNetworkState,
|
|
||||||
ClientNetworkState,
|
|
||||||
ConnectionStatus
|
|
||||||
} from "./types";
|
|
||||||
import { LocalClient, PeerServer, PeerClient, ChatMessage } from "@/network";
|
|
||||||
|
|
||||||
const mutations: MutationTree<NetworkState> = {
|
const mutations: MutationTree<NetworkState> = {
|
||||||
becomeServer(state, payload: { local: LocalClient; server: PeerServer }) {
|
becomeServer(state, payload: { local: LocalClient; server: PeerServer }) {
|
||||||
state.peerType = "server";
|
state.peerType = "server";
|
||||||
|
state.players = [payload.local.name];
|
||||||
(state as ServerNetworkState).local = payload.local;
|
(state as ServerNetworkState).local = payload.local;
|
||||||
(state as ServerNetworkState).server = payload.server;
|
(state as ServerNetworkState).server = payload.server;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue