Skip to content

Add the dwarf multicannon - #1201

Open
HarleyGilpin wants to merge 1 commit into
GregHib:mainfrom
HarleyGilpin:feat/add-dwarf-multi-cannon
Open

Add the dwarf multicannon#1201
HarleyGilpin wants to merge 1 commit into
GregHib:mainfrom
HarleyGilpin:feat/add-dwarf-multi-cannon

Conversation

@HarleyGilpin

@HarleyGilpin HarleyGilpin commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Closes #1192.

Screencast_20260822_145934.webm

Cannon

  • Assembles from the four parts in four stages, one placed cannon per player.
  • Rotates one octant per tick, firing a single cannonball into the wedge it faces, eight per 4.8s revolution. Neighbouring wedges overlap, so a target in an overlap is fired on twice per revolution.
  • Targets by range 10 and line of sight, honouring immune_cannon (first consumer of the param) and the single-way combat rules.
  • Flat roll capped at 300 rolled against the owner's ranged accuracy; 2 Ranged xp per 10 life points and no Constitution xp.
  • Decays 25 minutes after placement, warning at 20, handing the parts back to the inventory or bank. Logging out loses it instead.
  • Setup is refused in the areas that ban cannons, via a new no_cannon area tag plus flavour tags for the locations that word the refusal differently.

Nulodion

Sells a whole cannon for 750,000 coins along with the mould and instruction manual, both routes into the parts shop, the cannon explanation, and replaces a cannon lost on logout — loaded with the cannonballs that were in it.

Notes

Two things needed working around, both commented at the call site:

  • The cannon's own 3×3 collision blocks line of sight from its centre tile, so sight is traced from a tile clear of the footprint and shots leave the barrel tip.
  • hit() called from a script never emits combatStart, so the target is left flagged under attack with no attacker, and Target.attackable then rejects it as "someone else is fighting that" on every later tick, the cannon would fire at a monster once and ignore it for ~8 ticks. It now claims an unclaimed target after hitting it. This is scoped to the cannon; the underlying behaviour affects any script calling hit() directly and is probably worth fixing at the root separately.

32 tests - All tests passed.

The four cannon parts, cannonballs, Nulodion's shop and the "cannon"
hitsplat all already existed, but nothing read them - the parts were dead
weight and the immune_cannon npc param had no consumer.

Name cache objects 6-9 as the four build stages, register the rotation
animations (514-521) and the cannonball projectile, then add a script that
assembles a cannon from the parts, rotates it one octant per tick and fires
a single cannonball into the wedge it faces - eight per 4.8 second
revolution. Neighbouring wedges overlap, so a target sitting in an overlap
is fired on twice per revolution.

Targets are picked by range, line of sight, the immune_cannon param and the
single-way combat rules. Line of sight is traced from a tile clear of the
cannon's own 3x3 footprint and shots leave the barrel tip, since the cannon
blocks its own line of sight from the centre. A hit claims an unclaimed
target: hit() called from a script never emits combatStart, so the target
would otherwise be left flagged under attack by nobody, and Target.attackable
then rejects it as "someone else is fighting that" on every later tick.

Damage is a flat roll capped at 300 with the owner's ranged accuracy, giving
2 ranged experience per 10 life points and no constitution experience, so
CombatExperience gains a cannon branch that returns before the constitution
grant.

Cannons decay 25 minutes after being placed, warning at 20, and hand the
parts back to the inventory or the bank. Logging out loses the cannon
instead, recording what was owed so Nulodion replaces it free of charge,
loaded with the cannonballs that were in it.

Setup is refused in the areas that ban cannons, via a new no_cannon area tag
with flavour tags for the locations that word the refusal differently.

Nulodion gains his dialogue: a whole cannon for 750,000 coins along with the
mould and instruction manual, the two routes into his parts shop, the cannon
explanation, and the replacement flow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dwarf multi-cannon

1 participant