176 Commits

Author SHA1 Message Date
Aaron Suen
47bee9dbae Allow "opting out" of specific variants for anvil recipes
When registering anvil recipes, returning no recipe will skip
adding that recipe instead of crashing.
2023-05-11 19:09:35 -04:00
Aaron Suen
00a274e763 Fix damage when trying to chop glowing lode in node form
There's now a separate damage_pickup group that only damages you
if you try to actually pick up the thing, not if you try to
punch/pummel it.
2023-04-28 21:17:17 -04:00
Aaron Suen
c1d165031c Don't drop unsoftened ores
Fixes inconsistencies with high-tier tools in custom mods
2023-04-22 19:39:49 -04:00
Edward Jewell
a5c8ebf01c Added lode crate and form to metallic group 2023-03-04 19:42:11 +00:00
Aaron Suen
166cfe5f14 Mitigate excess server block sends
The problem was pointed out by Josh
(gitlab.com/krazy-j) in merge request !22.
Apparently MT is not very smart about marking
mapblocks dirty to send to clients based on
calling mt.set_node(), i.e. it will mark them
dirty presumptively even if you set the node to
the same value it had already been.

This behavior can be confirmed by registering
an ABM against a common node like grass and
setting action = minetest.set_node.  This
causes every mapblock containing that node
to be invalidated every interval, causing a big
spike in the packets received each interval
that you can clearly see on the F5 graph.

Rather than just fixing it for the most easily
observed case (fire checks), add utlity functions
to check this for ALL node change situations,
and apply it more or less universally anywhere
that we are not certain that the node is being
changed and we don't need to worry about the
extra overhead cost of the check.

Note that we don't need a
nodecore.set_loud_check call, as set_loud was
only ever being used already in cases where
we were pretty sure we were actually changing
a node.
2022-08-24 20:44:14 -04:00
Aaron Suen
25a1f69883 "else if" that should be "elseif" 2022-05-16 18:49:40 -04:00
Aaron Suen
eea39a773f Fix raking sand/gravel by machine 2022-05-01 01:41:29 -04:00
Aaron Suen
98ea7d1c26 Make deep stone lode stains easier to see 2022-04-30 14:41:40 -04:00
Aaron Suen
cf4bd2d749 Fix quench check on heating recipes
If there's any coolant near a node, that blocks
all application of heat and prevents it from being
cooked, and also prevents any passive slow-cooling
recipes from operating on it (i.e. racing against
the quenched recipes).

Use coolant neargroups for quench check too,
for consistency.  Add memoization to the recipe
data on the check, so to avoid doing the quench
scan for each recipe separately.
2022-04-05 20:32:33 -04:00
Aaron Suen
66a338b680 Fix lode rake recycling/wearout recipes 2022-01-23 15:52:46 -05:00
Aaron Suen
42e07db626 Fix lode block forging on stone
If you have enough glowing prills in a stack, then
making a lode cube always takes precedence over
"stone anvil" hot-forging recipes.  If players want to
make toolheads they'll just have to make sure they
don't have excess amounts of lode in the stack; it's
a good reason to eventually switch to cold-forging
on tempered anvils anyway.
2022-01-09 17:10:03 -05:00
Aaron Suen
4c09d412c1 MAJOR: Rake recipe reform
Trying a new more "intuitive" rake recipe shape.
Rakes will now be notably cheaper than before, but
durability will not be nerfed.
2022-01-07 20:35:01 -05:00
Aaron Suen
849ebc62d4 Typo fixes 2022-01-04 16:33:14 -05:00
Aaron Suen
0144a3edd7 Hints for forms and new shelf recipes 2022-01-04 06:19:49 -05:00
Aaron Suen
741955e097 Fix item deletion on crafting storage boxes
Since items inside box would be deleted, just don't
allow crafting of storeboxes/totes if there's already
an item trapped in the form.
2022-01-02 21:31:15 -05:00
Aaron Suen
4304c47c6f MAJOR: Shelf recipe rework
Finally use the new Forms to craft shelves
using a 2-component recipe, and replace the
old 3x3 recipes.  This affects:
- Wood shelves
- Clear glass cases
- Float glass cases
- Lode crates
- Tote handles

For now, we're just going with the simplest
recipe of just putting an item into the form.
If players want to store things in the form
without assembling a shelf, they'll have to
remember to drop items in through the top
only.

Forms may have served a purpose as makeshift
storage when actual shelves are too expensive
but this is NOT their purpose.  They are
primarily intended as crafting ingredients for
proper storage, and secondarily as hoppers for
stack-fed machines.  Any ability to use them as
actual player-controlled storage devices is
purely coincidental and not guaranteed.
2021-12-30 12:05:29 -05:00
Aaron Suen
1ef418acfc De-genericize metallurgy groups
When this was setup, it was named generically
in order to support future functionality that
used the same heating/tempering/annealing
mechanics.  Ironically this has actually only
caused problems.

Standard game mechanics will not mimic one
another, especially something this complex.
Anything worth making a system for nodecore
that's as complex as lode-working deserves its
own distinct mechanics rather than recycling
lode-working.  So vanilla NC will not reuse the
metal-working logic anyway.

Mods were able to reuse the existing logic, but
ironically the only one mod that would actually
have benefitted from it (i.e. uses very similar
heating/tempering/annealing) just copied and
pasted the code from NodeCore anyway, which
not only didn't take advantage of the existing
mechanic provided, but actually made the mod
break the game when installed, because the
mod would replace functionality in use by
vanilla with an older version, and the copying
will always keep that functionality locked in to
an older version, breaking whenever future
changes to the base mechanic are made.

Rename the base mechanic to (1) get out of
the way of the existing mod, and (2) make it
more clear that this is NOT generic functionality
that can be used to create new metals, but
only specifically for lode, and if somebody else
wants a clone of this logic, they would need to
rename it to make sense.
2021-12-29 11:34:30 -05:00
Aaron Suen
31f8ab4ae1 Fix anvil hints (again) 2021-12-24 02:32: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
65dc1fe58f Start working on some hint reform
Got through a bunch of mods, up next is optics.

- Try to use crafting recipes rather than resources as
  the criteria for completing a hint.
- It's okay to use simple item observation for specific
  cases of transient things like pliant concrete.
- It's also okay to still use simple observations for the
  eligibility checks.
- Simple observation is also okay for naturally occuring
  e.g. decay processes, like wilting flowers, as opposed
  to crafts that need to be completed.
2021-12-16 22:31:50 -05:00
Aaron Suen
df0a2a177f Fix anvil performance issues
Instead of registering 12 separate recipes for
each anvil recipe, just register 2: one for each
temper, and do a second lookup for anvil types
in pre/post check.  This should avoid having
to re-evaluate all the rest of the stuff for each
anvil/temper combination type.
2021-12-11 22:56:51 -05:00
Aaron Suen
13abe9a45b Add hard stone support for anvils
Deeper strata can be used, and each is twice as
resistant to weakening as the one above.
2021-12-06 22:26:57 -05:00
Aaron Suen
5d1833c983 Hints for each anvil process type 2021-12-04 21:46:11 -05:00
Aaron Suen
7aaf383f70 Annealed lode forms 2021-12-02 22:07:13 -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
2f5b2daf93 Add lode ladders and frames 2021-11-27 16:14:25 -05:00
Aaron Suen
7c45ca5eb2 Stone anvils, new anvil API
- Anvil API is a wrapper that registers multiple
  recipes, one for each type of anvil allowed.
- Can now use smooth stone as an anvil, however
  once it's been used it cracks, and once it's been
  cracked, if it cools, it converts to cobble and cannot
  be reused, forcing players to master concrete, keep
  their forge hot, or relocate the forge each time it
  cools.
2021-11-25 20:12:55 -05:00
Aaron Suen
24896399c0 More liberal glowing lode cobble draining
Instead of draining only into air/non-walkable below, allow
draining into any space air can pass, including ones where the
prills would be immediately displaced, e.g. into a frame.
This also allows it to drain directly into an existing stack of
glowing prills without an intervening airspace.  This should tone
down the difficulty of figuring out ore smelting a bit, and
make for somewhat more interesting lode furnace builds.
2021-10-01 07:49:19 -04: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
5639ec773c Simplify early-game hints
Lock more things behind prerequisite hints, even if
they're not absolutely strictly necessary to complete
in that order, if they would commonly be done in
that order.  This reduces players being overwhelmed
by available hints very early in the game, and avoids
red herrings like "find lux" which can technically be
accomplished but yields no useful results until the
player can act on them.
2021-08-14 08:29:27 -04:00
Aaron Suen
52a7211c00 Fix silk touch for lode ore 2021-08-07 15:20:05 -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
40e8d23a16 Proof of concept sand-raking nodes 2021-07-02 15:40:52 -04:00
Aaron Suen
3dd945085e Remove the txp_* overlay image feature
- For inventory and wield images, this is already
  possible via override.txt since 5.3.
- For special tiles, this will be possible in 5.4.
- This complicates things, and introduces warning
  messages into mods built without awareness of
  this feaure.
- As far as I know, no texture packs have actually
  ever used this feature.
2021-04-11 10:42:27 -04:00
Aaron Suen
a6308d8378 Don't pre-initialize stone strata arrays
The original theory was that preallocating the array forced lua
to use the "array part" of a table instead of the "hash part",
which should be faster since lookups are a simple linear offset
calculation and not a hash with collision check.

It turns out, however, that in empirical testing, whether the
array-preallocated or the naive-allocated version is faster depends
on circumstances, such as how sparse the array is, how uniform
access is, or how much other load the system is under.  This seems
to suggest that arrays are more computationally-efficient but less
cache-efficient, so cache evictions caused by other concurrent
processes may slow this method down significantly.

Worst-case performance will be the most noticeable here, since a
system that's heavily loaded would have the most need for speed
in the first place, so it's probably better generally to use the
naive allocation.

In all, the naive allocation method also seemed to be the least
sensitive to external factors.  In addition to the array method,
attempts to pre-compile the dynamic checks into a binary tree of
if/then statements (which could be JITted and optimized) failed
as well.
2021-04-07 07:44:13 -04:00
Aaron Suen
f633e86235 Make raw ores not silk-touchable
For one thing, it's a bit overpowered when you go
right from infused still digging lode ore as loose
cobble, right to boosted-infused digging it as raw
ore.

For another, uncobbled lux stone is purposefully
labeled as just plain stone to force the player to
pay attention to light cues, but this would make
inventory management problematic once smooth
lux stone has been collected with boosted tools.
2021-03-15 00:11:05 -04:00
Aaron Suen
319a3f7480 Fix dynamic lighting staying after torch goes out 2021-03-09 18:29:32 -05:00
Aaron Suen
95f0fb0ee9 Heaviest image compression option 2021-03-09 08:33:58 -05:00
Aaron Suen
410ebd5d8d Recompression using ECT
https://github.com/fhanau/Efficient-Compression-Tool
2021-03-09 08:16:23 -05:00
Aaron Suen
c10e80ef87 Set name in mod.conf as demanded by 5.5+ 2021-03-01 20:10:27 -05:00
Aaron Suen
ed2cfc18a1 Register capabilities for tool heads
This allows tool heads to be used in crafting,
esp. presscraft.  Note that certain tiers do not
have tool heads, like stone and infused.
2020-09-29 21:10:26 -04:00
Aaron Suen
82452c9cb6 Annealed lode cube hint
Stepping stone to reach tote handle hint
2020-09-26 22:09:22 -04:00
Aaron Suen
d4fdf8c6e8 Fix items unplaceable due to stack/touch-hurt 2020-09-26 15:03:22 -04:00
Aaron Suen
90e932bf9d Fix lode smelting hint 2020-09-26 14:19:12 -04:00
Aaron Suen
4f35782ecc Fix a few more old skinny selection boxes 2020-09-17 21:51:44 -04:00
Aaron Suen
ae74e4f546 Complete basic hint audit of all mods 2020-09-11 17:20:21 -04:00
Aaron Suen
3915426d7b Add exclusive use for infused rake
Recalculate rake function based on update tool
capabilities so rakes can work on pumice now, and
theoretically even a future snappy=3 material.
2020-09-06 17:48:47 -04:00
Aaron Suen
1632b6352a Revert "Appease 5.4-dev texture_alpha warnings"
This reverts commit 253c2282917ecade5b8356d592edab40b1d517f5.

Apparently this warning is full of crap.  Explicitly
setting use_texture_alpha in the node def does
something DIFFERENT than what the engine says
it's doing enabling it internally.  use_texture_alpha
enables alpha BLENDING, which is what we
don't want with interpolation filters, whereas
leaving it off enables alpha THRESHOLDING which
is exactly what we want.
2020-09-05 23:46:44 -04:00
Aaron Suen
18b01c1ae7 Redistribute hints into each mod
Hints themselves have not been tided up
much, but this makes the project of fixing the
hints for each mod a little more manageable
and breaks up the hard-to-navigate single
monolithic hints file in the old guide mod.

The old guide mod has now been completely
retired.  Hints are now a full-fledged API-layer
standard feature.
2020-09-04 19:07:45 -04:00
Aaron Suen
f8da98acf7 Fixes/tidying 2020-09-04 12:29:34 -04:00