vibes
This commit is contained in:
+19
-21
@@ -16,7 +16,6 @@ import (
|
||||
type Hull struct {
|
||||
DryMass int64 // kg
|
||||
FuelCap int64 // kg
|
||||
CargoCap int64 // kg
|
||||
Thrust int64 // newtons at full throttle
|
||||
ExhaustVel int64 // m/s
|
||||
MineRate int64 // kg mined per tick
|
||||
@@ -26,7 +25,6 @@ type Hull struct {
|
||||
var CommandShip = Hull{
|
||||
DryMass: 8000,
|
||||
FuelCap: 4000,
|
||||
CargoCap: 6000,
|
||||
Thrust: 6000,
|
||||
ExhaustVel: 30000,
|
||||
MineRate: 10,
|
||||
@@ -35,18 +33,21 @@ var CommandShip = Hull{
|
||||
// Docking / mining limits.
|
||||
const (
|
||||
MineRangeKm = 5 // max distance to an asteroid for mining
|
||||
DockRangeKm = 20 // max distance to the station for selling
|
||||
DockRangeKm = 20 // how close counts as "near the station"
|
||||
MaxRelSpeedM = 100 // max relative speed (m/s) for mining or docking
|
||||
StarRadiusKm = 200_000
|
||||
ScanRangeKm = 500_000 // the scanner sees nothing farther away than this
|
||||
)
|
||||
|
||||
type Ship struct {
|
||||
ID int64
|
||||
Owner int64
|
||||
Hull Hull
|
||||
Pos fixed.Vec
|
||||
Vel fixed.Vec
|
||||
Fuel fixed.F
|
||||
ID int64
|
||||
Owner int64
|
||||
Hull Hull
|
||||
Pos fixed.Vec
|
||||
Vel fixed.Vec
|
||||
Fuel fixed.F
|
||||
// Cargo is the hold of the earlier design, before ore travelled in containers.
|
||||
// It is only read to convert what old ships still carry (migrateLegacyCargo).
|
||||
Cargo [world.NumOre]int64
|
||||
CPU *vm.CPU
|
||||
Alive bool
|
||||
@@ -65,16 +66,9 @@ type Ship struct {
|
||||
MathZ int32
|
||||
}
|
||||
|
||||
func (s *Ship) CargoTotal() int64 {
|
||||
var t int64
|
||||
for _, v := range s.Cargo {
|
||||
t += v
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func (s *Ship) Mass() fixed.F {
|
||||
return fixed.FromInt(s.Hull.DryMass+s.CargoTotal()) + s.Fuel
|
||||
// baseMass is the hull and its fuel; towed containers add to it (State.shipMass).
|
||||
func (s *Ship) baseMass() fixed.F {
|
||||
return fixed.FromInt(s.Hull.DryMass) + s.Fuel
|
||||
}
|
||||
|
||||
// State is everything that persists between daily runs.
|
||||
@@ -83,8 +77,11 @@ type State struct {
|
||||
Asteroids []world.Asteroid // sorted by ID
|
||||
Station world.Station
|
||||
Ships []*Ship // sorted by ID
|
||||
Credits map[int64]int64
|
||||
Market market.Market
|
||||
// Containers are sorted by ID; NextContainer is the last ID handed out.
|
||||
Containers []*Container
|
||||
NextContainer int64
|
||||
Credits map[int64]int64
|
||||
Market market.Market
|
||||
}
|
||||
|
||||
// NewState builds the initial world from the config seed.
|
||||
@@ -123,6 +120,7 @@ type Uplink struct {
|
||||
type DayInput struct {
|
||||
Launches []Launch // processed in slice order (must be deterministic)
|
||||
Uplinks []Uplink
|
||||
Scraps []int64 // ships to remove from the world before the day starts, in slice order
|
||||
}
|
||||
|
||||
// Downlink is the content of a ship's transmit buffer at the end of the day.
|
||||
|
||||
Reference in New Issue
Block a user