Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateLaboratoryPacket ¶ added in v0.2.21
type CreateLaboratoryPacket struct { // Type is always create-laboratory Type string `json:"type" mapstructure:"type"` // Location that the laboratory should be placed at Location cp.Vector }
CreateLaboratoryPacket is the packet sent by the science AIs to the server when the science AI would like to create a laboratory nearby.
func (*CreateLaboratoryPacket) GetType ¶ added in v0.2.21
func (p *CreateLaboratoryPacket) GetType() string
func (*CreateLaboratoryPacket) PrepareForMarshal ¶ added in v0.2.21
func (p *CreateLaboratoryPacket) PrepareForMarshal()
type CreateTentPacket ¶ added in v0.2.10
type CreateTentPacket struct { // Type is always create-tent Type string `json:"type" mapstructure:"type"` // Location is where you are trying to place the tent Location cp.Vector }
CreateTentPacket is sent by an economy AI in order to place the tent for their team.
func (*CreateTentPacket) GetType ¶ added in v0.2.10
func (p *CreateTentPacket) GetType() string
func (*CreateTentPacket) PrepareForMarshal ¶ added in v0.2.10
func (p *CreateTentPacket) PrepareForMarshal()
type IssueSmartObjectOrderPacket ¶
type IssueSmartObjectOrderPacket struct { // Type is always issue-smart-object-order Type string `json:"type" mapstructure:"type"` // UID is the uid of the smart object the order is being issued to UID string `json:"uid" mapstructure:"uid"` // Order contains the order being issued and should be processed based // on the UnitType of the smart object. Order interface{} `json:"order" mapstructure:"order"` }
IssueSmartObjectOrderPacket describes the client trying to issue an order to a smart object by the given UID.
func (*IssueSmartObjectOrderPacket) GetType ¶
func (p *IssueSmartObjectOrderPacket) GetType() string
func (*IssueSmartObjectOrderPacket) PrepareForMarshal ¶
func (p *IssueSmartObjectOrderPacket) PrepareForMarshal()
type MinePacket ¶
type MinePacket struct { // Type is always mine Type string `json:"type" mapstructure:"type"` // MiningUID is the UID of the object doing the mining MiningUID string `json:"mining_uid" mapstructure:"mining_uid"` // MinedUID is the UID of the object being mined MinedUID string `json:"mined_uid" mapstructure:"mined_uid"` }
MinePacket is used for AI to mine resources which are near a unit they control.
func (*MinePacket) GetType ¶
func (p *MinePacket) GetType() string
func (*MinePacket) PrepareForMarshal ¶
func (p *MinePacket) PrepareForMarshal()
type MovePacket ¶
type MovePacket struct { // Type is always move Type string `json:"type" mapstructure:"type"` // UID of the game object to move UID string `json:"uid" mapstructure:"uid"` // Direction to move the object in. If the magnitude is less than one then // move in the move force multiplied by this vector, otherwise move in this // direction at the maximum move force Direction Vector `json:"dir" mapstructure:"dir"` }
MovePacket describes the client trying to move the game object with the given uid in the given direction.
func (*MovePacket) GetType ¶
func (p *MovePacket) GetType() string
func (*MovePacket) PrepareForMarshal ¶
func (p *MovePacket) PrepareForMarshal()
type Packet ¶
type Packet interface { // GetType returns the canonical unique identifier for the packet GetType() string // PrepareForMarshal ensures that the default values for this packet have been // set correctly. PrepareForMarshal() }
Packet describes any of the packets within this package, which is useful for grabbing the Type of the packet without a large switch statement.
func ParsePacket ¶
ParsePacket attempts to parse the packet described by the given bytes as one of the packets in this package. The resulting interface is nil if error is not nil, otherwise its a pointer to one of the Packet structs and should be switched on by type.
func ParseSinglePacket ¶
ParseSinglePacket parses a single packet which has already been converted to the map interpretation. Note that many of these may be sent within a single websocket message frame, formatted as a JSON array. In order to parse from the raw bytes of a websocket message frame, use ParsePacket.
type SendCommandPacket ¶
type SendCommandPacket struct { // Type is send-command Type string `json:"type"` // Text is the text of the command to execute; the first character // is ignored (so "/foo the bar" is parsed as "foo the bar"). Anything // after the 4096'th character is ignored. Text string `json:"text"` }
SendCommandPacket is the client telling the server that they wish to execute a text command. We allow clients to decide what counts as a "command" so that we can support many different formats (e.g, slash, hyphen, whatever). The first character of the command is ignored for the purpose of parsing.
func (*SendCommandPacket) GetType ¶
func (p *SendCommandPacket) GetType() string
func (*SendCommandPacket) PrepareForMarshal ¶
func (p *SendCommandPacket) PrepareForMarshal()
type SendLocalMessagePacket ¶
type SendLocalMessagePacket struct { // Type is send-local-message Type string `json:"type"` // Text is the text of the message; will be treated as untrusted. // Anything after the 4096th character is ignored. Text string `json:"text"` }
SendLocalMessagePacket is the client telling the server that they wish to send some text to nearby players
func (*SendLocalMessagePacket) GetType ¶
func (p *SendLocalMessagePacket) GetType() string
func (*SendLocalMessagePacket) PrepareForMarshal ¶
func (p *SendLocalMessagePacket) PrepareForMarshal()