Commit Graph

54 Commits

Author SHA1 Message Date
Wuzzy
1d04903c19
Add paramtype2s for 4 horizontal rotations and 64 colors (#11431)
4dir is like facedir, but only for 4 horizontal directions: NESW. It is identical in behavior to facedir otherwise. The reason why game makers would want to use this over facedir is 1) simplicity and 2) you get 6 free bits.
It can be used for things like chests and furnaces and you don't need or want them to "flip them on the side" (like you could with facedir).

color4dir is like colorfacedir, but you get 64 colors instead of only 8.
2022-09-16 13:18:55 +02:00
Gregor Parzefall
70b71c5013
Fix rotation of falling facedir nodes (#12587)
in some cases
2022-07-31 15:18:29 +02:00
Lars Müller
b204655081
Fix regression & replace more occurrences of vector.new with vector.copy (#12539) 2022-07-14 20:51:42 +02:00
Wuzzy
ff9945dc6e
Fix falling mesh nodes being half size (#11389) 2021-09-01 22:20:57 +02:00
Wuzzy
f4d8cc0f0b
Add wallmounted support for plantlike and plantlike_rooted nodes (#11379) 2021-07-15 21:19:59 +02:00
benrob0329
fbcf0fab8e
falling.lua - Fix Meshnodes Being Too Big (#11307) 2021-06-12 18:48:14 +02:00
DS
8f085e02a1
Add metatables to lua vectors (#11039)
Add backwards-compatible metatable functions for vectors.
2021-06-04 21:22:33 +02:00
Wuzzy
228f1c6770
Fix rotation for falling mesh degrotate nodes (#11159) 2021-04-28 08:38:47 +02:00
Wuzzy
90a7bd6a0a
Put torch/signlike node on floor if no paramtype2 (#11074) 2021-04-20 19:50:03 +02:00
benrob0329
a106bfd456
Also return the ObjectRef from minetest.spawn_falling_node() (#11184) 2021-04-13 20:02:43 +02:00
Wuzzy
535557cc2e
Fix fallnode rotation of wallmounted nodebox/mesh (#10643) 2020-12-22 14:54:27 +01:00
sfan5
ecd4f45318 Fix certain connected nodeboxes crashing when falling
fixes #10695
2020-12-04 11:28:45 +01:00
Wuzzy
ee1853e9bc
Fix falling image of torchlike if paramtype2="none" (#10612) 2020-11-15 17:37:09 +01:00
SmallJoker
aba8c37531 Falling: Fix error caused by missing param2
Falling nodes that were spawned prior the recent falling node changes did not require param2.
Default to param2 = 0 when none is found in the node data.
2020-07-30 19:03:48 +02:00
sfan5
03dae5fba6 Fix falling entity not falling through players 2020-05-27 21:58:20 +02:00
Wuzzy
c94d37827d
Rework functionality of leveled nodes (#9852)
Co-authored-by: sfan5 <sfan5@live.de>
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2020-05-19 21:08:37 +02:00
sfan5
e8e5d282da Enable collide_with_objects for falling entities
falling nodes intentionally still fall through players
fixes #5313
2020-05-06 14:03:52 +02:00
sfan5
723926a995 Rewrite falling entity to make use of collision info
fixes #4781, fixes #9293
2020-05-06 14:03:52 +02:00
Wuzzy
d507047443
Falling nodes: Add support for facedir, colorfacedir, wallmounted, colorwallmounted, color, airlike, signlike, torchlike and glow (#9205) 2020-02-22 01:10:17 +00:00
sfan5
7d29611c1b Convert sound_play uses in builtin to ephemeral 2020-02-01 20:31:41 +01:00
Warr1024
ad96df191b Merge pull request #8166 from Warr1024/fix7020
Fix (or workaround?) for 'Falling nodes with node inventory cause crash when unloaded'
2019-10-05 15:46:57 +02:00
DS
60ab2d94f0 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
2019-03-05 08:17:48 +01:00
SmallJoker
ade7a1cbcf
Builtin: Replace deprecated function calls (#7561) 2018-07-17 20:17:54 +02:00
SmallJoker
0cf36454d6 core.spawn_falling_node: Keep metadata (#7476) 2018-07-09 23:33:21 +02:00
you
93eb0794d6 ObjectRef: Add add_velocity() (#3208)
Allow changing the velocity of objects relatively to their current velocity
2018-03-31 14:50:17 +02:00
paramat
737f0b4473 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.
2018-02-13 03:48:28 +00:00
ashtrayoz
abd8a30c05 Add callback to preserve node metadata as item metadata 2017-12-14 20:54:04 +00:00
Auke Kok
41bc0efe71 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.
2017-11-14 00:37:31 +00:00
Rui
b8f06ad37e Remove nodeupdate and nodeupdate_single 2017-08-30 19:39:10 +01:00
Dániel Juhász
0fcaf9fb1b 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
2017-06-20 11:19:56 +02:00
Vladislav Tsendrovskii
7a4878cd0b Save metainfo for falling nodes 2017-03-11 23:42:19 -08:00
zaoqi
c9ac722ea9 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)
2017-03-04 18:36:37 +01:00
Dániel Juhász
00123ee04d 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.
2017-02-18 22:47:24 +00:00
sfan5
73fdb63597 builtin/.../falling.lua: Avoid crash when hitting unknown nodes 2017-01-09 16:39:40 +01:00
paramat
5e4d6468a3 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.
2016-12-21 13:30:10 +00:00
est31
afc48c802a 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"
2016-11-16 18:51:36 +01:00
est31
649448a2a9 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.
2016-11-14 13:08:22 +01:00
paramat
3c5da70d7c 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.
2016-11-07 21:55:17 +00:00
tenplus1
a468acce2c Builtin/../falling.lua: Code optimisation 2016-10-14 02:12:32 +01:00
paramat
89dbc0a25d 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.
2016-10-03 01:56:08 +01:00
Wayward One
8b940c005f Add on_punchnode callback 2016-05-17 22:16:21 +10:00
Auke Kok
855a305057 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.
2016-04-20 06:51:11 +01:00
Auke Kok
d7908ee494 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.
2016-04-11 00:01:28 -04:00
tenplus1
e72b8f25ee 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>
2016-03-29 23:56:23 +02:00
Rui
c3f6cdcd54 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.
2016-03-25 15:19:39 +01:00
paramat
2ce02c99b4 Builtin/game/falling: Re-add comma removed by recent commit 2016-03-19 18:46:08 +00:00
Rui914
65c09a96f4 Set acceleration only once in falling node 2016-03-19 17:56:46 +00:00
Rui
4124e360cb Minor tweaks __builtin:falling_node 2015-09-01 19:14:08 +02:00
Craig Davison
dbae8a8854 Fix some undeclared global variables 2014-11-26 22:50:08 +10:00
SmallJoker
db5aff832b Use round if falling node is misplaced
Fixes: http://i.imgur.com/arAWw1i.png (middle-right)
2014-09-28 13:33:39 +02:00