65 Commits

Author SHA1 Message Date
Aaron Suen
d348b04668 Fix torch AISM bugs
Torches being inert when not wielded
- Not snuffing in water
- Not getting ashy as they approach expiry
2021-02-03 22:02:30 -05:00
Aaron Suen
4f35782ecc Fix a few more old skinny selection boxes 2020-09-17 21:51:44 -04:00
Aaron Suen
2f730e0c68 Fix the "light a torch" hint 2020-09-06 18:10:07 -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
253c228291 Appease 5.4-dev texture_alpha warnings
Apparently we will be required to enable
use_texture_alpha explicitly for anything using
any level of transparency, not just alpha
blending, in some future version.
2020-08-31 23:36:35 -04:00
Aaron Suen
338dc72e3b Remove /torchlite cheat, superseded by /nckfa 2020-06-30 19:30:30 -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
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
533d8f3360 Remove old dead torch globalstep hook
This has now been replaced entirely by dynamic lighting and AISMs
2020-05-26 18:49:09 -04:00
Aaron Suen
55efdfa027 Fire ambiance consolidation
- Fire flame and torch flame use the same ambiance def via
  a new flame_ambiance group.
- Items can now emit ambiance via AISM.
2020-05-26 18:48:03 -04:00
Aaron Suen
620e7c09a4 Change dynamic light API, smoother under lag?
Instead of registering the TTL for a light and expecting
more time to be pushed in, use a fixed TTL of 0.25s and
register a callback to check if the light is still valid, i.e.
lights now pull time as necessary.

This should prevent light flickering that can happen
under heavy server lag, i.e. when the time step is
wider than the dynamic light TTL.

Lights that don't register a callback will be ephemeral,
and will disappear after 0.25 seconds, which can be
used to increase the chance that the server has had an
opportunity to move the light, as per torch destructor.
2020-05-26 07:50:57 -04:00
Aaron Suen
3fc187f0e6 Centralize entity glow too
Thrown/falling entities containing a light_source will now cast
a dynamic light glow automatically as well.
2020-05-12 07:22:41 -04:00
Aaron Suen
3484b55cb0 Centralize wield glow logic
- Wield item glow is now handled automatically
- Player glows with same glow level as scaling nodes
2020-05-12 07:13:36 -04:00
Aaron Suen
124aa5e4f4 Dynamic light restructuring
All possible light level nodes are pre-registered at startup time
so that light levels can be determined fully dynamically at run
time, without needing to explicitly declare what light levels will
actually be needed.

Hopefully this will make using dynamic lights a little easier
and lead to some interesting content.
2020-05-12 06:55:11 -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
4dd97d3b2c Tweak cheat torch command decription 2020-03-22 08:15:50 -04:00
Aaron Suen
63ee28c8e0 Base torch life variance on base life. 2020-03-15 09:11:51 -04:00
Aaron Suen
bd9edb15c4 Buff base torch lifetime to 2 minutes. 2020-03-15 09:06:08 -04:00
Aaron Suen
0f474b90e4 Remove debug code. 2020-03-15 09:03:44 -04:00
Aaron Suen
8a5835f21b Add visible stages of lit torch decay. 2020-03-15 09:02:58 -04:00
Aaron Suen
48e7bab366 More torch smoothing.
- Smoother entity light casting.
- Fix flicker on torch pickup.
2020-03-15 08:34:45 -04:00
Aaron Suen
0a26b5bdec Preserve all torch metadata, not just expire. 2020-03-15 08:24:48 -04:00
Aaron Suen
82bc47642e Smoother torch light operation.
Also reduce client packets by tracking dynalight node
ttl in-memory instead of meta.  Lights might flicker out
a bit on area first loading, but some startup judder is
expected on any unloaded area anyway.

Add a "cheat" code for torch testing, and possibly for
other dev uses.
2020-03-15 08:20:56 -04:00
Aaron Suen
3200149cc4 Buff torch and scaling light sources.
- Better compat with low gamma play.
- Torch now emits some light when in inventory, even
  if not actively wielded.
- Dynamic light API for mod use.
2020-02-22 21:57:08 -05:00
Aaron Suen
e3599fb4cf Belt-and-suspenders for wield-light.
It seems there are a couple of scenarios in which MT
doesn't correctly run wield light timers to remove the
wield light; use an ABM to catch anything left over.
2020-01-31 07:25:30 -05:00
Aaron Suen
4d47ab2e75 NC API dependency simplification.
Treat all API mods as a "layer", and use the new
nc_api_all registration to indicate that a mod depends
on the NC API (which ALL NC mods assume they do).
This means that each non-API mod does not need to
worry about which API mods it really needs and which
it does not, nor will they need to be updated for any
internal API restructures.

This is a game, not a modpack, so all mods will be
loaded anyway, and we only care about order.  That
means that we don't really need to worry about
having excess dependencies because any mod we
don't actually need will be needed by something that's
loaded anyway.  If somebody wants to reuse a
component elsewhere, they're likely to need to do
some work to untangle it anyway, because of the
amount that NodeCore mechanics interact and
interdepend.
2020-01-05 12:59:12 -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
Aaron Suen
6013583e4c Item dispersal tweaks/cleanup. 2019-11-28 11:40:28 -05:00
Aaron Suen
9afeebe215 Standardize item dispersal. 2019-11-28 11:29:21 -05:00
Aaron Suen
9beebc3498 Conservation of mass for burning stacks. 2019-11-28 11:18:03 -05:00
Aaron Suen
061d100723 Re-increase torch water quenching radius a little. 2019-11-18 22:55:36 -05:00
Aaron Suen
b9fb3660d0 Run AISMs on item_entities too.
Even though they're ephemeral and supposedly short-lived,
throwing a torch into water should probably extinguish it
before it lands at the bottom.
2019-11-18 22:35:10 -05:00
Aaron Suen
8c45be8abb Make handheld torches more forgiving.
You can now wade in shallow water or stand closer to a
waterfall without torches going out.
2019-11-18 22:17:17 -05:00
Aaron Suen
07850123d7 Standardize high-resolution gametime.
Use high-res version in a few places we were using integer-res
timer before.  This should e.g. smooth time variation of wind
strength for ambient sounds.
2019-11-10 08:10:34 -05:00
Aaron Suen
fdd881ae53 Active ItemStack Modifier overhaul.
AISM's now tick against stacks, including in piles, shelves,
and player inventories, (hopefully) efficiently compared to
the old way with separate ABMs.  Item entity support is also
possible, but not necessary yet.

This started out as a bugfix for being able to put a torch inside a
shelf, which didn't make much sense gameplay-wise.  It ended up
going quite a bit further.

- Aggregate now gets wet in stack form.  Swimming with dry
  concrete now has consequences.
- Lux reactions, radiation, and infusion should now behave more
  consistently.
- Sponges can now wet or dry in stack form, including inside
  containers.
- Torch ignition, quenching, and extinguishing is now more
  consistent regardless of context, and torches are now more
  dangerous, and can ignite things in more contexts.
2019-10-29 20:03:18 -04:00
Aaron Suen
b6168151bf Style consistency.
Avoid redefining tables on every call.
2019-10-06 12:06:36 -04:00
Aaron Suen
1fbad4ad70 Buff torch firestarting ability. 2019-10-06 11:29:46 -04:00
Aaron Suen
d0ef7ab3ad Use torches for super-easy firestarting. 2019-10-06 11:26:30 -04:00
Aaron Suen
b8d340587e Deprecated function cleanup. 2019-10-05 17:49:16 -04:00
Aaron Suen
c147da4dde Convert from depends.txt to mod.conf 2019-10-05 11:24:16 -04:00
Aaron Suen
7fd1da272e Wield light effect works on thrown/dropped torches too. 2019-10-01 21:30:20 -04:00
Aaron Suen
2314097781 Tweak torch wield texture, extend avg life 50%. 2019-10-01 21:14:14 -04:00
Aaron Suen
0a29fd34e9 Clean up sound handling, fix floating point timers. 2019-10-01 19:24:39 -04:00
Aaron Suen
8a65ab5367 Torch logic refactors.
- Unify burn-out logic to just always become ash.
- Reduce logic depth a bit on wield tick, but look for some
  early bail-outs.
- Combine ABM's.
2019-10-01 19:01:06 -04:00
Aaron Suen
77de117ea1 Place certain stacks as nodes.
If a node is specially tagges with the stack_as_node group, and
the stack size is exactly 1, place as a real node instead of a
stack node.

This reinstates logic from WAY back in the super-early pre-alpha
days, except only for nodes explicitly tagged this way.

This should be applied only to nodes that aren't transformed in
any non-desirable way when placed as nodes instead of stacks, and
can be dug the same ways as stacks (i.e. snappy = 1 or
crumbly = 1).

Currently applied to sticks, staves, leaves, ladders/frames,
and torches.  Ladder/frame placement offers some interesting
possibilities in terms of throwing ladders to rappel down holes.
2019-10-01 18:59:53 -04:00
Aaron Suen
a193b966a2 Code reorg, texture optimization.
Use the upstream coal textures from the fire mod, since that's
already a dependency, and we can make sure our textures are
consistent with the upstream ones.  Make the burning torch tip
look embery and not just coaly.
2019-10-01 18:52:05 -04:00
Aaron Suen
b17845f949 Auto-format/check, including some bugs found and fixed. 2019-10-01 18:30:15 -04:00