aboutsummaryrefslogtreecommitdiff
path: root/internal/game/core_stations.go
blob: d30a35c493614f07bc03ff7240cf86cf4ca7eaf0 (plain)
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
package game

func (g *Game) findStation(roomID int, stationIDs []string) (defID string, displayName string) {
	for _, obj := range g.World.AllObjInstances(roomID) {
		if obj.Depleted {
			continue
		}
		for _, sid := range stationIDs {
			if obj.DefID == sid {
				name := sid
				if def, err := g.ObjectStore.Load(sid); err == nil {
					name = def.Name
				}
				return sid, name
			}
		}
	}
	return "", ""
}

func stationMatch(defID string, recipeStations []string) bool {
	for _, rs := range recipeStations {
		if rs == defID {
			return true
		}
	}
	return false
}