aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
AgeCommit message (Collapse)Author
2020-08-15Allow binding dig, place actions to keys; remove LMB/RMB hardcodingANAND
Co-authored-by: Sam Caulfield <sam@samcaulfield.com>
2020-06-13Exposing the zoom key to Lua API (#9903)Lars Müller
Co-authored-by: Raul Ferriz <raul.ferriz@gmail.com>
2020-05-07Server class code cleanups (#9769)Loïc Blot
* Server::overrideDayNightRatio doesn't require to return bool There is no sense to sending null player, the caller should send a valid object * Server::init: make private & cleanup This function is always called before start() and loads some variables which can be loaded in constructor directly. Make it private and call it directly in start * Split Server inventory responsibility to a dedicated object This splits permit to found various historical issues: * duplicate lookups on player connection * sending inventory to non related player when a player connects * non friendly lookups on detached inventories ownership This reduce the detached inventory complexity and also increased the lookup performance in a quite interesting way for servers with thousands of inventories.
2020-05-05Sky API: Rename *_tint to fog_*_tint for consistencySmallJoker
2020-05-02set_fov: Add support for time-based transitions (#9705)ANAND
2020-04-27Forbid object:attach(obj, ...) (#9762)Loïc Blot
Fixes #9761
2020-04-18script: Move SAO usability check so that it covers all functions (#9698)sfan5
see also 91eef646a59575bd9ae792e257bb6ad12fafc0b1
2020-04-14scriptapi: Some small optimizations to value pushing (#9669)sfan5
2020-04-11Drop content_sao.{cpp,h}Loic Blot
Move LuaEntitySAO to a new dedicated file Drop TestSAO (useless object) Drop the old static startup initialized SAO factory, which was pretty useless. This factory was using a std::map for 2 elements, now just use a simple condition owned by ServerEnvironment, which will be lightweight, that will also drop a one time useful test on each LuaEntitySAO creation. This should reduce server load on massive SAO creation
2020-04-11Move PlayerSAO to dedicated filesLoic Blot
2020-04-11Move serveractiveobject & unitsaoLoic Blot
Move serverobject.{cpp,h} to server/serveractiveobject.{cpp,h} Move UnitSAO class to dedicated files
2020-04-11scriptapi: Sort out ServerEnvironment / Environment distinction properlysfan5
The API implementation is shared between CSM and SSM. Functions should retrieve a plain env when they do not need any server-specific functions.
2020-03-08Fix star visilibity and documentation (since 946c03c6)Jordan Snelling
Fix memory leak (unused allocation) Fix star rendering Rename sky color struct Fix stars on android Remove extraneous .data() from android star draw
2020-03-05set_sky improvements, set_sun, set_moon and set_starsJordach
2020-02-23Move core.get_connected_players() implementation to C++sfan5
Keeping the ObjectRefs around in a table isn't ideal and this allows removing the somewhat nonsensical is_player_connected() added in 86ef7147.
2020-02-11Script API: Check that SAOs are still usable before attempting to use themsfan5
2019-09-22Punchwear (improved) (#8959)sfan5
2019-09-21Wieldhand: Specify which ItemStack to use (#8961)SmallJoker
Makes 'get_wield_item' to return the "main" ItemStack
2019-09-19Add support for per-player FOV overrides and multipliersAnand S
2019-08-24Inventory: Send dirty lists where appropriate (#8742)SmallJoker
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time. Raises protocol version to 38 to ensure correct backwards-compatible code.
2019-08-10Implement adding velocity to player from Luasfan5
The intended usecase is knockback, but there's potential for more.
2019-08-07Unify wield item handling (#8677)SmallJoker
This moves the wield item functions to Player and the tool utils for range calculation Also 'local_inventory' was removed due to redundancy in Client
2019-07-30Move the clamping of hp/breath when their maximums change to ↵Beha
read_object_properties(). (#8689) This prevents set_properties() calls that have nothing to do with hp_max or breath_max overriding the saved hp before another mod has the chance to set a player's intended hp_max (such as in on_joinplayer).
2019-05-21Fix forgotten PlayerSAO cast in a90f2efSmallJoker
2019-05-21Check for out-of-bounds breath when setting breath_max (#8493)ANAND ツ
2019-04-28Force send a mapblock to a player (#8140)sofar
* Force send a mapblock to a player. Send a single mapblock to a specific remote player. This is badly needed for mods and games where players are teleported into terrain which may be not generated, loaded, or modified significantly since the last player visit. In all these cases, the player currently ends up in void, air, or inside blocks which not only looks bad, but has the effect that the player might end up falling and then the server needs to correct for the player position again later, which is a hack. The best solution is to send at least the single mapblock that the player will be teleported to. I've tested this with ITB which does this all the time, and I can see it functioning as expected (it even shows a half loaded entry hallway, as the further blocks aren't loaded yet). The parameter is a blockpos (table of x, y, z), not a regular pos. The function may return false if the call failed. This is most likely due to the target position not being generated or emerged yet, or another internal failure, such as the player not being initialized. * Always send mapblock on teleport or respawn. This avoids the need for mods to send a mapblock on teleport or respawn, since any call to `player:set_pos()` will pass this code.
2019-04-11Add node field to PlayerHPChangeReason table (#8368)Paul Ouellette
2019-04-07Add deprecation warnings for ObjectRef:get/set_attribute (#8443)ANAND
2019-03-12HPChange Reason: Fix push after free, and type being overwritten (#8359)rubenwardy
* HPChange Reason: Fix push after free, and type being overwritten Fixes #8227 and #8344
2019-02-10Consistent HP and damage types (#8167)SmallJoker
Remove deprecated HUDs and chat message handling. Remove unused m_damage variable (compat break). HP: s32 for setter/calculations, u16 for getter.
2019-01-06Fix various bugs (Anticheat, Lua helpers) (#8013)SmallJoker
* Fix various bugs (Anticheat, Lua helpers) Anticheat: Use camera position instead of player position for shoot line calculations Lua helpers: Increase 'i' to not overwrite earlier added table values * Remove lag compensation * * 1.5 for larger selection boxes
2018-11-28Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)CoderForTheBetter
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
2018-07-08Lua templating reading (part 4): s16, v2s16, v2f (#7512)Loïc Blot
2018-07-01Log deprecated Lua function calls (#7491)SmallJoker
2018-06-30Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot
* Modernize lua read (part 2 & 3): C++ templating assurance Implement the boolean reader Implement the string reader Also remove unused & unimplemented script_error_handler Add a reader with default value
2018-06-04Modernize lua read (part 1): C++ templating insurance (#7394)Loïc Blot
* Modernize lua read (part 1): C++ templating assurance Implement the float reader
2018-05-31Fix isNan on setYaw Lua call (#7380)Loïc Blot
* Fix isNan on setYaw Lua call
2018-04-30Allow damage for attached objects, add attach/detach callbacks (#6786)SmallJoker
* Allow right-clicking on attached LuaEntities
2018-04-06Add player:get_meta(), deprecate player attributes (#7202)rubenwardy
* Add player:get_meta(), deprecate player attributes
2018-04-02Fix many issues reported by clang-tidy (#7189)Loïc Blot
* Fix many issues reported by clang-tidy We have many issues in code related to some performance to float <-> double. Clang-tidy reported it in performance-type-promotion-in-math-fn I fixed many of them. It's not ready for a promote to blocking Also fix some value which should be const-ref
2018-03-31ObjectRef: Add add_velocity() (#3208)you
Allow changing the velocity of objects relatively to their current velocity
2018-03-28Add reasons to on_dieplayer and on_hpchangeAndrew Ward
2018-03-28Add formspec theming using prepended stringsAndrew Ward
2018-03-08Cleanup & bugfixLoic Blot
* ObjectRef::set_local_animation: fix wrong lua return (should push a boolean, currently returns nil) * ObjectRef::set_eye_offset: fix wrong lua return (should push a boolean, currently returns nil) * Fix various Server functions which depends on RemotePlayer objet and return true/false when player object is nil whereas it's a caller implementation error. Change those bool functions to void and add sanitize_check call instead. Current callers are always checking player object validity * Optimize Server::setClouds : use CloudParams object ref instead of attribute deserialization from structure & perform RemotePlayer::setCloudParams directly in server class like many other calls * Optimize Server::SendCloudParams: use CloudParams object ref instead of deserialized attributes
2018-03-08Cleanup: drop Server::hudGetHotbarSelectedImage()Loic Blot
Call directly accessible RemotePlayer::getHotbarSelectedImage() from server api
2018-03-08Cleanup: drop Server::hudGetHotbarImage()Loic Blot
Call directly accessible RemotePlayer::getHotbarImage() from server api & make it const ref
2018-03-08Cleanup: drop Server::hudGetHotbarItemcount()Loic Blot
Call directly accessible RemotePlayer::getHotbarItemcount() from server api
2018-01-20[CSM] Add basic HUD manipulation. (#6067)red-001
* [CSM] Add basic HUD manipulation. Workaround for on_connect not working right now.
2017-09-30Make Player::peer_id server-side only and add getters and setters (#6478)Loïc Blot
* Make Player::peer_id server-side only and add getters and setters Player::peer_id has no sense client side, move it to server, make it private and add setter and getter Also add some PEER_ID_INEXISTENT instead of harcoded 0
2017-09-15ServerEnv: Clean up object lifecycle handling (#6414)sfan5
* ServerEnv: Clean up object lifecycle handling