933 Commits

Author SHA1 Message Date
DS
fc1e5e14e1 Add vector.offset (#10321) 2021-11-16 00:27:41 +03:00
NetherEran
22440a5db5 Some vector functions useful for working with rotations (#9572)
* added vector.rotate

* added vector.forward_from_rotation and vector.up_from_rotation

* added vector.forward_up_to_rotatiton

* fixed some bugs and formatting with vector functions

* shortened name of some new vector functions and added documentation

* made vector.rotate not require a unit vector as axis

* fixed crash with vector.forward_up_to_rot

* renamed new vector functions, made vector.rotate apply a rotation matrix, old vector.rotate is now called vector.rotate_around_axis

* documented vector function changes

* removed some whitespace to appease luacheck

* implemented and fixed optimization of vector.rotate_around_axis by SmallJoker

* added some unit tests for rotation vector functions

* clarified that rotation vectors are in radians and according to the left hand rule

* hopefully appeased luacheck

* renamed rotation_to_horizontal to forward_at_rotation, rotation_to_vertical to up_at_rotation

* handled cases where sin or cos are 0 in rotation vector functions

* added more comments

* clarified documentation of rotation vector functions

* added more unit tests

* changed way in which vector.rotate_around_axis is adjusted for left handed coordinate systems

* made vector.rotate_around_axis actually left handed

* unrolled matrix multiplication

* removed vector.forward_at_rotation and vector.up_at_rotation

* prettified vector.rotate_around_axis, made previous commits not break anything

* removed references to removed vector.forward_at_rotation and vector.up_at_rotation

* removed documentation of removed vector functions

* clarified documentation and fixed styling of rotation vector functions

* restyled comments minorly

* spelling fixes and some hopefully better comments

* allowed 'up' to be missing from vector.directions_to_rotation and removed requirement for unit vectors as arguments

* made vector.rotate_around_axis() right handed again for consistency

* documented previous changes

* made matrix multiplication actually multiply

* renamed vector.directions_to_rotation() to vector.dir_to_rotation()

* optimized a distance comparison

* Fixed potential false positive in unit tests.

Co-authored-by: NetherEran <nethereran@hotmail.com>
2021-11-16 00:27:39 +03:00
HybridDog
788ff081cc Add vector.dot and vector.cross
Mostly copied from MarkuBu's code
2021-11-16 00:27:06 +03:00
ANAND
0dd672c4b3 Builtin: Add vector.angle(). Returns the angle between 2 vectors (#7738) 2021-11-16 00:27:04 +03:00
Paramat
5cb75c5b7d Vector functions: Fix vector.direction() function, improve documentation (#6801)
vector.direction() now returns a normalised vector with direction p1 to p2.
2021-11-16 00:26:28 +03:00
Auke Kok
a2e2d40745 Vector: Add vector.sort(a, b): return box edges
This function returns the box corners of the smallest box
that includes the two given coordinates.
2021-11-16 00:26:28 +03:00
paramat
47322de803 Gennotify: Add 'minetest.get_decoration_id' API
Returns the decoration ID for the provided decoration name string.
For use with gennotify, to know the decoration IDs for use in
'minetest.set_gen_notify'.
2021-11-14 18:45:26 +03:00
Loïc Blot
a4cac3613a Implement player attribute backend (#4155)
* This backend permit mods to store extra players attributes to a common interface.
* Add the obj:set_attribute(attr, value) Lua call
* Add the obj:get_attribute(attr) Lua call

Examples:
* player:set_attribute("home:home", "10,25,-78")
* player:get_attribute("default:mana")

Attributes are saved as a json in the player file in extended_attributes
key

They are saved only if a modification on the attributes occurs and loaded
when emergePlayer is called (they are attached to PlayerSAO).

 Author:    Loïc Blot <nerzhul@users.noreply.github.com>
 Date:      Fri Jan 27 08:59:30 2017 +0100
 You are currently cherry-picking commit b7a98e985.
2021-11-14 04:58:45 +03:00
rubenwardy
e21edd121f Rename ObjectRef methods to be consistent and predictable
Author:    rubenwardy <rubenwardy@gmail.com>
 Date:      Mon Jan 16 13:08:59 2017 +0000
 You are currently cherry-picking commit 63c892eed.
2021-11-14 03:27:38 +03:00
ShadowNinja
44c489d7bd Use a settings object for the main settings
This unifies the settings APIs.

This also unifies the sync and async registration APIs, since the async
registration API did not support adding non-functions to the API table.

 Author:    ShadowNinja <shadowninja@minetest.net>
 Date:      Fri Dec 12 14:49:19 2014 -0500
 You are currently cherry-picking commit 43d1f375d.
2021-11-14 03:15:12 +03:00
proller
1efdd353aa Merge remote-tracking branch 'minetest/master' 2016-12-28 02:43:20 +03:00
sfan5
b16252dcae Various anticheat improvements
* Calculate maximum interact distance from wielded tool
* New "interacted_while_dead" cheat_type for the Lua API
* Disallow dropping items while dead
* Move player to spawn before resurrecting them
2016-12-26 22:34:29 +01:00
proller
4d4ffa4c1f Merge remote-tracking branch 'minetest/master' 2016-12-23 15:20:26 +03:00
sfan5
231ac33d34 Bump version to 0.4.15 2016-12-22 23:14:17 +01:00
proller
668681f6aa Merge remote-tracking branch 'minetest/master' 2016-12-07 21:52:22 +03:00
Auke Kok
2e69711613 Simple deco: Allow setting param2 value on placement
Schematics can already be placed with a param2 value, but not
simple 1-node plant decorations of the simple type.

This adds a `param2` field to the simple deco type that is
checked to be between 0 and 255, and put to the placed node
at mapgen.

This can be used to put a degrotate value in, or e.g. a fill
value for leveltype nodes, or a place_param2 value at mapgen
placement, or vary the shape of meshoptions plantlike drawtype.
2016-12-07 04:17:17 +00:00
proller
a5f670a8d5 Merge remote-tracking branch 'minetest/master' 2016-12-02 19:31:57 +03:00
Amaz
8b63fbefba Fix incorrect docs about minetest.hud_replace_builtin (#4833)
Fixes https://github.com/minetest/minetest/issues/4832
2016-12-02 11:41:08 +01:00
Bluebird
144da5f522 Very small documentation fix. (#4830) 2016-12-02 20:20:55 +10:00
proller
ac541b01dc Merge remote-tracking branch 'minetest/master' 2016-12-01 19:02:20 +03:00
paramat
105676b952 Lua_api.txt: Clarify use of looping sounds 2016-12-01 05:09:01 +00:00
proller
3fa0057ac3 Merge commit 'c389858' 2016-11-30 17:47:24 +03:00
proller
2aa520c2a1 Merge commit '785a9a6' 2016-11-30 17:44:18 +03:00
proller
4c7a8e2f32 Merge commit '0d1c959' 2016-11-30 17:43:52 +03:00
sfan5
c38985825f Allow restricting detached inventories to one player
This combats the problem of sending the hundreds of
"creative" / "armor" or whatever detached invs that
exist on popular servers to each and every player
on join or on change of said invs.
2016-11-28 13:41:19 +01:00
TeTpaAka
785a9a6c1a Wieldhand: Allow overriding the hand 2016-11-26 03:49:30 +00:00
orwell96
0d1c9598a0 Make supplying empty formspec strings close the formspec (#4737)
This will only happen if the formname matches or if formname is "".
2016-11-23 02:15:22 +10:00
proller
f9ab0977b1 Merge remote-tracking branch 'minetest/master' 2016-11-18 19:13:50 +03:00
orwell96
681d127ff1 Particles: Make attached particle spawners respect the parent's yaw
Position, velocity and acceleration vectors of particles are rotated
by the yaw of the parent object so that they are truly relative to it.
Clarify new attached particle spawner behavior in lua_api.txt.
2016-11-18 06:18:54 +00:00
Auke Kok
4a0a6723af Builtin/../item: Enable tool breaking sounds
If a tool wears out and is destroyed, it's itemstack count
goes to 0, and we can optionally play a breaking sound.

This patch implements playing a breaking sound when this
occurs. Sounds need to be added to the tool itemdef
registration as the sound name string in the .sound.breaks
member.
2016-11-18 06:15:08 +00:00
proller
348b7b0cf8 Merge remote-tracking branch 'minetest/master' 2016-11-17 15:44:46 +03:00
Wuzzy
8e61c1dfd9 Lua_api.txt: Naming convention for custom item/entity fields
Custom (non-engine) field names of items and entities are allowed.
This is now documented in lua_api.txt. Field names beginning with
an underscore are now reserved for mod use, the engine must not
introduce any fields beginning with an underscore.
2016-11-15 23:08:34 +00:00
sfan5
5fd1ef9b58 Revert "Adding particle blend, glow and animation (#4705)"
This reverts commit 93e3555eae2deaeca69ee252cfa9cc9c3e0e49ef.
2016-11-14 15:28:06 +01:00
Foghrye4
93e3555eae Adding particle blend, glow and animation (#4705) 2016-11-15 00:09:59 +10: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
proller
d60020992e Merge commit '67ec2fa' 2016-11-14 00:43:22 +03:00
paramat
67ec2fa92d Nodeupdate: Remove documentation in lua_api.txt
In preparation for nodeupdate being renamed and made official API
in future.
2016-11-12 06:45:09 +00:00
proller
851d781c15 Merge commit 'bf315c0' 2016-11-05 01:10:51 +03:00
proller
c402a405f4 Merge commit '7607b0a' 2016-11-05 01:09:36 +03:00
proller
ab7ee0a362 Merge commit '70e2df4' 2016-11-05 01:07:54 +03:00
proller
a004251ed1 Merge commit '1fd9a07' 2016-11-04 13:53:27 +03:00
Brandon
bf315c05f1 Add minetest.get_server_uptime() function to Lua API (#4702)
Add minetest.get_server_uptime() function to Lua API
2016-11-02 09:36:58 -07:00
ShadowNinja
7607b0ac20 Add version API 2016-10-31 21:53:00 -07:00
paramat
70e2df4f86 Lua voxelmanip: Add optional buffer param for 'get param2 data'
Update lua_api.txt.
2016-10-31 10:59:38 +00:00
raymoo
1fd9a07497 Document item use callbacks (#4668) 2016-10-27 13:24:34 +10:00
proller
ab52d86d0b Merge remote-tracking branch 'minetest/master' 2016-10-21 13:23:00 +03:00
paramat
74eb7f50c9 Lua_api.txt: Clarify 'override_meta' bool in 'set mapgen setting' 2016-10-21 05:49:06 +01:00
proller
5757ccc4e5 Merge remote-tracking branch 'minetest/master' 2016-10-18 12:16:24 +03:00
rubenwardy
0d740c5d82 Builtin: Add vector.floor helper function 2016-10-17 22:03:49 +02:00
proller
ab2b46b674 Merge remote-tracking branch 'minetest/master' 2016-10-16 23:25:41 +03:00