aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
AgeCommit message (Collapse)Author
2021-12-12Rename new_gravity to new new_accelerationElias Fleckenstein
2021-12-12Add correct gravity calculationElias Fleckenstein
2021-10-31Fix number of tool uses being off by 1..32767 (#11110)Wuzzy
2021-08-28Remove redundant on_dieplayer callssavilli
2021-08-27Joystick sensitivity for player movement (#11262)NeroBurner
This commit deprecates the forward, backward, left, and right binary inputs currently used for player movement in the PlayerControl struct. In their place, it adds the movement_speed and movement_direction values, which represents the player movement is a polar coordinate system. movement_speed is a scalar from 0.0 to 1.0. movement_direction is an angle from 0 to +-Pi: FWD 0 _ LFT / \ RGT -Pi/2 | | +Pi/2 \_/ +-Pi BCK Boolean movement bits will still be set for server telegrams and Lua script invocations to provide full backward compatibility. When generating these values from an analog input, a direction is considered active when it is 22.5 degrees away from either orthogonal axis. Co-authored-by: Markus Koch <markus@notsyncing.net> Co-authored-by: sfan5 <sfan5@live.de>
2021-08-21HUD: Reject and warn on invalid stat types (#11548)SmallJoker
This comes into play on older servers which do not know the "stat" type. Warnings are only logged once to avoid spam within globalstep callbacks
2021-08-19Validate staticdata and object property length limits (#11511)sfan5
Some games provide users with enough freedom to create items with metadata longer than 64KB, preventing this from causing issues is on them but we'll still do the minimum not to abort the server if this happens.
2021-05-30script: Replace calls to depreated luaL_openlibsfan5
2021-02-17Add nametag background setting and object property (#10937)rubenwardy
2021-01-31Preserve immortal group for players when damage is disabledsfan5
2021-01-21ObjectRef: fix some v3f checks (#10602)Zughy
2021-01-02Add on_deactivate callback for luaentities (#10723)hecks
2020-12-23Fix unsafe cast in l_objectrubenwardy
2020-11-10ObjectRef: Re-add legacy code for set_physics_override (#10585)SmallJoker
These arguments are used at least by MTG beds and homedecor_common. A deprecation warning is shown to safely remove it in a future release.
2020-11-04Fix ObjectRef errors due to lua_isnil() (#10564)Zughy
Treat 'none' values as 'nil'
2020-10-31Fix segfault in deprecation logging due to tail call, log by default (#10174)rubenwardy
2020-10-22Clean up l_object.cpp (#10512)Zughy
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-10-13Add ObjectRef:get_children() (#10480)Zughy
Co-authored-by: Zughy <4279489-marco_a@users.noreply.gitlab.com>
2020-10-04Minimap as HUD element with API controlPierre-Yves Rollo
Features: * Define Minimap available modes (surface/radar, scale) from Lua, using player:set_minimap_modes() * New HUD elements for displaying minimap with custom size and placing * New minimap mode for displaying a texture instead of the map
2020-10-04Add First Person Attachments (#10360)Jordan Snelling
Fixes some other third person camera specific attachments. Implements a single new flag for entities to be forced visible in first person mode. Old mods do not need to be updated to use the new flag and are fully backwards compatible.
2020-10-04Deprecate get_player_velocity and add_player_velocity (#10173)rubenwardy
2020-08-27Lua API: Register missing get_texture_mod function (#10338)karamel59
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