You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.8 KiB
42 lines
1.8 KiB
package action
|
|
|
|
import "hexmap-server/state"
|
|
|
|
// ServerHello is the action sent to establish the current state of the server when a new client connects.
|
|
type ServerHello struct {
|
|
// Version is the protocol version the server is running.
|
|
Version int `json:"version"`
|
|
// State is the complete state of the server as of when the client joined.
|
|
State state.Synced `json:"state"`
|
|
}
|
|
|
|
// ServerRefresh is the action sent to reestablish the current state of the server in response to ClientRefresh.
|
|
type ServerRefresh struct {
|
|
// State is the complete state of the server as of when the corresponding ClientRefresh was processed.
|
|
State state.Synced `json:"state"`
|
|
}
|
|
|
|
// ServerOK is the action sent when one or more client actions have been accepted and applied.
|
|
type ServerOK struct {
|
|
// IDs contains the IDs of the actions which were accepted and applied, in the order they were accepted and applied.
|
|
// This is the same as the order they were received, though other actions may have been between these that were
|
|
// rejected.
|
|
IDs []int `json:"ids"`
|
|
}
|
|
|
|
// ServerFailed is the action sent when one or more client actions have been rejected.
|
|
type ServerFailed struct {
|
|
// IDs contains the IDs of the actions which were rejected, in the order they were rejected.
|
|
// This is the same as the order they were received, though other actions may have been between these that were
|
|
// accepted and applied.
|
|
IDs []int `json:"ids"`
|
|
// Error contains the error text sent from the server about why these actions failed.
|
|
Error string `json:"error"`
|
|
}
|
|
|
|
// ServerSent is the action sent when one or more client actions from other clients have been accepted and applied.
|
|
// The client's own actions will never be included in this action.
|
|
type ServerSent struct {
|
|
// Actions contains the actions that are now being applied.
|
|
Actions []Syncable `json:"actions"`
|
|
}
|
|
|