Commit Graph

4394 Commits

Author SHA1 Message Date
rubenwardy 13f94ecad5 Make NodeMetaRef::getmeta a non-static member 2017-02-04 22:07:55 +00:00
rubenwardy bbdd869d72 Derive NodeMetadata from Metadata 2017-02-04 22:07:55 +00:00
sfan5 de664b1c6d Fix PlayerSAO deletion warning (0eede97af2) 2017-02-04 13:31:21 +01:00
paramat 047168ca83 Mgv6: Add fallback node for gravel
Gravel now falls back to stone.
Gravel is not a particularly fundamental node, allowing it to fall back
to stone frees up subgames from having to include a gravel node.
Non-blob-ore gravel is only present in mgv6 as extremely rare 'gravel
biomes'.
2017-02-04 07:21:23 +00:00
paramat 8e4c11406e Mgv6: Add stairs to desert stone dungeons
As with the other mapgens, now that wide stairs in dungeons are
possible we can now finally add stairs to desert stone dungeons.
Re-order some lines.
2017-02-04 07:21:23 +00:00
paramat 2d03cfd24c MapgenBasic node resolver: Various fixes
Add a fallback node for stair_desert_stone to avoid ignore placed
in Minimal subgame desert dungeons.
Don't allow river_water_source to fallback to water_source as river
water needs to be non-renewable and have a short flow range.
Make stair_sandstonebrick fall back to sandstonebrick instead of
sandstone.

Re-order some lines.
Add a comment.
2017-02-04 07:21:16 +00:00
kilbith 03b34cb3dd Serverlist: Add ping indicators (#5164) 2017-02-03 23:53:43 +10:00
Duane Robertson 3b9ae409c7 Tell on_punch to expect a return value
The return value should be interpreted as a boolean saying whether
the lua on_punch function handled damage or the system needs to.
2017-02-01 22:13:49 +01:00
paramat 326cc5df74 Mgvalleys: Fix missing decorations and incorrect function order
Fix missing decorations at horizontal chunk borders by adding
'updateHeightmap()' after terrain generation.

Swap order of 'calculateNoise' and 'calcBiomeNoise' because
'calculateNoise' modifies the heat and humidity maps created in
'calcBiomeNoise'.

Remove confusing comment, code block is not just for mods and
seems essential for correct mapgen behaviour.
2017-02-01 15:05:35 +00:00
Ekdohibs d873545ac7 Fix anticheat resetting client position after the client is teleported
Previously, m_move_pool could accomodate the client moving from the new
position to the old one, and the server accepted the client to go back
to its old position. However, it couldn't then accomodate the client
moving from its old to its new position, and therefore would reset position
to the old position. Thus, by emptying m_move_pool after a teleport, the
server no longer accepts the client to go back to its old position. A
drawback is however that a laggy client *will* trigger a few
"moved_too_fast" anticheats before being told about its new position.

Don't report player cheated if caused by lag.

Fixes #5118
2017-02-01 15:03:57 +00:00
paramat cdc538e0a2 Plantlike visual scale: Send sqrt(visual_scale) to old clients
Keep compatibility with protocol < 30 clients now that visual_scale
is no longer applied twice to plantlike drawtype and mods are being
updated to a new value.
2017-01-30 16:38:28 +00:00
sapier e761b9f486 Add multiply texture modifier
Allows colorizing of textures using a color multiplication method.
2017-01-30 16:37:17 +00:00
Dániel Juhász 6642c8583a Use fabs() instead of abs() (#5141) 2017-01-30 08:18:18 +01:00
Dániel Juhász f0e3abc64d Re-add halo highlight (#5130)
Due to a rebase mistake halo highlighting was disabled. This commit
re-adds that feature.
2017-01-30 11:47:36 +10:00
Ezhh 0c9189d109 Add console height setting (#5136) 2017-01-30 02:10:17 +10:00
Zeno- 707e27b5c2 Rename height to scale for openConsole() (#5139)
For Game::openConsole() and GUIChatConsole::openConsole() the
parameter name 'height' is misleading because it's actually a
percentage of the screen/window height.
2017-01-29 19:26:00 +10:00
ShadowNinja 3eecc6ff44 Fix AIX threading build 2017-01-28 18:52:07 -05:00
ShadowNinja c93f7f5cea Fix synchronization issue at thread start
If a newly spawned thread called getThreadId or getThreadHandle before
the spawning thread finished saving the thread handle, then the
handle/id would be used uninitialized.  This would cause the threading
tests to fail since isCurrentThread would return false, and if Minetest
is built with C++11 support the std::thread object pointer would be
dereferenced while ininitialized, causing a segmentation fault.

This fixes the issue by using a mutex to force the spawned thread to
wait for the spawning thread to finish initializing the thread object.

An alternative way to handle this would be to also set the thread
handle/id in the started thread but this wouldn't work for C++11
builds because there's no way to get the partially constructed object.
2017-01-28 18:52:07 -05:00
SmallJoker 79d752ba4f from_table: Fix crash for missing inventory or field 2017-01-28 16:38:46 +01:00
sapier 814ee971f7 Make entity on_punch have same signature and behaviour as player on_punch 2017-01-28 15:57:54 +01:00
Paramat 953cbb3b15 Plantlike: Fix visual_scale being applied squared (#5115)
Visual_scale was applied twice to plantlike by accident sometime between
2011 and 2013, squaring the requested scale value. Visual_scale is
correctly applied once in it's other uses in signlike and torchlike.

Two lines of code are removed, they also had no effect for the vast
majority of nodes with the default visual_scale of 1.0.
The texture continues to have it's base at ground level.
2017-01-28 20:07:35 +10: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
paramat 2a89531071 Dungeongen: Fix selection of diagonal corridors
The do .. while loop is waiting for both dir.X and dir.Z to be non-zero,
so should continue to loop if either dir.X or dir.Z are zero. The brackets
present suggest this was intended to be OR not AND.
2017-01-26 20:19:05 +00:00
paramat ae929ce2fd Dungeons: Add nodebox stairs to desert and sandstone dungeons
Desert and sandstone dungeons have 2 node wide corridors. Previously,
nodebox stairs were disabled because dungeon generation code did not
support nodebox stairs wider than 1 node, now it does.

Add 'stair desert stone' content id to MappgenBasic.

Requires 'mapgen stair desert stone' to be added to Minetest Game.
2017-01-26 20:18:54 +00:00
Dániel Juhász c268db7b46 Fix after hardware node coloring (#5114) 2017-01-27 01:10:56 +10:00
paramat 9f108b56d3 Dungeongen: Fix out-of-voxelmanip access segfault
My recent dungeon commit allowed stairs to be placed across the full
width of corridors, but some of the new node positions accessed were
missing checks for being within the voxelmanip, causing occasional
segfaults near dungeons with corridors wider than 1 node.

Add 'vm->m_area.contains(pos)' checks just before stair position
voxelmanip access. This allows an earlier check to be removed as it
is now redundant.
2017-01-25 20:34:03 +01:00
rubenwardy 08911160aa Block spam messages before calling on_chatmessage callbacks (#4805)
Fixes #4799
2017-01-25 10:57:33 +01:00
number Zero 33e0eedbfb Add smooth lighting for all nodes
Note: Smooth lighting disables the mesh cache.
2017-01-24 13:59:40 -08:00
raymoo 87e9466caf Wrap to positive degree values (#5106) 2017-01-24 17:25:11 +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
paramat 59fdf57134 Zoom FOV: Reduce minimum zoom FOV to 7 degrees
The default of 15 is unchanged.
7 degrees is x10 magnification which is common for binoculars.
Alter hardcoded limits in camera.cpp:
Minimum 7 degrees.
Maximum 160 degrees to match upper limits in advanced settings.
2017-01-23 07:39:58 +00:00
paramat d413dfe87c Dungeons: Support nodebox stairs wider than 1 node
Previously, code did not support stair nodeboxes in corridors wider
than 1 node.
Make stair nodeboxes full width even in corridors with different
widths in X and Z directions.
2017-01-23 07:39:50 +00:00
Dániel Juhász d04d8aba70 Add hardware node coloring. Includes:
- Increase ContentFeatures serialization version
- Color property and palettes for nodes
- paramtype2 = "color", "colored facedir" or "colored wallmounted"
2017-01-23 07:27:12 +01:00
sfan5 43822de5c6 Fix potential crash in chat handling (since 2f56a00d9e) 2017-01-22 20:17:13 +01:00
Loïc Blot 39123fcce5 Remove os.exit from the Lua secure sandbox (#5090)
os.exit will exit not using proper resource liberation paths.

Mods should call the proper exit mod using our API
2017-01-21 22:05:54 +01:00
Loïc Blot 6d5a407133 Add show_statusline_on_connect setting (#5084)
Add show_statusline_on_connect setting
2017-01-21 19:30:42 +01:00
Loïc Blot bc29e03b59 Revert "Detach the player from entities on death." (#5087) 2017-01-21 17:30:55 +01:00
sapier b9c1a758a1 Fix unknown command message not providing number of cmd 2017-01-21 17:16:22 +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
Loïc Blot 0eede97af2 Warning fix for 2ea6015643 (#5082)
Neither flag as force delete nor show the warning when mapblock is full and object is a player
2017-01-21 20:29:18 +10:00
Loïc Blot 2ea6015643 Do not force deletion of players when mapblock is full (#5081)
This fixes #4067
2017-01-21 10:41:00 +01:00
red-001 0dada51a55 Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072) 2017-01-20 23:19:41 +01:00
SmallJoker dd282e646c Fix MSVC build Build broken by 98e36d7 2017-01-19 20:19:53 +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
red-001 2f56a00d9e Remove client-side chat prediction. (#5055)
Network lag isn't really a big issue with chat and chat prediction makes writing mods harder.
2017-01-17 00:09:47 +01:00
rubenwardy 63c892eedf Rename ObjectRef methods to be consistent and predictable 2017-01-16 15:34:44 +00:00
sapier f5070b4454 Added lua tracebacks to some errors where you have been blind to what… (#5043)
* Added lua tracebacks to some errors where you have been blind to what actually went wrong
2017-01-15 13:36:53 +01:00
sapier d03b4fb627 Add color names from web page referenced in luaapi doc 2017-01-15 02:03:51 +00:00
lhofhansl c41352a1c7 Only set material flag on rendered meshes (#5023) 2017-01-14 22:30:14 +01:00
sfan5 f0c6feca97 Fix build with freetype support disabled 2017-01-14 12:39:20 +01:00
Loic Blot ee9b59a7fe Fix another missing const reported by clang & @sfan5
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-14 12:20:59 +01:00
Loic Blot ee6d8c10ce Fix missing const in ServerActiveObject::getStaticData
This fixes #5033

Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-14 12:03:50 +01:00
ShadowNinja 8002366097 Organize defaultsettings.cpp 2017-01-13 19:06:51 -05:00
ShadowNinja bb154c2e1c Main menu tweaks 2017-01-13 18:13:43 -05:00
Loic Blot ef0aa7d5b5 Optimize SAO getStaticData by using std::string pointer instead of return copy
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-13 21:56:24 +01:00
Rogier e2dd96b432 Cleanup content_sao by factorizing similar code parts
Signed-off-by: Loic Blot <loic.blot@unix-experience.fr>
2017-01-13 21:56:24 +01:00
ShadowNinja 7ae7f1ea4c Enable mod security by default 2017-01-13 14:08:24 -05:00
paramat 25ba96fcac Meshes: Make object mesh face shading consistent
Previously, object meshes had their North and South faces darker than
East and West faces, the opposite of nodes and meshnodes. This commit
corrects this.
State constants as float-literals not double-literals.
Simplify code.
Add comment.
2017-01-13 02:42:18 +00:00
Rui 5d60a6c533 Make nametag removable with set_nametag_attributes (#5021) 2017-01-11 20:25:25 +01:00
Loic Blot 430d3b28e4 Cleanup some header inclusions to improve compilation times 2017-01-11 15:53:56 +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
zeuner 11df7e886a support older PostGreSQL versions (#4999)
* support older PostGreSQL versions
* documentation accuracy

* improve performance by affecting less rows in UPDATE queries
2017-01-09 17:03:13 +01:00
paramat 8c1b4f298e Map generation limit: Cache as 'const' not 'const static' 2017-01-08 21:18:11 +00:00
paramat ddcf8422a2 Map generation limit: Fix checks for block/sector over-limit
Fix the maths that check if any part of a mapblock or sector is over the
set map_generation_limit.
Therefore avoid the loading of any over-limit blocks that were previously
generated when map_generation_limit was larger. The set limit can vary
for a world because it is not yet a per-world mapgen parameter, even when
it is sometimes it will be changed deliberately.
Therefore avoid a player being returned to world centre if they re-enter
a world while being over-limit.

Fix the createSector() crash caused by a mob spawning over-limit in an
over-limit mapblock
2017-01-08 21:18:11 +00:00
Lars Hofhansl 1fee649f15 Minor: Fix indentation in serverenvironment.cpp 2017-01-08 19:22:33 +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 eb2c19bbed Move ClientEnvironment to dedicated cpp/header files 2017-01-08 12:16:06 +01:00
lhofhansl b0746834cc Get neighbor from same map block if possible in ABMHandler (#4998) 2017-01-08 17:42:25 +10:00
sfan5 ce106a4113 Revert "Extend minetest.is_yes()"
This reverts commit c435eabf3f.
2017-01-07 11:05:05 +01:00
red-001 c435eabf3f Extend minetest.is_yes() 2017-01-07 09:54:51 +01:00
Lars Hofhansl ca3629637c Fixes for using std:vector in ABMHander and further perf improvements 2017-01-04 21:37:29 +01:00
Rogier-5 ad10b8b762 Use std::vector instead of std::map in class ABMHandler 2017-01-04 21:37:29 +01:00
Dániel Juhász 3f8261830e Improve getPointedThing() (#4346)
* Improved getPointedThing()

The new algorithm checks every node exactly once.
Now the point and normal vector of the collision is also returned in the
PointedThing (currently they are not used outside of the function).
Now the CNodeDefManager keeps the union of all possible nodeboxes, so
the raycast won't miss any nodes. Also if there are only small
nodeboxes, getPointedThing() is exceptionally fast.
Also adds unit test for VoxelLineIterator.

* Cleanup, code move

This commit moves getPointedThing() and
Client::getSelectedActiveObject() to ClientEnvironment.
The map nodes now can decide which neighbors they are connecting to
(MapNode::getNeighbors()).
2017-01-04 19:18:40 +01:00
Lars Hofhansl 7387b19021 Pull occlusion check out of loop, and minor code cleanups. 2017-01-03 08:14:58 +01:00
sfan5 a07b032245 Add 2D sheet animation for nodes 2017-01-02 15:28:06 +01:00
Luke Puchner-Hardman 7057c196c4 Added "[sheet" to the texture special commands.
"[sheet:WxH:X,Y" assumes the base image is a tilesheet with W*H tiles
on it and crops to the tile at position X,Y.  Basically it works
like "[verticalframe" but in 2D.

For testing, I combined the four default_chest images into one.
2017-01-02 15:28:06 +01:00
sfan5 523f0e8c5b Move TileAnimation code to seperate file 2017-01-02 15:28:06 +01:00
Loic Blot e2e8da5ee4 Fix non reverted change on TOSERVER_BREATH compat 2017-01-01 23:57:37 +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
sfan5 dd3cda6bed Fix interact range check (thanks to @lhofhansl) 2016-12-29 19:35:22 +01:00
Rogier-5 abd68d3466 Use the outgoing split sequence number for every outgoing packet (#4864)
(instead of the last incoming sequence number...)

Fixes #4848
2016-12-29 13:44:47 +01:00
Auke Kok 094a5a73d3 Redo light.cpp.
Remake the light_decode_table.

The table starts out without pre-filled in values since those
are always discarded by the code apparently. We calculate a
pseudo curve with gamma power function, and then apply a new
adjustment table.

The adjustment table is setup to make the default gamma of 2.2
look decent: not too dark at light level 3 or so, but too dark
at 1 and below to be playable. The curve is much smoother than
before and looks reasonable at the whole range, offering a
pleasant decay of light levels away from lights.

The `display_gamma` setting now actually does something logical:
the game is darker at values below 2.2, and brighter at values
above 2.2. At 3.0, the game is very bright, but still has a good
light scale. At 1.1 or so, the bottom 5 light levels are virtually
black, but you can still see enough detail at light levels 7-8,
so the range and spread is adequate.

I must add that my monitor is somewhat dark to begin with, since
I have a `hc` screen that doesn't dynamic range colors or try to
pull up `black` pixels for me (it is tuned for accurate color and
light levels), so this should look even better on more dynamic
display tunings.
2016-12-28 14:16:39 -08:00
adrido 5a0a59ad46 Dont compare short with bool (#4963)
Fixes a compiler warning on MSVC
2016-12-28 21:22:01 +01:00
sfan5 084cdea686 Irrlicht 1.9 support 2016-12-26 22:36:22 +01:00
sfan5 b16252dcae Various anticheat improvements
* Calculate maximum interact distance from wielded tool
* New "interacted_while_dead" cheat_type for the Lua API
* Disallow dropping items while dead
* Move player to spawn before resurrecting them
2016-12-26 22:34:29 +01:00
Rogier 4d4b8bb8a4 Move PP() and PP2() macros to basic_macros.h
Instead of redefining them everywhere.
2016-12-24 00:32:50 +00:00
Lars Hofhansl 2f59a0c840 Process ABMs in a spherical volume instead of cubic
Increase active_block_range default to a 3 mapblock radius.
2016-12-24 00:28:39 +00:00
Rogier a76e7698b2 Make minetest abort on lua panic
Currently, lua does a regular exit() after a lua panic, which can make
a problem hard to debug. Invoking FATAL_ERROR() instead will print
some useful information, and abort() minetest, so that a debugger can
be used to analyze the situation.
2016-12-24 00:18:45 +00:00
est31 ba52a34f94 Don't ship with broken languages (#4940) 2016-12-21 14:15:48 +01:00
sfan5 09f1a0c1ff Disable mod security by default (closes #4944) 2016-12-21 14:13:10 +01:00
sfan5 cc7c31a5bc Fix warning reported by clang (possible bug in Settings lua api) 2016-12-21 10:20:06 +01:00
sfan5 bdf8f85493 Limit drawing rect of selected item to viewport size (fixes #4341) 2016-12-20 14:29:12 +01:00
ShadowNinja 0f0502109e Security: Fix resolving of some relative paths
Trying to resolve a path with RemoveRelativePathComponents that can't
be resolved without leaving leading parent components (e.g. "../worlds/foo"
or "bar/../../worlds/foo") will fail.  To work around this, we leave
the relative components and simply remove the trailing components one
at a time, and bail out when we find a parent component.  This will
still fail for paths like "worlds/foo/noexist/../auth.txt" (the path
before the last parent component must not exist), but this is fine
since you won't be able to open a file with a path like that anyways
(the O.S. will determine that the path doesn't exist.
Try `cat /a/../etc/passwd`).
2016-12-20 17:17:38 +10:00
ShadowNinja f522e7351a Fix RemoveRelatvePathComponents
This used to return "/foo" for "../foo" when it should return the enpty
string (i.e., error removing all relative components).
2016-12-20 17:17:38 +10:00
ShadowNinja 59f84ca0a0 Mod security: Allow read-only access to all mod paths 2016-12-20 06:34:04 +00:00
lhofhansl 24edfb77af Fix occlusion culling, again (#4930) 2016-12-19 06:43:04 +01:00