standardize display, add flavour text
This commit is contained in:
parent
c4ba6b83e6
commit
ffbf8afca3
@ -1,7 +1,8 @@
|
|||||||
[[converter]]
|
[[converter]]
|
||||||
itemid = 3
|
itemid = 3
|
||||||
name = "teaConverter"
|
name = "teaConverter"
|
||||||
displayName = "Tea Pulper"
|
displayName = "Tea Presser"
|
||||||
|
flavour = "Compresses tea leaves into useful bricks"
|
||||||
source = "tea"
|
source = "tea"
|
||||||
output = "brick"
|
output = "brick"
|
||||||
rate = 4
|
rate = 4
|
||||||
@ -14,6 +15,7 @@ value = 10
|
|||||||
itemid = 4
|
itemid = 4
|
||||||
name = "teaPlanter"
|
name = "teaPlanter"
|
||||||
displayName = "Tea Planter"
|
displayName = "Tea Planter"
|
||||||
|
flavour = "Grows tea leaves automagically"
|
||||||
source = ""
|
source = ""
|
||||||
output = "tea"
|
output = "tea"
|
||||||
rate = 0
|
rate = 0
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
itemid = 1
|
itemid = 1
|
||||||
name = "tea"
|
name = "tea"
|
||||||
displayName = "Tea"
|
displayName = "Tea"
|
||||||
|
flavour = "Simple tea leaves. If only I could boil water.."
|
||||||
buildable = true
|
buildable = true
|
||||||
icon = "p"
|
icon = "p"
|
||||||
rate = 3
|
rate = 3
|
||||||
@ -10,6 +11,7 @@ rate = 3
|
|||||||
itemid = 2
|
itemid = 2
|
||||||
name = "brick"
|
name = "brick"
|
||||||
displayName = "Tea Bricks"
|
displayName = "Tea Bricks"
|
||||||
|
flavour = "Tea compressed into a brick shape"
|
||||||
icon = "b"
|
icon = "b"
|
||||||
buildable = false
|
buildable = false
|
||||||
|
|
||||||
|
4
menu.go
4
menu.go
@ -39,10 +39,10 @@ func newMenuModel(entries []sim.ItemEntry, i menutype) menuModel {
|
|||||||
p.kind = i
|
p.kind = i
|
||||||
items := []list.Item{}
|
items := []list.Item{}
|
||||||
for _, v := range entries {
|
for _, v := range entries {
|
||||||
items = append(items, item{v.String(), "no description", v.ID().String(), v})
|
items = append(items, item{v.Describe(), v.Description(), v.ID().String(), v})
|
||||||
}
|
}
|
||||||
//w,h
|
//w,h
|
||||||
p.list = list.New(items, list.NewDefaultDelegate(), 32, 32)
|
p.list = list.New(items, list.NewDefaultDelegate(), 80, 32)
|
||||||
switch i {
|
switch i {
|
||||||
case placeMenu:
|
case placeMenu:
|
||||||
p.list.Title = "What do you want to place?"
|
p.list.Title = "What do you want to place?"
|
||||||
|
@ -10,6 +10,7 @@ type Converter struct {
|
|||||||
Name string `toml:"name"`
|
Name string `toml:"name"`
|
||||||
DisplayName string `toml:"displayName"`
|
DisplayName string `toml:"displayName"`
|
||||||
Icon string `toml:"icon"`
|
Icon string `toml:"icon"`
|
||||||
|
Flavour string `toml:"flavour"`
|
||||||
Rate int `toml:"rate"`
|
Rate int `toml:"rate"`
|
||||||
source itemType
|
source itemType
|
||||||
SourceName string `toml:"source"`
|
SourceName string `toml:"source"`
|
||||||
@ -35,6 +36,7 @@ func newConverter(k itemType, o *Player) *Converter {
|
|||||||
res.DisplayName = temp.DisplayName
|
res.DisplayName = temp.DisplayName
|
||||||
res.Name = temp.Name
|
res.Name = temp.Name
|
||||||
res.Icon = temp.Icon
|
res.Icon = temp.Icon
|
||||||
|
res.Flavour = temp.Flavour
|
||||||
res.source = lookupByName(temp.SourceName).ID()
|
res.source = lookupByName(temp.SourceName).ID()
|
||||||
res.output = lookupByName(temp.OutputName).ID()
|
res.output = lookupByName(temp.OutputName).ID()
|
||||||
res.Rate = temp.Rate
|
res.Rate = temp.Rate
|
||||||
@ -68,6 +70,11 @@ func (c Converter) Describe() string {
|
|||||||
return c.DisplayName
|
return c.DisplayName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Description returns flavour description
|
||||||
|
func (c Converter) Description() string {
|
||||||
|
return c.Flavour
|
||||||
|
}
|
||||||
|
|
||||||
//Type returns consumer
|
//Type returns consumer
|
||||||
func (c Converter) Type() ObjectType {
|
func (c Converter) Type() ObjectType {
|
||||||
return consumerObject
|
return consumerObject
|
||||||
|
@ -17,7 +17,9 @@ type item interface {
|
|||||||
//ItemEntry is a human/ui friendly item description
|
//ItemEntry is a human/ui friendly item description
|
||||||
type ItemEntry interface {
|
type ItemEntry interface {
|
||||||
String() string
|
String() string
|
||||||
|
Describe() string
|
||||||
Render() string
|
Render() string
|
||||||
|
Description() string
|
||||||
ID() itemType
|
ID() itemType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func (p *Player) String() string {
|
|||||||
sort.Ints(ress)
|
sort.Ints(ress)
|
||||||
for _, k := range ress {
|
for _, k := range ress {
|
||||||
id := itemType(k)
|
id := itemType(k)
|
||||||
res += fmt.Sprintf("%v: %v\n", GlobalItems[id], p.Resources[id])
|
res += fmt.Sprintf("%v: %v\n", GlobalItems[id].Describe(), p.Resources[id])
|
||||||
}
|
}
|
||||||
res += "\nLocation: \n"
|
res += "\nLocation: \n"
|
||||||
if p.CurrentTile != nil {
|
if p.CurrentTile != nil {
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package simulator
|
package simulator
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,6 +9,7 @@ type Resource struct {
|
|||||||
Id itemType `toml:"itemid"`
|
Id itemType `toml:"itemid"`
|
||||||
Name string `toml:"name"`
|
Name string `toml:"name"`
|
||||||
DisplayName string `toml:"displayName"`
|
DisplayName string `toml:"displayName"`
|
||||||
|
Flavour string `toml:"flavour"`
|
||||||
Buildable bool `toml:"buildable"`
|
Buildable bool `toml:"buildable"`
|
||||||
Rate int `toml:"rate"`
|
Rate int `toml:"rate"`
|
||||||
Icon string `toml:"icon"`
|
Icon string `toml:"icon"`
|
||||||
@ -27,10 +26,12 @@ func newResource(k itemType) *Resource {
|
|||||||
if template, ok := GlobalItems[k]; ok {
|
if template, ok := GlobalItems[k]; ok {
|
||||||
temp := template.(Resource)
|
temp := template.(Resource)
|
||||||
res.DisplayName = temp.DisplayName
|
res.DisplayName = temp.DisplayName
|
||||||
|
res.Flavour = temp.Flavour
|
||||||
res.Id = k
|
res.Id = k
|
||||||
res.Name = temp.Name
|
res.Name = temp.Name
|
||||||
res.Buildable = temp.Buildable
|
res.Buildable = temp.Buildable
|
||||||
res.Rate = temp.Rate
|
res.Rate = temp.Rate
|
||||||
|
res.Flavour = temp.Flavour
|
||||||
res.Icon = temp.Icon
|
res.Icon = temp.Icon
|
||||||
res.value = 0
|
res.value = 0
|
||||||
res.growth = 0
|
res.growth = 0
|
||||||
@ -69,10 +70,13 @@ func (r Resource) Render() string {
|
|||||||
func (r Resource) Describe() string {
|
func (r Resource) Describe() string {
|
||||||
return r.DisplayName
|
return r.DisplayName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r Resource) Description() string {
|
||||||
|
return r.Flavour
|
||||||
|
}
|
||||||
func loadResources(filename string) {
|
func loadResources(filename string) {
|
||||||
var res resources
|
var res resources
|
||||||
foo, err := toml.DecodeFile(filename, &res)
|
_, err := toml.DecodeFile(filename, &res)
|
||||||
log.Println(foo.Undecoded())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ type Tech struct {
|
|||||||
ID TechID `toml:"techid"`
|
ID TechID `toml:"techid"`
|
||||||
DisplayName string `toml:"displayName"`
|
DisplayName string `toml:"displayName"`
|
||||||
Name string `toml:"name"`
|
Name string `toml:"name"`
|
||||||
|
Flavour string `toml:"flavour"`
|
||||||
Requires []relation `toml:"requires"`
|
Requires []relation `toml:"requires"`
|
||||||
Unlocks []string `toml:"unlocks"`
|
Unlocks []string `toml:"unlocks"`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user