chiark / gitweb /
otter.git
3 years agoapitest: Break out filter_by_desc_glob etc.
Ian Jackson [Sun, 24 Apr 2022 18:34:14 +0000 (19:34 +0100)]
apitest: Break out filter_by_desc_glob etc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodemo game: Give the dice descriptions
Ian Jackson [Sun, 24 Apr 2022 15:45:01 +0000 (16:45 +0100)]
demo game: Give the dice descriptions

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Support specifying the html description in the spec
Ian Jackson [Sun, 24 Apr 2022 15:44:46 +0000 (16:44 +0100)]
dice: Support specifying the html description in the spec

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Refactor describe_html to prep for desc
Ian Jackson [Sun, 24 Apr 2022 15:40:29 +0000 (16:40 +0100)]
dice: Refactor describe_html to prep for desc

Break out showing so that we don't have combinatorical description
formats.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodemo game: Make the 2-sided die a disc
Ian Jackson [Sun, 24 Apr 2022 15:35:14 +0000 (16:35 +0100)]
demo game: Make the 2-sided die a disc

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix many dbgc calls to be trace_dbg instead
Ian Jackson [Sun, 24 Apr 2022 11:36:23 +0000 (12:36 +0100)]
Fix many dbgc calls to be trace_dbg instead

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix trace_dbg to tolerate call without any value parameters
Ian Jackson [Sun, 24 Apr 2022 11:37:32 +0000 (12:37 +0100)]
Fix trace_dbg to tolerate call without any value parameters

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove logging::setup out of main.rs
Ian Jackson [Sun, 24 Apr 2022 11:26:57 +0000 (12:26 +0100)]
Move logging::setup out of main.rs

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agologging: Change output formats
Ian Jackson [Sun, 24 Apr 2022 11:18:11 +0000 (12:18 +0100)]
logging: Change output formats

Format is like that from flexi_logger but with only the level
coloured.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocurrency: Move qty into xdata
Ian Jackson [Mon, 18 Apr 2022 19:03:38 +0000 (20:03 +0100)]
currency: Move qty into xdata

When we multigrab, we must split, which involves mutating the value of
the grabbed piece.  So the value must be in xdata, not ipc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoat-otter: Fix a ref to PIA that ought to be PIB.
Ian Jackson [Mon, 18 Apr 2022 16:10:58 +0000 (17:10 +0100)]
at-otter: Fix a ref to PIA that ought to be PIB.

I think.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocurrency: Abolish min_unit
Ian Jackson [Mon, 18 Apr 2022 15:23:47 +0000 (16:23 +0100)]
currency: Abolish min_unit

We can instead just rely on the players to Not Do That, or to tell
each other off.  It's easy to recover from, too: just move money until
the amounts are right.

This also avoids any question of what to do if people try to combine
banknotes with the same currency but different min_qty.  (GCD?)

Suggested-by: Gareth Taylor
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMultigrab: Provide in initial load
Ian Jackson [Mon, 18 Apr 2022 15:22:05 +0000 (16:22 +0100)]
Multigrab: Provide in initial load

This was broken by the special refactoring.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMultigrab: allow to multigrab occulters
Ian Jackson [Mon, 18 Apr 2022 15:20:46 +0000 (16:20 +0100)]
Multigrab: allow to multigrab occulters

I don't expect any pieces to exist that can both be active occulter,
and multigrab.  But if it does it should probably do the thing, rather
than mysteriously not work.  And this simplifies the code.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoJS: Add a comment about PieceInfo vs SessionPieceLoadJson
Ian Jackson [Mon, 18 Apr 2022 15:17:50 +0000 (16:17 +0100)]
JS: Add a comment about PieceInfo vs SessionPieceLoadJson

I made a bug due to not realising this needed to be updated too.

Maybe at some point the common bits should be combined, at least on
the Rust side.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoCurrency: Declare to be multigrab
Ian Jackson [Mon, 18 Apr 2022 11:38:14 +0000 (12:38 +0100)]
Currency: Declare to be multigrab

We don't actually implement the PieceTrait method, so that just
returns Inapplicable.  Ie, after this you can try to multiselect a
banknote but you get
  Problem manipulating piece: UI operation not valid in the curret piece state
in the log.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoJS: Implement multigrab
Ian Jackson [Mon, 18 Apr 2022 12:20:30 +0000 (13:20 +0100)]
JS: Implement multigrab

Check the multigrab boolean, and if appropriate make a single
multigrab API call rather than trying to grab multiple pieces.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoPlumbing for "multigrab" piece API call
Ian Jackson [Mon, 18 Apr 2022 12:00:56 +0000 (13:00 +0100)]
Plumbing for "multigrab" piece API call

We can now pass this through to a piece.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoElide angle in game save file, when it's just North
Ian Jackson [Mon, 18 Apr 2022 11:22:24 +0000 (12:22 +0100)]
Elide angle in game save file, when it's just North

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoElide some fields from save game state where we can
Ian Jackson [Mon, 18 Apr 2022 11:02:11 +0000 (12:02 +0100)]
Elide some fields from save game state where we can

This saves writing out the field names as well as just the vslues.

We would like to do this for the updates sent to the client, but that
would really depend on the JS nullable coalesce operator "??" which is
not available the version of typescript I'm using, nor our ES
compatibility target.  Newer typescript would do a polyfill but that
maybe wouldn't be super-fast?  So postpone that.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix type of PreparedPieceState.held in the JS
Ian Jackson [Mon, 18 Apr 2022 10:59:42 +0000 (11:59 +0100)]
Fix type of PreparedPieceState.held in the JS

I was comparing the JS and Rust versions, and spotted this
discrepancy.

In fact it is assigned to internal fields and variables which are all
nullable, so there is no other code change needed.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide is_default() function
Ian Jackson [Mon, 18 Apr 2022 10:42:26 +0000 (11:42 +0100)]
Provide is_default() function

We're going to use this to elide some fields from the game save state.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide and plumb multigtab piece property from Rust to JS
Ian Jackson [Mon, 18 Apr 2022 09:10:37 +0000 (10:10 +0100)]
Provide and plumb multigtab piece property from Rust to JS

Currently nothing sets this (on the Rust side) nor uses it (on the JS
side).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoscript: Add a missing comma in a type definition
Ian Jackson [Mon, 18 Apr 2022 12:20:17 +0000 (13:20 +0100)]
script: Add a missing comma in a type definition

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAdd "p" argument to mouse_clicked_one
Ian Jackson [Mon, 18 Apr 2022 09:18:00 +0000 (10:18 +0100)]
Add "p" argument to mouse_clicked_one

Almost the callers have it and the one that doesn't (mouse_find_clicked)
is about to need it in another of its branches.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove special rendering instructions to PieceSpecialProperties
Ian Jackson [Mon, 18 Apr 2022 10:20:12 +0000 (11:20 +0100)]
Move special rendering instructions to PieceSpecialProperties

This gets rid of an ipc method (meaning we get rid of one method call
during piece rendering) and is also more principled, than a call which
might conceivably give different answers at different times.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoAdd special field to SpecLoaded
Ian Jackson [Mon, 18 Apr 2022 10:12:56 +0000 (11:12 +0100)]
Add special field to SpecLoaded

This is currently empty.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agosplit PieceSpecLoaded
Ian Jackson [Mon, 18 Apr 2022 10:07:55 +0000 (11:07 +0100)]
split PieceSpecLoaded

We are goint to want to add a field to only the non-inert version, so
this generic is not applicable any more.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoapi: Introduce and use ApiPieceOpArgs::pri
Ian Jackson [Mon, 18 Apr 2022 12:08:44 +0000 (13:08 +0100)]
api: Introduce and use ApiPieceOpArgs::pri

We're going to have a new call site, too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoapi: Replace open-coded calculation with call to fully_visible
Ian Jackson [Mon, 18 Apr 2022 12:01:34 +0000 (13:01 +0100)]
api: Replace open-coded calculation with call to fully_visible

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoui: Disable pointer events on text in dice and currency
Ian Jackson [Mon, 18 Apr 2022 00:07:42 +0000 (01:07 +0100)]
ui: Disable pointer events on text in dice and currency

Otherwise you can end up with bits of the displayed text (currency
value, or die face) selected.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoui: Break out HTML_TEXT_LABEL_ELEM_START from clock.rs
Ian Jackson [Mon, 18 Apr 2022 00:02:15 +0000 (01:02 +0100)]
ui: Break out HTML_TEXT_LABEL_ELEM_START from clock.rs

We actually need this in other places too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocurrency: Tweaks to rendering
Ian Jackson [Sun, 17 Apr 2022 23:54:56 +0000 (00:54 +0100)]
currency: Tweaks to rendering

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocurrency: Add one to the demo game
Ian Jackson [Sun, 17 Apr 2022 23:28:17 +0000 (00:28 +0100)]
currency: Add one to the demo game

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocurrency: Initial skeleton
Ian Jackson [Sun, 17 Apr 2022 22:05:30 +0000 (23:05 +0100)]
currency: Initial skeleton

Can render, but no special behaviours.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoui: Improve a comment and make it a doc comment
Ian Jackson [Sun, 17 Apr 2022 23:12:43 +0000 (00:12 +0100)]
ui: Improve a comment and make it a doc comment

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix another HTML syntax error
Ian Jackson [Sun, 17 Apr 2022 23:06:15 +0000 (00:06 +0100)]
Fix another HTML syntax error

Define the type of `otherwise`, to be an Html variant.  And pass
HtmlStr values.  Otherwise the HTML gets re-escaped, leading to a
xyntax error.

An effect of this is that the hollow diamond is actually hollow now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix an HTML syntax error
Ian Jackson [Sun, 17 Apr 2022 23:05:35 +0000 (00:05 +0100)]
Fix an HTML syntax error

Nothing seemed to be reporting this.  I found it while looking for
another bug, which I'm about to fix now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoimpl Default for &HtmlStr
Ian Jackson [Sun, 17 Apr 2022 23:05:13 +0000 (00:05 +0100)]
impl Default for &HtmlStr

We'll use this in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoscript.ts: Fix a uk spelling of "mitre"
Ian Jackson [Sun, 17 Apr 2022 22:46:15 +0000 (23:46 +0100)]
script.ts: Fix a uk spelling of "mitre"

CSS wants "miter".  This was producing a message on the JS console.

I have a feeling some of the code here existed to work around not
being able to get mitre to work properly.  but I CBA to look into that
now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoui.rs: Bring another constants together here
Ian Jackson [Sun, 17 Apr 2022 22:34:24 +0000 (23:34 +0100)]
ui.rs: Bring another constants together here

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoui.rs: Bring a number of constants etc. together here
Ian Jackson [Sun, 17 Apr 2022 22:26:55 +0000 (23:26 +0100)]
ui.rs: Bring a number of constants etc. together here

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove 0.35 magic value for font y adjustment into a Rust constant
Ian Jackson [Sun, 17 Apr 2022 22:24:57 +0000 (23:24 +0100)]
Move 0.35 magic value for font y adjustment into a Rust constant

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoserde_with_compat: Add some docs, since this is confusing
Ian Jackson [Sun, 17 Apr 2022 20:09:07 +0000 (21:09 +0100)]
serde_with_compat: Add some docs, since this is confusing

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agocargo: Document private items by default
Ian Jackson [Sun, 17 Apr 2022 20:04:11 +0000 (21:04 +0100)]
cargo: Document private items by default

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoserde_with_compat: Move to utils.rs where it belongs
Ian Jackson [Sun, 17 Apr 2022 20:00:49 +0000 (21:00 +0100)]
serde_with_compat: Move to utils.rs where it belongs

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohidden cleanups: Introduce load_lilk
Ian Jackson [Sun, 17 Apr 2022 18:24:50 +0000 (19:24 +0100)]
hidden cleanups: Introduce load_lilk

This more-centralises the interpretation of LOI and IOI variants.

Also add some commentary and rename create_coalesce.  It doesn't
always create.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoilk mixing: Support non-mixing pieces
Ian Jackson [Sun, 17 Apr 2022 17:11:44 +0000 (18:11 +0100)]
ilk mixing: Support non-mixing pieces

Allow us to handle an pieces which are occultable but which don't
participate in shuffling and displacement.

I. Introduce IOccultIlk enum.  The old approach is the variant Mix.
This allows us to introduce a new approach Distinct.

II. Make Notch optional in Passive Replace the unconditional
OccultIlkOwningId in IPiece with a new enum IOccultIlk, and the
OccultIlkName in the return value from PieceSpec::load with a new enum
LOccultIlk.

III. Immediately use the new approach for dice, dropping all handling
of ilks.  (Combining this into this commit avoids writing a bunch of
daft code that will be deleted right away.)

Consequences and ancillary changes:

 * We need a new compatibility arrangement so we can load old
   savefiles.  This is a bit fiddly and involves some macro
   trickery (which we will be moved to another file in due course).

 * OccultIlks gets two new methods from_iilk and dispose_iilk for
   handling IOccultIlk, rather than merely OccultIlkName.
   (We're going to move creation in here too, shortly.)

 * All existing pieces other than dice are still mixed by ilk.
   Allowing this not to be the case ia a question for the future.

 * Rename Passive.notch to Passive.permute_notch, for clarity
   of its purpose.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohidden: style: Use if_let macro a couple more times
Ian Jackson [Sun, 17 Apr 2022 17:51:47 +0000 (18:51 +0100)]
hidden: style: Use if_let macro a couple more times

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohidden: style: Unwrap a binding
Ian Jackson [Sun, 17 Apr 2022 17:37:54 +0000 (18:37 +0100)]
hidden: style: Unwrap a binding

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoilks: Make ilk available earlier in passive calculation
Ian Jackson [Sun, 17 Apr 2022 15:17:43 +0000 (16:17 +0100)]
ilks: Make ilk available earlier in passive calculation

The only functional effect is that some broken states now no longer
get occultated.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoilks: Refactoring of passive computation
Ian Jackson [Sun, 17 Apr 2022 17:41:09 +0000 (18:41 +0100)]
ilks: Refactoring of passive computation

Use if_chain instead of the outer if let.  This is good because we're
going to want to add another condition.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoilk mixing: piece_pri: Hoist pri_occulted call
Ian Jackson [Sun, 17 Apr 2022 10:36:43 +0000 (11:36 +0100)]
ilk mixing: piece_pri: Hoist pri_occulted call

We are going to want to add a new branch to these conditionals, and
the new branch doesn't want this functionality.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohidden: style: Make get take &I and remove some pointles borrow calls
Ian Jackson [Sun, 17 Apr 2022 17:40:31 +0000 (18:40 +0100)]
hidden: style: Make get take &I and remove some pointles borrow calls

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice test: demo game: Add a 2nd demo die
Ian Jackson [Sat, 16 Apr 2022 20:10:30 +0000 (21:10 +0100)]
dice test: demo game: Add a 2nd demo die

This lets us test occult mixing.  Which in fact is not desirable.  But
keep this to let us test it while we work on the problem, and
afterwards.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice test: demo game: Add a demo die with occultation label
Ian Jackson [Sat, 16 Apr 2022 20:03:22 +0000 (21:03 +0100)]
dice test: demo game: Add a demo die with occultation label

This lets us test how they occult.  It turns out, not particularly
well...

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Support occultation by label, for all 1-faced images
Ian Jackson [Sun, 17 Apr 2022 12:51:38 +0000 (13:51 +0100)]
dice: Support occultation by label, for all 1-faced images

Right now we mix dice of all ilks.  This is wrong.  Dice shouldn't mix
at all.  We're going to do that RSN.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohidden: Add another consistency check for pieces<->notches
Ian Jackson [Sun, 17 Apr 2022 15:10:15 +0000 (16:10 +0100)]
hidden: Add another consistency check for pieces<->notches

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Break out occ_label
Ian Jackson [Sat, 16 Apr 2022 13:32:25 +0000 (14:32 +0100)]
dice: Break out occ_label

We are going to want to call this for situations where we have an
OccultSpec but not an occultable image.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Reorganise occultation handling
Ian Jackson [Sat, 16 Apr 2022 20:00:44 +0000 (21:00 +0100)]
dice: Reorganise occultation handling

I was trying to support ilks properly.  This code is in fact going to
be considerably simplified.

But it will still make sense to split the interpretation of the spec
from the assembly of the Arc<dyn InertPieceImage> for the occulted
view.  That will make it possible for the spec interpretation to
provide an occulted view in more situations.

In fact it appears that these plans are going to be postponed and not
done right now, but I'm keeping this refactoring.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Break out OccultSpec (breaking change)
Ian Jackson [Sat, 16 Apr 2022 13:17:22 +0000 (14:17 +0100)]
dice: Break out OccultSpec (breaking change)

Earlier I wrote: We want to add an ilk here.

But this is no longer going to be true, because we are getting rid of
ilk mixing for dice.  Nevertheless, this change is going in a roughly
good direction in spec API terms since it will allow us to add other
things to occult.

Notably, if we allow composition of a die image from a base and faces,
or if we allow specifying an occulted face image separately from the
face images.

And `occult_label` is just a bad pattern.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodemo table: Move die
Ian Jackson [Sat, 16 Apr 2022 13:16:59 +0000 (14:16 +0100)]
demo table: Move die

We're going to add another die

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoReduce proposed stability promise re management protocol
Ian Jackson [Sun, 17 Apr 2022 12:48:25 +0000 (13:48 +0100)]
Reduce proposed stability promise re management protocol

This will allow us not to worry about errors, which are otherwise
awkward.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodbgc: Remove a call in clock.rs
Ian Jackson [Sun, 17 Apr 2022 09:54:36 +0000 (10:54 +0100)]
dbgc: Remove a call in clock.rs

This looks like leftovers.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodbgc: Replace many calls in hidden.rs with trace_dbg
Ian Jackson [Sun, 17 Apr 2022 09:54:15 +0000 (10:54 +0100)]
dbgc: Replace many calls in hidden.rs with trace_dbg

This looks like leftovers.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agotrace_dbg: Remove some use's.
Ian Jackson [Sun, 17 Apr 2022 10:02:05 +0000 (11:02 +0100)]
trace_dbg: Remove some use's.

This seems to generate spurious unused import warnings in some
situations.  Perhaps because it constantly reimports ?

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Sort out the logging
Ian Jackson [Sat, 16 Apr 2022 11:46:04 +0000 (12:46 +0100)]
dice js: Sort out the logging

Don't log every frame!

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Actually do the animation
Ian Jackson [Sat, 16 Apr 2022 11:39:58 +0000 (12:39 +0100)]
dice js: Actually do the animation

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Rename remprop parameter to wasm die_cooldown_path
Ian Jackson [Sat, 16 Apr 2022 11:38:20 +0000 (12:38 +0100)]
dice: Rename remprop parameter to wasm die_cooldown_path

Apparently I missed renaming this when I introduced the "rempprop"
name.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Obtain radius from the input dataset
Ian Jackson [Sat, 16 Apr 2022 11:38:14 +0000 (12:38 +0100)]
dice js: Obtain radius from the input dataset

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Always provide the label text node
Ian Jackson [Sat, 16 Apr 2022 11:31:08 +0000 (12:31 +0100)]
dice: Always provide the label text node

This will give us a way to tell which elements are part of the
cooldown clock and therefore need to be removed when it runs down.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Obtain information from the input dataset etc.
Ian Jackson [Sat, 16 Apr 2022 11:24:41 +0000 (12:24 +0100)]
dice js: Obtain information from the input dataset etc.

We want this all nicely in our JS object.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Break out die_request_animation
Ian Jackson [Sat, 16 Apr 2022 11:36:14 +0000 (12:36 +0100)]
dice js: Break out die_request_animation

We're going to want to re-request animiation in the frame renderer,
obviously.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Make s.anim_id be possibly null
Ian Jackson [Sat, 16 Apr 2022 11:27:14 +0000 (12:27 +0100)]
dice js: Make s.anim_id be possibly null

We might not have requested an animation frame.  If so we shouldn't
cancel it.  Nor, if we have already cancelled it, or if it has
occurred.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice js: Initial plumbing of animiation
Ian Jackson [Sat, 16 Apr 2022 11:15:57 +0000 (12:15 +0100)]
dice js: Initial plumbing of animiation

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agojs: Introduce SpecialRendering handling
Ian Jackson [Sat, 16 Apr 2022 11:49:14 +0000 (12:49 +0100)]
js: Introduce SpecialRendering handling

This is the generic plumbing.  We must implement at least a no-op for
Die right away, because otherwise we throw an exception during game
load.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agojs: Notice errors during start() and display them
Ian Jackson [Sat, 16 Apr 2022 10:49:17 +0000 (11:49 +0100)]
js: Notice errors during start() and display them

Otherwise if the game is buggy, you can get a fundamentally broken and
unresponsive UI, and no indication that this isn't your fault.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Change SpecialClientRendering representation
Ian Jackson [Sat, 16 Apr 2022 10:12:25 +0000 (11:12 +0100)]
dice: Change SpecialClientRendering representation

Making this an internally-tageed union is going to be nicer for the
JS, which then doesn't have to prat about with Object.keys(thing)[0]
etc.

And the special rendering is Die, not DieCooldown, since if dice get a
second kind of special rendering thta will have to be here too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: overlay extractor: fix autogeneration comment
Ian Jackson [Sat, 16 Apr 2022 00:20:41 +0000 (01:20 +0100)]
dice: overlay extractor: fix autogeneration comment

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Support rolling
Ian Jackson [Sat, 16 Apr 2022 00:12:20 +0000 (01:12 +0100)]
dice: Support rolling

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agofake-rng: Provide range() method
Ian Jackson [Sat, 16 Apr 2022 00:12:09 +0000 (01:12 +0100)]
fake-rng: Provide range() method

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Break out check_permit_flip_roll
Ian Jackson [Sat, 16 Apr 2022 00:11:49 +0000 (01:11 +0100)]
dice: Break out check_permit_flip_roll

The "roll" ui operation is going to want this too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Break out cooldown_start_value
Ian Jackson [Sat, 16 Apr 2022 00:10:53 +0000 (01:10 +0100)]
dice: Break out cooldown_start_value

The "roll" ui operation is going to want this too.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Prevent flipping during cooldown
Ian Jackson [Fri, 15 Apr 2022 23:31:50 +0000 (00:31 +0100)]
dice: Prevent flipping during cooldown

This involves a new hook for the piece trait.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoflip: Use description after flip, not before
Ian Jackson [Fri, 15 Apr 2022 23:12:55 +0000 (00:12 +0100)]
flip: Use description after flip, not before

This makes the log messages about dice true.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Actually display the labels
Ian Jackson [Fri, 15 Apr 2022 23:12:42 +0000 (00:12 +0100)]
dice: Actually display the labels

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Add definite article to log entries
Ian Jackson [Fri, 15 Apr 2022 23:11:41 +0000 (00:11 +0100)]
dice: Add definite article to log entries

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Rename iface from face
Ian Jackson [Fri, 15 Apr 2022 23:10:56 +0000 (00:10 +0100)]
dice: Rename iface from face

This is a mangled version of the requested face which we should only
use for the image, since it might be 0 even if there are many labels.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: Adjust text size
Ian Jackson [Fri, 15 Apr 2022 22:51:15 +0000 (23:51 +0100)]
die: Adjust text size

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: Prepare for extracting text template too (2)
Ian Jackson [Fri, 15 Apr 2022 22:40:31 +0000 (23:40 +0100)]
die: Prepare for extracting text template too (2)

Bracket our cooldown output all together.

I did it the other way because I had forgotten that the output order
is controlled by the script, not the input.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: Prepare for extracting text template too
Ian Jackson [Fri, 15 Apr 2022 22:30:44 +0000 (23:30 +0100)]
die: Prepare for extracting text template too

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: Hack about at SVG to make a nicer template for label
Ian Jackson [Fri, 15 Apr 2022 21:37:58 +0000 (22:37 +0100)]
die: Hack about at SVG to make a nicer template for label

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Add labels to demo game
Ian Jackson [Fri, 15 Apr 2022 21:31:26 +0000 (22:31 +0100)]
dice: Add labels to demo game

But they don't display yet...

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Add cross-referencing notes and comments
Ian Jackson [Fri, 15 Apr 2022 19:58:00 +0000 (20:58 +0100)]
dice: Add cross-referencing notes and comments

This may help us find things in future.  Used inkscape's "document
properties", "metadata" pane, and then manually moved the new metadata
tag nearer to the top of the svg file.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Fix cooldown radius
Ian Jackson [Fri, 15 Apr 2022 19:46:06 +0000 (20:46 +0100)]
dice: Fix cooldown radius

This looks good now.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide cooldown timer stroke width to Rust
Ian Jackson [Fri, 15 Apr 2022 19:34:49 +0000 (20:34 +0100)]
Provide cooldown timer stroke width to Rust

We now have this in two places which is a bit poor, but we already
have some duplication between die.svg and the Rust code - eg, the path
generation which was just c&p.

I have left a comment.  And arranged to filter it out for distribution.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide select stroke width to Rust
Ian Jackson [Fri, 15 Apr 2022 19:36:08 +0000 (20:36 +0100)]
Provide select stroke width to Rust

We now have this in two places which is a bit poor, but I don't fancy
plumbing it into the ts machinery.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Use bespoke outline path for surround (selection)
Ian Jackson [Fri, 15 Apr 2022 19:17:57 +0000 (20:17 +0100)]
dice: Use bespoke outline path for surround (selection)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoOutlineTrait: Document outline_path
Ian Jackson [Fri, 15 Apr 2022 19:06:57 +0000 (20:06 +0100)]
OutlineTrait: Document outline_path

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Fix a radius/diameter confusion
Ian Jackson [Fri, 15 Apr 2022 19:06:49 +0000 (20:06 +0100)]
dice: Fix a radius/diameter confusion

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>