chiark / gitweb /
otter.git
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>
3 years agodie svg: Shrinking by 10: Change window
Ian Jackson [Fri, 15 Apr 2022 19:38:25 +0000 (20:38 +0100)]
die svg: Shrinking by 10: Change window

Just asked inkscape to recenter the view.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie svg: Shrinking by 10: Reduce die box size
Ian Jackson [Fri, 15 Apr 2022 18:43:29 +0000 (19:43 +0100)]
die svg: Shrinking by 10: Reduce die box size

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie svg: Shrinking by 10: Reduce stroke widths
Ian Jackson [Fri, 15 Apr 2022 18:39:20 +0000 (19:39 +0100)]
die svg: Shrinking by 10: Reduce stroke widths

We don't have anything to rescale the elements we extract for use as
the cooldown timer, so we need to get the linewidths as we finally
want them.

In this commit we mostly do the stroke widths and the circle size.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Adjust sizes, wip
Ian Jackson [Fri, 15 Apr 2022 18:34:51 +0000 (19:34 +0100)]
dice: Adjust sizes, wip

Adjust the strokes of the circles using inkscape.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Add a test die to the demo game
Ian Jackson [Fri, 15 Apr 2022 12:46:53 +0000 (13:46 +0100)]
dice: Add a test die to the demo game

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Cooldown template: Add header about autogeneration
Ian Jackson [Fri, 15 Apr 2022 17:54:00 +0000 (18:54 +0100)]
dice: Cooldown template: Add header about autogeneration

This may help avoid editing it manuallly...

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Make moveable
Ian Jackson [Fri, 15 Apr 2022 17:43:31 +0000 (18:43 +0100)]
dice: Make moveable

Don't bake into the piece implementation that these aren't moveable.
If this is desired, it can be part of the game spec.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Sort out defaults
Ian Jackson [Fri, 15 Apr 2022 12:47:06 +0000 (13:47 +0100)]
dice: Sort out defaults

 * Abolish the separate DEFAULT_COOLDOWN constant.  This seems otiose.
 * Clarify what the radius scale is supposed to mean
 * Provide a default radius scale

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agotest.table.toml: Add a currently-working rune
Ian Jackson [Fri, 15 Apr 2022 12:46:58 +0000 (13:46 +0100)]
test.table.toml: Add a currently-working rune

Many of the others are obsolete but I don't want to take the time now
to clean them up.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Start a cooldown the first time a die is added to the game
Ian Jackson [Fri, 15 Apr 2022 12:14:24 +0000 (13:14 +0100)]
dice: Start a cooldown the first time a die is added to the game

This is useful for testing.  It also means you can't just add a die
showing what you want using the game management interface...

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide InternalError::FutureInstantOutOfRange
Ian Jackson [Fri, 15 Apr 2022 12:20:59 +0000 (13:20 +0100)]
Provide InternalError::FutureInstantOutOfRange

The dice itself wants to sometimes do this conversion (notably, on
initial piece load), and if it's out of range that's implausible.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Always use a circular Outline and adjust radiii
Ian Jackson [Fri, 15 Apr 2022 12:12:16 +0000 (13:12 +0100)]
dice: Always use a circular Outline and adjust radiii

The circular outline will go nicely with the cooldown timer.

The radius etc. is still not quite right.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Set cooldown_expiry to None when we can
Ian Jackson [Fri, 15 Apr 2022 12:04:37 +0000 (13:04 +0100)]
dice: Set cooldown_expiry to None when we can

This will avoid pointless calls to Instant::now, which would otherwise
be needed to discover that the cooldown time has expired (perhaps long
ago).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Tidy remprop handling
Ian Jackson [Fri, 15 Apr 2022 11:54:37 +0000 (12:54 +0100)]
dice: Tidy remprop handling

This macro was overkill.  It existed mostly to avoid uselessly
comparing the remaining duration with 0 and storing None when it was
there already.  That's a daft microoptimisation.

Doing it this way instead lets us only do the remprop calculation when
it's wanted, and it will let us provide a way to set cooldown_expires
to None if and when we have &mut State and can see it's timed out.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Initial implementation of piece
Ian Jackson [Tue, 12 Apr 2022 21:42:46 +0000 (22:42 +0100)]
dice: Initial implementation of piece

Does not work properly yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide FutureTimeInstant, for use by dice
Ian Jackson [Fri, 15 Apr 2022 09:56:27 +0000 (10:56 +0100)]
Provide FutureTimeInstant, for use by dice

This loads and saves as a Duration.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: cooldown_path etc.: rename remaining proportion to "remprop"
Ian Jackson [Mon, 11 Apr 2022 21:07:58 +0000 (22:07 +0100)]
dice: cooldown_path etc.: rename remaining proportion to "remprop"

This distinguishes "remaining" (a duration) from "remprop" (a proportion).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Cooldown template: Use total_ms for duration variable
Ian Jackson [Fri, 15 Apr 2022 17:47:14 +0000 (18:47 +0100)]
dice: Cooldown template: Use total_ms for duration variable

Make the units clearer.  We will provide a value for this from a
Serialize context struct in the Rust code, which is still to come.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Generate cooldown template using extractor
Ian Jackson [Mon, 11 Apr 2022 20:32:28 +0000 (21:32 +0100)]
dice: Generate cooldown template using extractor

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove die helper materials to dice/ subdirectory
Ian Jackson [Mon, 11 Apr 2022 19:57:48 +0000 (20:57 +0100)]
Move die helper materials to dice/ subdirectory

This declutters the toplevel a bit.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoSpecial client rendering: Do explain why not to provide xdata here
Ian Jackson [Fri, 15 Apr 2022 11:28:57 +0000 (12:28 +0100)]
Special client rendering: Do explain why not to provide xdata here

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoSpecial client rendering: Fix quoting of JSON payload
Ian Jackson [Fri, 15 Apr 2022 17:54:07 +0000 (18:54 +0100)]
Special client rendering: Fix quoting of JSON payload

The needs to be in " " (and the JS will evaluate it).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide plumbing for special client rendering instructions
Ian Jackson [Mon, 11 Apr 2022 19:52:10 +0000 (20:52 +0100)]
Provide plumbing for special client rendering instructions

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMake PieceBaseTrait dyn_upcast-able
Ian Jackson [Thu, 14 Apr 2022 20:01:09 +0000 (21:01 +0100)]
Make PieceBaseTrait dyn_upcast-able

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agopcrender: prep for more attributes in pelem
Ian Jackson [Mon, 11 Apr 2022 19:38:37 +0000 (20:38 +0100)]
pcrender: prep for more attributes in pelem

We are going to add a .special.

NFC.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, add more tests
Ian Jackson [Mon, 11 Apr 2022 19:33:40 +0000 (20:33 +0100)]
die: wip svg, add more tests

Again, verified by hand-hacking and using Refresh in inkscape, that
they look right.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, cooldown timer better assert
Ian Jackson [Mon, 11 Apr 2022 19:31:29 +0000 (20:31 +0100)]
die: wip svg, cooldown timer better assert

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, fix cooldown timer path and add test cases
Ian Jackson [Mon, 11 Apr 2022 19:27:16 +0000 (20:27 +0100)]
die: wip svg, fix cooldown timer path and add test cases

I've verified that the 1. test case shows as expected.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, make example less than half
Ian Jackson [Mon, 11 Apr 2022 19:15:47 +0000 (20:15 +0100)]
die: wip svg, make example less than half

This let me c&p the string into the new test case.  Although, the test
will need to be different because of rounding errors.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodice: Provide die_cooldown_path
Ian Jackson [Mon, 11 Apr 2022 18:10:36 +0000 (19:10 +0100)]
dice: Provide die_cooldown_path

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, fix colour of white
Ian Jackson [Mon, 11 Apr 2022 17:50:49 +0000 (18:50 +0100)]
die: wip svg, fix colour of white

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg extractor
Ian Jackson [Mon, 11 Apr 2022 17:50:26 +0000 (18:50 +0100)]
die: wip svg extractor

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, change timewhite path (back) to a circle
Ian Jackson [Mon, 11 Apr 2022 17:10:45 +0000 (18:10 +0100)]
die: wip svg, change timewhite path (back) to a circle

We want to be able to auto-adjust it by fiddling with r=.  That's
going to be awkward with the path element but easy with circle.

I have checked that one can (eg) change the width of the line in
inkscaqpe, and it remains a circle.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, remove unneeded parts
Ian Jackson [Thu, 7 Apr 2022 16:44:59 +0000 (17:44 +0100)]
die: wip svg, remove unneeded parts

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg, remove zigzag
Ian Jackson [Thu, 7 Apr 2022 16:28:46 +0000 (17:28 +0100)]
die: wip svg, remove zigzag

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg
Ian Jackson [Thu, 7 Apr 2022 16:22:17 +0000 (17:22 +0100)]
die: wip svg

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg
Ian Jackson [Thu, 7 Apr 2022 16:17:15 +0000 (17:17 +0100)]
die: wip svg

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodie: wip svg
Ian Jackson [Thu, 7 Apr 2022 16:02:24 +0000 (17:02 +0100)]
die: wip svg

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoInertPieceTrait: Add comment clarifying FaceId etc.
Ian Jackson [Fri, 15 Apr 2022 10:50:07 +0000 (11:50 +0100)]
InertPieceTrait: Add comment clarifying FaceId etc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoGamestate: Fix a more style nit
Ian Jackson [Fri, 15 Apr 2022 09:58:24 +0000 (10:58 +0100)]
Gamestate: Fix a more style nit

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoSpecError: Add a comma (for consistent coding style)
Ian Jackson [Thu, 14 Apr 2022 00:20:10 +0000 (01:20 +0100)]
SpecError: Add a comma (for consistent coding style)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoProvide load_inert for SimplePieceSpec
Ian Jackson [Fri, 15 Apr 2022 17:38:00 +0000 (18:38 +0100)]
Provide load_inert for SimplePieceSpec

This will let us use these as backgrounds for dice.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove fn load out of SimplePieceSpec into macro
Ian Jackson [Fri, 15 Apr 2022 17:23:27 +0000 (18:23 +0100)]
Move fn load out of SimplePieceSpec into macro

The only call site was in impl_PieceSpec_for_SimplePieceSpec.
Hoisting it there makes little codegen difference but seems more
natural.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoCombine impls into impl_PieceSpec_for_SimplePieceSpec
Ian Jackson [Fri, 15 Apr 2022 17:18:34 +0000 (18:18 +0100)]
Combine impls into impl_PieceSpec_for_SimplePieceSpec

We want to add load_inert to this.  It's getting too repetitive.

We can't use generic impl on <P: SimplePieceSpec> because we need to
specxify the serde typetag.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoPass face to InertPieceTrait::describe_html
Ian Jackson [Fri, 15 Apr 2022 10:40:56 +0000 (11:40 +0100)]
Pass face to InertPieceTrait::describe_html

This ought to have been part of
  Extend InertPieceTrait to support multiple faces

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMake OccultIlkName a type alias, not a newtype
Ian Jackson [Fri, 15 Apr 2022 10:26:00 +0000 (11:26 +0100)]
Make OccultIlkName a type alias, not a newtype

There's not really an abstraction here defending anything, and it
lacks constructors etc.  Just abolish it.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoPlumb xdata through to InertPieceTrait svg
Ian Jackson [Thu, 14 Apr 2022 19:55:17 +0000 (20:55 +0100)]
Plumb xdata through to InertPieceTrait svg

Occulted dice will need this to display the cooldown timer.

This makes dice's InertPieceTrait impl not very inert, but it is OK
because nothing can set off an inert die's cooldown timer.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMove itemname into PieceBaseTrait
Ian Jackson [Thu, 14 Apr 2022 19:45:42 +0000 (20:45 +0100)]
Move itemname into PieceBaseTrait

We want this becasue dice want to use inert pieces as images, and use
their images' item names in their own item names.

This involves providing an itemname for ItemInertForOcculted.
Happily the SvgBaseName will do nicely.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoIntroduce PieceBaseTrait and put nfaces() in it
Ian Jackson [Thu, 14 Apr 2022 19:03:34 +0000 (20:03 +0100)]
Introduce PieceBaseTrait and put nfaces() in it

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohumantime: Switch to humantime_serde
Ian Jackson [Wed, 13 Apr 2022 21:32:56 +0000 (22:32 +0100)]
humantime: Switch to humantime_serde

We are going to want this for dice cooldown spec.
Using the humantime re-export avoids version problems.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agohumantime: Promote dependency to otter main crate
Ian Jackson [Wed, 13 Apr 2022 21:28:31 +0000 (22:28 +0100)]
humantime: Promote dependency to otter main crate

We are going to want this for dice cooldown spec.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agospec errors: Expand WrongNumberOfFaces error
Ian Jackson [Tue, 12 Apr 2022 20:33:51 +0000 (21:33 +0100)]
spec errors: Expand WrongNumberOfFaces error

We're going to want to reuse this in a new context.  And, this already
produces better error messages for the case where it's used now.

It seems better to provide this rather generic error rather than
expect each funky piece kind to invent its own kind in SpecError.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agodocs: Document scope of semver guarantees
Ian Jackson [Tue, 12 Apr 2022 20:33:28 +0000 (21:33 +0100)]
docs: Document scope of semver guarantees

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoMake GenericSimpleShape::count_faces return RawFaceId
Ian Jackson [Tue, 12 Apr 2022 20:12:49 +0000 (21:12 +0100)]
Make GenericSimpleShape::count_faces return RawFaceId

RawFaceId is smaller than usize.  It is better not to ask callers to
do the unwrap.  Motivated by wanting add a new call site which wants a
RawFaceId.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoExtend load_inert to offer an occultable piece
Ian Jackson [Tue, 12 Apr 2022 00:18:22 +0000 (01:18 +0100)]
Extend load_inert to offer an occultable piece

Now inert pieces can be occultable too.  Currently this is meaningless
since we only call load_inert when resolving the occultation
for *another* piece, where we discard the occultation information.

But that is going to change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoGenericise SpecLoaded
Ian Jackson [Tue, 12 Apr 2022 00:12:48 +0000 (01:12 +0100)]
Genericise SpecLoaded

We are going to want to make inert pieces occultable too.  Currently
this is meaningless since we only call load_inert when resolving the
occultation for *another* piece.  But that is going to change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix message for IE::JSONEncode
Ian Jackson [Mon, 11 Apr 2022 19:51:12 +0000 (20:51 +0100)]
Fix message for IE::JSONEncode

The name is JSONEncode, so this must be serialisation, and indeed that
is true of both the construction sites.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoImplement InertPieceTrait for SimpleShape
Ian Jackson [Mon, 11 Apr 2022 09:50:03 +0000 (10:50 +0100)]
Implement InertPieceTrait for SimpleShape

Right now, this allows simple circles and rectangles to be used as
backs (for occultation).  It will also allow them to be used for dice,
when we have those.

It is not convenient to provide a test for this because occultation
methods must be provided in libraries, and we don't have a test
library.

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