This Week's Program
This Week’s Program: Nov 7 - Nov 11
I don’t owe anyone an “open mind” or “hope”.
I would have preferred to be writing something different in my Tinyletter this week. I would have preferred a different subject line.
My work is a retreat from this week’s reality. I have that privilege. I have the privilege of having a retreat at all. Many do not, and I have little to offer them. Maybe some will read my code and these notes and will learn and can better themselves in some way. Just as others’ code and notes helped me learn. I can hope for that.
My code this week revolved mostly around weaponry for the game, which now feels in poor taste.
Here’s the work.
4215c5c94565efb245da08eb2a7ce9c5d2b3042c
I write out a bit more types for the Weapons
module. This feels
emergent, and as I read through the Necromunda rulebook and attempt to
translate it to Elm, I frequently change my mind about how something
should be modeled.
ac7db0c6438b08d597f16e7a5bf81cead20b1aae
I bring in a new module:
toastal/either
. The
Either
type is pretty common in functional languages. The strength
of a Weapon can be either a fixed value or a modifier of its wielder’s
strength. The Either
type lets us encapsulate this for both cases.
f9216cc058041849e0545b0831d50696006b5e97
I make guns.
7735a65cae44e69cfb8673b6c8f0274fa03d33e2
A Model
can equip
a Weapon
. Weapons have a cost
associated
with them, but I’m ignoring that for now, and make sure that my
Model
generator equips a pistol and a gun.
ad590878203cb41b515a007cefb6abf1a90efc26
I parameterize the Shoot
Action
with the Weapon
that will do the
shooting.
e3b0be2541c482d225ad9433fe2afde70332a502
For every weapon equipped by a fighter
, I render a new Shoot
view
to tie up the work from the previous commit.
6d24d3664cb2acec64aeac7a446dc983a15230a7
I create a little button and a new Msg
: Advance
. When I click the
button, the turn advances to the next phase. If a Player doesn’t want
to move or shoot, they can elect to advance to the following phase.
a042bd9126bb52dd0d1c48a64a3b74fd6b304913
How or what a fighter can shoot depends on what direction it is
facing, so I have to update the Model
to encapsulate what direction
it’s facing. On Hover
, I do some math to update the bearing
of the
fighter to track where the mouse is moving. I’m not sure if bearing
is the right word for this concept but it seemed appropriate. I add a
few helpers: Tabletop.angle
calculates the angle in degrees between
two points (I am so bad at math this took me forever to figure
out). Player.updateSelectedGangMember
well apply a transformation to
a Player’s selected model. A Model
can pivot even if it has used up
its movement. In the next commit, I restrict this to be able to happen
only in the Movement
phase.
Stay safe.
– Mark