bubble up more, accounts
This commit is contained in:
parent
a6d74089ee
commit
207a0e2d69
10
account.go
Normal file
10
account.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import sim "git.saintnet.tech/stryan/spacetea/simulator"
|
||||||
|
|
||||||
|
//Account is a account
|
||||||
|
type Account struct {
|
||||||
|
Player *sim.Player
|
||||||
|
Simulator *sim.Simulator
|
||||||
|
Landmark *sim.Landmark
|
||||||
|
}
|
11
data/landmark.toml
Normal file
11
data/landmark.toml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
[[landmark]]
|
||||||
|
landmarkid = 0
|
||||||
|
name = "Spawn"
|
||||||
|
content = "Nothing's here but us chickens"
|
||||||
|
links = [1]
|
||||||
|
|
||||||
|
[[landmark]]
|
||||||
|
landmarkid = 1
|
||||||
|
name = "Landmark 1"
|
||||||
|
content = "New spot"
|
||||||
|
links = []
|
2
jmenu.go
2
jmenu.go
@ -52,7 +52,7 @@ func (j jMenuModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
case tea.KeyMsg:
|
case tea.KeyMsg:
|
||||||
switch keypress := msg.String(); keypress {
|
switch keypress := msg.String(); keypress {
|
||||||
case "ctrl-c":
|
case "ctrl-c":
|
||||||
return j, tea.Quit
|
return j, tea.Batch(tea.Quit, j.GetSize)
|
||||||
case "esc":
|
case "esc":
|
||||||
return initMainscreen(j.acc), tea.Batch(j.GetSize, heartbeat())
|
return initMainscreen(j.acc), tea.Batch(j.GetSize, heartbeat())
|
||||||
case "enter":
|
case "enter":
|
||||||
|
6
main.go
6
main.go
@ -11,12 +11,14 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
simulator := sim.NewSimulator()
|
simulator := sim.NewSimulator()
|
||||||
sim.Demo(simulator)
|
player := sim.NewPlayer()
|
||||||
acc := &Account{
|
acc := &Account{
|
||||||
Player: simulator.Player,
|
Player: player,
|
||||||
Simulator: simulator,
|
Simulator: simulator,
|
||||||
Landmark: nil,
|
Landmark: nil,
|
||||||
}
|
}
|
||||||
|
sim.Demo(acc.Player, acc.Simulator)
|
||||||
|
|
||||||
simulator.Start()
|
simulator.Start()
|
||||||
parent := parent{initMainscreen(acc)}
|
parent := parent{initMainscreen(acc)}
|
||||||
if err := tea.NewProgram(parent, tea.WithAltScreen()).Start(); err != nil {
|
if err := tea.NewProgram(parent, tea.WithAltScreen()).Start(); err != nil {
|
||||||
|
@ -16,16 +16,15 @@ type Simulator struct {
|
|||||||
stop chan bool
|
stop chan bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func Demo(s *Simulator) {
|
func Demo(p *Player, s *Simulator) {
|
||||||
pod := newPod()
|
pod := newPod()
|
||||||
player := NewPlayer()
|
|
||||||
pod.Place(newResource(lookupByName("tea").ID()), 4, 4)
|
pod.Place(newResource(lookupByName("tea").ID()), 4, 4)
|
||||||
player.AddItem(itemType(1), 30)
|
p.AddItem(itemType(1), 30)
|
||||||
player.AddItem(itemType(3), 5)
|
p.AddItem(itemType(3), 5)
|
||||||
pod.Tiles[0][0].User = player
|
pod.Tiles[0][0].User = p
|
||||||
player.Announce("Game started")
|
p.Announce("Game started")
|
||||||
s.Place = pod
|
s.Place = pod
|
||||||
s.Player = player
|
s.Player = p
|
||||||
}
|
}
|
||||||
|
|
||||||
//NewSimulator creates a new simulator instance
|
//NewSimulator creates a new simulator instance
|
||||||
|
Loading…
Reference in New Issue
Block a user