22 Commits

Author SHA1 Message Date
Aaron Suen
caac2968dc Inventory dump on built-in teleport cmd
Allow the built-in teleport command to be used
with standard NodeCore rules, i.e. players
can move freely, but items cannot.  Players
travelling by use of this command need a
special priv to keep inventory.
2020-07-05 10:13:26 -04:00
Aaron Suen
4ce7076708 Standardize and log players losing items
Item ejection due to injury or teleportation:
- Check for custom on_drop calls from items, e.g. admin tools
  that distintegrate instead of becoming items.
- Log players losing items so we can audit where things came from
  or went to.
- Make teleportation and injury APIs use the same methods.
2020-07-01 07:21:10 -04:00
Aaron Suen
70c5dcf191 Efficient rebuild of item entity merge
- O(n) efficiency walk of item entities
- Honor stack family merging, e.g. differing lux levels combine

Since the new walk should be much more efficient, the need to
handle "extremal" cases specially, e.g. creation of a multi-stack
ent, is probably unnecessary.  Remove it from the task list,
barring any future evidence that it's still relevant.
2020-06-25 07:50:34 -04:00
Aaron Suen
7e5f70da9b Move visinv efficiency reforms
- Push early activation externally.
- Fix bug with ents fooling visinv checker into
  thinking pos is handled even when marked
  for removal
- Eliminate a redundant stack_get call
2020-06-21 09:38:54 -04:00
Aaron Suen
500ef347e1 Fully passivize visinvs
Now use an LBM to load ents, and skip the
ABM entirely.  I think we've finally found all
the "leakage" points.
2020-06-21 03:52:09 -04:00
Aaron Suen
70efb016af Add auditing for player stack movement 2020-06-18 07:20:15 -04:00
Aaron Suen
4a784aeb8f Trigger visinv checks more smoothly
- Check item on same tick as creation.
- Stagger rechecks across ticks.
2020-05-31 10:36:11 -04:00
Aaron Suen
b21b7c2da2 Fix pathological visinv scalabilty
Defer and coalesce visinv entity creation/removal
checks until the next tick, so we can process them more
efficiently in a batch.

The spawn area of the Community MP server was
lagging to something like 6x the dedicated step size,
due to the huge number of dropped items.  This code,
on the same machine, seems to appear the same to the
player, but produces almost no measurable lag.
2020-05-30 22:33:13 -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
80a2f8277c Be even more conservative about using stackfamily merge logic. 2019-08-31 08:02:06 -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
c1828219e6 Refactor social sounds subsystem.
Standardize the "play a sound for everybody except the player who
is already playing it client-locally" logic into one place.

Fix failure to correctly detect tool speeds for some things, i.e.
when the player is using a tool but the capability used on a node
is actually inherited from the hand.

Note that this may allow pummeling with wrong tools (e.g. repacking
soils with spades) along with accompanying inappropriate tool wear,
but this should be minor and avoidable, and can be fixed later...
2019-04-06 23:51:05 -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
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
Aaron Suen
5de0cc54ec Add stony sounds, and sounds for stacks/shelves. 2019-03-14 00:31:09 -04:00
Aaron Suen
9607bcc6a6 Start working on sounds, plus minor refinements.
- Clean up registered_* usage patterns.
- Reduce tendancy of leaves to create stack nodes.
  Now they tend to stack up properly in-world more often.
- Tweak damage system to create "headroom" where minor
  damage doesn't cost inv slots immediately.
- Make player hand skin color match model skin.
- Cleanup/unify grass abm logic.
- Start installing new sounds by MagikEh

Sound source:
  https://github.com/MagikEh/SoundsOfWarr
2019-03-13 23:51:59 -04:00
Aaron Suen
efa9007793 Change how visinv items handle rotation.
Rotation is now fixed, non-moving, and deterministic.  This fits
in better with the rest of the visuals in the game being
stationary when in steady-state, i.e. only things actually changing
are actually moving.

Instead of rotation speed indicating a full stack, rotation angle
now does; non-full stacks will always be off significantly from
orthogonal, while full ones will be perfectly square.
2019-03-08 19:11:05 -05:00
Aaron Suen
ab2132a035 Fix shelf not accepting ANY items. 2019-03-02 22:53:28 -05:00
Aaron Suen
5a83a15b48 Definitively block placing shelves/totes inside shelves. 2019-03-02 21:41:25 -05:00
Aaron Suen
58cd080fdf Apply big stack refactor. 2019-02-23 10:21:27 -05:00
Aaron Suen
f893f613c3 API refinements.
- Make node match operate on only one of node or stack, depending
  on whether node defers to stack via is_stack_only.  This should
  hopefully prevent future pummel recipe issues.
- Add new core stack API.  Needs to be deployed in a lot of places.
- Start work on system for allowing flammable containers; they
  eject their potentially non-flammable contents.
2019-02-23 09:44:22 -05:00