Commit Graph

603 Commits

Author SHA1 Message Date
Tristan de Cacqueray
7c9e46d033
Fix modal toggle to unpause the game (#452)
And also enable modal view toggle using the same key.

* Unpause the game after quitting a modal with Esc
* Handle FKey event before `uiModal` event to enable toggle through Fkey
2022-06-20 16:13:22 -05:00
Tristan de Cacqueray
7f4db06422
Handle mouse click event for robot inventory (#448)
This change makes inventory click select the inventory item.

Fixes #446
2022-06-20 19:16:44 +00:00
Brent Yorgey
8b8c16a71b
switch from U+2591 Light Shade to U+2592 Medium Shade (#449)
Some terminals (*e.g.* `gnome-terminal`) use the character to decide
how dark or light the color should be, rather than showing the
character itself (like *e.g.* `rxvt-unicode`).  Light Shade looks OK
in terminals that display the actual character, but too dark in
terminals that use it as a brightness hint.  Medium Shade seems to
look good (at least, IMO) in both.

See https://github.com/swarm-game/swarm/issues/196#issuecomment-1147298159 .
2022-06-20 17:56:55 +00:00
Brent Yorgey
389e3b7940 progress report blog post 2022-06-20 11:29:14 -05:00
Tristan de Cacqueray
88933d82fb
Handle mouse click event (#437)
This change adds support for mouse event:
- Change panel focus
- Display world location distance to the center

Fixes #203
2022-06-20 14:30:37 +00:00
Brent Yorgey
9fdfeb7554
reset some UI state fields when beginning a new game (#445)
Reset `uiFocusRing`, `uiInventory`, `uiShowFPS`, and `uiShowZero`.

Fixes #444.
2022-06-20 13:27:17 +00:00
Tristan de Cacqueray
bbcdfbcddc
Add knows command (#433)
Fixes #409
2022-06-19 17:01:43 +00:00
Tristan de Cacqueray
7a35efacbc
Exit the game when the previous menu is not set (#432)
This change fixes an issue when the game is started directly using
the `-s` command line argument. The new behavior is to halt the game
when no previous menu is set.
2022-06-19 14:07:29 +00:00
Brent Yorgey
fa207506f9
recipes for treads + tank treads: LaTeX -> rubber + motors + iron (#434)
This doesn't yet prevent normal treads from being installed on the base (see #334).  That will be a separate PR.
2022-06-19 12:16:03 +00:00
Tristan de Cacqueray
04e143d51b
Destroy robot when needed (#429)
This change fixes #428
2022-06-19 01:26:20 +00:00
Tristan de Cacqueray
1eb714db38
Crafting tutorial (#423)
This change adds a new crafting tutorial.
2022-06-18 22:48:10 +00:00
Tristan de Cacqueray
59da90340d
Returns to the scenario menu after winning a game (#422)
This change slightly improves the navigation by saving
the menu position so that the user gets back to the next
tutorial or challenge after winning a game.
2022-06-18 22:40:51 +00:00
Brent Yorgey
32021df8ba
Wordsmithing (#430)
- Expand some entity descriptions
- Improve formatting, grammar, punctuation, wording etc. all around
- Also make big furnaces able to process copper and iron too
2022-06-18 21:47:47 +00:00
Brent Yorgey
af2b3ce799
Add recipe for mirror and make it required for self (#416)
The `whoami` command used to be more interesting back when robot names were used to uniquely identify them.  It seemed fitting to make `mirror` required for `self`, which now plays the same role.  I also added a recipe for `mirror` which we lacked (`glass` + `silver`) and made a new type of `deep mine` where we can mine `gold`, `silver`, and `mithril`.
2022-06-18 02:39:02 +00:00
Ondřej Šebek
6838dfa1aa Add portal challenge to tests 2022-06-18 02:44:22 +02:00
Ondřej Šebek
820f1b067e Recurse integration test discovery 2022-06-18 02:44:22 +02:00
Ondřej Šebek
bb8a31ec4d Test scenarios
- add winning solutions to scenarios
- test the winning solutions
  - fail if any robot has a `Fatal error` in its log
  - timeout in X seconds (default 1)
- add a Testing scenario collection hidden without the `--cheat` flag
  - add a test case for #394

- closes #388
2022-06-18 02:44:22 +02:00
Ondřej Šebek
05e4e08d10 Move test into separate folders
It makes IDE usage easier and allows us to split
main files once they get too big.
2022-06-18 02:44:22 +02:00
Ondřej Šebek
6b36ff04c4 Clean up startup messages 2022-06-18 02:44:22 +02:00
Ondřej Šebek
ab738fcd27 Fix creative mode ignoring scenario inventory 2022-06-18 02:44:22 +02:00
Ondřej Šebek
6d2550bb0f
Add teleport command (#406)
- add command `teleport :: robot -> (int * int) -> cmd ()` requiring god capability

In challenges, it is useful to be able to check the state of some remote position.
This gets you there.
2022-06-17 23:24:32 +00:00
Brent Yorgey
7237a37e65
put base in a 32x32 patch with all necessary starting resources (#412)
Fixes #385 .  Note, we will need to update `TUTORIAL.md` since this changes what world 0 looks like, but I wanted to get some feedback before launching into updating that.
2022-06-17 22:11:02 +00:00
Ondřej Šebek
7fc7051c8d Remove create capability 2022-06-16 14:08:40 +02:00
Ondřej Šebek
83a7b6626e
Add robotNumbered command for debugging (#405)
Sometimes I need a dirty and direct way to get the n-th robot in the world quickly.

The name of the command is longer by design so that it does not get confused with the proposed `child` command or custom user definitions.

- part of #343
2022-06-16 11:17:33 +00:00
Brent Yorgey
221e7ec679
Some new devices and recipes (#395)
- Add quartz and quartz mines
- Add `clock`, `silicon`, and `circuit`
- Add `comparator` device
- Metal drills can now drill through boulders too
- Add pixels to the world, and recipes for `camera` and `scanner`

See discussion at https://github.com/swarm-game/swarm/issues/26#issuecomment-1152743741 and https://github.com/swarm-game/swarm/pull/361 .
2022-06-15 16:06:25 +00:00
Brent Yorgey
7a88bc1db6
copy over known (count 0) items when salvaging (#398)
Fixes #391.
2022-06-15 15:53:16 +00:00
Ondřej Šebek
bda16b79ac
Iron (#373)
- add iron ore, iron mine and iron vein (closes #93)
  - split gear into iron/wooden gear
  - add metal drill
  - add faster recipes with the metal drill
- add compass (closes #341)
- handle multiple entities providing the same capability
  - try to find if the robot has at least one entity providing the capability
  - when no entity could provide the capability rejects it too
- list required devices in the `Incapable` error (closes #342)
2022-06-14 16:13:27 +00:00
Brent Yorgey
7ee8d2458b fix module name in comment 2022-06-13 06:23:18 -05:00
Brent Yorgey
2b5bffc6e0 Delete bound variables from capCtx when recursing into terms
Fixes #389.
2022-06-12 17:03:50 -05:00
Brent Yorgey
54e5e35bbe clean up examples
Closes #325.
2022-06-11 15:15:07 -05:00
Ondřej Šebek
d55c6e8bf6
Add note about create (#381)
- add a note about 'create' to the make command
- also fix spacing before punctuation in error messages
2022-06-11 01:53:47 +00:00
Brent Yorgey
2da8cb06e0 tutorial: remove reference to creative mode hotkey
Fixes #360.
2022-06-10 15:40:54 -05:00
Brent Yorgey
6780254b2f
resolve seed every time a scenario is selected to be played (#379)
Seed resolution used to happen in `loadScenarioFile`, but that was the
wrong place.  Resolution now happens in `playScenario`.  This means that, e.g. if you
select "New Game > Classic" from the menu, then quit back to the menu, then start
a second new game, you will get a different random world each time.

Fixes #369.
2022-06-10 10:24:48 +00:00
Brent Yorgey
597d1c6853
require --cheat flag to allow toggling creative mode with m key (#368)
Closes #360.
2022-06-10 00:38:00 +00:00
Brent Yorgey
a5a5832afe
add recipe weights and choose randomly among matching recipes (#372)
Recipes can now optionally have a `weight` (with a default weight of
1).  Any time multiple recipes match the criteria by which we are
selecting a recipe, one of the recipes will be chosen randomly, with
probability proportional to its weight.

As a simple example, drilling a boulder now produces 3 rocks with
probability 3/4 and 4 rocks with probability 1/4.

The ultimate purpose of this is to support some things I would like to propose in relation to mines, iron, etc. but it seems like a useful/interesting feature on its own.
2022-06-09 00:42:29 +00:00
Ondřej Šebek
14c5bdbd04 Move HLint to GHC 8.10.7 in CI
The version check only cares about 8/9
and HLint has some trouble installing
in 9.2, so this avoids it for now.
2022-06-09 01:29:05 +02:00
Ondřej Šebek
dabcb21608 Update stack resolver 2022-06-09 01:29:05 +02:00
Ondřej Šebek
ff9ec66711 Add ci flag to CI
- set -Werror in CI
- fix GHC 9.2 warning about TH looking syntax ($e)
2022-06-09 01:29:05 +02:00
Ondřej Šebek
94c876a01a Add GHC 9.2.3 to CI 2022-06-09 01:29:05 +02:00
Brent Yorgey
69929f1b61 Bump dependency bounds
- bump upper bounds on dependencies
- remove special th-extras and depedent-sum deps
- fix problems with new opaque types in Aeson
2022-06-09 01:29:05 +02:00
Ondřej Šebek
b67a0f3ef4
Enable HLint in CI (#371)
- uncomment HLint configuration in Haskell-CI config
- remove unused pragmas
- remove some unnecessary parens
2022-06-08 22:40:29 +00:00
Ondřej Šebek
9a72bc52a5
Reformat codebase with Fourmolu (#370)
Run
```bash
fourmolu -i $(find . -name '*.hs')
```
2022-06-08 22:32:12 +00:00
Brent Yorgey
128a15ebe8
skip menu and default to classic mode if --run or --seed is given (#364)
Closes #363.  Also addresses the issue discussed in #359 .
2022-06-06 12:23:34 +00:00
Brent Yorgey
7b4ffccb9d
add sand, glass, and calculator (#362)
- Sand is now found near water.  Sand regenerates immediately (like water).
- Sand can be used in a furnace to make glass.
- Glass + copper wires + 3D printer can be used to make solar panels.
    - Note that with #361 I intend to start the base with a small number of 3D printers, so other robots could carry this out.  But also, the base will start with a bunch of solar panels too.
- Solar panel + counter can be used to make a calculator.
2022-06-06 12:17:46 +00:00
Brent Yorgey
ee857a5d21
upgrade to brick-0.69 (#365)
Closes #340.
2022-06-04 22:59:18 -05:00
Ondřej Šebek
161f510f15
Find robots (#339)
* add robotNamed : string -> cmd robot
* add chess knight challenge

In challenges, it's impossible to access the robot
by its assigned number. We do however name it.
Seems reasonable to add a way to get robot by its name.
2022-06-05 00:29:06 +02:00
Ondřej Šebek
7ad65ad00a
Update Github Actions and fix Doctest (#352)
* Fix doctests

* Regenerate haskell-ci with config

- use latest haskell-ci
- configure haskell-ci to use doctest

* Update tested with compiler

- update cabal tested-with field
- update .mergify.yaml to new compiler
  - restore note about mergify in haskell-ci
2022-06-04 15:04:26 -05:00
Brent Yorgey
8578a5675a update tutorial to match changes to the way game is started 2022-06-04 13:56:01 -05:00
Brent Yorgey
3ab402a810 link to the web tutorial from the Tutorial menu 2022-06-04 13:40:01 -05:00
Brent Yorgey
b381bf8272 update README to reflect latest changes 2022-06-04 13:36:45 -05:00