aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
AgeCommit message (Collapse)Author
2016-10-25Adding LuaError on attempt to assign vectors with values out of rangeFoghrye4
2016-10-16Emergeblocks: Fix occasional crashRogier
Modification of the emergeblocks internal state was not protected by a lock, causing a race condition. This can be reproduced by repeatedly running emergeblocks for an already-generated section of the map (with multiple emerge threads).
2016-10-13Attached particle spawnersraymoo
2016-10-08Move RemotePlayer code to its own cpp/headerLoic Blot
2016-10-08RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) ↵Loic Blot
(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-08More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)Loic Blot
* 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-08Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)Loic Blot
* 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-08Prevent attached models from disappearing during parent reload (#4128)Foghrye4
2016-10-08Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)Loic Blot
* 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-06Use more unordered_maps to improve performance in c++11 buildsLoic Blot
2016-10-05Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot
This is part 2 for 5f084cd98d7b3326b51320455364337539710efd Other improvements: * Use the defined ItemGroupList when used * make Client::checkPrivilege const * inline some trivial functions * Add ActiveObjectMap typedef * Add SettingsEntries typedef
2016-09-14Decorations: Generalise 'spawn by' to be used by all decoration typesparamat
In lua_api.txt, make clear that 'place on' and 'spawn by' can be lists.
2016-09-10Return nil on empty get_area() (#4508)James Stevenson
2016-09-08Add minetest.unregister_item and minetest.register_alias_forcepaly2
2016-08-18Script API: Make the craft recipe field 'method' consistentSmallJoker
2016-08-10Fixes for compiling with a newer (system) jsoncpp (#4429)Rogier-5
* Move included json code to jsoncpp subdirectory This is needed to avoid having to specify the minetest src directory as a system include when fixing the json includes. * Fix json includes They used "", so that the compiler searches the project's directory first. The result was that when compiling with a system jsoncpp, the project's own version of json.h was still included, instead of the system version. The includes now use <>, so a system location, or one specified with '-Ilocation' is searched only. * Fix for jsoncpp deprecated function warning When compiling with a newer version of jsoncpp (and ENABLE_SYSTEM_JSONCPP=true), jsoncpp emits a warning about a deprecated function that minetest uses.
2016-08-10Permit usage of std::unordered_map & std::unorderered_set on c++11 compilers ↵Ner'zhul
(#4430) This fallback to std::map & std::set for older compilers Use UNORDERED_SET as an example in decoration and ore biome sets Use UNORDERED_MAP as an example in nameidmapping
2016-08-04Fix l_request_insecure_environment not ignoring all whitespace (#4395)Dorian Wouters
l_request_insecure_environment didn't ignore all whitespace in the secure.trusted_mods config option. Replaces std::remove with std::remove_if and the isspace function.
2016-07-05Adding minetest.clear_craftFoghrye4
Modifications by est31: grammar fixes in doc + error messages and a little style fix, no functional change.
2016-07-03Add MapSettingsManager and new mapgen setting script API functionskwolekr
This commit refactors the majority of the Mapgen settings system. - MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap, instead of the EmergeManager. - New Script API functions added: core.get_mapgen_setting core.get_mapgen_setting_noiseparams, core.set_mapgen_setting, and core.set_mapgen_setting_noiseparams. - minetest.get/set_mapgen_params are deprecated by the above new functions. - It is now possible to view and modify any arbitrary mapgen setting from a mod, rather than the base MapgenParams structure. - MapgenSpecificParams has been removed.
2016-07-03Mapgen: Refactor mapgen creation and managementkwolekr
- Move mapgen creation logic out of EmergeManager and into Mapgen - Internally represent mapgen type as an enum value, instead of a string - Remove the need for a MapgenFactory per mapgen
2016-06-24Player: New get_look, set_look APIraymoo
Deprecate get_look / set_look pitch / yaw
2016-06-11Make node timers more efficientEkdohibs
2016-06-05Biome API: Add per-biome riverbed material and depthparamat
Mgvalleys: Remove riverbed sand placement from base terrain generation Riverbed material placement moved to MapgenBasic::generateBiomes() Document fields and add note that the biome API is still unstable
2016-06-04Change internal type for seeds to s32kwolekr
This fixes value truncation (and therefore incompatibility) on platforms with an LP32 data model, such as VAX or MS-DOS.
2016-05-30Add minetest.check_password_entry callbackest31
Gives a convenient way to check a player's password. This entirely bypasses the SRP protocol, so should be used with great care. This function is not intended to be used in-game, but solely by external protocols, where no authentication of the minetest engine is provided, and also only for protocols, in which the user already gives the server the plaintext password. Examples for good use are the classical http form, or irc, an example for a bad use is a password change dialog inside formspec. Users should be aware that they lose the advantages of the SRP protocol if they enter their passwords for servers outside the normal entry box, like in in-game formspec menus, or through irc /msg s, This patch also fixes an auth.h mistake which has mixed up the order of params inside the decode_srp_verifier_and_salt function. Zeno-: Added errorstream message for invalid format when I committed
2016-05-28Particles: Add option to remove particles on collisionAuke Kok
Adds the particle option `collision_removal = bool` Some particles are hard to use right now since they either go through solid blocks (without collision detection), and with collision detection enabled they (e.g. raindrops) would just stop dead on the floor and sit there until they expire, or worse, scrape along a wall or ceiling. We can solve the problem by adding a boolean flag that tells the particle to be removed if it ever collides with something. This will make it easier to add rain that doesn't fall through your roof or stick on the top of it. Or clouds and smoke that don't go through trees. Particles that collide with this flag are marked expired unconditionally, causing them to be treated like normal expired particles and cleaned up normally. Documentation is adjusted accordingly. An added bonus of this patch is that particles can potentially collide many times with nodes, and this reduces the amount of collisions to 1 (max), which may end up reducing particle load on the client.
2016-05-27Add base64 encoding and decoding to the lua api. (#3919)red-001
2016-05-27Fix MgStoneType and BiomeType enum nameskwolekr
2016-05-27Move biome calculation to BiomeGenkwolekr
BiomeGen defines an interface that, given a set of BiomeParams, computes biomes for a given area using the algorithm implemented by that specific BiomeGen. This abstracts away the old system where each mapgen supplied the noises required for biome generation.
2016-05-01Pathfinder: Fix styleest31
* Fix naming style for methods and classes: Use camelCase for methods and PascalCase for classes as code style demands it. And use sneak_case for methods that are not member of a class. * Replace "* " with " *" for Pointers * Same for references * Put function body opening braces on new line * Other misc minor non functional style improvements
2016-03-15Add option to not send pre v25 init packetest31
The legacy init packet (pre v25) sends information about the client's password that a server could use to log in to other servers if the username and password are the same. All the other benefits of SRP of protocol v25 are missed if the legacy init packet is still sent during connection creation. This patch adds an option to not send the v25 init packet. Not sending the v25 packet means breaking compat with pre v25 servers, but as the option is not enabled by default, no servers are affected unless the user explicitly flips the switch. More than 90% of the servers on the serverlist support post v25 protocols. The patch also fixes a bug with greying out of non compliant servers being done wrongly, the min and max params were mixed.
2016-03-15Much better API for auth.{cpp, h}est31
* No function overloading * Adhere coding style and with method names following lowercase_underscore_style * Use std::string in external API, handling these is much more fun
2016-03-09Add consistent monotonic day counter - get_day_count()Auke Kok
I've written several experimental bits of code that revolve around the need for a consistent calendar, but implementing one is extremely hard in mods due to time changes and mods overriding core.get_timeofday(), which will conflict. The second part of the problem is that doing this from a mod requires constant maintenance of a settings file. An implementation in core is trivial, however, and solves all of these problems at virtually no cost: No extra branches in server steps, and a single branch when minetest.set_time_of_day(), which is entirely reasonable. We store the day_count value in env_meta.txt. The use case is obvious: This change allows mods to create an actual virtual calendar, or properly account for seasonal changes, etc.. We add a "/days" chatcommand that displays the current day count. No permissions are needed. It can only retrieve the day count, not modify it.
2016-03-07Add AreaStore custom ID APIShadowNinja
2016-03-07Implement AreaStore serializationShadowNinja
2016-03-07Move AreaStore container selection logic into getOptimalImplementationShadowNinja
2016-03-07Move AreaStore to utilShadowNinja
2016-03-07Simplify AreaStore ID managementShadowNinja
2016-03-07Add minetest.register_lbm() to run code on block load onlyest31
2016-03-07Use LuaErrors in security check macrosShadowNinja
Throwing a LuaError calls destructors as it propagates up the stack, wheres lua_error just executes a longjmp.
2016-03-03Require minetest.request_http_api to be called from the mod's main scopeJeija
Fixes #3764
2016-03-03Fix main menu being unable to set secure settingsShadowNinja
2016-02-26Fix minetest.request_insecure_environment() always returning nilJeija
Fixes #3765
2016-02-22Add Lua interface to HTTPFetchRequestJeija
This allows mods to perform both asynchronous and synchronous HTTP requests. Mods are only granted access to HTTP APIs if either mod security is disabled or if they are whitelisted in any of the the secure.http_mods and secure.trusted_mods settings. Adds httpfetch_caller_alloc_secure to generate random, non-predictable caller IDs so that lua mods cannot spy on each others HTTP queries.
2016-02-19Ignore spaces in secure.trusted_mods settingJeija
2016-02-19Require request_insecure_environment to be called from the mod's main scopeShadowNinja
Previously you could steal a secure environment from a trusted mod by wrapping request_insecure_environment with some code like this: local rie_cp = minetest.request_insecure_environment local stolen_ie function minetest.request_insecure_environment() local ie = rie_cp() stolen_ie = stolen_ie or ie return ie end
2016-02-11v2d & aabbox3d<f32> & sky cleanupsnerzhul
* Sky: rename Box => m_box and inline getBoundingBox * Uniformize aabbox3d<f32> to aabb3f
2016-02-11Add '/clearobjects quick'Kahrl
2016-01-28Don't print whole json data buffer to errorstream on errorest31
`errorstream` must not be overly verbose as clientside it is directly printed onto the ingame chat window. These days, the serverlist can contain > 200k bytes, so better print it to warningstream if the data buffer is too long.