test fixes

This commit is contained in:
anton.gurov 2020-01-28 15:25:32 +03:00
parent bf13c9c7a2
commit e738568c14
6 changed files with 20 additions and 13 deletions

6
TODO
View File

@ -27,7 +27,7 @@ Assets and i18n:
ECS & engine: ECS & engine:
- implement time queue (how to deal with closures?) (?) github.com/thefish/scheduleq - get rid od time.Now inside - implement time queue (how to deal with closures?) (?) github.com/thefish/scheduleq - get rid od time.Now inside
- move all rendering to systems - move all rendering to systems
- try to move input handling to systems + try to move input handling to systems
Dungeon and branches: Dungeon and branches:
General: General:
@ -53,7 +53,7 @@ Combat:
- mass - mass
- damage calculated from: - damage calculated from:
kinetic energy is calculated by mass / speed / material density (p = mv) масса на скорость = кинетическая энергия kinetic energy is calculated by mass / speed / material density (p = mv) масса на скорость = кинетическая энергия
next you determine target and its subpart (accuracy appied) next you determine target and its subpart (accuracy applied)
next we calculate the area, on which kinetic energy is applied (determined by piercing, hacking, crushing damage profile) находим площадь next we calculate the area, on which kinetic energy is applied (determined by piercing, hacking, crushing damage profile) находим площадь
next we calculate next we calculate
@ -81,5 +81,5 @@ Combat:
Quest engine: Quest engine:
- look at parsers like URQL etc - look at parsers like URQL etc
- distorted Aschenputtel story / partisans / rapist prince / Grey Mountains - distorted Aschenputtel story / partisans / rapist prince / Grey Mountains / No gold

View File

@ -148,6 +148,7 @@ func main() {
} }
screenMgr.AddScreen("devmenu", screens.NewDevmenuScreen( screenMgr.AddScreen("devmenu", screens.NewDevmenuScreen(
mainCtx,
mw, mw,
controller, controller,
screenMgr, screenMgr,

View File

@ -1,5 +1,5 @@
{ {
"version": "v0.0.1.7", "version": "v0.0.1.7-16-gbf13c9c",
"title": "Alchemyst", "title": "Alchemyst",
"sizeX": 100, "sizeX": 100,
"sizeY": 47, "sizeY": 47,

View File

@ -18,14 +18,14 @@ func TestDelaunay(t *testing.T) {
} }
expected := []types.Edge{ expected := []types.Edge{
{types.Coords{10, 60}, types.Coords{10, 10}}, {types.Coords{ 60, 10}, types.Coords{40, 20}},
{types.Coords{30, 10}, types.Coords{40, 20}}, {types.Coords{40, 20}, types.Coords{10, 10}},
{types.Coords{60, 10}, types.Coords{40, 60}}, {types.Coords{30, 10}, types.Coords{60, 10}},
{types.Coords{40, 20}, types.Coords{40, 60}}, {types.Coords{40, 60}, types.Coords{10, 60}},
{types.Coords{10, 10,}, types.Coords{30, 10}}, {types.Coords{40, 20,}, types.Coords{10, 60}},
} }
result := delaunay.GetMst(coords, 100, 100) result := delaunay.GetMst(coords, 100, 100, 100 )
for idx, _ := range result { for idx, _ := range result {
if result[idx] != expected[idx] { if result[idx] != expected[idx] {

View File

@ -7,10 +7,12 @@ import (
"lab.zaar.be/thefish/alchemyst-go/engine/gamestate" "lab.zaar.be/thefish/alchemyst-go/engine/gamestate"
"lab.zaar.be/thefish/alchemyst-go/engine/types" "lab.zaar.be/thefish/alchemyst-go/engine/types"
"lab.zaar.be/thefish/alchemyst-go/ui/mainwindow" "lab.zaar.be/thefish/alchemyst-go/ui/mainwindow"
"lab.zaar.be/thefish/alchemyst-go/util/appctx"
"strings" "strings"
) )
type DevmenuScreen struct { type DevmenuScreen struct {
ctx appctx.ClientCtx
mw *mainwindow.MainWindow mw *mainwindow.MainWindow
controller *ecs.Controller controller *ecs.Controller
scm *types.ScreenManager scm *types.ScreenManager
@ -23,8 +25,9 @@ type DevmenuScreen struct {
fgColor string fgColor string
} }
func NewDevmenuScreen(mw *mainwindow.MainWindow, controller *ecs.Controller, scm *types.ScreenManager, state *gamestate.GameState, rect types.Rect, renderParent bool) *DevmenuScreen { func NewDevmenuScreen(ctx appctx.ClientCtx, mw *mainwindow.MainWindow, controller *ecs.Controller, scm *types.ScreenManager, state *gamestate.GameState, rect types.Rect, renderParent bool) *DevmenuScreen {
return &DevmenuScreen{ return &DevmenuScreen{
ctx: ctx,
mw: mw, mw: mw,
controller: controller, controller: controller,
scm: scm, scm: scm,
@ -58,6 +61,7 @@ func (devm *DevmenuScreen) HandleInput(input string) {
level.Tiles[idx].Explored = false level.Tiles[idx].Explored = false
} }
devm.scm.SetScreen(devm.scm.PreviousScreen) devm.scm.SetScreen(devm.scm.PreviousScreen)
appctx.Logger(devm.ctx).Info().Msg("resetting to normal visibility")
break break
case "v": case "v":
level := devm.state.Level level := devm.state.Level
@ -65,13 +69,15 @@ func (devm *DevmenuScreen) HandleInput(input string) {
level.Tiles[idx].Visible = true level.Tiles[idx].Visible = true
level.Tiles[idx].Explored = true level.Tiles[idx].Explored = true
} }
fmt.Printf("making everything visible!") appctx.Logger(devm.ctx).Info().Msg("making everything visible")
devm.scm.SetScreen(devm.scm.PreviousScreen) devm.scm.SetScreen(devm.scm.PreviousScreen)
break break
case "p": case "p":
if devm.controller.HasComponent(devm.state.Player, effects.BuffPassWall) { if devm.controller.HasComponent(devm.state.Player, effects.BuffPassWall) {
appctx.Logger(devm.ctx).Info().Msg("disabling passwall")
devm.controller.RemoveComponent(devm.state.Player, effects.BuffPassWall) devm.controller.RemoveComponent(devm.state.Player, effects.BuffPassWall)
} else { } else {
appctx.Logger(devm.ctx).Info().Msg("enabling passwall")
devm.controller.AddComponent(devm.state.Player, effects.PassWall{}) devm.controller.AddComponent(devm.state.Player, effects.PassWall{})
} }
case "Escape": case "Escape":

View File

@ -55,5 +55,5 @@ Roguebasin Libtcod Tutorial (c) 2010-2011, Jotaf Henriques
Brogue 1.3 (c) 2010 Brian Walker Brogue 1.3 (c) 2010 Brian Walker
Madness (c) 2010 hmp <humpolec@gmail.com> Madness (c) 2010 hmp <humpolec@gmail.com>
BearLibTerminal (c) Cfyz 2009-2019 <http://foo.wyrd.name/en:bearlibterminal> BearLibTerminal (c) Cfyz 2009-2019 <http://foo.wyrd.name/en:bearlibterminal>
Gogue (c) jcerise Gogue (c) 2019 jcerise
` `