42 Commits

Author SHA1 Message Date
Aaron Suen
66ddeeb2d3 Fix players being hurt by own thrown items 2021-12-13 21:54:13 -05:00
Aaron Suen
0d3601b831 Items/nodes no longer bounce off players
Be consistent with the principle that the mere
presence of a player does not affect the behavior
of objects in the world.  Items should "fall
through" players instead of bouncing off them,
i.e. being deflected.
2021-08-06 21:11:42 -04:00
Aaron Suen
c10e80ef87 Set name in mod.conf as demanded by 5.5+ 2021-03-01 20:10:27 -05:00
Aaron Suen
baed978f6e Cap nodefall disturbance distance
Teleportation should cause some disturbance, maybe
plausibly even extra disturbance, but it shouldn't be
unlimited.
2020-06-24 00:53:38 -04:00
Aaron Suen
5648331c9f Replace all perplayer with playerstep 2020-06-22 22:47:33 -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
9c9eb4b85a Guard against dummy objects in 5.3+
Some time in the 5.3 dev stream (docs updated at
217f3a42), object refs started being invalidated
immediately on calling obj:remove(), such that
obj:get_pos() starts to return nil instead of the object's
last known position.

This can cause some crashes in NodeCore, where we
assume that our object is still valid (or usable as if it
were still valid) even though we're looping through
handlers and any one of them may have remove()d the
object before other handlers get a chance to fire.

Instead, just watch for unexpected nil returns from
functions we expect would never return nil (e.g.
get_pos or get_properties) and return if we hit one.
We can assume all other calls will be non-nil after that
one, as long as we stay in the same function flow.
2020-05-18 18:36:06 -04:00
Aaron Suen
5a19628586 Odd crash on nil vel in nodefall damage. 2020-03-22 00:09:24 -04:00
Aaron Suen
756b12b7d4 Better record damage/heal types for stats. 2020-02-20 07:16:19 -05:00
Aaron Suen
d0e6dcc410 Add "stasis" option and command.
This freezes many things that normally happen automatically
in the world, including most ABMs and AISMs, and a few other
custom step logic items like the player "hot potato" logic.

This can be used for "creative mode" purposes to setup a complex
build without it running itself away from you, and for texture
pack authors, to have time to see things that are normally
transient or difficult to observe because of the effects they have
on nearby things or players.
2020-01-10 06:26:07 -05: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
89020e8340 Major rebuild of item_entity.
This created a ton of dependency inversions, which
necessitated moving a number of API functions up into
higher layers, and restructuring dependency lists for
a number of mods.

BOLO: non-deterministic load errors due to missed
dependencies.
2020-01-05 11:42:22 -05:00
Aaron Suen
b1fab67491 Start work on unifying/simplifying builtins.
falling_node rebuilt from scratch so far.
2020-01-04 10:51:10 -05:00
Aaron Suen
8add276587 Make falling things bounce off players.
If the falling item/node causes enough damage to
trigger a "hurt" effect, then it loses much of its energy
and bounces upward off the player.

This will also reduce the "scraping" effect when nodes
fall through a player.  Hopefully the damage from
falling things is a little more consistent now.
2019-12-29 12:12:08 -05:00
Aaron Suen
b7efac4a7f Note updates from discord. 2019-12-15 08:28:34 -05:00
Aaron Suen
b9e2f822f8 New flexible find_nodes_around api. 2019-11-30 10:28:35 -05:00
Aaron Suen
a12d44c4f8 Tighten up interact checks. 2019-11-28 08:55:09 -05:00
Aaron Suen
829e8aed81 Fix some things affected by spectators. 2019-11-25 21:46:29 -05:00
Aaron Suen
ac4ae381a6 Fix nodefall-disturb group falling.
Wrong falling check.  We don't need to check for repose
because that's already handled by an ABM.  Instead use the
standard check_for_falling that's recursive.
2019-11-23 09:27:06 -05:00
Aaron Suen
feb9c5016d Nerf door op rate, falling node operation.
Also:
- Persist door squelch data.
- Work around crush damage logic issue...?
- Try to reduce unnecessary network packets?
2019-10-11 01:14:00 -04:00
Aaron Suen
c147da4dde Convert from depends.txt to mod.conf 2019-10-05 11:24:16 -04:00
Aaron Suen
6536276430 Non-loose nodes inherit crush damage from loose alternatives. 2019-09-21 08:38:16 -04:00
Aaron Suen
77cc5d603e Thrown items also cause crush damage while falling.
- Make some adjustments to player entity location finding.
- Genericize crush damage logic to apply to item entities too.
- Item ents cause only 20% crushing damage.
2019-09-13 22:26:47 -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
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
50c4d2d094 Fix bad log formatting. 2019-04-07 18:44:35 -04:00
Aaron Suen
a674184df0 Fix deprecated getpos -> get_pos. 2019-04-06 20:34:13 -04:00
Aaron Suen
d8acafe9cc Switch from line_of_sight to raycast. 2019-04-06 20:31:12 -04:00
Aaron Suen
c43eaa10ec Fix bug that broke falling node hazards. 2019-04-06 20:20:04 -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
3a299e712f Some minor API cleanup (celebrating 5.0 release). 2019-03-04 19:33:55 -05:00
Aaron Suen
98b235511c Standardize use of include function. 2019-03-02 20:39:08 -05:00
Aaron Suen
393210db69 Start proper spectator support.
Make sure that non-built-in content respects the interact priv
and prevents spectator players from doing nasty stuff.
2019-02-24 21:54:33 -05:00
Aaron Suen
35d814fb43 Fix suspected infinite loop in nodefall. 2019-02-09 23:35:16 -05:00
Aaron Suen
33cbce23e5 Merge branch 'master' into refac1 2019-02-04 20:16:54 -05:00
Aaron Suen
d67f736ac5 Merge node_is into match. 2019-02-03 12:44:33 -05:00
Aaron Suen
3a377af1fd Guard against failed def lookup. 2019-02-03 09:11:36 -05:00
Aaron Suen
2d3b468c65 Knock out a bunch of small low-hanging issues.
- Eggcorn cleanup.  They look a little better falling out of the
  tree, and we don't have so many now.
- Crushing damage fixes.  Crushing is nuanced now, and most things
  don't smush you, and many do reduced damage.  A few may do more.
- Item stack convenience.  Items landing on a stack or right-
  clicked onto one attempt to merge into it.
- Ladders now fall (they don't connect to sides).  Use the new
  full-scale frames for ones that don't.
2019-01-29 20:41:29 -05:00
Aaron Suen
8a7dbfe255 Remove debug code. 2019-01-26 16:18:21 -05:00
Aaron Suen
8b8c20ec03 Add falling node hazards.
- Nodes that are falling do damage to those near to them from
  crushing and/or friction.
- Player activity can cause falling nodes left in precarious
  positions by mapgen to fall randomly.
2019-01-26 13:58:35 -05:00