93 Commits

Author SHA1 Message Date
Aaron Suen
bf8f74b35f Fix cooking/cooling in storebox regression
Allow matching to work explicitly with items inside
containers if so marked, and automatically mark
all cooking/cooling recipes thus.
2022-01-11 20:58:35 -05:00
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
3e14eda5eb Try to avoid "air pummelling" due to lag. 2022-01-06 07:40:22 -05:00
Aaron Suen
31de8b0fde Add automatic unload testing for DNTs 2021-12-18 12:05:25 -05:00
Aaron Suen
a1b2df3941 Begin standardization of unload bounds check
- New near_unloaded API that supports custom
  distance parameter, map bounds check, and
  some optimizations.
- Add area automatic unload check support to ABM
  API and add to applicable ABMs, replacing many
  old manual checks.

Note that the explicit unload check is only strictly
necessary when something will happen due to
a node NOT being present in the area, e.g. something
igniting due to absent coolant, or soaking quantity
being reset due to missing sources.  In simple cases
where the absence of a thing causes the ABM to do
nothing, then the standard check can work because
the default action is to do nothing anyway.
2021-12-18 11:28:14 -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
b73d1d1290 Pre-clean-transparent filter on all textures
Some users may use filtering but not have the "clean transparent"
filter enabled in the Minetest engine config.  Bake this filter
into all images to (1) avoid the consequences of this (i.e. black
halos), and (2) possibly speed up startup time (the filter will
converge immediately).
2021-09-23 07:36:21 -04:00
Aaron Suen
fd181833f4 Limit smoke effects, e.g. from concrete cure
Standardize a "fair limiting" mechanism that
limits the items accepted into a queue, and
returns a uniform random sample when flushed.

Pass all cooking/curing smoke effects into fair
limit queue.

Apply fairl limit queue to fire sparks too.

Pliant concrete curing checks still seem to lag
the server somewhat, but at least now they
shouldn't hammer the client with particles and
kill framerate too.
2021-08-19 22:19:27 -04:00
Aaron Suen
19652c2fe1 Begin major rework of nodenames matching, autostart DNTs
- Unify logic for expanding nodenames/itemnames lists into indexes
  of matching names, and comparing item names/defs to lists,
  with group expansion and deferral.
- Add "autostart" option to DNTs which registers construction traps
  and a patrol ABM automatically, use for some things that are a
  good match.
- Note that some things are doing more complex logic in ABMs, such
  as determining if a node is eligible, or custom timing logic;
  leave these as-is for now.
2021-08-04 07:41:00 -04:00
Aaron Suen
9fb4cf55b2 Deprecate register_limited_abm
This has just been an alias to minetest.register_abm
for a while now, and all ABM enhancement features
have been added directly to the core API.
2021-07-10 11:09:44 -04:00
Aaron Suen
8a8bed8e5d Major settings cleanup
- Run all settings through a common API.
- Use modname prefix consistently for setting
  keys instead of "nodecore".
- Add automatic dumping of settingtypes.txt
  metadata for maintenance.
- Include initial settingtypes.txt for game for
  main menu use.
- Remove per-recipe tuning for pummel recipes,
  as there were way too many of those to be
  possibly useful and it was clogging up the
  settings menu.  Use tool rate adjustments to
  control it instead.
- Remove vestigial enable_damage setting.
2021-07-10 10:04:03 -04:00
Aaron Suen
8e94e09aee Unify node update hooks 2021-06-20 08:20:46 -04:00
Aaron Suen
005325bc32 Fix fast cook check bug affecting glass quench
It was checking the craft before actually placing
the node, causing the crude glass recipe to
complete when molten glass flowed into a mold
with water below, then it got replaced by the
source node, then it re-quenched to chromatic on
the next ABM pass.  Now it actually quenches
directly to chroma immediately like it should.
2021-06-18 19:24:19 -04:00
Aaron Suen
8683143a32 Fast cook check on placement
As soon as an item is placed run a cooking recipe
check, so auto-furnaces can run at maximum
designed speed instead of having to wait for ABMs,
which may lag.  This should make MP performance
also a lot closer to SP performance...
2021-06-18 19:03:49 -04:00
Aaron Suen
c10e80ef87 Set name in mod.conf as demanded by 5.5+ 2021-03-01 20:10:27 -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
94401942ee Protect doors, standardize protection 2020-07-01 00:30:40 -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
e1a558b754 Sneak+punch prevents pummels 2020-06-19 13:45:51 -04:00
Aaron Suen
b8bf2322fa More work on DNTs
- DNTs can have default time value
- Automatic loop option
- Optional node name filter
- Use DNT for scaling particles
- A few tail call optimizations
2020-06-19 09:38:03 -04:00
Aaron Suen
4a4fd996a1 Register cooking to use DNTs 2020-06-19 00:29:49 -04:00
Aaron Suen
984e87e155 Consistent ABM labeling
- Make sure every ABM has a label
- Use consistent case
- More concise names / consistent voice
2020-06-17 07:09:20 -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
e0156b4742 Add profiler instrumentation metadata everywhere
N.B. the MT built-in profiler doesn't yet actually support reading
labels from bare-function registrations, so a builtin hack is
needed.
2020-06-15 07:21:39 -04:00
Aaron Suen
6c640a11b1 Validate log message levels 2020-06-09 19:02:07 -04:00
Aaron Suen
a998009656 Merge branch 'master' of gitlab.com:yamanq/nodecore into dev 2020-06-09 18:57:34 -04:00
Aaron Suen
e9b9bd43d9 Protection support for storeboxes, pummel 2020-06-09 18:10:44 -04:00
Aaron Suen
5f165b4da3 Fix crash on completing stone brick chisel
Bug was introduced in 16a7c9fe, caused by
the fact that sometimes nodes are dug by nil,
i.e. the way the chisel is dug up automatically
in the chiseling process.
2020-06-01 18:08:59 -04:00
Aaron Suen
16a7c9fe26 Completing a dig resets pummel
This should fix false pummel detection on long
hard-stone dig/drop-in-place sequences
2020-05-31 08:51:02 -04:00
Yaman Qalieh
a8147e9875 Add levels to log messages 2020-05-27 14:04:00 -04:00
Aaron Suen
35292eb259 Switch to an internal sound API
Avoid mangling official Minetest API
functions that mods may want to
use directly.
2020-04-05 21:22:51 -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
dcfc80b367 Remove explicit names in mod.confs. 2020-01-05 12:38:45 -05:00
Aaron Suen
89020e8340 Major rebuild of item_entity.
This created a ton of dependency inversions, which
necessitated moving a number of API functions up into
higher layers, and restructuring dependency lists for
a number of mods.

BOLO: non-deterministic load errors due to missed
dependencies.
2020-01-05 11:42:22 -05:00