11 Commits

Author SHA1 Message Date
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
d872119fd7 Multiple press-craft fixes
- Fix door place-craft discovery not triggering due
  to wrong label name
- Fix many door witnesses not working because the door
  itself obstructs view of the action; "spread" the witness
  event to multiple positions and give the player credit
  if they can observe any part of the interacting nodes.
2022-03-29 09:06:15 -04:00
Aaron Suen
413641aa71 Fix delayed witness, finish known form use-cases 2021-11-29 23:10:22 -05:00
Aaron Suen
bba0a17abe Flexible craft discovery API
- Flexible discovery list format for discover and
  witness APIs
- Add "discover" key to recipes that contains a list
  of discoveries to give players so they can act like
  recipe groups and allow different recipes to
  complete hints

Recipe group system should be easier to setup for
hints than having to list all hints individually.  We
can use them especially in recipes that are loop
generated.
2021-11-29 21:08:34 -05:00
Aaron Suen
b4315def27 Delayed witness on staring 2021-08-06 22:59:33 -04:00
Aaron Suen
fb6a4d7dd1 Hyrbid immediate/delayed witnessing
If we have line of sight to see the event happen
now, then discover it immediately, otherwise save
it for delayed witnessing on punch.
2020-09-26 20:17:31 -04:00
Aaron Suen
64e917fc95 New witnessing system
If a player is close enough to an event when it
happens (withing "likely hearing" distance) then if
they later punch the node then they can "collect"
the discovery.

The idea is that if a player hears the sound of
something happening, then they might go and
investigate and discover the thing they thought
they had left there isn't what's there anymore.

In retrospect I may want to combine this with a
limited form of the visual witnessing, just as there
may be events that a player is less likely to touch
in aftermath, or may not be practical to (e.g.
if what's left behind is air)
2020-09-26 17:52:09 -04:00
Aaron Suen
77464e725a Reduce witness log noise 2020-09-26 15:04:34 -04:00
Aaron Suen
de87702497 Door crafting hints and witnessing 2020-09-11 01:08:20 -04:00
Aaron Suen
edea123a1e Start on new unified Hint API
- Move hint handling down to API layer
- Simplify stat data; old nc_stats counting can
  be moved out to a separate mod.  We only
  need whether the player has seen or not.
- Invert inventory tab responsibility.
- Merge witness system in from crafting.

TODO:
- Redistribute hint registration responsibility
  to individual mods.
- Test external mod compat.
- Retire old nc_stats and nc_guide systems.
- Add a way to reset hints.
2020-09-04 16:28:27 -04:00