2852 Commits

Author SHA1 Message Date
Aaron Suen
92afc2c553 Fix inefficient dynamic light checks
Instead of checking to make sure one of the objects
found at a location is the glowing entity (which is
very slow and has to search every object for each
light) just make sure that the entity still exists
(get_pos() does not return nil) and that it's still
within the same node position as before.

This fixes a huge lagspike that was caught on NCC
due to a bunch of dropped glowing lenses.
2022-09-28 22:16:17 -04:00
Aaron Suen
c02df68fa6 Fix dropped shining lenses shining forever 2022-09-28 21:57:20 -04:00
Aaron Suen
b27c696c06 Somehow lost the var name 2022-09-26 07:44:03 -04:00
Aaron Suen
f15e1369f1 Always spawn wield ents at live player pos
Don't use the stored pos, which might be at the time of
player login, and thus arbitrarily far from where the player
is now, such that it might never actually be loaded.
2022-09-26 07:31:20 -04:00
Aaron Suen
b37d01107f Do the distance check before db check
The distance check is less complex and will probably
filter out players a lot faster on a largeish server, so
it's a better check to run first.
2022-09-24 16:36:55 -04:00
Aaron Suen
a9e99f921e Deferrable discovery and witness optimization
- Split "discovery" into 2 stages: a check (to see if
  there is even anything new to discover) and a
  commit.
- When doing witness checks, check to see if there
  is anything to be discovered first, before doing the
  more expensive visibility checks.  If the player
  already knows all the discoveries, then we don't
  need to do any of the raycasts.

This should speed up especially pathological cases
like door catapulting, which can cause witnessing to
happen at multiple points, and causes major
slowdowns when multiple players are within the
distance range and facing the correct direction due
to tons of raycasts happening.
2022-09-24 12:23:24 -04:00
Aaron Suen
dfcfb906a7 Trivial fix for priv cache
Clear the dirty flag after cleaning the cache.  In
practice this will probably make no difference
since game logic makes it very likely the cache
would be dirty after every tick anyway, but it's
more correct at least, and MAY reduce lag on
empty servers.
2022-09-24 12:20:09 -04:00
Aaron Suen
433161466b Unify cached privs checks
All base-game priv checks should now only
require one priv lookup per player per tick,
except in special cases where a player's privs
changed during that tick.
2022-09-24 00:20:27 -04:00
Aaron Suen
5b3a13c459 Cache player interact privs for current tick
Apparently accessing player privileges is
weirdly expensive, regardless of whether
get_player_privs or check_player_privs is used,
and because interact privs are checked so
frequently, it adds up to quite a lot (as much as
a third of the playerstep time).  Since things
controlled by interact privs are probably safe
to delay for a tick (it won't be toggled very
often), just cache it for the current tick to
mitigate this.

In the future it might make sense to (1) trap
the privilege change calls to invalidate the
cache, and (2) consider  doing this for some
other privilege checks.
2022-09-23 23:47:33 -04: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
6215c8c670 Translation updates 2022-08-24 20:01:54 -04:00
Aaron Suen
3c9682bf18 Make a few "fundamental constants" configurable 2022-08-14 12:16:18 -04:00
Aaron Suen
e60eaa8294 One more note 2022-08-12 07:31:20 -04:00
Aaron Suen
cebd4e1545 Massive notes dump 2022-08-12 06:37:13 -04:00
Aaron Suen
42d92f4ca9 Disallow basic_debug by default (FINALLY) 2022-08-12 05:47:27 -04:00
Aaron Suen
26ca958083 EOL 5.4, now that 5.6 has been released
Note that we are not YET bumping the protocol version requirement
because (1) the proto bump policy was new as of 5.5, and (2) we
have no known cases yet of 5.4- not working correctly.
2022-08-12 05:45:00 -04:00
Aaron Suen
33be42cbd2 Translation sync 2022-08-12 05:35:56 -04:00
Aaron Suen
3d3f696880 Player name HUD customizability hook
An example of use for this might be attaching images to player
nametags to indicate server roles.
2022-08-12 05:33:59 -04:00
Aaron Suen
c6f054749f Audit and consistentize item drop hooks
Should fix remaining crashes in multicraft
reported by maksym related to item drop
having a nil player.
2022-07-02 11:37:58 -04:00
Aaron Suen
0c7e0e819b Guard against nil player
https://gitlab.com/sztest/nodecore/-/issues/14
Unable to reproduce the crash, but the fix
seems obvious given the symptom.
2022-06-26 08:13:56 -04:00
Aaron Suen
81a5c6dad5 Translation sync 2022-06-08 08:24:07 -04:00
Aaron Suen
4cec30a2eb Add tip about tedium 2022-06-08 08:21:28 -04:00
Aaron Suen
a7b84724c8 Improved smoke API, smoking torches
- Smoke API uses expandable options param instead of positional
- Separate burst qty from automatically adjusted rate
- Backward compat with old API for now
- Standardize burst of smoke puffs for crafting
- Torches emit small smoke particles at increasing rate as they
  start to wear out, to warn players holding them to light another
- Torches now emit a puff of smoke upon snuffing
2022-06-08 08:15:31 -04:00
Aaron Suen
2e5641843b Hide wieldtips for non-interact players who can't have items
Virtual items, esp. the hand of power, were showing up on
join even if the hotbar was hidden.
2022-06-08 08:06:23 -04:00
Aaron Suen
d28a438063 Fix worn wooden tools being stone-tippable 2022-06-08 07:52:17 -04:00
Aaron Suen
10575352f2 Translation update 2022-06-08 03:02:55 -04:00
Aaron Suen
3b9eb9fbaa Remove errant debugging cruft 2022-05-28 07:50:18 -04:00
Aaron Suen
b10da442dc Eggcorn planting automation
A single eggcorn that finds itself "forced" into a node
of loose dirt (e.g. by being displaced by a falling loose
dirt node that settles where it was) will become a
sprout.
2022-05-27 22:32:57 -04:00
Aaron Suen
7bd2d9df94 Document some issues 2022-05-27 22:15:48 -04:00
Aaron Suen
5e0da66653 Clean up the screenshot mods a bit
- Unify setup and inv mods so they can share some
  logic
- Lock more things when player is standing in the
  "home" position.
- Automatically re-lock player if they return to the
  "home" position and stay still.
2022-05-18 20:40:10 -04:00
Aaron Suen
bd4cc715fa Oxford 2022-05-17 23:28:14 -04:00
Aaron Suen
08554fd473 Simplify readme copyright statement
Mainly refer to the license file for the official copyright,
prevent forgetting to update the year in the readme by just
omitting it for now.
2022-05-16 18:52:17 -04:00
Aaron Suen
8518e08ddb Translation sync 2022-05-16 18:50:46 -04:00
Aaron Suen
25a1f69883 "else if" that should be "elseif" 2022-05-16 18:49:40 -04:00
Aaron Suen
58a046f4d8 Translations 2022-05-07 18:01:35 -04:00
Aaron Suen
08a22640d2 Translation update 2022-05-04 08:49:14 -04:00
Aaron Suen
7f24ff234f Fix high-tier rakes not silk-touching soil 2022-05-02 07:27:57 -04:00
Aaron Suen
5f727b3040 Make machines always do selective raking
Machines can only dig one way, and cannot hold the "sneak" key,
nor is there a particularly sensible way to differentiate between
different kind of actions or setup the environment to signal
the digging "mode".

Toward this end, it seems to make the most sense to have the thing
that the machine is digging always significant, and it should be
possible to emulate a "dig everything" machine (knowing that only
certain kinds of things will be within range within a machine)
using multiple "dig one thing" rakes, whereas the reverse is not
so obvious.

For this reason, until a multi-modal system is figured out, change
the default mode to be selective.
2022-05-02 07:14:30 -04:00
Aaron Suen
3e3264d3e8 Fix door rake-digging causing random other digs to rake 2022-05-02 07:09:12 -04:00
Aaron Suen
c268b70938 Fix tools pummeling instead of digging 2022-05-02 07:05:38 -04:00
Aaron Suen
e28584b881 Add subtle door indicators
It was always weird that the player character could
sense hinged panels even when the faces shown were
completely undifferentiated from their non-panel
counterparts.  Add a fairly subtle visual indicator that
makes it obvious why the player can spot them.

Players can still hide doors in plain sight, they may
just need to take more advantage of shadows and
other geometry tricks to ensure they don't stand out
against a field of similar nodes, or use psychological
tricks to distract other players from spotting the
patterns.
2022-05-01 19:46:25 -04:00
Aaron Suen
5587c0cbcc Generalize brickmaking hints
Treat all "stone-like substances" as stone for purposes
of the hints.  You can chisel/bond any of stone, adobe,
sandstone, tarstone, etc. to get credit for the hints, so
there should no longer be hints hidden because you
haven't had the exact right kind of unetched concrete.
2022-05-01 19:08:37 -04:00
Aaron Suen
6ce87f27bd Fix door catapult crash 2022-05-01 03:51:54 -04:00
Aaron Suen
6a4c9ce29c Remove completed idea 2022-05-01 01:57:26 -04:00
Aaron Suen
a5b80d1654 Notes update 2022-05-01 01:48:32 -04:00
Aaron Suen
714e99a783 Merge "door raking" branch into dev
- Ability to rake-dig using doors
- Ability to rake-pummel dirt/sand/gravel via doors
- Fix for stylus patterns and training with doors
2022-05-01 01:43:15 -04:00
Aaron Suen
6891ca5e6e Clean up debug code 2022-05-01 01:42:55 -04:00
Aaron Suen
f8ebcec543 Simplify stylus etch code 2022-05-01 01:42:32 -04:00
Aaron Suen
eea39a773f Fix raking sand/gravel by machine 2022-05-01 01:41:29 -04:00
Aaron Suen
e803155cbc Fix stylus patterns/training with doors 2022-05-01 01:36:16 -04:00