Commit Graph

5704 Commits

Author SHA1 Message Date
SmallJoker fec30e37ac
Fix AreaStore's IDs persistence (#8888)
Improve documentation
Read old formats
Fix free ID function. Return first gap in map
2019-09-21 17:54:52 +02:00
SmallJoker 5fa614d97e
Wieldhand: Specify which ItemStack to use (#8961)
Makes 'get_wield_item' to return the "main" ItemStack
2019-09-21 11:44:24 +02:00
Anand S 47da640d77 Add support for per-player FOV overrides and multipliers 2019-09-19 20:14:16 +02:00
sfan5 5c9983400f Remove incorrect MutexAutoLock
The line declared a variable "m_con" instead of locking m_con.
getClient() doesn't need this anyway, so remove it.
2019-09-19 16:46:41 +02:00
DS-Minetest 0b5c5499ec Trigger on_place in many situations even if prediction failed 2019-09-19 16:36:02 +02:00
SmallJoker 4271889ef8 Settings: Prevent mutex deadlock in remove() (#7803) 2019-09-18 18:48:41 +02:00
SmallJoker 94a5df795c
Inventory: Properly revert client predictions (#8945)
Caused by incremental inventory sending
Previously everything was overwritten by serializing the entire inventory
2019-09-18 18:47:09 +02:00
Hugo Locurcio 05a7da6279 Improve undersampling settings
The setting now accepts values between 1 and 8 in the
Advanced Settings menu.
Values 0 and 1 now behave the same way (setting it to 1 won't
disable MSAA anymore), so there's no need to expose 0 as a value.

This closes #8939.
2019-09-17 19:06:51 +02:00
SmallJoker e0a85fae01 Inventory: Undo prediction on drop 2019-09-17 19:02:01 +02:00
DS 1db3d252cf Fix the bgcolor formspec element (#8716) 2019-09-15 17:14:31 +01:00
rubenwardy 1ea9bfc6f7 Fix formspec version backup in prepends losing data 2019-09-15 16:56:11 +01:00
Paramat 23bd5630d0
Dungeons: Clean up parameters, improve structure variety (#8918)
While preserving the general character of dungeon structure.
Slightly increase the range of standard room horizontal size, while
preserving the average horizontal size.
Return to classic maximum large room size of 16x16x16.
Make 1 in 4 dungeons have a 1 in 8 chance for each room being 'large',
making multiple large rooms possible for the first time.
Make 1 in 8 dungeons allow diagonal corridors, to make these a little
more common.
Make corridor width vary from 1 to 2, but forced to 2 if diagonal
corridors are allowed, to make them passable.
Add some comments.
2019-09-14 23:02:07 +01:00
SmallJoker 1de4ca1f9d Built-in formspecs: Force version 1 2019-09-14 20:42:54 +02:00
ANAND 8e42a25e57 client.h: Add missing const's 2019-09-14 20:16:55 +02:00
ANAND 16d6ca3937 LocalPlayer: Fix code-style 2019-09-14 20:16:55 +02:00
ANAND eea082ee3f client.cpp: Fix code-style in Client::sendPlayerPos 2019-09-14 20:16:55 +02:00
ANAND e2d6445f2a Fix LocalPlayer::isDead always returning false if player is immortal 2019-09-14 20:16:55 +02:00
ANAND 81c7f0ae04 Send ActiveObjects once right after Init2 2019-09-14 20:16:55 +02:00
SmallJoker 9acd36bf99 Formspecs: Introduce formspec_version to mods 2019-09-14 19:43:08 +02:00
SmallJoker b0baa698a4 CSM: Fix itemstack:get_meta() 'metadata' indexing error 2019-09-14 19:42:30 +02:00
SmallJoker 23677be951 Load CSM environment after the restrictions are known
Safety-guards for CSM callbacks to abort on a bad implementation
Only run callbacks when the mods are loaded (and with it: builtin)

Duplication checks inside constructors
2019-09-14 19:42:25 +02:00
SmallJoker 720aedb467 InventoryManager: Fix virtual function overload warning 2019-09-09 20:35:45 +02:00
SmallJoker fae6242d4e Send cumulated inventory changes only each step (#8856)
Applies to player and detached inventories
2019-09-09 19:19:54 +02:00
updatepo.sh ae92bbe508 Update translation strings 2019-09-09 19:18:30 +02:00
Paramat 4682c7be5d
Dungeons: Remove non-functional 'projecting dungeons' setting (#8897) 2019-09-08 17:51:34 +01:00
HybridDog 36bfc67574 Move debug.txt after it grows too big (#8904)
Before opening the file for writing, its file size is tested. If it exceeds 50 MB, it is moved to debut.txt.1, otherwise the log is appended to the old messages. An old debut.txt.1 is removed if it already exists.
2019-09-07 19:38:54 +02:00
SmallJoker 2c9edefde3 label[]: Fix cut-off translated text 2019-09-07 11:15:12 +02:00
sfan5 ea9b241c13 Fix Irrlicht 1.9 support 2019-09-06 18:29:29 +02:00
sfan5 4582691104 Fix Inventory::moveItemSomewhere() 2019-09-03 20:16:36 +02:00
SmallJoker f3acdd3914
Inventory: Handle removeItem leftovers (#8884) 2019-09-02 19:30:36 +02:00
Muhammad Rifqi Priyo Susanto cd1d01b8b4 'All Settings': Don't use checkboxes for 'no...' mapgen flags (#7847) 2019-09-01 22:43:41 +01:00
ANAND 095f26a4f8 particles.cpp: Fix code-style
Mainly spacing and pointer placement
2019-08-31 19:05:53 +02:00
ANAND 96762af3ce clientobject.h: Fix code-style 2019-08-31 19:05:53 +02:00
Pedro Gimeno 9543b84970 Fix rotation of attached particlespawner
Co-authored-by: ANAND <ClobberXD@gmail.com>
2019-08-31 19:05:53 +02:00
SmallJoker 1d3f5af7c0 Inventory: Fix missing setModified calls
Previously inv:remove_item and inv:set_list did not trigger an inventory update
2019-08-25 09:46:54 +02:00
Paramat b53a60c8d5
Mapgen v6: Various mudflow code improvements and bugfixes (#8805)
Calculate 'i' inside 'y' loop to avoid 'i' and 'y' becoming
out of step due to the uses of 'continue'.
Simplify calculation of 'p2d' when coordinates are inverted.
Remove some unnecessary and unreliable 'index out of
voxelmanip' checks.
Move calculation of '&em' out of loops.
For 'Loop further down until not air' code, use y coordinate
to detect being out of voxelmanip, instead of checking index
which did not detect that.
Add and improve comments.
Indent the 'for (;; y--) {' loop.
Improve format and fix codestyle issues.
2019-08-24 20:06:31 +01:00
SmallJoker fbc8724d59 fontengine: Fix non-gettext builds 2019-08-24 19:11:50 +02:00
SmallJoker 0b4f424f41
Inventory: Send dirty lists where appropriate (#8742)
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time.

Raises protocol version to 38 to ensure correct backwards-compatible code.
2019-08-24 19:07:38 +02:00
Paul Ouellette 008b80fe1c Add ItemStack:get_description() to get tooltip (#8847) 2019-08-24 18:38:02 +02:00
sfan5 efbac7e446 Improve occlusion culling in corridors with additional check 2019-08-24 18:37:25 +02:00
sfan5 e8716ffede Restore approximate occlusion check
While less precise, it worked better which is what matters in the end.
2019-08-24 01:41:55 +02:00
DS b14aa305ce Make Mapgen::spreadLight use a queue (#8838) 2019-08-23 22:16:50 +02:00
SmallJoker 6ada090bb0 Occlusion: Check for light_propagates and do mapblock bounds checks 2019-08-23 19:17:43 +02:00
SmallJoker 7d016b4efd Occlusion: Begin cleanup 2019-08-23 19:17:43 +02:00
sfan5 ba8fb774c1 Revert "Don't send position update packet if player is dead"
This reverts commit fb6f1fdcbe.
2019-08-21 15:30:52 +02:00
SmallJoker b8131c3415 remove_detached_inventory: Fix segfault during mod load 2019-08-20 19:42:21 +02:00
ANAND fb6f1fdcbe Don't send position update packet if player is dead 2019-08-20 18:49:06 +02:00
ANAND 3c395d908f Disable autoforward if player is dead 2019-08-20 18:48:28 +02:00
theviper121 ded5da7800 Restore intended functionality to minimap markers (#8819) 2019-08-19 19:18:11 +02:00
SmallJoker d73e458db6
ClientInterface: Use recursive mutex to prevent freeze in on_newplayer() (#8808) 2019-08-17 13:27:28 +02:00
sfan5 13b22e2afb Remove unused function in ReliablePacketBuffer 2019-08-16 20:03:53 +02:00
sfan5 428a4c86e3 Minor refactor of IncomingSplitBuffer 2019-08-16 20:03:53 +02:00
sfan5 fc2f55d931 Drop m_list_size from ReliablePacketBuffer
It's not required and, worse, can lead to bugs.
2019-08-16 20:03:53 +02:00
Paramat d7c10b66d3
Mapgen v6: Fix mudflow iteration and iterate twice (#8795)
In MapgenV6::flowMud(), the previous implementation of coordinate
inversion caused the 2 inverted mudflow iterations (out of the 3
iterations) to not loop over the area, so only 1 non-inverted
iteration occurred.

Fix this bug but only iterate mudflow twice, as mapgen v6 has only
had 1 iteration for many years. There is now a good balance of 1
non-inverted iteration and 1 inverted iteration.
2019-08-15 20:32:28 +01:00
sfan5 2db0e93f73 network: Stricter handling of split packets 2019-08-15 20:15:22 +02:00
sfan5 c4491165da network: Fix crash in ReliablePacketBuffer on mismatching packets
In the error condition the exception would be thrown before m_list_size
is decremented, causing a nullptr dereference in e.g. popFirst().
2019-08-15 19:18:54 +02:00
upsilon b2065756cf Add function `minetest.read_schematic` 2019-08-14 13:15:41 +02:00
Jozef Behran bf22184d6e Fix unnecessary exception use in 3 more methods (#8791)
* Fix unnecessary exception use in Server::SendBlocks

The code in this method calls getBlockNoCreate and then
messes around with try...catch to skip blocks which are not
in the memory. Additionally, it repeatedly calls
m_env.getMap() inside this loop. Speed the code up by
extracting the m_env.getMap() out of the loop and getting
rid of the try...catch.

* Fix unnecessary exception use in Server::SendBlock

Another unnecessary try...catch is slowing down
Server::SendBlock. Remove that to speed it up and get a nice
side effect of simplifying the code in question.

* Fix unnecessary exception use in MMVManip::initialEmerge

Remove another unneeded exception usage from
MMVManip::initialEmerge to speed that code up and simplify
it but be careful to not remove the braces as there is a
TimeTaker in use there.
2019-08-13 20:02:50 +02:00
Jozef Behran 72b7a957af Fix unnecessary exception use in Map::getSectorXXX (#8792)
The Map::getSectorNoGenerate throws an exception but no other
code is really dependent on that. Fix the odd instance of
misuse in ClientMap::emergeSector and remove the exception
throwing version of the method along with the "NoEx" suffixes
in the names of these methods.
2019-08-13 19:58:27 +02:00
SmallJoker 539f016c1b
Better F6 profiler (#8750)
Update the profiler names to make more sense of what they actually represent
Move the profiler code from header to its source file
Use monospace font to align lines
Format the statistics line to align better with surrounding values
Refresh the profiler each 3 seconds (roughly)
2019-08-13 19:56:55 +02:00
Jozef Behran e9ceead81d Fix unnecessary exception use in Map::isNodeUnderground
The isNodeUnderground calls getBlockNoCreate which calls
getBlockNoCreateNoEx and throws InvalidPositionException
if the returned value is nullptr, which isNodeUnderground
then catches to return "false". Remove the try..catch in
isNodeUnderground by calling getBlockNoCreateNoEx instead
of getBlockNoCreate and checking the returned value for
nullptr.
2019-08-13 19:40:59 +02:00
Jozef Behran 833e60d8d2 Fix compare between pointer and 0 in unittests
Pointers shall be set to nullptr, not 0, according to the
coding standards. By implication they shall be compared with
nullptr, not 0, too. Fix this code to match that.
2019-08-13 14:44:32 +02:00
Beha 2f879e8bbd Clear old item groups when they are overridden. (#8753)
This fixes overridden items keeping their old groups in the group to
items mapping even after their groups have been changed in lua.
It also prevents a more widespread issue where overriding an item
will add its content ID *twice* to the mapping, resulting in odd
behaviour in features such as ABMs.
2019-08-12 19:18:52 +02:00
rubenwardy 91114b562f Add support for set_formspec_prepend in main menu (#8611) 2019-08-12 19:16:35 +02:00
Rogier a067d40454 Handle multiple deserialization of a block's entities
This fix consists of two parts:
- Clear the list of stored entities. This has no side-effects.
- Catch the case where active entities exist and print a message.
  Clearing the active entitiy list has side-effects that should
  be handled. (those entities are known to the environment and
  to clients).

  As avoiding those side-effects is more complex, and as this
  problem is not expected to occur (with PR #4847 merged), there
  is no real incentive to implement this ATM.

This issue was a contributing factor to bug #4217. With the other
contributing factor removed (PR #4847), this commit makes sure this
factor does not go unnoticed if it ever happens again.
2019-08-12 19:14:07 +02:00
Jozef Behran 49f1006183 Fix breakage of non-GLES2 setups (#8774)
The commit 526a9e4b66 breaks
the non-GLES2 setups because the code that is intended to
handle that is behind "elseif()" which is interpreted as
"elseif(false)" and thus the code never gets executed. Fix
that by changing the offending line to else().

Additionally, to avoid breaking the server only build
(which shall not have a dependency on GL/GLU/GLES at all),
enclose the entire block code in if(BUILD_CLIENT).
2019-08-10 23:32:46 +02:00
Paul Ouellette 120155f312 Fix some issues with minetest.clear_craft (#8712)
* Fix some issues with minetest.clear_craft

- Fix memory leak
- Fix crafts with an output count not being cleared when clearing by
  input.
- Fix recipe list being reversed when clearing by input.

* Add CraftInput::empty()
2019-08-10 23:28:00 +02:00
Jozef Behran 86d7f84b89 Merge pull request #8776 from osjc/FixGetNode
Finish getNode cleanup
2019-08-10 19:45:44 +02:00
sfan5 cf64054390 Implement adding velocity to player from Lua
The intended usecase is knockback, but there's potential for more.
2019-08-10 19:44:27 +02:00
ANAND d1c27c7e80 Allow customizing chat message format (#8529) 2019-08-08 17:04:46 +01:00
ANAND cc610c74a7 guiVolumeChange: Fix child not being removed 2019-08-08 18:03:35 +02:00
Paramat 37923920a0
Avoid crash caused by, and improve, 'findSpawnPos()' (#8728)
Avoid an unsuitable spawn position (which if outside mapgen limits can
cause a crash) if the main 0-3999 loop reaches its end. Fallback to a
spawn at 0,0,0.
Check the mapgen-returned 'spawn_level' value for being outside limits.
When 'air_count' reaches 2, move back down 1 to spawn in the lower
empty node.
If the spawn position is disallowed by 'objectpos_over_limit()', 'break'
from loop instead of 'continue' because positions above are probably
also over limit.
Reset 'air_count' to 0 if an obstruction is found, to make 'air_count'
consecutive empty nodes.
Allow spawn in 'airlike' drawtype nodes such as mod-added vacuum,
alien atmospheres, fog etc.
Add clarifying comments and improve codestyle.
2019-08-07 22:07:51 +01:00
SmallJoker 0c533dc436 Game: Fix double BS multiplication 2019-08-07 21:23:01 +02:00
ANAND e788ee283f Client::Interact: Use InteractAction enum instead of numeric constants
This replaces the magic numbers used as interaction modes both client-side and server-side, primarily for the sake of ease-of-readability.
2019-08-07 19:21:14 +02:00
SmallJoker e462a9a5ef
Unify wield item handling (#8677)
This moves the wield item functions to Player and the tool utils for range calculation
Also 'local_inventory' was removed due to redundancy in Client
2019-08-07 19:16:31 +02:00
ANAND 003af74213 guiConfirmRegistration: Set focus to text field (#8761) 2019-08-07 19:15:46 +02:00
ANAND fa6bc699bc Hide chat when console is open (#8656) 2019-08-07 19:15:33 +02:00
DS 1cef09ff10 Fix inventory_overlay for nodes without inventory_image (#8433) 2019-08-07 12:07:30 +02:00
sfan5 19426387d4 Optimize usage of TOSERVER_GOTBLOCKS packet 2019-08-07 11:32:16 +02:00
Beha 4d7f296717 Do not add group values of zero to group lists. (#8751)
This fixes an issue where when the engine looked up groups (for example,
in ABM node names), NodeDefManager's m_group_to_items would contain nodes
with a group value of zero, resulting in nodes with flammable = 0 being
burned by a fire mod with a group:flammable checking ABM.

It brings consistency to the behaviour described in the api
documentation, where zero and nil groups should be the same.
2019-08-07 10:48:04 +02:00
SmallJoker 233cb86e86
Clean up and fix freetype=false crashes (#8641)
A IGUIFont of type bitmap/vector cannot be converted to CGUITTFont
Fixes various segfaults in gameplay
Shorter font cache code, cleaned up (?)
2019-08-06 21:33:13 +02:00
Paramat 8da35c22d1
Mapgen Flat: Fix and improve getSpawnLevelAtPoint() (#8756)
Previously, this wrongly returned ground level (a position containing
a solid node) as spawn level.
Return ground level + 2 (+ 2 to spawn above biome 'dust' nodes).
Improve codestyle and make more consistent with generateTerrain().
2019-08-06 02:30:28 +01:00
sfan5 800fa2d8e7 Fix binary-string confusion in client network code 2019-08-04 20:40:35 +02:00
sfan5 6c2ded4cac Unify GLES support in gui scaling filter 2019-08-04 16:12:52 +02:00
sfan5 ca363d3ef8 Unify OpenGL ES support 2019-08-04 16:12:52 +02:00
sfan5 526a9e4b66 Let ENABLE_GLES appear in cmake_config.h and change its functionality 2019-08-04 16:12:52 +02:00
rubenwardy 4f7fa8d417 Add formspec testing to test mod in minimal 2019-08-03 19:36:30 +01:00
rubenwardy 9541165752 Add styles to most elements 2019-08-03 19:36:30 +01:00
rubenwardy ec3795a55c Add style[] tag with button support 2019-08-03 19:36:30 +01:00
rubenwardy d1a1c5cbf0 Add custom colorable GUIButton implementation 2019-08-03 19:36:30 +01:00
rubenwardy 41ad0f4f20 Fix negative offsets not being supported by container[] 2019-08-03 16:20:15 +01:00
Beha 1a97d06b5a Correct ServerActiveObject's virtual getArmorGroups() to be const.
Due to commit ec3142a , UnitSAO's getArmorGroups() did not match
ServerActiveObject's, notably resulting in the lua get_armor_groups() call
returning nothing.
2019-08-01 18:14:37 +02:00
SmallJoker 3ceef8e6a0 Mainmenu: Use textarea in error formspecs 2019-08-01 15:56:28 +02:00
Wuzzy ec3142af99 Group "immortal" also protects players from damage
Document new meaning of immortal=1 for players

Disable breathing if player is immortal

Hide builtin statbars if player immortal (delayed)

Co-authored-by: ClobberXD <ClobberXD@gmail.com>
2019-08-01 14:45:23 +02:00
sfan5 3296952ae5 Allow toolcaps to override the built-in times for dig_immediate 2019-07-31 18:28:21 +02:00
Methacrylon cdc7eb2d4c Sky: Refactor of moon and sun drawing (#8683)
Split sun and moon render parts from the main render function.
2019-07-30 20:25:47 +02:00
Beha b8aaef704d Move the clamping of hp/breath when their maximums change to read_object_properties(). (#8689)
This prevents set_properties() calls that have nothing to do with hp_max or breath_max overriding the saved hp before another mod has the chance to set a player's intended hp_max (such as in on_joinplayer).
2019-07-30 17:29:45 +02:00
DS-Minetest 115ef6c09c Rename guiScrollBar to GUIScrollBar 2019-07-29 21:45:39 +02:00
SmallJoker 4aa9a669cb
ContentCAO: Fix broken attachments on join (#8701)
What happened:
1) Object data is received. Client begins to read the data
2) Client initializes all its children (gob_cmd_update_infant)
3) Children try to attach to parent (yet not added)
4) Parent initializes, is added to the environment

And somewhere in between, Irrlicht wrecks up the attachments due to the missing matrix node.

The solution here is to:
1) Use the same structure as ServerActiveObject
2) Attach all children after the parent is really initialized
2019-07-29 19:14:07 +02:00
DS-Minetest 705630e7d0 guiScrollBar: move directly to clicked pos if clicked into tray 2019-07-28 21:43:07 +02:00