Skip to content

feat: add fletching - #185

Open
reldo-dev wants to merge 5 commits into
OpenRune:mainfrom
reldo-dev:pr/fletching
Open

feat: add fletching#185
reldo-dev wants to merge 5 commits into
OpenRune:mainfrom
reldo-dev:pr/fletching

Conversation

@reldo-dev

Copy link
Copy Markdown
Contributor

Implements Fletching (#59): 204 recipes across cutting, stringing, attaching, gem tips and crossbow assembly, levels 1 to 95. Recipe data came from the wiki and is checked back against the packed cache by an out-of-tree probe; behaviour was checked in-game for every family.

Not in this PR: ballistae, mith grapples, greenman masks, lyre, scorching bow, webweaver bow and bone shortbow, deferred as a batch and blocked on nothing; the 32 Forestry Vale totem offerings, which need a Totem site that does not exist yet; dart rapid mode, so feather on dart tips opens Make-X at one set per tick rather than making ten instantly; and the Fletching knife's three-ticks-then-two rule.

Worth knowing before testing darts: openSkillMulti takes the requested quantity from the resume pausebutton's subcomponent, which is a slot index rather than the quantity, so every craft makes min(28, maxProducible) whatever was clicked. It shows only on stackable inputs, which this is the first content to exercise — one set with 240 tips in hand makes 24. SkillingMenu.kt is shared by 17 call sites and is untouched here.

@Mark7625

Copy link
Copy Markdown
Collaborator

You can now also put the db tables ect and enums in the plugin itself look at shooting stars

@reldo-dev

Copy link
Copy Markdown
Contributor Author

You can now also put the db tables ect and enums in the plugin itself look at shooting stars

Will probably give this a try and let you know how it goes!

Five server-only production tables sourced from the wiki's Recipe bucket, split
by the script that will consume them: cutting, stringing, attaching, gem tips
and assembly. 411 raw wiki rows for uses_skill=Fletching reduce to the 204 here;
the header comment carries the full accounting of what was dropped and why.

Three things are worth knowing before reading the data:

XP is stored multiplied by ten. 46 of these recipes have fractional xp - a magic
shortbow is 83.3 - and the column is an int, matching how CombinationRune already
stores tenths. Content divides once.

Only obj.feather appears as an input. Any feather fletches bolts, darts and
headless arrows, and the other seven types are substituted in the content layer
rather than duplicated as 154 near-identical rows.

The `tool` column is held, never consumed, so it is not an input. For cutting and
gem tips it is also half the trigger - the tool is used on the first material and
the rest come from the inventory, which is how the wiki describes the interaction
and matches the vanilla cache's own dbtable.fletching_blowpipe_crafting, split
into log_resource and secondary_resource. It is declared only on the three tables
that use it, so stringing and attaching generate no tool accessor at all.

dbrow ids are append-only within the reserved 56000-56299 block, so no id moves
when a later batch lands; gamevals.toml maps them.

Tables and the animation enum live in the plugin's own `pack` module, so the
cache build never compiles the fletching scripts to reach them.
One normalised FletchingRecipe that every table row maps onto, and one queued
loop that drives all five flows. Giving each family the same recipe shape means
there is only one loop to write, so the engine is four files and under 300 lines.

FletchingDefinitions holds the two groupings the trigger shapes need - a material
pair for stringing, attaching and assembly, and (first material, tool) for cutting
and gem tips - plus the feather and tool substitution sets. It is also the only
place that divides xp by ten.

FletchingAction consumes inputs, adds the output, pays the xp and re-queues,
restoring anything already consumed if a later step fails. The tool is re-checked
every tick, so dropping a hammer mid-run stops the loop rather than forging
without one; an Imcando hammer counts, matching the check smithing already uses.

One set is produced per cycle. Darts and unfinished bolts are faster than that in
OSRS, but not by a rate this loop can express: they are an instant per-interaction
action the player repeats by hand, optionally swapped for a bounded Make-X queue
by an account setting. Neither is modelled here, so their table rows carry the
wiki's zero-tick value and run at one set per tick.

The queue lives in its own PluginScript so no single family's removal can take
the other four down with it.
One PluginScript per family, each a handful of lines: iterate the distinct
trigger pairs and register an onOpHeldU per pair. 332 registrations, no
collisions - onOpHeldU throws at boot on a duplicate or a reversed pair, so a
clean boot is the proof.

Cutting and gem tips key on (material, tool) taken from the row rather than a
hardcoded knife or chisel, which is what lets a knife on teak logs offer both the
teak stock and the hunter's spear, and a chisel on a sunlight antelope antler
offer both its bolt tips and the crossbow upgrade.

Attaching passes the feather the player actually clicked through to the menu, so
the candidate list and the consume step agree on which of the eight feather types
to use.

The pairs are registered material-first. Registering knife-first instead would
put the reversed click order behind firemaking's default log handler, which runs
before ours and would swallow it.

Stringing and attaching resolve an animation from the recipe output, the cache
carrying one per bow tier and per bolt or dart metal; the shared animation is
left to the rest. It loops, so a lone action takes the one-shot variant and only
a looping one is reset at the end, which otherwise cut the last animation short.
The mapping is enum.fletching_anims rather than something derived from the item
name, because a bolt item says adamantite where its animation says adamant, while
crossbow stringing keeps adamantite.

A repeat re-queues at one cycle more than the recipe's tick cost. A queue
submitted while the queue list is being processed is decremented on that same
cycle, so without it every repeat arrives a tick early and a 2-tick recipe runs
at 0.6s.
@reldo-dev

Copy link
Copy Markdown
Contributor Author

Both moved over. Tables and the animation mappings live in content/skills/fletching/pack now, with the anims as enum.fletching_anims (OBJ -> SEQ) instead of hardcoded maps, so FletchingAnims is down to a lookup and or-cache is untouched. Rebased onto #186.

Re-verified against the packed cache and in game after the move; the animations still resolve to the same ids.

@Mark7625

Copy link
Copy Markdown
Collaborator

Thanks ill take a look at this next few days :)

@Mark7625

Copy link
Copy Markdown
Collaborator

Good job, Some small issues

  • When you attach a string to a bow it makes the item way before the anim is finished
  • Cant see to make crossbow (u)'s? so i cant make crossbows
  • Does not let me make arrows using headless and arrowtips
  • Cant make javalins
  • None of the Tipped bolts dont work
  • Atlatl stuff does not seem to work
  • Missing Fletching knife?
  • Fletching cape perk maybe?
  • Blowpipe missing

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.

2 participants