Commit Graph

33 Commits

Author SHA1 Message Date
Desour f1a228902a
Add sounds for falling and attached nodes (#7719)
* Add sounds for falling and attached nodes

The sound specified in `node_definition.sounds.fall` is used.
When a falling node is spawned at a position or an attached node drops, the sound is played at this position.

* allow all sorts of soundspecs
2022-05-21 16:16:54 +02:00
SmallJoker c08b05bb36
Builtin: Replace deprecated function calls (#7561) 2022-05-21 16:16:09 +02:00
SmallJoker 1c0eb83cc3
core.spawn_falling_node: Keep metadata (#7476) 2022-05-21 16:16:08 +02:00
HybridDog 04a81cf4ab
ObjectRef: Add add_velocity() (#3208)
Allow changing the velocity of objects relatively to their current velocity
2022-05-21 16:15:54 +02:00
paramat 068f060a45
Falling.lua: Delete falling node entities on contact with 'ignore'
Prevents falling node entities entering the ignore at a world edge and
resting on unloaded nodes 16 nodes below, unreachable, undiggable and
still being processed by 'on step' because they don't revert to nodes.
2022-05-21 16:15:47 +02:00
ashtrayoz 24263ccbb0
Add callback to preserve node metadata as item metadata 2022-05-21 16:15:37 +02:00
Auke Kok e5db1211dd
Sounds: Add falling node sounds
Falling nodes should make a sound. This can only be done here,
so for simplicity we just call the sound_play() here with the node
place sound. We ignore any gain value in the sound spec since a
falling node should be loud, so the 1.0 default gain makes sense
here.
2022-05-21 16:15:31 +02:00
Rui 39b6fb48a6
Remove nodeupdate and nodeupdate_single 2022-05-21 16:15:15 +02:00
Dániel Juhász e4a6867f2c
Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2022-05-21 16:14:56 +02:00
Vladislav Tsendrovskii 49602a4a4f
Save metainfo for falling nodes 2022-05-21 16:14:25 +02:00
zaoqi ebe297520a
Add minetest.spawn_falling_node(pos) (#5339)
* Add minetest.spawn_falling_node(pos)

* lua_api.txt: Add minetest.spawn_falling_node(pos)

* Update minetest.spawn_falling_node(pos)
2022-05-21 16:14:23 +02:00
Dániel Juhász 3a111fa7d6
Fixes for colorwallmounted and colorfacedir nodes
Correct node placement prediction for attached colorwallmounted nodes.
Correct placement direction for colorfacedir and colorwallmounted nodes.
Correct detatch mechanism for attached colorwallmounted nodes.
2022-05-21 16:14:22 +02:00
sfan5 6ecb28d409
builtin/.../falling.lua: Avoid crash when hitting unknown nodes 2022-05-21 16:14:11 +02:00
paramat e7f217fb2e
Builtin/../falling.lua: Avoid crash when object pos over limit
If the object pos is over limit, 'add entity' will not add an entity,
causing 'obj' to be nil.
2022-05-21 16:14:08 +02:00
est31 8fd57dc4bb
Introduce builtin_shared and use it to fix #4778
Fixes #4778 which was about the error:

ServerError: Lua: Runtime error from mod '' in callback item_OnPlace():
/usr/local/share/minetest/builtin/game/item.lua:278: attempt to call global 'check_attached_node' (a nil value)

The issue was a regression of commit 649448a2a91fbf3e944b2f2e739f4e2292af1df0

"Rename nodeupdate and nodeupdate_single and make them part of the official API"
2022-05-21 16:14:02 +02:00
est31 b47663d742
Rename nodeupdate and nodeupdate_single and make them part of the official API
Now, the renamed forms of nodeupdate and nodeupdate_single are part of the official API.

As nodeupdate has been used by Minetest Game and in mods despite of not
being part of the official API, we ease the transition by still supporting
it for the 0.4.15 release. After the release, the two functions can be removed.

The removal will not violate the stability promise, as that promise only
includes the official and documented API.

Also, make some formerly global functions local. They most likely haven't
been used by mods, therefore they won't get stubs with deprecation warnings,
hard erroring directly.
2022-05-21 16:14:00 +02:00
paramat f3720d5ee4
Builtin/../falling: Fix bugs caused by 'ignore' nodes
Original commit by t4im, rebased and developed by paramat.
Fix CONTENT_IGNORE being replaced by falling nodes or causing large
areas of sand to collapse into itself.
Format some conditional code for clarity.
Add and clarify some comments.
2022-05-21 16:14:00 +02:00
tenplus1 6dae557ad8
Builtin/../falling.lua: Code optimisation 2022-05-21 16:13:55 +02:00
paramat cadfd09355
Builtin/falling: Add fallback vector in case of nil 'wallmounted to dir'
The fallback vector is in case 'wallmounted to dir' is nil due
to voxelmanip placing a wallmounted node without resetting a
pre-existing param2 value that is out-of-range for wallmounted.
The fallback vector corresponds to param2 = 0.
2022-05-21 16:13:53 +02:00
Wayward One 306a8d1311
Add on_punchnode callback 2022-05-21 16:13:39 +02:00
Auke Kok ea243adba1
falling: walk 4 additional diagonally down directions.
This seems very little cost and matches the old behavior more
closely. This will cause some more falling nodes to get added
to falling clusters. With the efficiency of the algorithm, this
really doesn't do much damage.
2022-05-21 16:13:32 +02:00
Auke Kok a3d0df7466
Convert nodeupdate to non-recursive
This took me a while to figure out. We no longer visit all 9 block
around and with the touched node, but instead visit adjacent plus
self. We then walk -non- recursively through all neigbors and if
they cause a nodeupdate, we just keep walking until it ends. On
the way back we prune the tail.

I've tested this with 8000+ sand nodes. Video result is here:

  https://youtu.be/liKKgLefhFQ

Took ~ 10 seconds to process and return to normal.
2022-05-21 16:13:31 +02:00
tenplus1 b6b49f9cc9
stop falling.lua error
2016-03-27 15:47:01: ERROR[Main]: ServerError: Lua: Runtime error from mod '*builtin*' in callback luaentity_Step(): Node name is not set or is not a string!
2016-03-27 15:47:01: ERROR[Main]: stack traceback:
2016-03-27 15:47:01: ERROR[Main]: 	[C]: in function 'add_node'
2016-03-27 15:47:01: ERROR[Main]: 	/usr/share/minetest/builtin/game/falling.lua:96: in function </usr/share/minetest/builtin/game/falling.lua:43>
2022-05-21 16:13:29 +02:00
Rui 215e71efad
Falling: Set acceleration on step again
Commit

65c09a96f41705bb8e75fc5ff4276342be91ed11 "Set acceleration only once in falling node"

has made the acceleration being set only once.
But this has introduced a regression.

Fix #3884.
2022-05-21 16:13:28 +02:00
paramat b12c539595
Builtin/game/falling: Re-add comma removed by recent commit 2022-05-21 16:13:27 +02:00
Rui914 8760d15445
Set acceleration only once in falling node 2022-05-21 16:13:27 +02:00
Rui 4c9302c8a2
Minor tweaks __builtin:falling_node 2022-05-21 16:12:49 +02:00
Craig Davison 8ed639715a
Fix some undeclared global variables 2022-05-21 16:12:06 +02:00
SmallJoker 6fb306753d
Use round if falling node is misplaced
Fixes: http://i.imgur.com/arAWw1i.png (middle-right)
2022-05-21 16:11:58 +02:00
Casimir adeb452c4a
Remove buildable_to nodes without dropping item when replaced by a falling node 2022-05-21 16:11:56 +02:00
sfan5 29bc03cf5c
Allow custom liquids to have drops 2022-05-21 16:11:46 +02:00
ShadowNinja 37c32c715f
Use "core" namespace internally 2022-05-21 16:11:41 +02:00
ShadowNinja 148b74312e
Organize builtin into subdirectories 2022-05-21 16:11:40 +02:00