Commit Graph

93 Commits (e98d421aff046a2d9a9b87516779603dc170b209)

Author SHA1 Message Date
MoNTE48 e98d421aff Merge remote-tracking branch 'upstream/stable-0.4' into sync 2019-04-01 20:18:54 +02:00
Loic Blot 8474e543a0 More C++03 fixes 2018-06-03 17:32:00 +02:00
sfan5 8e3a110314 ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2018-06-03 17:31:59 +02:00
Maksim Gamarnik 35770f4abb Merge Minetest 0.4.16 2017-06-06 23:03:34 +03:00
Loic Blot c8fc6d9c0d Fix wrong return value in get_sky Lua call since ad9fcf859ec2347325830e09504ae96968b51ea8
Fix #5803
2017-05-23 19:59:47 +02:00
Loïc Blot 86253bb961 Player attrs: permits to remove an attribute by setting value to nil (#5716)
* Player attrs: permits to remove an attribute by setting value to nil

When doing player:set_attribute("attr", nil) remove attribute

Also remove a useless check on C++ API part (already done by checkplayer)

Fix #5709
2017-05-07 12:13:15 +02:00
paramat ad2e38e257 Set sky API: Add bool for clouds in front of custom skybox
Default true.
Add 'm_clouds_enabled' bool to sky.h, set from new bool in 'set sky' API.
Make 'getCloudsVisible()' depend on 'm_clouds_enabled' instead of
'm_visible' (whether normal sky is visible).
2017-05-02 20:42:35 -07:00
Ben Deutsch 4236cf8e5e Add clouds API 2017-04-30 00:06:13 +01:00
shivajiva101 f290d3c66d Fix visual slide issue with set_detach, fixes #5620 2017-04-29 18:18:46 +02:00
ShadowNinja b41838b8ef Rename Scripting API files for consistency 2017-04-25 13:41:36 -04:00
paramat afe086801d Sneak: Add option for old move code
Temporary option for the old move code for specific old sneak behaviour.
Enabled by setting the added 'new move' physics override to false.
By default 'new move' is true.
2017-04-17 10:13:05 +01:00
Dániel Juhász 88b956fe8e Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.

In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.

Dropped itemstacks with different colors do not merge.
2017-04-08 18:39:15 -07:00
Loïc Blot 3fe2ed00ed Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#5541)
We are bundling Lua5.1 which has same macro
2017-04-08 09:28:37 +02:00
Maksim Gamarnik 71ab3dea19 iOS 1.0.8 and fix luaL_Reg method 2017-04-03 18:32:36 +03:00
red-001 c43ad771f6 Add `get_wielded_item` 2017-03-13 23:56:05 +01:00
Loic Blot 045cc40d91 [CSM] Client side modding
* rename GameScripting to ServerScripting
* Make getBuiltinLuaPath static serverside
* Add on_shutdown callback
* Add on_receiving_chat_message & on_sending_chat_message callbacks
* ScriptApiBase: use IGameDef instead of Server
  This permits to share common attribute between client & server
* Enable mod security in client side modding without conditions
2017-03-13 23:56:05 +01:00
Maksim Gamarnik e05f7db82f Updated to Minetest ver. 0.4.15 2017-01-30 00:44:07 +02:00
Loïc Blot b24578ef70 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).
2017-01-27 08:59:30 +01:00
Loïc Blot 576308cb1d Revert "Detach the player from entities on death." (#5087) 2017-01-21 17:30:55 +01:00
sapier 8df666f56e Add Entity get_texture_mod() to Lua API
Send texture modifier to clients connecting later too
2017-01-21 17:01:02 +01:00
red-001 9f6e715c65 Detach the player from entities on death. (#5077) 2017-01-21 16:11:55 +01:00
sapier 552225ff0e Fix typo in alias for deprecated settexturemod 2017-01-17 19:41:52 +01:00
rubenwardy e8ba0cc76f Rename ObjectRef methods to be consistent and predictable 2017-01-16 15:34:44 +00:00
Rui d773473add Make nametag removable with set_nametag_attributes (#5021) 2017-01-11 20:25:25 +01:00
Rogier 1386ba186e Performance fix + SAO factorization
Original credits goes to @Rogier-5

* Merge common attributes between LuaEntitySAO & PlayerSAO to UnitSAO
* Make some functions const
* Improve some lists performance by returning const ref

Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-11 15:53:56 +01:00
Loic Blot 295d6102c0 Breath cheat fix: server side
Breath is now handled server side. Changing this behaviour required some modifications to core:

* Ignore TOSERVER_BREATH package, marking it as obsolete
* Clients doesn't send the breath to server anymore
* Use PlayerSAO pointer instead of peer_id in Server::SendPlayerBreath to prevent a useless lookup (little perf gain)
* drop a useless static_cast in emergePlayer
2017-01-01 23:11:26 +01:00
Rogier 92620bf458 Fix crash when attached object no longer exists
Active objects that are attached to other objects are not safe
from deletion. As a result, the parent object may have a reference
to an id of a child's that no longer exists.

If at some point an attempt is made to manipulate the child,
enviromment->getActiveObject(child-id) returns NULL. Using the
NULL pointer causes the crash...
2016-11-13 10:10:28 +01:00
Loic Blot 4abc944397 Fix overloading problems mentioned by clang 2016-10-30 16:30:55 +01:00
Ner'zhul 4d9f4685ff PlayerSAO/LocalPlayer refactor: (#4612)
* Create UnitSAO, a common part between PlayerSAO & LuaEntitySAO
* Move breath to PlayerSAO & LocalPlayer
* Migrate m_yaw from (Remote)Player & LuaEntitySAO to UnitSAO
* Migrate m_yaw from Player to LocalPlayer for client
* Move some functions outside of player class to PlayerSAO/RemotePlayer or LocalPlayer depending on which class needs it
* Move pitch to LocalPlayer & PlayerSAO
* Move m_position from Player to LocalPlayer
* Move camera_barely_in_ceiling to LocalPlayer as it's used only there
* use PlayerSAO::m_base_position for Server side positions
* remove a unused variable
* ServerActiveObject::setPos now uses const ref
* use ServerEnv::loadPlayer unconditionnaly as it creates RemotePlayer only if it's not already loaded
* Move hp from Player to LocalPlayer
* Move m_hp from LuaEntitySAO to UnitSAO
* Use m_hp from PlayerSAO/UnitSAO instead of RemotePlayer
2016-10-30 14:53:26 +01:00
Foghrye4 94eeb7ff8a Adding LuaError on attempt to assign vectors with values out of range 2016-10-25 21:10:51 +02:00
Loic Blot d014961e52 Move RemotePlayer code to its own cpp/header 2016-10-08 22:27:44 +02:00
Loic Blot feaeb523d2 RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) (patch 3 of X)
* remove IGameDef from Player class, only LocalPlayer has it now
* move many attributes/functions only used by LocalPlayer from Player to LocalPlayer
* move many attributes/functions only used by RemotePlayer from Player to RemotePlayer
* make some functions const
* hudGetHotbarSelectedImage now returns const ref
* RemotePlayer getHotbarSelectedImage now returns const ref
* various code style fixes
2016-10-08 22:27:44 +02:00
Loic Blot 3558ac7829 More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects
* Use RemotePlayer and LocalPlayer everywhere it's possible
* Minor code style fixes
* Drop Client::getBreath() unused function
2016-10-08 22:27:44 +02:00
Loic Blot d28e980e7c Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)
* Server/Client Environments now have an helper to cast Player object in the right type to use it
* Server: use RemotePlayer everywhere and remove previous added casts
* Client: use LocalPlayer where needed
* Environment: remove unused functions (getPlayers(), getRandomConnectedPlayer(), getNearestConnectedPlayer())
2016-10-08 15:57:50 +02:00
Foghrye4 5f714c5c6f Prevent attached models from disappearing during parent reload (#4128) 2016-10-08 14:51:25 +02:00
Loic Blot aca9ff5961 Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)
* LocalPlayer take ownership of maxHudId as it's the only caller
* RemotePlayer take ownership of day night ratio as it's the only user
* Pass getPlayerControl as const reference to prevent object copy on each call (perf improvement in ObjectRef::l_get_player_control call)
* getPlayerSAO is now only RemotePlayer call
* get/setHotbarItemCount is now RemotePlayer owned
* Server: Use RemotePlayer instead of Player object on concerned call to properly fix the object type
* PlayerSAO now uses RemotePlayer instead of Player because it's only server side
* ObjectRef::getplayer also returns RemotePlayer as it's linked with PlayerSAO
2016-10-08 11:36:28 +02:00
raymoo be9acaf9df Player: New get_look, set_look API
Deprecate get_look / set_look pitch / yaw
2016-06-24 02:13:09 +01:00
Maksim Gamarnik 23614e9479 Merge
I have not tested this
2015-12-28 11:26:50 +02:00
BlockMen 8b2e696093 Add option to give every object a nametag
or change the nametag text of players
2015-12-15 23:32:19 +01:00
Maksim Gamarnik bcf249297c Merge last Minetest commits 2015-11-10 20:29:00 +02:00
Maksim Gamarnik 919be490f9 Update
Sync all Minetest commits
2015-11-10 13:49:24 +02:00
kwolekr 47189162aa SAPI: Mark all Lua API functions requiring envlock 2015-10-25 23:06:48 -04:00
kwolekr 3079eaa37e Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
Maksim Gamarnik 9247f32e0e LGPL 2.1 to 3.0 on all files 2015-08-14 01:26:28 +03:00
kwolekr 925187a32b minimap: Add ability to disable from server 2015-08-13 15:05:48 -04:00
Elia Argentieri 44d030306e Added get_player_velocity() method. Fixes #1176 2015-07-20 05:40:44 +02:00
TeTpaAka 1c520f2f20 Fix invisible player when the attached entity is removed 2015-07-18 07:41:43 +02:00
kwolekr 01027450b0 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
MirceaKitsune ee7dfd7ba0 Fix some issues with animations, and allow non-looped animations to be defined 2015-06-22 01:53:38 +02:00
TeTpaAka 76c89a3f84 Add some missing getter functions to the lua API
ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
2015-05-31 23:21:45 +10:00