aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
AgeCommit message (Collapse)Author
2016-08-26Make plantlike drawtype more funAuke Kok
Adds several new ways that the plantlike drawtype mesh can be changed. This requires paramtype2 = "meshoptions" to be set in the node definition. The drawtype for these nodes should be "plantlike". These modifications are all done using param2. This field is now a complex bitfield that allows some or more of the combinations to be chosen, and the mesh draw code will choose the options based as neeeded for each plantlike node. bit layout: bits 0, 1 and 2 (values 0x1 through 0x7) are for choosing the plant mesh shape: 0 - ordinary plantlike plant ("x" shaped) 1 - ordinary plant, but rotated 45 degrees ("+" shaped) 2 - a plant with 3 faces ("*" shaped) 3 - a plant with 4 faces ("#" shaped) 4 - a plant with 4 faces ("#" shaped, leaning outwards) 5 through 7 are unused and reserved for future mesh shapes. bit 3 (0x8) causes the plant to be randomly offset in the x,z plane. The plant should fall within the 1x1x1 nodebox if regularly sized. bit 4 (0x10) causes the plant mesh to grow by sqrt(2), and will cause the plant mesh to fill out 1x1x1, and appear slightly larger. Texture makers will want to make their plant texture 23x16 pixels to have the best visual fit in 1x1x1 size. bit 5 (0x20) causes each face of the plant to have a slight negative Y offset in position, descending up to 0.125 downwards into the node below. Because this is per face, this causes the plant model to be less symmetric. bit 6 (0x40) through bit 7 (0x80) are unused and reserved for future use. !(https://youtu.be/qWuI664krsI)
2016-08-10couple of memory leaks fixes.David Carlier
2016-06-11Server: Add reason for leave to `on_leaveplayer` callbacksDiego Martinez
2016-05-30Remove unused code in s_security.cpp (#4172)Zeno-
Note that the macro CHECK_FILE_ERR implements the code removed
2016-03-12Nodebox: Allow nodeboxes to "connect"Auke Kok
We introduce a new nodebox type "connected", and allow these nodes to have optional nodeboxes that connect it to other connecting nodeboxes. This is all done at scenedraw time in the client. The client will inspect the surrounding nodes and if they are to be connected to, it will draw the appropriate connecting nodeboxes to make those connections. In the node_box definition, we have to specify separate nodeboxes for each valid connection. This allows us to make nodes that connect only horizontally (the common case) by providing optional nodeboxes for +x, -x, +z, -z directions. Or this allows us to make wires that can connect up and down, by providing nodeboxes that connect it up and down (+y, -y) as well. The optional nodeboxes can be arrays. They are named "connect_top, "connect_bottom", "connect_front", "connect_left", "connect_back" and "connect_right". Here, "front" means the south facing side of the node that has facedir = 0. Additionally, a "fixed" nodebox list present will always be drawn, so one can make a central post, for instance. This "fixed" nodebox can be omitted, or it can be an array of nodeboxes. Collision boxes are also updated in exactly the same fashion, which allows you to walk over the upper extremities of the individual node boxes, or stand really close to them. You can also walk up node noxes that are small in height, all as expected, and unlike the NDT_FENCELIKE nodes. I've posted a screenshot demonstrating the flexibility at http://i.imgur.com/zaJq8jo.png In the screenshot, all connecting nodes are of this new subtype. Transparent textures render incorrectly, Which I don't think is related to this text, as other nodeboxes also have issues with this. A protocol bump is performed in order to be able to send older clients a nodeblock that is usable for them. In order to avoid abuse of users we send older clients a "full-size" node, so that it's impossible for them to try and walk through a fence or wall that's created in this fashion. This was tested with a pre-bump client connected against a server running the new protocol. These nodes connect to other nodes, and you can select which ones those are by specifying node names (or group names) in the connects_to string array: connects_to = { "group:fence", "default:wood" } By default, nodes do not connect to anything, allowing you to create nodes that always have to be paired in order to connect. lua_api.txt is updated to reflect the extension to the node_box API. Example lua code needed to generate these nodes can be found here: https://gist.github.com/sofar/b381c8c192c8e53e6062
2016-03-07s_env.{cpp, h} cleanupsest31
* Replace string by-val passing with const reference * Fix code style * Remove redundant `int table` definition and indentation level
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-03Remove debug.getupvalue from the Lua sandbox whitelistShadowNinja
This function could be used to steal insecure environments from trusted mods.
2016-01-23Fix C++11 compilabilityest31
Previous commits broke it... :(
2015-12-02Add on_secondary_use when right clicking an item in the airAlex Ford
2015-11-02Add callback parameter for core.emerge_area()kwolekr
2015-11-01Fix Lua scripting synchronizationkwolekr
For several years now, the lua script lock has been completely broken. This commit fixes the main issue (creation of a temporary rather than scoped object), and fixes a subsequent deadlock issue caused by nested script API calls by adding support for recursive mutexes.
2015-10-31Fix server crashing on Lua errorsShadowNinja
Previously, the server called FATAL_ERROR when a Lua error occured. This caused a (mostly useless) core dump. The server now simply throws an exception, which is caught and printed before exiting with a non-zero return value. This also fixes a number of instances where errors were logged multiple times.
2015-10-26Remove some abort() callsest31
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
2015-10-18ABMs: Make catch-up behaviour optionalparamat
Default is true for backwards compatibility Update lua_api.txt
2015-10-04Add new ContentParamType2 "CPT2_DEGROTATE"est31
This might break some mods, but it is important for all uses of the param2 to be documented. This doesn't need a serialisation version or network protocol version change, as old clients will still work on new servers, and it is bearable to have new clients getting non rotated plants on old servers.
2015-08-27Push error handler afresh each time lua_pcall is usedKahrl
Fixes "double fault" / "error in error handling" messages (issue #1423) and instead shows a complete backtrace.
2015-08-27Use numeric indices and raw table access with LUA_REGISTRYINDEXKahrl
2015-08-23Clean up threadingShadowNinja
* Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
2015-08-12SAPI: Track last executed mod and include in error messageskwolekr
2015-08-10Display Lua memory usage at the time of Out-of-Memory errorkwolekr
Also misc. minor cleanups
2015-08-05Improve Script CPP API diagnosticskwolekr
2015-07-23Optional reconnect functionalityest31
Enable the server to request the client to reconnect. This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
2015-07-02Fix code style from recent commits and add misc. optimizationskwolekr
2015-06-29Add Lua errors to error dialogrubenwardy
2015-06-13Add minetest.register_on_player_hpchangeTeTpaAka
2015-06-12dofile error reporting for syntax errorsest31
According to doc, dofile() raises an error when parsing failed due to syntax errors. Fixes #2775
2015-06-02Fix uninitialized variable errorest31
If you run minetest with valgrind, you'll quickly notice uninitialized jump depend error messages that point to s_base.cpp:131. This commit fixes those.
2015-05-22Fix Windows build, clean up included headersSmallJoker
Also fix a startup error caused by s_security.cpp
2015-05-19Replace instances of std::map<std::string, std::string> with StringMapkwolekr
Also, clean up surrounding code style Replace by-value parameter passing with const refs when possible Fix post-increment of iterators
2015-05-16Add mod securityShadowNinja
Due to compatibility concerns, this is temporarily disabled.
2015-05-15Add minetest.register_on_punchplayerBrandon
2015-03-27Clean up and tweak build systemShadowNinja
* Combine client and server man pages. * Update unit test options and available databases in man page. * Add `--worldname` to man page. * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`. * Disable server build by default on all operating systems. * Make `ENABLE_FREETYPE` not fail if FreeType isn't found. * Enable LevelDB, Redis, and FreeType detection by default. * Remove the `VERSION_PATCH_ORIG` hack. * Add option to search for and use system JSONCPP. * Remove broken LuaJIT version detection. * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`. * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`. * Clean up style of CMake files.
2015-03-07For usages of assert() that are meant to persist in Release builds (when ↵Craig Robbins
NDEBUG is defined), replace those usages with persistent alternatives
2015-01-13Performance fixes.onkrot
2014-12-29Expose mapgen parameters on scripting initkwolekr
Add minetest.get_mapgen_params() Deprecate minetest.register_on_mapgen_init()
2014-12-14Expose mapgen chunksize in on_mapgen_init callbackskwolekr
2014-11-20Simplify loading of Android version of menuShadowNinja
2014-10-18Add meshnode drawtype.RealBadAngel
2014-10-07Fix object reference pushing functions when called from coroutinesShadowNinja
2014-10-02Add optional framed glasslike drawtypeBlockMen
2014-09-21Add firelike drawtypeTriBlade9
2014-08-21Don't call a player event without having player to do a event forsapier
2014-05-30Fix over-poping and only push the core onceShadowNinja
2014-05-08Use "core" namespace internallyShadowNinja
2014-05-07Organize builtin into subdirectoriesShadowNinja
2014-05-07Fix heart + bubble bar size on different texture packssapier
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-04-27Fix code style of async APIShadowNinja
2014-04-27Remove dependency on marshal and many other async changesShadowNinja
This makes a number of changes: * Remove the dependency on marshal by using string.dump and loadstring. * Use lua_tolstring rather than having Lua functions pass string lengths to C++. * Move lua_api/l_async_events.* to cpp_api/s_async.*, where it belongs. * Make AsyncWorkerThread a child of ScriptApiBase, this removes some duplicate functionality. * Don't wait for async threads to shut down. (Is this safe? Might result in corruption if the thread is writing to a file.) * Pop more unused items from the stack * Code style fixes * Other misc changes