race quit, transfer state, refactor
This commit is contained in:
@@ -38,7 +38,7 @@ const (
|
||||
StateLaunched ShipGroupState = "Launched"
|
||||
StateInSpace ShipGroupState = "In_Space"
|
||||
StateUpgrade ShipGroupState = "Upgrade"
|
||||
StateTransfer ShipGroupState = "Transfer_Status"
|
||||
StateTransfer ShipGroupState = "Transfer"
|
||||
)
|
||||
|
||||
func (sgs ShipGroupState) String() string {
|
||||
@@ -104,17 +104,18 @@ func (t Tech) String() string {
|
||||
}
|
||||
|
||||
type ShipGroup struct {
|
||||
Index uint `json:"index"` // FIXME: use UUID for Group Index (ordered)
|
||||
OwnerID uuid.UUID `json:"ownerId"` // Race link
|
||||
TypeID uuid.UUID `json:"typeId"` // ShipType link
|
||||
FleetID *uuid.UUID `json:"fleetId,omitempty"` // Fleet link
|
||||
Number uint `json:"number"` // Number (quantity) ships of specific ShipType
|
||||
CargoType *CargoType `json:"loadType,omitempty"` //
|
||||
Load Float `json:"load"` // Cargo loaded - "Масса груза"
|
||||
Tech TechSet `json:"tech"` //
|
||||
Destination uint `json:"destination"` // TODO: TEST: Destination, Origin, Range
|
||||
StateInSpace *InSpace `json:"stateInSpace,omitempty"` //
|
||||
StateUpgrade *InUpgrade `json:"stateUpgrade,omitempty"` //
|
||||
Index uint `json:"index"` // FIXME: use UUID for Group Index (ordered)
|
||||
OwnerID uuid.UUID `json:"ownerId"` // Race link
|
||||
TypeID uuid.UUID `json:"typeId"` // ShipType link
|
||||
FleetID *uuid.UUID `json:"fleetId,omitempty"` // Fleet link
|
||||
Number uint `json:"number"` // Number (quantity) ships of specific ShipType
|
||||
CargoType *CargoType `json:"loadType,omitempty"` //
|
||||
Load Float `json:"load"` // Cargo loaded - "Масса груза"
|
||||
Tech TechSet `json:"tech"` //
|
||||
Destination uint `json:"destination"` // TODO: TEST: Destination, Origin, Range
|
||||
StateInSpace *InSpace `json:"inSpace,omitempty"` //
|
||||
StateUpgrade *InUpgrade `json:"upgrade,omitempty"` //
|
||||
StateTransfer bool `json:"transfer,omitempty"` //
|
||||
}
|
||||
|
||||
func (sg ShipGroup) TechLevel(t Tech) Float {
|
||||
@@ -134,6 +135,9 @@ func (sg ShipGroup) State() ShipGroupState {
|
||||
if sg.StateInSpace.Range > 0 {
|
||||
return StateInSpace
|
||||
}
|
||||
if sg.StateTransfer {
|
||||
return StateTransfer
|
||||
}
|
||||
return StateLaunched
|
||||
case sg.StateUpgrade != nil && sg.StateInSpace == nil:
|
||||
return StateUpgrade
|
||||
|
||||
Reference in New Issue
Block a user