feat: add fletching - #185
Open
reldo-dev wants to merge 5 commits into
Open
Conversation
Mark7625
reviewed
Aug 21, 2026
Collaborator
|
You can now also put the db tables ect and enums in the plugin itself look at shooting stars |
Contributor
Author
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
force-pushed
the
pr/fletching
branch
from
August 22, 2026 15:22
45c0445 to
196c196
Compare
Contributor
Author
|
Both moved over. Tables and the animation mappings live in Re-verified against the packed cache and in game after the move; the animations still resolve to the same ids. |
Collaborator
|
Thanks ill take a look at this next few days :) |
Collaborator
|
Good job, Some small issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
openSkillMultitakes the requested quantity from the resume pausebutton's subcomponent, which is a slot index rather than the quantity, so every craft makesmin(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.ktis shared by 17 call sites and is untouched here.