-
Notifications
You must be signed in to change notification settings - Fork 0
/
part.go
43 lines (35 loc) · 858 Bytes
/
part.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package avi
import (
"errors"
"fmt"
)
func PartNotAvailable(name string) error {
return errors.New(fmt.Sprintf("part '%s' not available", name))
}
type Part interface {
Object
setShip(*shipT)
reset()
}
type ShipPartConf struct {
Name string `yaml:"name" json:"name"`
Position []float64 `yaml:"position" json:"position"`
Type string `yaml:"type" json:"type"`
}
type partT struct {
objectT
ship *shipT
used bool
}
func (part *partT) setShip(ship *shipT) {
part.ship = ship
}
func (part *partT) reset() {
part.used = false
}
type PartSetConf struct {
Engines map[string]EngineConf `yaml:"engines" json:"engines"`
Thrusters map[string]ThrusterConf `yaml:"thrusters" json:"thrusters"`
Weapons map[string]WeaponConf `yaml:"weapons" json:"weapons"`
Sensors map[string]SensorConf `yaml:"sensors" json:"sensors"`
}