26 Commits

Author SHA1 Message Date
Aaron Suen
90fbdabdf2 Redo pickup interceptor using base metatables
The new method of intercepting item addition into
player inventories hooks into the base metatables for
the userdata types only once per type, instead of
trying to substitute every inventory object with a
table (which crashed some things) and does a lookup
to find the player per inv.  This should hopefully be
more reliable, and avoid some of the leaks to
rearrangement we had before.

If we can finally stop hitting the player inv rearrange
safety net then it can be removed.
2020-09-08 09:24:45 -04:00
Aaron Suen
8fd659068d Fix drop-all repetition guard hook 2020-09-05 20:43:12 -04:00
Aaron Suen
3b64a3ecc4 Aux+sneak+drop = drop all matching 2020-09-04 13:16:41 -04:00
Aaron Suen
387a72ccbc Aux+drop dumps entire inventory 2020-09-03 20:22:09 -04:00
Aaron Suen
77bb713b77 Raise minimum log level to "action"
Log entries of "info" don't end up in server log
trace output by default; it's hard-coded to
LL_ACTION in main.cpp.
2020-07-05 08:14:52 -04:00
Aaron Suen
94a887266c Work around apparently-obscure inventory crash 2020-06-28 14:37:51 -04:00
Aaron Suen
5648331c9f Replace all perplayer with playerstep 2020-06-22 22:47:33 -04:00
Aaron Suen
70efb016af Add auditing for player stack movement 2020-06-18 07:20:15 -04:00
Aaron Suen
e0156b4742 Add profiler instrumentation metadata everywhere
N.B. the MT built-in profiler doesn't yet actually support reading
labels from bare-function registrations, so a builtin hack is
needed.
2020-06-15 07:21:39 -04:00
Aaron Suen
6c640a11b1 Validate log message levels 2020-06-09 19:02:07 -04:00
Yaman Qalieh
a8147e9875 Add levels to log messages 2020-05-27 14:04:00 -04: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
dc8c483e01 Standardize virtual items, prevent them dropping. 2019-12-09 04:46:33 -05:00
Aaron Suen
6e1f3fee94 Standardize intra-line spacing in code. 2019-12-01 11:08:12 -05:00
Aaron Suen
c147da4dde Convert from depends.txt to mod.conf 2019-10-05 11:24:16 -04:00
Aaron Suen
310ce1bc6c Treat NodeCore as a unified thing.
- Collapse all nodecore "core" mods in the /mods listing, so it's
  easier to find the actual add-on mods.
- Parameterize in-game branding to make renaming derivatives just
  a little easier.
2019-09-07 09:08:57 -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
3c5d7e200b "Family" stacking API
If items have a common "stackfamily" property in definition, then
they combine stacks; name and metadata are effectively ignored and
any name is considered acceptable for the combined stack name.

This is used by Lux to allow it to stack naturally instead of the
player having to lay them out spaced on the ground to "cool" them
all to the same level, since all Lux changes dynamically anyway.
2019-08-30 22:36:44 -04:00
Aaron Suen
fe2c153f9e Clean up all lua code style.
Formatting rules based on Paul Kulchenko's perl-based formatter...
http://notebook.kulchenko.com/programming/lua-beautifier-in-55-lines-of-perl
...using a single tab for indent.

Mostly pure whitespace changes.
2019-08-27 19:14:51 -04:00
Aaron Suen
5768317269 Make pickup and rearrange logic consistent again.
The new change preserves uncombined stacks when digging.  For
example, if you have dirt on the far right, tools on the far left,
and space between, and you dig dirt with the tools on the left,
it will create a NEW stack in the space between BEFORE it reaches
the dirt on the far right.

This behavior is necessary to ensure we can keep stacks separate
that we've separated for a specific purpose.

We also can't make the behavior vary based on whether using a tool
or not, because this would be even MORE jarring.
2019-03-29 18:44:01 -04:00
Aaron Suen
dca1e58a85 Yet more inventory/pickup changes.
- Intercept /give commands.
- Provide an API for giving the player an item and inserting it
  into the inventory in the right place(s).
- Change the fill order.  We try to fill the current slot first,
  the continue to the right to the end of the bar, and then
  finally work our way left to the beginning.  I think this fill
  order should be most comfortable, in terms of having items tend
  to fall close to the cursor.
2019-03-28 22:52:48 -04:00
Aaron Suen
854493dcd9 Intercept /give and /giveme commands too. 2019-03-28 09:03:31 -04:00
Aaron Suen
29a2c6cfcd Fix tool wear causing inv rearrange. 2019-03-27 23:57:56 -04:00
Aaron Suen
f3ab916f3b Combine first, to minimize rearrangements. 2019-03-27 22:42:28 -04:00
Aaron Suen
47b4ae9bc6 Promote inventory pickup changes to a first-class feature mod.
Use interception where possible to modify destintion for items
directly instead of relying on post-hoc inventory rearrangement.

This should resolve the glitches where items appear in the wrong
place in inventory for a flash before being moved.
2019-03-27 22:10:45 -04:00