mirror of
https://github.com/arnaucube/gogame.git
synced 2026-02-06 19:16:40 +01:00
add CreatePlanet and put planet in solar system
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
package models
|
||||
|
||||
type Galaxy struct {
|
||||
SolarSystem []string
|
||||
}
|
||||
|
||||
type SolarSystem struct {
|
||||
Id string
|
||||
Planets []string // array with ids of the planets
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package models
|
||||
|
||||
import "gopkg.in/mgo.v2/bson"
|
||||
|
||||
type Planet struct {
|
||||
Id string
|
||||
Size int64 // fields
|
||||
Id bson.ObjectId `json:"id", bson:"_id, omitempty"`
|
||||
Size int64 // fields/slots
|
||||
Name string
|
||||
OwnerId string
|
||||
OwnerId bson.ObjectId
|
||||
}
|
||||
|
||||
12
models/solarsystem.go
Normal file
12
models/solarsystem.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package models
|
||||
|
||||
import "gopkg.in/mgo.v2/bson"
|
||||
|
||||
const GALAXYSIZE = 50
|
||||
const SOLARSYSTEMSIZE = 15
|
||||
|
||||
type SolarSystem struct {
|
||||
Id bson.ObjectId `json:"id", bson:"_id, omitempty"`
|
||||
Position int64 // position of the solar system in the galaxy, the maximum position is GALAXYSIZE-1
|
||||
Planets []bson.ObjectId // array with ids of the planets, if empty is equal to ""
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package models
|
||||
|
||||
import "gopkg.in/mgo.v2/bson"
|
||||
|
||||
type Resource struct {
|
||||
Value int64
|
||||
Max int64
|
||||
}
|
||||
|
||||
type User struct {
|
||||
Id string
|
||||
Id bson.ObjectId `json:"id" bson:"_id,omitempty"`
|
||||
Name string
|
||||
Password string
|
||||
Email string
|
||||
|
||||
Reference in New Issue
Block a user