49 Commits

Author SHA1 Message Date
Aaron Suen
af5375cf0c Recheck root match in crafts
This is necessary when the last step is placing a tool
or other item with wear, as the precheck apparently
doesn't check wear.
2022-01-07 20:28:19 -05:00
Aaron Suen
8bfdc211a3 Convert some action logs to info
We were using action log level for a lot of
things because by default MT does not seem
to capture info logs to stderr.  On "production"
servers though this makes too much noise and
makes it hard to find actual player actions.
Servers that want info logging will just have
to configure/compile it in.
2021-12-11 21:26:18 -05:00
Aaron Suen
ada9e11987 Support probabilistic craft node replacement 2021-12-06 22:25:03 -05:00
Aaron Suen
bba0a17abe Flexible craft discovery API
- Flexible discovery list format for discover and
  witness APIs
- Add "discover" key to recipes that contains a list
  of discoveries to give players so they can act like
  recipe groups and allow different recipes to
  complete hints

Recipe group system should be easier to setup for
hints than having to list all hints individually.  We
can use them especially in recipes that are loop
generated.
2021-11-29 21:08:34 -05:00
Aaron Suen
9235744612 Items can cool in storeboxes, but not cook
Cooking recipes run in all visinv nodes, not just
item stacks, BUT non-stack-only nodes (i.e. all
storeboxes) block flame touchgroups so things
in boxes cannot be heated/melted.

This allows items dropped into boxes from ore
melting to cool, but prevents sand from being
melted in a box which would naively replace
the box with the molten glass entirely.

This also fixes an old rumored bug where forcing
glowing lode items into a shelf with a door would
cause them to stay hot indefinitely.

N.B. lode cooking/cooling used to assume it could
replace the entire node, and deleted the thing
as a fail-safe when an item of the given temper
was not found (e.g. tools w/ handles).  This is
now gone, and invalid tempers will throw errors
if they can ever be achieved in practice.
2021-11-27 19:26:31 -05:00
Aaron Suen
6b3e5f21a1 Allow custom toolgroups for craft check 2020-09-29 22:39:55 -04:00
Aaron Suen
a78bf0ea2a "Lazy" crafting API
Instead of checking for and immediately
completing a craft, the API can be told to
search for a recipe and return a function that
can be used to commit it later.  This way,
we can search for a valid recipe during the
"check" phase of a craft check and then
commit it during the "after" phase.
2020-09-29 21:44:26 -04:00
Aaron Suen
64e917fc95 New witnessing system
If a player is close enough to an event when it
happens (withing "likely hearing" distance) then if
they later punch the node then they can "collect"
the discovery.

The idea is that if a player hears the sound of
something happening, then they might go and
investigate and discover the thing they thought
they had left there isn't what's there anymore.

In retrospect I may want to combine this with a
limited form of the visual witnessing, just as there
may be events that a player is less likely to touch
in aftermath, or may not be practical to (e.g.
if what's left behind is air)
2020-09-26 17:52:09 -04:00
Aaron Suen
de87702497 Door crafting hints and witnessing 2020-09-11 01:08:20 -04:00
Aaron Suen
edea123a1e Start on new unified Hint API
- Move hint handling down to API layer
- Simplify stat data; old nc_stats counting can
  be moved out to a separate mod.  We only
  need whether the player has seen or not.
- Invert inventory tab responsibility.
- Merge witness system in from crafting.

TODO:
- Redistribute hint registration responsibility
  to individual mods.
- Test external mod compat.
- Retire old nc_stats and nc_guide systems.
- Add a way to reset hints.
2020-09-04 16:28:27 -04:00
Aaron Suen
f01be30a00 Tidy up registration reporting 2020-07-16 07:29:11 -04:00
Aaron Suen
72839b1a74 Fix press and other late-registered recipes 2020-06-27 19:03:49 -04:00
Aaron Suen
e7911dd7fd Fix crash on empty craft set 2020-06-27 13:32:03 -04:00
Aaron Suen
7ae24bf7fa Further craft set reductions
- Merge the "legacy, could be anyting" sets
  into every other set so we can do only 2
  set lookups instead of 3.
- Make sure we don't do any duplicate
  recipe checks.

N.B. the craft priority order MAY be different
now, since primary node recipes are
checked before visinv stacks.
2020-06-27 13:00:34 -04:00
Aaron Suen
b2f78c0daa Indexing for craft checks
By restricting the recipes we check based
on the name of the central object being
checked, we can do many fewer craft
checks per item and avoid expensive
checks.
2020-06-27 12:20:35 -04:00
Aaron Suen
3d561a229b Optimize stack cook/cool check
If the item type does not at least pratially match any cooking/cooling recipe the first run, assume it never will and cache this fact
so we can quickly skip all stacks of the same
item next run.
2020-06-17 01:23:30 -04:00
Aaron Suen
6c640a11b1 Validate log message levels 2020-06-09 19:02:07 -04:00
Yaman Qalieh
a8147e9875 Add levels to log messages 2020-05-27 14:04:00 -04:00
Aaron Suen
e7d4d54b1c Genericize chisels, fix recipe digging
- Register groups for chiseling doors.
- Make recipe digging not use player inventory, but drop
  as an item unconditionally.  N.B. the old "replace with air
  then drop item" method only worked with explicit item
  names and not group detection.
2020-03-29 21:32:15 -04:00
Aaron Suen
98b7e21533 After chiseling a door, automatically dig rod
Also adds the ability to register recipes to automatically
attempt to dig a node upon completion.
2020-03-29 21:18:40 -04:00
Aaron Suen
e575cb9b26 Some more hint bugfixes. 2020-01-21 21:36:05 -05:00
Aaron Suen
7bc1a4ddad Standardize node placement sounds.
Add node placement sounds to processes
missing them, like tree growth.
2020-01-16 22:02:59 -05:00
Aaron Suen
25be3b07a8 Small pos key calc optimization. 2020-01-10 21:11:52 -05:00
Aaron Suen
c6584d79d4 Settle craft excess immediately. 2020-01-09 22:23:32 -05:00
Aaron Suen
3eb21593b6 Block accidental new pummel recipes from hand-dig. 2019-12-29 14:08:27 -05:00
Aaron Suen
5b0459e4bb Speed adjustment settings for many long-running processes.
Many processes that have a significant speed/time component can
now have speeds adjusted (as a multiplier from base rate) via
settings.

Things that can be adjusted:
- Tool speeds (including digging and pummeling)
- Cooking and pummel recipe durations
- Soaking processes like tree growth, peat fermentation

The settings are hierarchical, so groups of rates can be
adjusted together, and a further multiplier can be applied to
each member of the group.

The settings are calculated dynamically, for power users only,
and documenting them is out of scope for the project.

Specifically, this should help tuning for Kimapr's SkyBlock, and
possibly other mods involving signficant gameplay rebalancing.
2019-12-06 07:01:12 -05:00
Aaron Suen
e5f54b49f6 Add witness system for cooking/soaking recipes. 2019-10-27 10:05:57 -04:00
Aaron Suen
52de19a28c Unified falling check, check after craft. 2019-09-09 07:05:01 -04:00
Aaron Suen
39dea8a2ae MAJOR: Code quality audit using luacheck.
- Removed lots of unused variables, a few shadowed identifiers.
- Removed a few sections of dead code.
2019-08-31 09:26:53 -04:00
Aaron Suen
47f5e17560 Scaling handholds should disappear when node under is dug. 2019-08-28 21:22:45 -04:00
Aaron Suen
560b068bd7 Fix crafting, standardize recipe callback params. 2019-08-24 06:31:27 -04:00
Aaron Suen
86cc55c12b Basic door node setup and recipes.
- Craft door panels by chiseling with a rod.
- Rotate door panels.
- Hammer in rod to act as hinge pin.
- Dig out hinge pin, dig up panel.
2019-08-13 21:06:13 -04:00
Aaron Suen
3614068263 Bug fixes, tidier craft excess handling. 2019-04-03 08:10:03 -04:00
Aaron Suen
8a8533a8fc Convert lode to new cooking recipe system. 2019-03-22 22:55:30 -04:00
Aaron Suen
da54ec1815 Start to unify cooking/cooling into recipe system. 2019-03-22 21:55:02 -04:00
Aaron Suen
2f3d2afff5 Sounds on tapping/pummeling nodes. 2019-03-14 21:48:29 -04:00
Aaron Suen
547dfcdd96 Setup some crafting sounds. 2019-03-14 20:08:08 -04:00
Aaron Suen
bd0f201469 Allow excess items in recipe stacks (by default), eject excess.
This makes it a little easier to discover recipes, since you now
generally don't have to get the exact count right anymore; just
make sure you at least have enough.
2019-03-12 21:52:00 -04:00
Aaron Suen
111338e56f Pound glass back into sand. Fix recipe prioritization for pummels. 2019-03-09 19:40:02 -05:00
Aaron Suen
516780a619 Fix bug causing pummel particles for invalid recipes (node check). 2019-03-07 16:47:12 -05:00
Aaron Suen
b680b69cd8 Stat improvements.
- Fix cheat stat bug.
- Hook to track crafting recipe completion.
2019-02-23 17:00:42 -05:00
Aaron Suen
58cd080fdf Apply big stack refactor. 2019-02-23 10:21:27 -05:00
Aaron Suen
b6650068a1 Trying to find a saner way to handle node stack recipes. 2019-02-23 02:29:16 -05:00
Aaron Suen
4b972b4d3b More recipe conversion, bugfixing. 2019-02-10 00:20:55 -05:00
Aaron Suen
a6c4ec6706 Fix crafting crash. 2019-02-09 23:36:39 -05:00
Aaron Suen
b5bd67d5a7 Finished pummel-craft API, started converting recipes. 2019-02-09 22:44:56 -05:00
Aaron Suen
2b8cc8fba2 Finished refactoring crafting into a separate mod.
Appears to work with existing functionality.

Next step will be to rework pummel to use a "recipe" system and
reuse most of the useful parts of the crafting system.
2019-02-03 12:10:27 -05:00
Aaron Suen
e78ba700a1 Some more adjustments.
Started flattening recipes.
2019-02-03 11:24:06 -05:00
Aaron Suen
f98e8be5c2 Started a large refactor project.
The idea is to merge the pummel logic with crafting recipes,
and move them up out of plain old api.
2019-02-03 09:00:09 -05:00