2635 Commits

Author SHA1 Message Date
Aaron Suen
1f8f2cc28b Make all non-node items follow the same rules
Before, non-node items (tools and craftitems) were
exempted from opacity entirely and were always
transparent.  Now, they use the same optic_opaque
and optic_transparent groups, are opaque by default,
and honor the sunlight_propagates heuristic (even
though this is rarely used for non-node items).
2023-11-01 18:59:01 -04:00
Aaron Suen
9407dc65a0 MAJOR: Make many things optic-beam-opaque
The following things were nodes that were defined as
sunlight_propagates = true but NOW will be opaque:

- shaftcraft items like sticks, staves, bars, rods, ladders,
  frames, and torches
- flora such as rushes and flowers
- sedges, but only at max growth (make it now possible
  to detect and automate sedge growth)
2023-11-01 18:55:48 -04:00
Aaron Suen
93717fa421 Small optimization to storebox check 2023-11-01 18:42:01 -04:00
Aaron Suen
47f20ac2f0 Don't pack/unpack varargs in nodecore.door_operate
Instead of using variadics, hard-code array accesses for the
expected arity of door_operate_core, throwing away any
"future-proofing" that variadics were supposed to offer.

This is because in Lua 5.1, the length of arrays that contain
nil values anywhere in the sequence is apparently undefined, and
implementations are free to return the position of any value that
is followd by a nil, so length of {1, nil, 3} could be 1 or 3.
PUC lua seems to generally return 3, but LuaJIT takes more
liberties here (presumably exploiting UB for optimizations).
The problem arises when trying to unpack({1, nil, 3}) and LuaJIT
sees the length as 1 so return only <1>, instead of <1, nil, 3>.
This means that calling nodecore.door_operate(pos, ni, dir),
which was INTENDED for this API (it would look up node for you if
you didn't provide one) could result in the dir param being
lost due to packing the args into an array to defer them, and then
that array getting only partially unpacked.

Reference to WONTFIX bug where LuaJIT claims this is allowed UB:
https://github.com/LuaJIT/LuaJIT/issues/527

The solution for now is to stop relying on unpack (which is sort
of easy in its own way since I never really liked it).  In the
specific case of nodecore.door_operate in particular, adding
more positional args (it already has 3) would be bad for other
reasons (should switch to a named passing style).
2023-11-01 01:07:19 -04:00
Aaron Suen
34f09bcd88 Try to canonicalize doors before moving
Some external rotation mods may change the way
node rotation works and put doors into a state where
they are one of the 12 "reversed" rotations instead of
the 12 "canonical" ones.  Renormalize door facing
before processing rotations to ensure that these doors
are corrected automatically.
2023-10-29 03:07:09 -04:00
Aaron Suen
966ed012b2 Expose node spin data in registrations
Deprecate the old APIs that used to close over the
metadata about valid node rotations.  Now expose
this data in the node definition, and use a generic
non-closure function to handle the callback.

nodedef.spindata contains:

qty = number of allowed rotations total
cycle = table keyed on current param2 and valued with
  next param2 for next rotation
equiv = table keyed by each possible param2 (24 keys)
  and valued with canonical equivalent for that param2
2023-10-29 02:49:22 -04:00
Aaron Suen
e35b45c011 Fix getting "find lux" hint upon making a lantern 2023-10-28 15:37:00 -04:00
Aaron Suen
9a0804fae0 Fix broken stylus programming
...along with possibly other downstream bugs.

We had stripped the metadata off the wield item in the
pummel state tracking to make it so that changes to
wield item metadata (especially things that could be
changed by AISM while the player is using the thing)
would not cancel a pummel, but forgot that the wield
metadata that gets put into the pummel state is ALSO
fed to the recipe check.  Use a separate key for this
stripped only-for-comparison version, and keep the
proper itemstack with full meta for recipe checks.
2023-10-28 15:36:40 -04:00
Aaron Suen
0910265cc0 Add a storebox_sealed_always group
NodeCore will probably never use this itself, but it
can be used for mod content (i.e. Winter's waterlogged
containers) that will never allow infiltration of air
whether the sides are open or not.
2023-10-28 11:46:18 -04:00
Aaron Suen
085c862d33 Merge 'copygirl/fix/register-item-strip-colon' into dev 2023-10-27 07:29:08 -04:00
copygirl
2804ad2392 Remove unnecessary ":" prefix stripping 2023-10-27 09:29:51 +02:00
copygirl
84a832ac0f Strip ":" prefix in overridden register_item 2023-10-27 09:09:07 +02:00
Aaron Suen
997cd73cdd Translation update 2023-10-26 20:12:03 -04:00
Aaron Suen
5a10a8cfc5 Translation sync 2023-10-25 00:34:11 -04:00
Aaron Suen
8d08eb3518 Translation update 2023-10-23 19:53:19 -04:00
Aaron Suen
b5060b34cd Don't discredit "same as source" translations in stats
While we don't need to include these in the .tr file, if the
translators verified that the translated string matches the
source string (e.g. lines with only a URL or other technical
information) it still counts toward translation completion %.
2023-10-23 06:57:59 -04:00
Aaron Suen
d0206e13c9 Add weblate URL and translation stats, update translations
Hopefully, showing the weblate URL and translation status will
encourage people to contribute to translations...
2023-10-23 06:48:42 -04:00
Aaron Suen
8836a6d409 Fix non-log node door placement orientation 2023-10-22 22:32:13 -04:00
Aaron Suen
18a3684664 Defer door ablation to end of optics transaction
Optic checks follow a plan-then-commit phased process,
but ablation processing was happening (and modifying
the map) during the "plan" phase, which was almost
certainly the root cause of the optics duplication bug
that was just mitigated.

Add a mandatory "defer" function to the optic_check
protocol that nodes can use to peform additional
custom logic AFTER the commit phase has completed,
and move all door ablation actions there.

The "optic family" mitigation is left in place to also
provide a heuristic for verifying the problem has been
resolved.
2023-10-22 22:04:42 -04:00
Aaron Suen
1b2671c2ee Mitigate optic duplication bug
Optic nodes are each assigned a "family" of nodes that
are equivalent things with different power states.  Optic
commit is not allowed to replace any node with another
node outside of the source node's family.  This at least
prevents optic_commit replacing an air node with an
optic node (the way the dupe manifests).  Log a warning
whenever this happens.

Unfortunately we still don't yet know the actual cause of
the problem, so this is just a workaround, not an actual
fix.
2023-10-22 21:08:32 -04:00
Aaron Suen
fee85c5b56 Consistency 2023-10-22 20:36:05 -04:00
Aaron Suen
85ece02691 Fix overcomplicated optic immediate check
Don't cache the current node for multiple cycles,
just only allow only one node to be modified once
in the immediate transaction.
2023-10-22 19:53:02 -04:00
Aaron Suen
2e68093e8b Support multiple skin textures
If a custom model is in use, or a 2-sided sprite,
then the textures array may need to contain
multiple textures.
2023-10-13 21:53:37 -04:00
Aaron Suen
6f6602fea2 Fix lens selection box asymmetry
All rotatable node selection boxes should be as symmetrical as
possible so that rotating a node without moving the cursor won't
change which node the cursor is pointed at by resizing the
rotated selection box out of the way, which can cause repeated
right-clicking to miss and hit another node.

Prisms were corrected for this some time ago.  Lenses were
apparently close enough that this was missed, or considered not
important enough, but this change makes things much more
consistent, including making the lens and prism hitboxes match.
2023-10-13 20:49:59 -04:00
Aaron Suen
041b15f2b6 Updated new source strings 2023-10-12 19:38:52 -04:00
Aaron Suen
a15c972431 Translation updates 2023-10-12 19:36:01 -04:00
Aaron Suen
cfa0a85bb5 Display player offline time in ghost looktips by default
Show a textual fuzzy description of how long a player has been
offline (in terms of in-game time, not realtime) in player ghost
looktips instead of just "Offline Player", if the last seen time
is actually known.  Can be disabled by a setting.
2023-10-12 19:26:52 -04:00
Aaron Suen
1e130030de Immediate optic state acquisition on placement
When placing an optic node into an existing beam path, it
immediately acquires the correct state rather than being placed
as "inactive" and needing one tick to activate.  This would cause
a "down" pulse to travel down networks when placing a "vampiric
tap" into an existing beam path, even if it was placed with the
correct initial rotation.  This reduces a source of noise in
optic circuit building that doesn't appear to add any meaningful
challenge, only nuisance.
2023-10-12 19:17:42 -04:00
Aaron Suen
b43c02f589 Reduce tongs item meta churn
Prevent stack from doing selection-reanimation
by just setting the time at which annealing would
happen once rather than keeping a count of
elapsed time.
2023-10-11 20:22:37 -04:00
Aaron Suen
5c40b44cc4 Clear item meta on cooling with tongs
This allows non-glowing items to stack again
2023-10-11 20:19:07 -04:00
Aaron Suen
804fd01d85 Fix cache invalidation on wrong command hook 2023-10-11 19:53:54 -04:00
Aaron Suen
16f4068a14 Fix priv cache aliasing issue
The builtin grant/revoke commands modify the privs table returned
from get_player_privs, which can poison the cache if the priv
modification is later aborted due to an error.  Return a clone of
the privs table instead so that modifications of it don't affect
the cached copy.
2023-10-11 19:47:10 -04:00
Aaron Suen
d9321044bb Excess debugging messages 2023-10-10 00:20:27 -04:00
Aaron Suen
82c99d6148 YCTIWY markers visually fade with age 2023-10-10 00:06:24 -04:00
Aaron Suen
90b0659aa1 Hint for tongs recipe 2023-10-09 22:45:11 -04:00
Aaron Suen
e17d322d85 Fix metallurgy witness in tongs 2023-10-09 22:44:16 -04:00
Aaron Suen
87fc2d586c Witness always works within "touch" range
If the transformation happens at the player's actual
location, they don't have to "see" it if they can "feel"
it.  This fixes witness triggers happening inside the
player's inventory.
2023-10-09 22:43:51 -04:00
Aaron Suen
68ca7ad4c3 Tong cooling/quenching recipes
Note that these are separate from the existing
recipes used elsewhere out of necessity.  Lode
also anneals faster when carried (it's exposed
to more air cooling).
2023-10-09 22:37:50 -04:00
Aaron Suen
8e503c9b93 Tongs recipes 2023-10-09 21:50:14 -04:00
Aaron Suen
4a86163534 Prototype lode tongs
- Pick up and carry hot lode things
- Sane tool wear management

Known Issues:

- No recipes yet
- Glowing things don't anneal/temper when inside
  player inventory
2023-10-09 21:41:08 -04:00
Aaron Suen
3c011361f2 Door node placement honors facedir/4dir 2023-08-18 21:55:08 -04:00
Aaron Suen
37ec4db8d5 Refactor, standardize backstop logic
Door press and plank recipes now share the same
underlying logic for checking for a "backstop".

Refactor the recipe checks a bit more to get rid of
excess structure and named functions.
2023-08-18 21:20:54 -04:00
Aaron Suen
2ac0f3ed1c Merge branch 'dev' into directions 2023-08-18 20:49:57 -04:00
Aaron Suen
8a28ec054e Fix door conveyance node dupe bug
After successfully moving a node, always stop trying
to move that node to another spot, regardless of
whether or not we had any retries to process as a
result.
2023-08-17 20:55:45 -04:00
Aaron Suen
33f2f3ca52 Translation update 2023-08-17 08:21:51 -04:00
Aaron Suen
b1af597b6d Merge branch 'horzyverty' into dev 2023-08-07 21:11:21 -04:00
Jeremy Hussell
152063a034 Make horzy/verty concrete rotatable
Rotate horzy and verty etched concrete around its vertical axis
when it's placed. This only affects the direction of the stripes
on the top and bottom of the blocks. For example, a cross-beam
made of horzy concrete can now have the stripes on the top and
bottom of the beam in the same direction as the stripes on the
sides, or not, as desired, where before the top and bottom stripes
always ran east-west.
2023-08-07 21:10:22 -04:00
Aaron Suen
d1cc4e84e3 Point to NodeCore Matrix space instead of channel 2023-08-06 18:32:12 -04:00
Aaron Suen
9c13ac4366 Don't crash on wielding items without a dig sound 2023-06-22 21:17:38 -04:00
Aaron Suen
dea2432325 Add stasis/quell state to cheat HUD, detect more node types 2023-06-20 08:01:43 -04:00