Commit Graph

58 Commits (f1b3f9d92945fc4fb71f451ec260d7354a5f9fc9)

Author SHA1 Message Date
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
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
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
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 4573eef202 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-28 16:46:35 +02:00
kwolekr 5292177986 SAPI: Accept either ARGB8 table or ColorString to specify colors 2015-05-16 20:15:03 -04:00
TeTpaAka 766d3b3a57 Add push_ARGB8 to script/common/c_converter 2015-05-15 16:21:56 -04:00
TeTpaAka 676750bd57 Generalize core.get/set_nametag_color into core.get/set_nametag_attributes 2015-05-15 16:21:01 -04:00
TeTpaAka 888e2f9b45 Add get and set functions for the nametag color 2015-05-15 11:03:27 +02:00
est31 de86d6dabf is_player() is no player-only function 2015-05-12 05:52:49 +02:00
Loic Blot 455863a38f Revert "Add a Lua call to do damages / heals" ok @ShadowNinja
This reverts commit 467fc0ddc912ae38c3bf9fcb99e0b66d7478eec0.
2015-03-22 18:01:56 +01:00
Loic Blot 7caacf745b Add a Lua call to do damages / heals 2015-03-18 14:52:35 +01:00
Loic Blot fa9145128a We always know playerSAO when calling SendInventory. Using it instead of searching it via peer_id 2015-03-04 15:28:33 +01:00
Loic Blot c468ca4821 Send Inventory packet on event, don't check it at each AsyncRunStep.
* Call UpdateCrafting into SendInventory because this functions is only called before SendInventory
* Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id
* m_env_mutex don't need to be used with this modification because it's already locked before the calls
2015-03-04 11:29:39 +01:00
Loic Blot ee42254b45 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00
Loic Blot 14e866c4a6 Send Player HP when setHP (or a setHP caller) is called instead of looping and testing the state change. 2015-03-03 16:06:04 +01:00
Kahrl eb49a8d55e Disallow object:remove() if the object is a player
Rebased by Zeno- (conflict in lua_api.txt)
2015-02-23 16:49:48 +10:00
Loic Blot 1905f12b61 SAO work: ActiveObject types & SAO cleanup * Replace u8 types with ActiveObjectType. * Merge content_object.h into activeobject.h * Remove DummyLoadSAO, it's now unused. * Remove ItemSAO, it's also unused 2015-02-17 09:09:50 +01:00
rubenwardy 056427477e Fix direction property of HUD 2015-01-07 20:51:47 +01:00
kwolekr c7589703e5 Check minetest.hud_change() parameters on conversion (Fix #1714) 2014-10-30 00:12:12 -04:00
sapier 1bc27bc115 Small cleanup of hud add/remove code 2014-05-31 22:32:44 +02:00
sapier d83d1a95b7 Fix heart + bubble bar size on different texture packs
Add DPI support for statbar
Move heart+bubble bar to Lua HUD
Add statbar size (based upon an idea by blue42u)
Add support for customizing breath and statbar
2014-05-07 21:46:27 +02:00
sapier e2a88e15fd Add proper lua api deprecated handling 2014-04-29 22:49:04 +02:00
BlockMen f2e2f59cdd Use integers instead of float values 2014-04-12 20:04:12 +02:00
BlockMen a5db2961b2 Add player:set_eye_offset() by @MirceaKitsune and clean up 2014-04-12 17:44:20 +02:00
BlockMen 8909fe913c Add third person view 2014-04-12 17:44:15 +02:00
ShadowNinja ce942de6ed Remove lua_State parameter from LuaError::LuaError 2014-03-15 16:28:59 -04:00
Perttu Ahola 0ad66f64a5 Add player:override_day_night_ratio() for arbitrarily controlling sunlight brightness 2014-02-01 18:38:21 +01:00
Perttu Ahola 89f9a3e607 Add player:set_sky() with simple skybox support 2014-02-01 18:34:26 +01:00
RealBadAngel 6d28b11897 New HUD element - waypoint. 2014-01-26 21:31:59 +01:00
Ilya Zhuravlev eac09737af Fix some errors reported by clang static analyzer. 2014-01-13 03:29:12 +04:00
kaeza 883ffdd684 Fix enum element name in Lua HUD code (position vs. pos) 2013-12-31 06:13:54 +01:00
PilzAdam 8dae6c5967 Use a table in set_physics_override() 2013-12-03 23:20:00 +01:00
PilzAdam 844cac9e3a Add sneak and sneak_glitch to set_physics_override() 2013-12-03 23:20:00 +01:00