128 Commits

Author SHA1 Message Date
Aaron Suen
fa6f9212de Fix get_sky compat warnings 2022-04-06 07:07:35 -04:00
Aaron Suen
dd5127c6c4 Upper limit for "saved" soaking tickle time 2022-02-10 22:13:39 -05:00
Aaron Suen
a2f81d9ee1 DNT auto-start refinements
- Regen with LBM too.
- Allow different delay time for "just loaded" case.
- Use DNT auto-start for more things, replacing
  regen ABM/LBM where possible.

Also tried to improve door ablation reliabiity:
- Use DNT autostart for door ablation.
- Faster DNT check so we don't need the ABM
  neighbor scan anymore.
- On early ablation trigger, set DNT for right after
  cooldown ends instead of letting DNT loop die,
  removing one scenario that could cause
  sponge squeezer stalls.
2022-02-10 22:08:58 -05:00
Aaron Suen
2e6e1dde34 Fix crash on nil dnt_get 2022-01-30 09:56:39 -05:00
Aaron Suen
a8c521caea Add missing dnt_get API 2022-01-30 09:39:43 -05:00
Aaron Suen
9555a1ecba Optimize ABM delay
Only register a single job with after() per tick.
Store actual node processing to do in a much
simpler linear array.
2022-01-23 17:28:48 -05:00
Aaron Suen
91e5c615c2 ABM delay, prevent "prompt critical" ignition
During processing of the flammable ignition ABM,
nodes could ignite, causing the new ember nodes
created by this ignition to trigger fire propagation
instantly during the same tick by nodes still yet
to be processed for ABM checks during the same
scan.  This often caused large areas of flammable
nodes, like wooden plank skyblocks, to be ignited
instantly in a specific direction from any source
ignition.  This led to some "cheap shots" where
players were ruined by fire far more rapidly than
they should be.

Instead of processing flammability checks in
sync, delay them until the next tick, so that we
find all flammables to check before any new
igniters are created.  This should tame fire
spreading back down to normal levels.
2022-01-22 16:20:10 -05:00
Aaron Suen
86a53392ec More diagnostic logging
- Log pos of first missed ABM
- Log fire ignitions
2022-01-22 15:30:41 -05:00
Aaron Suen
9c03cf35eb Log format cleanups 2022-01-19 23:30:56 -05:00
Aaron Suen
1ad5bde166 Allow ambiance check to return a simple true
Allow use of true to indicate no custom options.  The check
was originally put in place to allow custom options, but
some mods may use it more simply like the craft check,
where it's meant to be a simple pass/fail.
2022-01-15 23:49:19 -05:00
Aaron Suen
72e417e49d Soil leaching tickling recipe
Also, fix inability to push soaking for leaching
ABMs due to fieldname collision.
2022-01-15 14:07:51 -05:00
Aaron Suen
f0ea46e4f6 Standardize "tickling" rate
Base rate on the natural ABM soaking rate, so
that quality of environment can still be used
to increase rate.
2022-01-15 13:54:11 -05:00
Aaron Suen
acd4156ed8 Soaking "tickle" API, standardize particles 2022-01-15 13:29:50 -05:00
Aaron Suen
ec6a04c1ce Support ambiance pitch variation 2022-01-14 21:33:30 -05:00
Aaron Suen
9a2082f084 Fix soaking ABM push cache incoherence 2021-12-24 22:08:10 -05:00
Aaron Suen
8c027089ae Merge branch 'unloadcheck' into dev 2021-12-18 12:14:08 -05:00
Aaron Suen
17c3f1700f Area load check for AISMs 2021-12-18 12:10:58 -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
a73d9e4457 Report demuxed ABM amounts too 2021-12-18 10:44:45 -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
430f08385c Fix soaking meta cache corruption
This was causing soaking things to finish early
and all fire at the same time.
2021-12-11 21:10:27 -05:00
Aaron Suen
0b3271d2da Significantly simplify ambiance dequeueing
These are just going into the after() queue now so
all the rate-limiting stuff is no longer needed.
2021-12-08 23:43:31 -05:00
Aaron Suen
3e262c0a17 Avoid soaking cache collisions
It's possible multiple soaking ABMs are registered
against a single node, and if this happens, make sure
that the qty and time fields in the cache are kept
separate the same way they are in the node meta.
2021-12-07 23:01:14 -05:00
Aaron Suen
25e0219ad8 Desynchronize node ambient sounds
- Removes repeating patterns, creates a richer and
  fuller sound experience
- Larger areas fill sound volume out better instead of
  just repeating more loudly
- Spread network traffic across multiple ticks better
  to reduce packet spikes

Each node position has a set delay, between 0 and 1
second, that's fixed for that pos but varies more or
less randomly between positions.  This ensures that
sounds loop with the same frequency and alignment
for a given single node, but desync across nodes.
2021-12-07 00:57:33 -05:00
Aaron Suen
ca694993c9 Un-delay inverted ABMs
Instead of queueing inverted ABMs and then running
them out-of-band, run them inside the normal ABM
schedule time.  This should:
- Prevent ABM mux lookup problems caused by nodes
  changing after a delayed inverted ABM schedule and
  the action actually running
- Allow the ABM scheduler to better account for the
  time spent running inverted ABM actions, to ensure
  that they properly count against the default 0.2s
  ABM runtime budget and can't spike lag up higher.
2021-12-05 14:11:01 -05:00
Aaron Suen
bf744aab8b Fix excess meta writes in soaking API
It didn't seem to affect many test cases, but avoid
excess calls to meta:set_*() due to 0/nil disagreement.
2021-12-05 09:10:43 -05:00
Aaron Suen
f412b7f570 More extensive ABM statistic reporting 2021-12-05 09:04:17 -05:00
Aaron Suen
8bf23e6f0a Fix DNTs not being reset on node replace
Invalidate DNT cache when nodes are changed and
force it to be re-read from meta, as meta was also
likely cleared during that operation.
2021-12-03 23:02:31 -05:00
Aaron Suen
f7461414d2 Move lazy raycast into playerstep API 2021-08-06 21:33:23 -04:00
Aaron Suen
a0d2abfe3a Fix missed DNTs 2021-08-05 21:09:01 -04:00
Aaron Suen
4f9d756c3f Fix DNTs not firing without nodenames 2021-08-05 20:50:03 -04:00
Aaron Suen
81ef696bce Clear soaking meta cache on node replacement
Ensure that when meta is implicitly cleared by node replacement,
the cache doesn't keep an old copy and fast-forward through
soaking recipes if the old node is re-replaced later
2021-08-05 08:10:42 -04:00
Aaron Suen
6aafecf475 Optimize soaking check for dirt leaching
This was triggering on all dirt nodes everywhere, so optimize the
most common code path, i.e. one where there is no water above
and the soaking data must be reset.
2021-08-05 08:02:48 -04:00
Aaron Suen
0435e6af32 Rewrite core DNT API
- Store next runtime instead of countdown, so metadata always has
  one canonical representation for a given target time, allowing
  us to more easily avoid rewriting the same data with different
  representation.
- Tons of caching and duplicate write avoidance, reduced resetting
  of node timers, and MT API calls in general.
2021-08-05 07:36:14 -04:00
Aaron Suen
ffb25a9162 More exact DNT names
Keep actual name of DNTs distinct and self-describing instead of
relying on modname, which sometimes changes when things are
refactored.
2021-08-05 07:35:20 -04:00
Aaron Suen
dd009343f9 Fix DNT retriggering bug 2021-08-04 17:15:04 -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
964f2c5044 Make sure glass DNTs are queued 2021-08-03 21:08:57 -04:00
Aaron Suen
00b3dc477a Unified fluid wandering system
- New fluid wandering API, mostly unified logic, only needs
  some parameters, plus the "generation check".
- More sophisticated behavior seeking down-slopes beyond simple
  immediate flowing node reach ("subtle slope" detection).
- More reliable timing using DNTs.
- Set firm movement rate of concrete, molten glass.
- Reduce molten glass generations, since it can now be more
  reliably directed.
2021-08-02 07:17:51 -04:00
Aaron Suen
1f913bf402 Merge branch 'dev' into fluidwander 2021-08-02 07:55:11 -04:00
Aaron Suen
068e9b6995 Remove debugging code 2021-07-11 14:51:35 -04:00
Aaron Suen
e24112a2d9 Fix soaking with cache
Soaking recipe fails will result in a lot of clearing
of old soaking values out of node meta, which is
very slow in the common case of e.g. dirt that's
not near water and thus should not be soaking in
the first place.

Skip node meta writes if the node meta already
contains the correct data, by doing a cached read
and check before writing, instead of blindly
writing.
2021-07-11 14:50:33 -04:00
Aaron Suen
03948cfe0f In-memory cache for soaking
This speeds up performance of soaking API by
quite a lot, especially in the more or less
pathological case of soaking dirt to sand, which
involves clearing the metadata from thousands
of nodes each run.  Knowing that the nodes
had already had their metadata cleared is
very helpful.
2021-07-11 14:36:55 -04:00
Aaron Suen
4be7398ff4 Fix setting interval/chance in soaking 2021-07-11 14:13:04 -04:00
Aaron Suen
cf8364199c Simplify soaking metadata clearing 2021-07-10 11:25:49 -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
15936859c3 Persist stasis in modstore, not settings 2021-07-10 08:14:08 -04:00
Aaron Suen
3d2f449532 Checkpoint: start work on fluid wandering API
The idea is to unify cement and glass flowing, plus
add additional features: if there is no available
space, try to find the nearest dropoff to wander
toward even if flows can't actually reach it (assume
that the terrain subtly slopes that way).
2021-06-18 18:26:51 -04:00
Aaron Suen
4333c85d47 Fix ABM inversion with multiple candidates
This was apparently causing sand not to cook if it
had another sand node on top of it, because the
inverted cooking ABM would detect the top sand
node only and not process the cook check for the
lower one.
2021-05-28 14:47:32 -04:00