示例#1
1
文件: ship.go 项目: brendonh/drift
func (ship *Ship) LoadLocation(db *loge.LogeDB) bool {
	var body = db.ReadOne("shiplocation", loge.LogeKey(ship.ID)).(*simulation.PoweredBody)
	if body == nil {
		return false
	}
	ship.Location = body
	return true
}
示例#2
0
文件: ship.go 项目: brendonh/drift
func (ship *Ship) SaveLocation(db *loge.LogeDB) {
	if ship.Location == nil {
		return
	}

	db.SetOne("shiplocation", loge.LogeKey(ship.ID), ship.Location)
}
示例#3
0
文件: ship.go 项目: brendonh/drift
func GetShip(body *simulation.PoweredBody, db *loge.LogeDB) *Ship {
	var ship = db.ReadOne("ship", loge.LogeKey(body.ShipID)).(*Ship)
	if ship == nil {
		return nil
	}
	ship.Location = body
	return ship
}