21 Commits

Author SHA1 Message Date
Aaron Suen
25a1f69883 "else if" that should be "elseif" 2022-05-16 18:49:40 -04: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
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
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
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
42f125c716 Make most recipes indexable
Register a "rootmatch" property for all
recipes that represents a broader, quicker
test for recipe eligibility.  False positives are
allowed but false negatives are not.

Since most recipes are eligible, we can
use this to build an index for fast lookups
of subsets of recipes to run and skip most
of the other ones.
2020-06-27 11:06:43 -04:00
Aaron Suen
ec2454d592 Lode tool breakage is now lossy.
Players have an incentive to be careful with lode tools
and collect worn ones to melt down for recycling instead
of just letting them break naturally.
2020-01-31 08:17:51 -05:00
Aaron Suen
8417236d42 Experimental lode forging rework.
- You can now forge hot lode using either tempered OR
  annealed anvil.
- This creates a gameplay path for accessing annealed
  lode without having the resources (i.e. water/sponges)
  to access tempered yet.
- Cold-working is still more efficient for being able to
  pick up the excess prills from the process.
- Cold working, and then heating afterwards, is still likely
  the only reasonable way to make mattocks.
2020-01-24 19:28:41 -05:00
Aaron Suen
6e1f3fee94 Standardize intra-line spacing in code. 2019-12-01 11:08:12 -05:00
Aaron Suen
4c025eea00 Don't register useless glowing lode full tools. 2019-11-17 08:55:24 -05:00
Aaron Suen
9a75f4c87a More flexible burning API.
Stone, lode, and lux tools now all have their handles burn, and
eject the non-flammable portions of the tool.

Now using a unified on_ignite hook for when flammable things catch
fire.  The call is made BEFORE the node is replaced, and has an
opportunity to look at node metadata and eject anything
non-flammable.

It can be a function, e.g. for shelves, or a static value in the
same format that the function would return (e.g. for lode tools
which need string values for temper substitutions).

If it returns a string or itemstack, it will eject that from the
position where the node burned.  If it returns a table it will
eject all the values of that table.
2019-09-07 11:28:51 -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
3614068263 Bug fixes, tidier craft excess handling. 2019-04-03 08:10:03 -04:00
Aaron Suen
497e637d80 Code simplification. 2019-03-23 17:44:18 -04:00
Aaron Suen
29dbe0f411 Holy moly, it's the first new tool in like forever! 2019-03-23 17:41:31 -04:00
Aaron Suen
b717fcb04c Fix excess prills from tool breakage. 2019-03-10 19:25:28 -04:00
Aaron Suen
96b5863fc0 Tools melt down to prills; reworking is necessary. 2019-03-08 23:22:14 -05:00
Aaron Suen
f893f613c3 API refinements.
- Make node match operate on only one of node or stack, depending
  on whether node defers to stack via is_stack_only.  This should
  hopefully prevent future pummel recipe issues.
- Add new core stack API.  Needs to be deployed in a lot of places.
- Start work on system for allowing flammable containers; they
  eject their potentially non-flammable contents.
2019-02-23 09:44:22 -05:00
Aaron Suen
0638e3f11f Crafting cleanup.
- Alternate shelf recipe to make it a little more intuitive.
- Label all existing recipes.
2019-02-21 14:37:22 -05:00
Aaron Suen
0df805f647 Fix lode tool head name capitalization. 2019-02-20 01:58:14 -05:00
Aaron Suen
7c9c5a06f2 Lode tools are now a thing! Rejoice! 2019-02-19 23:53:40 -05:00