Commit Graph

634 Commits

Author SHA1 Message Date
SmallJoker 0f955bf7fa Minimap: Do a double-typecast to fix compiling with MSVC 2017-04-15 14:30:27 +02:00
bigfoot547 e80a83d1cb [CSM] Add function to set minimap shape (#5569)
* [CSM] Add function to set minimap shape

Also deprecates `toggle_shape`.

* Oh fish, I messed that one up!

* Fix Style

* Sorry, I missed something

I still had the `luamethod` call in there!

* Add getters

* Remove extra line

* Remove useless variable

Please review again @nerzhul . Thanks!

* Satisfy nerzhul
2017-04-14 09:04:41 +02:00
numberZero 83508277ce Fix inability to change metadata using stack:to_table() (#5547) 2017-04-12 16:51:07 +02:00
t0ny2 a3e7372686 Replace occurrence of luaL_reg in l_localplayer (#5566)
Related to commit 41c5483. Replace a final occurrence of luaL_reg in
src/script/lua_api/l_localplayer.cpp
2017-04-11 19:29:24 +02:00
Loïc Blot b4106ca58f Clang-format styles fixes since previous commit 2017-04-10 09:17:53 +02:00
Loic Blot 0419552c92
Clang format: fix LINT on old PR which doesn't have LINT enabled 2017-04-10 08:05:03 +02:00
Vincent Glize 8ad3dad137 LocalPlayer api lua 2017-04-08 22:04:30 -07:00
Dániel Juhász 58d83a7bb2 Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.

In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.

Dropped itemstacks with different colors do not merge.
2017-04-08 18:39:15 -07:00
Loïc Blot 41c5483024 Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#5541)
We are bundling Lua5.1 which has same macro
2017-04-08 09:28:37 +02:00
Loic Blot 4af99b75cf
Pass clang-format on 14 trivial header files fixes
Also remove them from whitelist
2017-04-07 23:22:00 +02:00
Loic Blot f7088f69ab
Clang-format: fix some header files and remove them from whitelist 2017-04-07 08:50:17 +02:00
Loïc Blot 3a90b78a03
LINT: Switch whitelist check from egrep to awk
Bonus: make CI happy with the last rules fix
2017-04-06 23:21:40 +02:00
red-001 88b9b9652a [CSM] Add function to get the server protocol version. (#5529) 2017-04-06 22:50:45 +02:00
Loic Blot 4b15f76ed1
Move LINT process in dedicated shell & fix
Move lint to dedicated shell permit to use it from your shell easily to check what is wrong
Also fix recent regressions in code style
2017-04-06 09:10:59 +02:00
red-001 4ee6be856d [CSM] Add support for positional audio. (#5516)
Fixes parts of #5389.
2017-04-06 08:14:31 +02:00
red-001 000ec26001 [CSM] Add local node meta reference. (#5508) 2017-04-04 07:41:37 +02:00
red-001 63ac62ec8a [CSM] Add function and chat command to disconnect from server. (#5487) 2017-04-01 13:40:56 +02:00
Loic Blot a4874270f7
Fix clang-format Columns Width
Also fix l_client.cpp/h and remove them from whitelist
2017-03-31 22:29:34 +02:00
Loïc Blot fbc1432fe8 l_minimap: don't show minimap if configuration doesn't allow it 2017-03-29 15:50:22 +02:00
bigfoot547 9efc5da0fb [CSM] Add function to get player names in range (#5435)
* [CSM] Add function to get currently connected player names
2017-03-22 21:13:03 +01:00
Loïc Blot 3c4ac70348 Refactor Game class (part 2) (#5422)
* showPauseMenu is now part of game
* remove many flags parameters passed to game functions, use the member.
* rename VolatileRunFlags to GameUIFlags (this will permit to share structure with client and CSM
* updatePointedThing: remove pointer ref, we already have the pointer in rundata
* move some attributes outside of VolatileRunFlags after renaming, to game class
* rename statustext to m_statustext
* make some const variables static
* All those changes permit to reduce a little bit function class cost and will permit to interface CSM with some interesting Game flags
* Expose GameUIFlags to client
* Client now have GameUIFlags parameter and setters for other classes
* Fix minimap show/hide in Lua because we now have access to the real flag
2017-03-19 13:18:52 +01:00
Loïc Blot 7b74f04a61 [CSM] Fix minimap problems (#5405)
This fixes issue #5404
2017-03-17 07:54:49 +01:00
Loïc Blot 0891975ad6 [CSM] Add core.get_timeofday & core.get_day_count env calls (#5401)
* [CSM] Add core.get_timeofday & core.get_day_count env calls

* [CSM] Add core.get_node_level, core.get_node_max_level, core.find_node_near
2017-03-17 07:48:29 +01:00
Loïc Blot 40ce538aad [CSM] Add minimap API modifiers (#5399)
* Rename Mapper (too generic) to Minimap
* Add lua functions to get/set position, angle, mode for minimap
* Client: rename m_mapper to m_minimap
* Add minimap to core.ui namespace (core.ui.minimap)
* Add various functions to manage minimap (show, hide, toggle_shape)
* Cleanup trivial declaration in client
2017-03-16 10:34:54 +01:00
Loïc Blot eb88e5dd4b Add ModStorageAPI to client side modding (#5396)
mod storage is located into user_path / client / mod_storage
2017-03-16 07:53:39 +01:00
paramat 46276414ed Get biome list: Downgrade missing biome message to infostream
It is harmless for a biome listed in an ore or decoration registration
to be missing.
Now that we are registering certain biomes or not based on options
(such as floatland biomes), the biome lists in ore and decoration
registrations trigger these error messages, avoiding these error
messages would need a large amount of duplication of ore and decoration
registrations.
2017-03-16 02:56:03 +00:00
red-001 88df9fb5b6 Add `get_wielded_item` 2017-03-13 23:56:05 +01:00
red-001 37df9cb7d7 [CSM] Add `get_node` and `get_node_or_nil` 2017-03-13 23:56:05 +01:00
Loic Blot ba66fce833 [CSM] storage + fixes 2017-03-13 23:56:05 +01:00
red-001 c42c53fccf [CSM] Add local formspecs. (#5094) 2017-03-13 23:56:05 +01:00
Loïc Blot 2c19d51409 [CSM] sound_play & sound_stop support + client_lua_api doc (#5096)
* squashed: CSM: Implement register_globalstep
  * Re-use fatal error mechanism from server to disconnect client on CSM error
  * Little client functions cleanups

* squashed: CSM: add core.after function
  * core.after is shared code between client & server
  * ModApiUtil get_us_time feature enabled for client
2017-03-13 23:56:05 +01:00
red-001 d7bc346981 [CSM] Add client-sided chat commands (#5092) 2017-03-13 23:56:05 +01:00
red-001 cb3a61f8db [CSM] Add method that display chat to client-sided lua. (#5089) (#5091)
* squashed: [Client-sided scripting] Don't register functions that don't work. (#5091)
2017-03-13 23:56:05 +01:00
Loic Blot 2efae3ffd7 [CSM] Client side modding
* rename GameScripting to ServerScripting
* Make getBuiltinLuaPath static serverside
* Add on_shutdown callback
* Add on_receiving_chat_message & on_sending_chat_message callbacks
* ScriptApiBase: use IGameDef instead of Server
  This permits to share common attribute between client & server
* Enable mod security in client side modding without conditions
2017-03-13 23:56:05 +01:00
Dániel Juhász ab371cc934 Light calculation: New bulk node lighting code
This commit introduces a new bulk node lighting algorithm to minimize
lighting bugs during l-system tree generation, schematic placement and
non-mapgen-object lua voxelmanip light calculation.

If the block above the changed area is not loaded, it gets loaded to avoid
lighting bugs.
Light is updated as soon as write_to_map is called on a voxel manipulator,
therefore update_map does nothing.
2017-03-11 02:06:18 +00:00
Loïc Blot ef6feca501 Add ModMetadata API (#5131)
* mod can create a ModMetadata object where store its values and retrieve it.
* Modmetadata object can only be fetched at mod loading
* Save when modified using same time as map interval or at server stop
* add helper function to get mod storage path
* ModMetadata has exactly same calls than all every other Metadata
2017-02-08 00:15:55 +01:00
rubenwardy 0680c47d6c Fix incompatibility of ItemStack.to_table() introduced by stack meta 2017-02-07 21:18:17 +00:00
rubenwardy f2aa2c6a98 Add ItemStack key-value meta storage 2017-02-04 22:07:55 +00:00
rubenwardy c2e7b1f579 Derive NodeMetaRef from MetaDataRef 2017-02-04 22:07:55 +00:00
rubenwardy 13f94ecad5 Make NodeMetaRef::getmeta a non-static member 2017-02-04 22:07:55 +00:00
kilbith 03b34cb3dd Serverlist: Add ping indicators (#5164) 2017-02-03 23:53:43 +10:00
SmallJoker 79d752ba4f from_table: Fix crash for missing inventory or field 2017-01-28 16:38:46 +01:00
Loïc Blot b7a98e9850 Implement player attribute backend (#4155)
* This backend permit mods to store extra players attributes to a common interface.
* Add the obj:set_attribute(attr, value) Lua call
* Add the obj:get_attribute(attr) Lua call

Examples:
* player:set_attribute("home:home", "10,25,-78")
* player:get_attribute("default:mana")

Attributes are saved as a json in the player file in extended_attributes
key

They are saved only if a modification on the attributes occurs and loaded
when emergePlayer is called (they are attached to PlayerSAO).
2017-01-27 08:59:30 +01:00
sfan5 0cde270bf5 Initialize TileAnimationParams to prevent crashes/bugs for legacy invocations of add_particle{,spawner} (fixes #5108) 2017-01-24 15:19:29 +01:00
Loïc Blot bc29e03b59 Revert "Detach the player from entities on death." (#5087) 2017-01-21 17:30:55 +01:00
sapier c57b4ff9b5 Add Entity get_texture_mod() to Lua API
Send texture modifier to clients connecting later too
2017-01-21 17:01:02 +01:00
red-001 72535d3328 Detach the player from entities on death. (#5077) 2017-01-21 16:11:55 +01:00
sfan5 7279f0b373 Add particle animation, glow
This is implemented by reusing and extending the
TileAnimation code for the methods used by particles.
2017-01-18 23:21:01 +01:00
sapier 51746ca910 Fix typo in alias for deprecated settexturemod 2017-01-17 19:41:52 +01:00
rubenwardy 63c892eedf Rename ObjectRef methods to be consistent and predictable 2017-01-16 15:34:44 +00:00
Rui 5d60a6c533 Make nametag removable with set_nametag_attributes (#5021) 2017-01-11 20:25:25 +01:00
Rogier 6647939403 Performance fix + SAO factorization
Original credits goes to @Rogier-5

* Merge common attributes between LuaEntitySAO & PlayerSAO to UnitSAO
* Make some functions const
* Improve some lists performance by returning const ref

Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-11 15:53:56 +01:00
Rui ec30d49e02 Add staticdata parameter to add_entity (#5009)
* Add staticdata parameter to add_entity
* Add add_entity_with_staticdata to core.features
2017-01-09 20:39:45 +01:00
Ner'zhul 8e7449e092 Environment & IGameDef code refactoring (#4985)
* Environment code refactoring
* Cleanup includes & class declarations in client & server environment to improve build speed
* ServerEnvironment::m_gamedef is now a pointer to Server instead of IGameDef, permitting to cleanup many casts.
* Cleanup IGameDef
  * Move ITextureSource* IGameDef::getTextureSource() to Client only.
  * Also move ITextureSource *IGameDef::tsrc() helper
  * drop getShaderSource, getSceneManager, getSoundManager & getCamera abstract call
  * drop unused emerge() call
  * cleanup server unused functions (mentionned before)
* Drop one unused parameter from ContentFeatures::updateTextures
* move checkLocalPrivilege to Client
* Remove some unnecessary casts
* create_formspec_menu: remove IWritableTextureSource pointer, as client already knows it
* Fix some comments
* Change required IGameDef to Server/Client pointers
* Previous change that game.cpp sometimes calls functions with Client + InventoryManager + IGameDef in same functions but it's the same objects
* Remove duplicate Client pointer in GUIFormSpecMenu::GUIFormSpecMenu
* drop ClientMap::sectorWasDrawn which is unused
2017-01-09 20:39:22 +01:00
Loic Blot 98e36d7d68 Move ServerEnvironment to dedicated cpp/header files
* also cleanup some unneeded inclusions
2017-01-08 12:16:06 +01:00
Loic Blot 52ba1f867e 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
adrido 5a0a59ad46 Dont compare short with bool (#4963)
Fixes a compiler warning on MSVC
2016-12-28 21:22:01 +01:00
sfan5 cc7c31a5bc Fix warning reported by clang (possible bug in Settings lua api) 2016-12-21 10:20:06 +01:00
ShadowNinja 59f84ca0a0 Mod security: Allow read-only access to all mod paths 2016-12-20 06:34:04 +00:00
Auke Kok 5a2431a9bd Simple decorations: Fix range check for deco->deco_param2
Allow any int value, and properly range check it before casting.
2016-12-08 08:38:10 +00:00
Auke Kok 2e69711613 Simple deco: Allow setting param2 value on placement
Schematics can already be placed with a param2 value, but not
simple 1-node plant decorations of the simple type.

This adds a `param2` field to the simple deco type that is
checked to be between 0 and 255, and put to the placed node
at mapgen.

This can be used to put a degrotate value in, or e.g. a fill
value for leveltype nodes, or a place_param2 value at mapgen
placement, or vary the shape of meshoptions plantlike drawtype.
2016-12-07 04:17:17 +00:00
sfan5 c38985825f Allow restricting detached inventories to one player
This combats the problem of sending the hundreds of
"creative" / "armor" or whatever detached invs that
exist on popular servers to each and every player
on join or on change of said invs.
2016-11-28 13:41:19 +01:00
sfan5 5fd1ef9b58 Revert "Adding particle blend, glow and animation (#4705)"
This reverts commit 93e3555eae.
2016-11-14 15:28:06 +01:00
Foghrye4 93e3555eae Adding particle blend, glow and animation (#4705) 2016-11-15 00:09:59 +10:00
Rogier 1980d9ea31 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
Brandon bf315c05f1 Add minetest.get_server_uptime() function to Lua API (#4702)
Add minetest.get_server_uptime() function to Lua API
2016-11-02 09:36:58 -07:00
ShadowNinja 7607b0ac20 Add version API 2016-10-31 21:53:00 -07:00
paramat 70e2df4f86 Lua voxelmanip: Add optional buffer param for 'get param2 data'
Update lua_api.txt.
2016-10-31 10:59:38 +00:00
Loic Blot 595932a860 Fix overloading problems mentioned by clang 2016-10-30 16:30:55 +01:00
Ner'zhul 9d25242c5c 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 6eb6e75fff Adding LuaError on attempt to assign vectors with values out of range 2016-10-25 21:10:51 +02:00
Rogier 4b17105dc4 Emergeblocks: Fix occasional crash
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-16 01:13:16 +01:00
raymoo c9e7a27eeb Attached particle spawners 2016-10-13 17:33:16 +02:00
Loic Blot 569b89b36f Move RemotePlayer code to its own cpp/header 2016-10-08 22:27:44 +02:00
Loic Blot 7bbd716426 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 fd5a130b86 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 656faf7373 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 ad163ee5c3 Prevent attached models from disappearing during parent reload (#4128) 2016-10-08 14:51:25 +02:00
Loic Blot 8bcd10b872 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
Loic Blot 667975fe3a Use more unordered_maps to improve performance in c++11 builds 2016-10-06 12:33:35 +02:00
Loic Blot 613797a304 Replace various std::map with UNORDERED_MAP + various cleanups
This is part 2 for 5f084cd98d

Other improvements:

* Use the defined ItemGroupList when used
* make Client::checkPrivilege const
* inline some trivial functions
* Add ActiveObjectMap typedef
* Add SettingsEntries typedef
2016-10-05 10:53:19 +02:00
paramat b88595050f Decorations: Generalise 'spawn by' to be used by all decoration types
In lua_api.txt, make clear that 'place on' and 'spawn by' can be lists.
2016-09-14 09:19:54 +01:00
James Stevenson 403dada85a Return nil on empty get_area() (#4508) 2016-09-10 01:47:13 +10:00
paly2 aa33166386 Add minetest.unregister_item and minetest.register_alias_force 2016-09-08 03:26:52 -04:00
SmallJoker 5c0e659516 Script API: Make the craft recipe field 'method' consistent 2016-08-18 20:43:49 +01:00
Rogier-5 4503b5097f Fixes for compiling with a newer (system) jsoncpp (#4429)
* 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-10 12:10:00 +02:00
Ner'zhul 058a869b70 Permit usage of std::unordered_map & std::unorderered_set on c++11 compilers (#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-10 12:08:05 +02:00
Dorian Wouters fca8e53842 Fix l_request_insecure_environment not ignoring all whitespace (#4395)
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-08-04 00:41:54 +02:00
Foghrye4 281e9f39fd Adding minetest.clear_craft
Modifications by est31: grammar fixes in doc + error messages and
a little style fix, no functional change.
2016-07-05 21:40:13 +02:00
kwolekr 3c63c3044d Add MapSettingsManager and new mapgen setting script API functions
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-03 15:38:36 -04:00
kwolekr 92705306bf Mapgen: Refactor mapgen creation and management
- 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-07-03 14:04:11 -04:00
raymoo fa0bbbf96d Player: New get_look, set_look API
Deprecate get_look / set_look pitch / yaw
2016-06-24 02:13:09 +01:00
Ekdohibs 559dd99469 Make node timers more efficient 2016-06-11 23:35:17 +01:00
paramat d24f384174 Biome API: Add per-biome riverbed material and depth
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-05 16:37:02 +01:00
kwolekr dfbdb5bcd7 Change internal type for seeds to s32
This fixes value truncation (and therefore incompatibility) on platforms
with an LP32 data model, such as VAX or MS-DOS.
2016-06-04 01:51:44 -04:00
est31 27db929252 Add minetest.check_password_entry callback
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-30 23:28:08 +10:00
Auke Kok d499ec4838 Particles: Add option to remove particles on collision
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-28 00:08:23 -04:00
red-001 62d15ac7c1 Add base64 encoding and decoding to the lua api. (#3919) 2016-05-27 23:37:28 -04:00
kwolekr 9b5c492be5 Fix MgStoneType and BiomeType enum names 2016-05-27 23:23:58 -04:00
kwolekr 76f4856479 Move biome calculation to BiomeGen
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-27 23:23:58 -04:00
est31 ac8bb457aa Pathfinder: Fix style
* 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-05-01 15:32:02 +02:00
est31 af30183124 Add option to not send pre v25 init packet
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-15 17:20:09 +01:00
est31 e0151d1054 Much better API for auth.{cpp, h}
* 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-15 05:55:49 +01:00
Auke Kok 4e59fcf5c1 Add consistent monotonic day counter - get_day_count()
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-09 01:45:23 +01:00
ShadowNinja 3ce6642a26 Add AreaStore custom ID API 2016-03-07 16:33:20 -05:00
ShadowNinja 821551a266 Implement AreaStore serialization 2016-03-07 16:33:20 -05:00
ShadowNinja 2e74e9ee20 Move AreaStore container selection logic into getOptimalImplementation 2016-03-07 16:33:20 -05:00
ShadowNinja 0079887b64 Move AreaStore to util 2016-03-07 16:33:20 -05:00
ShadowNinja 095db16990 Simplify AreaStore ID management 2016-03-07 16:33:20 -05:00
est31 d494733839 Add minetest.register_lbm() to run code on block load only 2016-03-07 19:54:26 +01:00
ShadowNinja 88fbe7ca1e Use LuaErrors in security check macros
Throwing a LuaError calls destructors as it propagates up the stack,
wheres lua_error just executes a longjmp.
2016-03-07 13:37:15 -05:00
Jeija 1100a5d614 Require minetest.request_http_api to be called from the mod's main scope
Fixes #3764
2016-03-03 22:42:00 +01:00
ShadowNinja 7bcbc0105b Fix main menu being unable to set secure settings 2016-03-03 00:57:19 -05:00
Jeija 033a510cf3 Fix minetest.request_insecure_environment() always returning nil
Fixes #3765
2016-02-26 06:36:48 +01:00
Jeija 31e0667a4a Add Lua interface to HTTPFetchRequest
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-22 15:39:41 +01:00
Jeija 1b9aef43c9 Ignore spaces in secure.trusted_mods setting 2016-02-19 18:50:42 -05:00
ShadowNinja 4827ee1258 Require request_insecure_environment to be called from the mod's main scope
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-19 14:52:10 +00:00
nerzhul fefa148d69 v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox
* Uniformize aabbox3d<f32> to aabb3f
2016-02-11 16:55:15 +01:00
Kahrl b1428ab4bb Add '/clearobjects quick' 2016-02-11 04:22:58 +00:00
est31 860d70bd0e Don't print whole json data buffer to errorstream on error
`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.
2016-01-28 23:53:58 +01:00
sfan5 a58c0f458d Make ItemStack:set_count(0) clear the item stack
fixes minetest/minetest_game#786
2016-01-15 13:44:45 +01:00
BlockMen 9eee3c3f46 Add option to give every object a nametag
or change the nametag text of players
2015-12-15 23:32:19 +01:00
est31 51e8c2b277 Fix threshold type
Fix the type of the threshold value for mapgen.
The commit

a78dd7f2b6 "Fix spelling of noise_threshold"

has changed it to be read as int, but it can have non-integral values too.

Thanks to @kwolekr for pointing this out.
2015-12-07 09:57:45 +01:00
paramat 49073ba2c3 Mapgen: Add propagate_shadow bool to calcLighting
To terminate unwanted shadows from floatlands or realms above
Also add to LuaVoxelManip calc_lighting for use in mapgen mods
Remove the 2 argument calcLighting, mapgens now use the 5
argument form to specify the volumes for propagateSunlight and
spreadLight
In mgsinglenode replace calcLighting with setLighting and
clean-up use of tabs and spaces
2015-12-07 03:18:24 +00:00
Jun Zhang a78dd7f2b6 Fix spelling of noise_threshold 2015-12-06 11:38:03 +01:00
est31 ad5ac39d8d Add LuaSecureRandom 2015-11-08 15:57:15 -05:00
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00
kwolekr 1384108f8c Schematics: Add core.place_schematic_on_vmanip API
Fix memory leak in minetest.place_schematic
Slightly refactor Schematic code
2015-11-05 01:18:32 -05:00
kwolekr c2b5da735e Add callback parameter for core.emerge_area() 2015-11-02 18:43:09 -05:00
kwolekr bc0318d2fc SAPI: Fix seed parameter truncation for LuaPseudoRandom constructor
Also fix a potential seed truncation issue on platforms where the
range of ptrdiff_t (the underlying type of lua_Integer) is too small.
2015-10-26 04:04:52 -04:00
kwolekr 306b067091 SAPI: Move core.get_us_time() to Util module 2015-10-26 03:46:36 -04:00
kwolekr d69ef6acd3 SAPI: Throw runtime error instead of if l_get_mapgen_object called in incorrect thread 2015-10-25 23:15:57 -04:00
kwolekr 54f1267c2c SAPI: Mark all Lua API functions requiring envlock 2015-10-25 23:06:48 -04:00
est31 3936a5e3f7 Correct comment in l_util.cpp
Remove outdated loglevel list from a l_util.cpp comment,
and rather point to the updated code.
2015-10-26 00:32:48 +01:00
paramat 3b9f99e0d6 ABMs: Make catch-up behaviour optional
Default is true for backwards compatibility
Update lua_api.txt
2015-10-18 16:42:59 +01:00
est31 6b0cae5a9d Remove wstrgettext
Everywhere where wstrgettext was used, its output was converted back
to utf8. As wstrgettext internally converts the return value
from utf8 to wstring, it has been a waste. Remove the function, and
use strgettext instead.
2015-10-18 02:29:06 +02:00
ShadowNinja 6f2d785d0f Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 2139d7d45f Refactor logging
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API
2015-10-14 01:03:54 -04:00
kwolekr 5130dbce7b Allow setting chunksize in core.set_mapgen_params 2015-10-04 17:26:08 -04:00
kwolekr 9f25aba6c2 Hide mapgens from main menu not intended for end users 2015-10-04 17:11:41 -04:00
kwolekr 0850d3bb93 Add emerge completion callback mechanism
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04 16:27:50 -04:00
kwolekr f0cd5da687 Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
Duane Robertson a5bdfb6b3c Add get_biome_id(biome_name) callback
It returns the index used in mg->biomemap for a given biome name.
The biomemap is useless without this unless you re-register all existing biomes,
which could cause problems for anyone else trying to use biomemap.
With this, you can quickly create a lookup table of ids and names.
2015-10-02 22:49:31 +02:00
kwolekr f062bbd7a1 Add /emergeblocks command and core.emerge_area() Lua API 2015-09-23 15:56:24 -04:00
est31 452df1c723 Various style cleanups + unused code removal
-> Don't pass pointer to whole IGameDef to NodeMetadata constructors
	and deserializers, but only to IItemDefManager, which is needed
-> Remove the unused content_mapnode_get_new_name() method
-> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22,
	improving accuracy of error messages a bit
-> Fix style at other serialisation methods too
-> Improve accuracy of some comments
2015-09-19 20:57:29 +02:00
kwolekr dcbb95338a Ore: Add puff ore type 2015-09-17 03:04:50 -04:00
kwolekr beba969413 Ore: Add ore sheet column height range selection
Modders are now able to select the range of ore column height,
and the midpoint at which they 'grow' starting from.
This commit adds three new parameters for the 'sheet' ore type:
column_height_min, column_height_max, and column_midpoint_factor.
clust_size is now deprecated for this ore type.
2015-09-13 00:11:50 -04:00
est31 2035bfc3a6 Areastore: fix "attempt to index a number value"
Before, calling get_areas_in_area for an areastore with both
include_borders and include_data would result in a lua error,
if there was at least one area as result:
attempt to index a number value in function 'get_areas_in_area'
2015-09-03 06:17:02 +02:00
est31 9c44aace4f l_mainmenu.h: remove unused l_get_dirlist function
The commit
8f9af57314 "Add core.get_dir_list" by @ShadowNinja
has removed the implementation of the l_get_dirlist function and all its usages
from the l_mainmenu.cpp file, but hasn't removed it from the header file.

The reason why this hasn't been detected earlier is that C++ has this interesting
feature to still make it possible to create instances of classes whose never used
private methods are declared but not defined.
2015-08-30 01:17:03 +02:00
Kahrl 3304e1e517 Push error handler afresh each time lua_pcall is used
Fixes "double fault" / "error in error handling" messages
(issue #1423) and instead shows a complete backtrace.
2015-08-27 01:56:06 +02:00
Kahrl 8658c8d9b5 Use numeric indices and raw table access with LUA_REGISTRYINDEX 2015-08-27 01:56:06 +02:00
kwolekr c2d23ff9cc SAPI: Disable unlockable time profiling 2015-08-18 01:26:11 -04:00
kwolekr bcf38a2ad1 SEnv: Remove static_exists from ActiveObjects in deleted blocks 2015-08-16 15:55:07 -04:00
kwolekr be9024a397 minimap: Add ability to disable from server 2015-08-13 15:05:48 -04:00
kwolekr 2b04ab874d SAPI: Track last executed mod and include in error messages 2015-08-12 23:56:12 -04:00
kwolekr bcf47bc67c Improve Script CPP API diagnostics 2015-08-05 21:13:03 -04:00
paramat cf77e0333d Biome API: Make fallback biome stone and water, disable filler 2015-08-03 02:34:32 +01:00
est31 c30a2d6854 Add AreaStore data structure 2015-07-27 06:42:56 +02:00
SmallJoker 454a290370 Fix MSVC number conversion warning 2015-07-25 17:38:04 +02:00
est31 fa1096ec49 Fix minetest.get_(all)_craft_recipe(s) regression
Since 03e0dd33a8 the calls didn't return an output count
for the recipes.
2015-07-25 17:33:41 +02:00
Loic Blot 4e6971e593 Cleanup server addparticle(spawner) by merge two identical functions. 2015-07-25 12:24:28 +02:00
est31 3b50b2766a Optional reconnect functionality
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-23 07:38:13 +02:00
Elia Argentieri 5ebb4237e2 Added get_player_velocity() method. Fixes #1176 2015-07-20 05:40:44 +02:00
TeTpaAka e47f390e0d Refactor particle code to remove the while loops
Replaces while loops with proper getfield calls
2015-07-18 14:54:07 +02:00
TeTpaAka dd2e08e117 Make acc and vel deprecated in add_particle and search for acceleration and velocity instead
The doc and the actual behaviour differed.
2015-07-18 07:57:20 +02:00
TeTpaAka 8d03301138 Fix invisible player when the attached entity is removed 2015-07-18 07:41:43 +02:00
kwolekr 1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
est31 b0784ba871 Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-08 10:12:44 +02:00
TeTpaAka 17ba584fe2 Fix bug when craft input isn't replaced 2015-06-22 19:30:35 +02:00
MirceaKitsune 660fa516bf Fix some issues with animations, and allow non-looped animations to be defined 2015-06-22 01:53:38 +02:00
paramat 70da8a940b Mapgen objects: Enable heatmap and humidmap for all biome api mapgens 2015-06-20 04:16:17 +01:00
Ilya Zhuravlev b6387b4e0f Use utf-8 in formspecs 2015-06-13 19:49:55 +02:00
TeTpaAka e50aa4ed06 Add return list of individual counts to find_node_in_area 2015-06-13 19:39:18 +02:00
kwolekr 522acf920f Make get_biome_list() error message more helpful 2015-05-28 20:04:50 -04:00
TeTpaAka c0335f7d13 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 da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
kwolekr 20aa78cffb Fix null dereference when loading schematic from definition without a NodeDefManager 2015-05-17 22:32:35 -04:00
kwolekr 46684beec1 Record MapBlock modification reasons as flags instead of strings
This improves performance of MapBlock::raiseModified by a factor of 6.
Also, clean up mapblock.h a bit and inline small functions.
2015-05-17 22:14:26 -04:00
kwolekr 4c9a8a91c4 SAPI/Noise: Add PerlinNoiseMap:getMapSlice() function
This adds the ability to grab 'slices' of noise calculated by PerlinNoiseMap.
Retrieving smaller slices of noise from the computation result as needed
optimizes memory usage while maintaining a reasonable amount of CPU overhead.
2015-05-17 04:04:17 -04:00
kwolekr 3ffb5f5761 Add optional buffer param for bulk data array writes in Lua 2015-05-17 00:07:45 -04:00
ShadowNinja c00b6812b1 Fix current mod name change missed during rebase 2015-05-16 21:12:03 -04:00
kwolekr fb36c471d7 SAPI: Accept either ARGB8 table or ColorString to specify colors 2015-05-16 20:15:03 -04:00
ShadowNinja 8f9af57314 Add core.get_dir_list 2015-05-16 18:33:22 -04:00
ShadowNinja 6c06330daf Add core.request_insecure_environment() 2015-05-16 18:33:19 -04:00
ShadowNinja 05ab9973f9 Add core.mkdir 2015-05-16 18:32:37 -04:00
ShadowNinja 3a8c788880 Add mod security
Due to compatibility concerns, this is temporarily disabled.
2015-05-16 18:32:31 -04:00
TeTpaAka 19cbb6b37b Add push_ARGB8 to script/common/c_converter 2015-05-15 16:21:56 -04:00
TeTpaAka 18c2f16c13 Generalize core.get/set_nametag_color into core.get/set_nametag_attributes 2015-05-15 16:21:01 -04:00
TeTpaAka 86a963caca Add get and set functions for the nametag color 2015-05-15 11:03:27 +02:00
est31 b70e67df8c Fix compiler warning about sign comparison 2015-05-13 00:04:30 +02:00
est31 b4c3ff6eab is_player() is no player-only function 2015-05-12 05:52:49 +02:00
est31 82e35edff5 Make early protocol auth mechanism generic, and add SRP
Adds everything needed for SRP (and everything works too),
but still deactivated, as protocol v25 init packets aren't final yet.
Can be activated by changing the LATEST_PROTOCOL_VERSION header to 25
inside networkprotocol.h.
2015-05-11 18:40:27 +02:00
kwolekr 2b99d904f6 Schematics: Add per-node force placement option 2015-05-09 18:44:00 -04:00
kwolekr 2dba29ebf2 Tests: Add schematic unittests
Improve schematic file-saving interface
Add ability to create temporary test files
2015-05-08 00:55:42 -04:00
kwolekr b246812455 Schematics: Add indent-with-space option for schematic Lua table serialization 2015-05-07 02:54:35 -04:00
kwolekr 656575b59d NodeResolver: Remove NodeResolveMethod
This simplifies NodeResolver logic and makes some interfaces cleaner.
2015-05-07 02:36:01 -04:00
kwolekr b785577f03 Add core.find_nodes_with_meta() script API 2015-05-05 16:21:59 -04:00
kwolekr 46a2c1f167 Ore: Add biomes parameter 2015-04-20 20:25:33 -04:00
kwolekr 3d4244cc75 Add 'persistence' alias for Lua noiseparams and validate more vector parameters 2015-04-19 21:42:40 -04:00
paramat a615da6b12 Biome API: Add biome-specific river water 2015-04-19 06:09:57 +01:00
kwolekr e0889c6c03 Schematics: Fix core.schematic_create() 2015-04-17 18:39:37 -04:00
kwolekr 3576f4fab7 Switch to check_v3s16 in l_mapgen.cpp and l_vmanip.cpp for type safety 2015-04-17 01:03:13 -04:00
est31 f0a1379e5a Refactor around translatePassword
Change types for passed password from wstring to string, which removes converting
back and forth in most cases. Move the narrow_to_wide conversion, where its neccessary,
closer to irrlicht. Remove trailing spaces in guiPasswordChange.cpp. Make parameters for
translatePassword passed as const reference.
2015-04-17 06:10:30 +02:00
kwolekr 821d0025da Biomes: Remove referenced biomes from Decorations on clear 2015-04-16 23:38:05 -04:00
kwolekr 479f38973e Schematics: Refactor NodeResolver and add NodeResolveMethod
NodeResolver name lists now belong to the NodeResolver object instead of
the associated NodeDefManager.  In addition to minimizing unnecessary
abstraction and overhead, this move permits NodeResolvers to look up nodes
that they had previously set pending for resolution.  So far, this
functionality has been used in the case of schematics for
serialization/deserialization.
2015-04-16 16:27:05 -04:00
Loic Blot 0c634a9719 Use std::vector instead of std::set for Environment::getObjectsInsideRadius
We are only iterating sequentially, we don't need a set here
Also use a vector reference instead of a copy
2015-04-16 18:37:29 +02:00
kwolekr b2a89c04b2 Schematics: Reorganize (de)serialization and add Lua serialization API 2015-04-13 03:10:52 -04:00
est31 0a413265cb Document for api functions that rely on current_modname, that it doesn't work when not loading mods 2015-04-08 23:05:26 +02:00
kwolekr 0df736173e Schematics: Prepend mod path to relative schematic filepaths 2015-04-08 00:28:56 -04:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
kwolekr 337e79c656 ObjDefManager, Mapgen SAPI: Huge refactoring
- General code cleanup
 - Unified object creation and loading
 - Specifying objects in APIs is now orthogonal (i.e. anything can take an ID,
   name string, or the raw table definition (and automatically registers if present
2015-03-31 23:27:58 -04:00
kwolekr ed10005d38 GenElementManager: Pass opaque handles to Lua and rename to ObjDefManager
Add core.clear_registered_schematics() and refactor schematics somewhat
2015-03-31 01:11:51 -04:00
Craig Robbins 34101015b2 Fix typo 2015-03-29 22:08:14 +10:00
Craig Robbins 2430b2e998 Add Lua function get_video_modes() for main menu
Also updates and uses porting::getSupportedVideoModes()
2015-03-28 13:26:03 +10:00
ShadowNinja 93fcab952b Clean up and tweak build system
* 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-27 15:00:48 -04:00
paramat d1681872bf lua_api/l_mapgen: generate_ores/decorations: make p1, p2 optional 2015-03-24 18:07:29 +00:00
kwolekr 732d7b9a7c Add core.register_schematic() and cache schematics on use 2015-03-23 22:23:38 -04:00
est31 5b5c498011 Fix minetest.get_craft_recipe function
Previously, calling it resulted in a crash.
2015-03-23 13:40:20 +10:00
Loic Blot 008d7e0467 Revert "Add a Lua call to do damages / heals" ok @ShadowNinja
This reverts commit 467fc0ddc9.
2015-03-22 18:01:56 +01:00
kwolekr 3993093f51 Add support for the PCG32 PRNG algo (and associated script APIs) 2015-03-22 00:48:08 -04:00
gregorycu 03e0dd33a8 Optimize minetest.get_(all)_craft_recipe(s)
Signed off by: ShadowNinja, kwolekr
2015-03-20 21:41:18 -04:00
kwolekr 26153bab7d Revert "Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp"
This reverts parts of commit 9749d9fee6, which breaks node resolver
list clearing
2015-03-20 18:41:26 -04:00
est31 538036d004 Fix game minetest.conf default settings
This was a regression introduced by f6e4c5d9cf .
2015-03-18 13:03:02 -04:00
Loic Blot 467fc0ddc9 Add a Lua call to do damages / heals 2015-03-18 14:52:35 +01:00
Loic Blot 74d34da6cb Prepare Protocol v25 init & authentication.
* TOSERVER_INIT and TOCLIENT_INIT renamed to _LEGACY
* TOSERVER_PASSWORD merged from dev-0.5, can use protocol v24 and v25
* TOCLIENT_ACCESS_DENIED merged from dev-0.5, can use protocol v24 and v25, with normalized strings an a custom id for custom errors
* new TOSERVER_INIT packet only send MT version, supported compressions, protocols and serialization, this permit to rework everything later without break the _INIT packet
* new TOSERVER_AUTH packet which auth the client
* new TOCLIENT_HELLO packet which send server serialization version atm
* new TOCLIENT_AUTH_ACCEPTED which is send when TOCLIENT_AUTH was okay. After this packet, the client load datas from servers, like after TOCLIENT_INIT_LEGACY packet
2015-03-13 20:23:03 +01:00
paramat b2b6bbf3e8 lua_api/l_mapgen: Fix overlapping areas of minetest.generate_ores/decorations 2015-03-11 03:36:39 +00:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Loic Blot 40c2c18a3f l_get_modnames: Compare using std::sort instead of a custom function which does same work 2015-03-05 20:12:54 +01:00
Loic Blot 9749d9fee6 Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp
* Also change some std::list to std::vector for ClientMap::renderMap
* Remove disabled code in ClientMap::renderMap, disabled since a long time
2015-03-05 15:36:20 +01:00
Loic Blot 365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot 7e088fdfe3 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 1b2f64473e 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 7e56637ed0 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00
Loic Blot 64ff966bae 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
Craig Robbins fdb9140825 Change find_surface_nodes_in_area to find_nodes_in_area_under_air 2015-02-27 21:42:00 +10:00
Loic Blot 0f556d0c7f Add find_surface_nodes_in_area LUA call which permit to only get the nodes which touch air. This permit to massively improve performance for mods like plantlife 2015-02-27 21:34:33 +10:00
paramat 14f7df980b Biome API: Re-calculate biome at every surface in a mapchunk column 2015-02-26 03:35:25 +00:00
Kahrl 38cf080a9c 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
est31 5a0ed780f5 Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist
Client now informs about incompatible servers from the list, this permits to prevent the protocol movements.
Server announces its supported protocol versions to master server
2015-02-18 16:09:59 +01:00
Loic Blot 27d4e89d32 Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable)
ok @ShadowNinja
2015-02-18 09:28:39 +01:00
Loic Blot f8d5af7536 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
Loic Blot 7c8793cbea Performance Improvement: Use a cache which caches result for getFacePositions.
This greatly reduce the number of std::list generated by caching the result, which is always constant for each radius selected.
In the callgrind map, you will see original:
  * 3.3M calls to std::list for 9700 calls to getFacePositions
In the modified version, you will see:
  * 3.3K calls to std::list for 6900 call to getFacePositions
Callgrind map is here: #2321

it's a huge performance improvement to l_find_node_near
2015-02-16 11:27:44 +01:00
ngosang e102cbd840 Fix .zip extraction (mod store) 2015-02-12 15:27:20 +01:00
ShadowNinja 9e2a9b55e1 Reduce gettext wide/narrow and string/char* conversions 2015-02-05 03:24:22 -05:00
kwolekr 38bd9e93a2 Fix all warnings and remove -Wno-unused-but-set cflag 2015-01-18 23:29:19 -05:00
kwolekr 976d0b2caa Reorganize supported video driver query mechanisms 2015-01-18 13:24:25 -05:00
kwolekr 9736548720 Add ability to delete MapBlocks from map
Also add a Lua API and chatcommand for this
2015-01-15 16:48:56 -05:00
rubenwardy 2504da28af Fix direction property of HUD 2015-01-07 20:51:47 +01:00
kwolekr 2d849b0a19 Shorten ManualMapVoxelManipulator to MMVManip 2015-01-05 02:42:27 -05:00
kwolekr 7289d61e99 Optionally specify propagateSunlight area in calcLighting
This fixes the Mapgen V5 calcLighting segfault
2015-01-05 01:20:36 -05:00