From 98aa19757863b025ced8052385e27365550dbadf Mon Sep 17 00:00:00 2001 From: thefish Date: Thu, 14 Nov 2019 22:42:03 +0300 Subject: [PATCH] context is great again, fixes to connectors --- TODO | 2 +- cmd/game/main.go | 17 +++++++++-------- engine/gamemap/mapgens/common.go | 7 +++---- engine/gamemap/room.go | 8 ++++---- update-config-version.php | 16 ++++++++++++++++ 5 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 update-config-version.php diff --git a/TODO b/TODO index 1f32df6..8e5a22e 100644 --- a/TODO +++ b/TODO @@ -16,7 +16,7 @@ Basics: - ai - dijkstra maps Tech: - - make context great again + - fix connector position - 1 tile inside Assets and i18n: diff --git a/cmd/game/main.go b/cmd/game/main.go index 507b696..78987cb 100644 --- a/cmd/game/main.go +++ b/cmd/game/main.go @@ -1,6 +1,7 @@ package main import ( + "context" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "lab.zaar.be/thefish/alchemyst-go/engine/ecs" @@ -138,7 +139,7 @@ func main() { SetBgColor("#ef305c70"). SetFgColor("white"). SetItems([]interface{}{ - `"Fisheye" crafty shaded glasses`, + `"Fish-eye" crafty shaded glasses`, "Xecutor's glowing visor", "Kitschy goggles of many pathways", "Ring of inexistence", @@ -190,7 +191,7 @@ func main() { // f() // break case <-State.Exit: - mainCtx.Logger().Warn().Msg("quitting NOW") + appctx.Logger(mainCtx).Warn().Msg("quitting NOW") exit = true break // не оставляйте default в бесконечном select {} - сожрет всё CPU @@ -201,7 +202,7 @@ func main() { } } - mainCtx.Logger().Info().Msg("pre-shutdown sequence") + appctx.Logger(mainCtx).Info().Msg("pre-shutdown sequence") } func setupLayers(mainwindow *mainwindow.MainWindow) { @@ -211,7 +212,7 @@ func setupLayers(mainwindow *mainwindow.MainWindow) { mainwindow.AddLayer("menu", 3, "white") } -func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) { +func decodeInput(ctx context.Context, baseLayer *mainwindow.Layer) { var exit = false var waitForWCspam = true for !exit { @@ -221,9 +222,9 @@ func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) { continue } if keycode == blt.TK_CLOSE && !waitForWCspam { - ctx.Logger().Warn().Msg("exiting on window close...") + appctx.Logger(ctx).Warn().Msg("exiting on window close...") State.Exit <- struct{}{} - ctx.Logger().Warn().Msg("...done") + appctx.Logger(ctx).Warn().Msg("...done") return } var pressed = "" @@ -247,9 +248,9 @@ func decodeInput(ctx appctx.ClientCtx, baseLayer *mainwindow.Layer) { case "Ctrl+q": //fallthrough //case "Escape": - ctx.Logger().Info().Msg("exiting on quit command...") + appctx.Logger(ctx).Info().Msg("exiting on quit command...") State.Exit <- struct{}{} - ctx.Logger().Info().Msg("...done") + appctx.Logger(ctx).Info().Msg("...done") exit = true return default: diff --git a/engine/gamemap/mapgens/common.go b/engine/gamemap/mapgens/common.go index faf7aa9..3585e9e 100644 --- a/engine/gamemap/mapgens/common.go +++ b/engine/gamemap/mapgens/common.go @@ -5,13 +5,12 @@ import ( "lab.zaar.be/thefish/alchemyst-go/engine/gamemap" "lab.zaar.be/thefish/alchemyst-go/engine/types" "lab.zaar.be/thefish/alchemyst-go/util" - "lab.zaar.be/thefish/alchemyst-go/util/appctx" ) //fixme move to config -var minRoomSize = 5 -var maxRoomSize = 15 -var maxrooms = 200 +var minRoomSize = 8 +var maxRoomSize = 22 +var maxrooms = 100 var fges = map[int]types.RectFill{ 1: types.RectFill{ diff --git a/engine/gamemap/room.go b/engine/gamemap/room.go index a349181..c7384da 100644 --- a/engine/gamemap/room.go +++ b/engine/gamemap/room.go @@ -91,10 +91,10 @@ func NewRandomRectRoom(rng *util.RNG, w, h int, fillage types.RectFill) Room { //add connectors newRoom.Connectors = append( newRoom.Connectors, - types.Coords{rng.Range(1, w - 2), 0}, - types.Coords{rng.Range(1, w - 2), h -1}, - types.Coords{0, rng.Range(1, h - 1)}, - types.Coords{w - 1, rng.Range(1, h - 1)}, + types.Coords{rng.Range(1, w - 2), 1}, + types.Coords{rng.Range(1, w - 2), h -2}, + types.Coords{1, rng.Range(1, h - 2)}, + types.Coords{w - 2, rng.Range(1, h - 2)}, ) return newRoom } diff --git a/update-config-version.php b/update-config-version.php new file mode 100644 index 0000000..0e1f460 --- /dev/null +++ b/update-config-version.php @@ -0,0 +1,16 @@ +