Commit Graph

7587 Commits

Author SHA1 Message Date
raymoo 7b8288d605 Fix default item callbacks to work with nil users (#5819)
* Fix default item callbacks to work with nil users

* item.lua: Handle node drops for invalid players

The if-condition for the dropping loop is the same as `inv`, which means that the 2nd possible definition of `give_item` is never used.
Remove redundant `local _, dropped_item`
2018-06-03 17:32:00 +02:00
Auke Kok 2f969196b8 Correct `prot_vers` in lua_api.txt.
We should avoid providing incorrect struct members in documentation
since people will be coding based on them.
2018-06-03 17:32:00 +02:00
Esteban I. RM 0041bcc73e Don't try to craft a non-existent item 2018-06-03 17:32:00 +02:00
rubenwardy cc48c95ca7 Profiler: Fix var args not being passed to callback register function
Fixes #6517
2018-06-03 17:31:59 +02:00
Loïc Blot 0129c9a9dd Thread: fix a crash on Windows due to data race condition on Thread::m_start_finished_mutex (#6515) 2018-06-03 17:31:59 +02:00
Loic Blot 9dc1f2d638 NetworkPacket::putRawPacket: resize m_data to datasize + memcpy
In some cases NetworkPacket was created using default constructor and m_data is not properly sized.
This fixed out of bounds memory copy
Also use memcpy instead of std::vector affectation to enhance packet creation
2018-06-03 17:31:59 +02:00
adrido d215198fe8 Replace deprecated WINAPI GetVersionInfoEx (#6496)
* Replace deprecated WINAPI GetVersionInfoEx
2018-06-03 17:31:59 +02:00
Rob Blanckaert c56c3d8d6f Add setting for near plane distance. (#6395)
* Allow setting the near plane

* - Add near_plane limit of 0.5 to prevent x-ray.
- Add more details to near_plane setting.
2018-06-03 17:31:59 +02:00
SmallJoker 0034abb560 Unkown nodes: Provide position on interact (#6505)
* Unkown nodes: Provide position on interact
2018-06-03 17:31:59 +02:00
SmallJoker 200e9cc4a2 ParticleSpawner::step cleanup and rotation fix (#6486)
* Particles: Move spawner code to a separate fucntion
2018-06-03 17:31:59 +02:00
paramat 6b0fb94d60 CAO footstep sounds: Reduce gain to balance volume 2018-06-03 17:31:59 +02:00
raymoo 017815161b Fix attached particle spawners far from spawn (#6479)
* Fix attached particle spawners far from spawn

When far from spawn, attached particle spawners
did not spawn particles.
2018-06-03 17:31:59 +02:00
SmallJoker ab72100a2c Localplayer: Fix disable_jump effect and getStandingNodePos()
Leave the old move code untouched.
2018-06-03 17:31:59 +02:00
raymoo 9927076b47 Document orientation parameter of set_attach (#6473) 2018-06-03 17:31:59 +02:00
Paramat bd8d6f8f2f Fix recent commit: std::max -> std::fmax for floats (#6469)
Fixes commit a455297d297c0819a7eff89e51e5f01a5ac731c3
<cmath> header was already present in commit.
2018-06-03 17:31:59 +02:00
paramat 3a9d500396 Positional sound: Limit volume when closer than 1 node
Change OpenAL distance model from AL_INVERSE_DISTANCE to
AL_INVERSE_DISTANCE_CLAMPED to avoid excessive volume when very close
to the sound location, for example MTG doors, and MTG fire sounds which
are combined at an average position and often located in air nodes.

Because AL_REFERENCE_DISTANCE has been reduced to 1 node (the distance
under which gain is clamped), multiply volume by the same factor to keep
sound gains the same as before, since the gain is calculated as:

gain = (AL_REFERENCE_DISTANCE / distance)
2018-06-03 17:31:59 +02:00
sfan5 01b9da870b Fix blocks written by vmanip not being marked as modified
This bug can be triggered by e.g. calling minetest.place_schematic()
and stopping the server immediately afterwards.
2018-06-03 17:31:59 +02:00
DTA7 e8286e8894 Set placer to nil instead of a non-functional one in item_OnPlace (#6449)
* Set placer to nil instead of a non-functional one

This requires nil checks in core.rotate_node and core.rotate_and_place.
2018-06-03 17:31:59 +02:00
paramat b8f473be21 Leveled nodebox: Change levels from 1/63rds to 1/64ths
Add missing documentation of leveled nodebox to lua_api.txt, plus
a little cleaning up nearby.
2018-06-03 17:31:59 +02:00
tenplus1 b1fae4c7be Fix Rotate Node Placement (#6424)
This properly checks for creative mode or privilege when using fixed rotate_node() function.
2018-06-03 17:31:59 +02:00
sfan5 c2a0333901 ServerEnv: Clean up object lifecycle handling (#6414)
* ServerEnv: Clean up object lifecycle handling
2018-06-03 17:31:59 +02:00
sfan5 5b2461c713 Fix core.wrap_text and make its behaviour consistent with the docs
Code based on initial implementation by @dsohler.
2018-06-03 17:31:59 +02:00
rubenwardy e9087d1be7 Fix empty legacy meta being persisted 2018-06-03 17:31:59 +02:00
Nathanaël Courant bb4ef52954 Statbars: fix incorrect half-images in non-standard orientations (fixes #6198) 2018-06-03 17:31:59 +02:00
Paramat 888b99e1b6 Android stepheight: Only increase if 'touching ground' (#6313) 2018-06-03 17:31:59 +02:00
Dániel Juhász 2c450ed93f Fix Android node selection distance (#6187) 2018-06-03 17:31:59 +02:00
Loïc Blot d9c7af109a serialize: use a temporary for SerializeException Exception must always use temporary instead of global copied exception instances, it's not recommended and should have undefined issues 2018-06-03 17:31:59 +02:00
Loic Blot 12562be393 Typo fix in compat code from commit 1d8d01074fdb52946f81110bebf1d001185b394b 2018-06-03 17:31:59 +02:00
Loïc Blot 151c19a6be ClientInterface: add a function to verify (correctly) if user limit was reached (#6258)
* ClientInterface: add a function to verify (correctly) if user limit was reached

CS_HelloSent is a better indicator of active slots than CS_Created, which are session objects created after init packet reception

Switch existing checks to ClientInterface::isUserLimitReached()

Use range-based for loop for getClientIds() used function too

This will fix #6254 (not the memory overhead if init is flooded)
2018-06-03 17:31:59 +02:00
Dániel Juhász 9d40d89d27 Make dropped items colorable 2018-06-03 17:31:59 +02:00
SmallJoker 037b01eac7 Trigger on_rightclick regardless on the formspec meta field
Document behaviour for older clients.
2018-06-03 17:31:59 +02:00
Fixer c789c532bb Full viewing range key message clarified
To make it sound less confusing to players
2018-06-03 17:31:59 +02:00
Jens Rottmann b3ffe675c3 Add tiny Y offset in collisionMoveSimple() to tweak performance
Another small general problem: the player is always standing exactly on the
bondary between 2 nodes e.g. Y=1.5 is exactly between nodes Y=1 and Y=2.
floatToInt() and myround() will round +/-n.5 always 'outwards' to +/-(n+1),
which means they behave differently depending on where you are: they round
upwards above sea level and downwards when underground. This inconsistency
comes from the way the coordinates are calculated, independent of the
specific C++ code.

The result is a tiny bit of lost performance when moving underground,
because 1 node level more than necessary is checked for collisions. This can
be amended by adding a tiny offset to minpos_f.Y, like @paramat suggested.
This is not an elegant solution, but still better than wasting CPU.
2018-06-03 17:31:59 +02:00
Jens Rottmann 90a9e4e69f Fix player coordinate rounding in collisionMoveSimple() (#6197)
To determine the area (nodes) where a player movement took place
collisionMoveSimple() first took the old/new player coordinates and rounded
them to integers, then added the player character's collision box and
implicitely rounded the result. This has 2 problems:

Rounding the position and the box seperately, then adding the resulting
integers means you get twice the rounding error. And implicit rounding
always rounds towards 0.0, unlike floatToInt(), which rounds towards the
closest integer.

Previous (simplified) behavior: round(pos)+(int)box, for example player at
Y=0.9, body is 1.75m high: round(0.9)+(int)1.75 = 1+1 = 2.
==> A character's height of 1.75m always got rounded down to 1m, its width
of +/-0.3 even became 0.

Fixed by adding the floats first, then rounding properly: round(pos+box) =
round(0.9+1.75) = round(2.65) = 3.
2018-06-03 17:31:59 +02:00
Juozas Pocius e5311a4d56 Fix crash when using --go in command line 2018-06-03 17:31:59 +02:00
SmallJoker 4be7d8b43a Noise: Prevent unittest crash caused by division by zero 2018-06-03 17:31:59 +02:00
SmallJoker 070ab6654a Sneak: Stripped down version
Fix taking damage caused by sneaking over a nodebox gap.
Fix strange behaviour on stair nodeboxes.
Enable jumping from node edges while sneaking.
Enable movement around corners while sneaking on a 1-node-high groove in a wall.
2018-06-03 17:31:59 +02:00
stujones11 ebf9dda2e6 Include TILE_MATERIAL_OPAQUE in shaders header (#6086) 2018-06-03 17:31:59 +02:00
stujones11 c352ff71e8 Tile material: Add 'TILE_MATERIAL_OPAQUE', use for drawtype 'NDT_NORMAL'
Prevents normal drawtype nodes having transparency.
Avoids clients cheating by using 'x-ray' texture packs with transparent textures.
2018-06-03 17:31:59 +02:00
paramat 26d0753d87 Mgv7: Fix undefined 'float_mount_height'
Commit cad10ce3b747b721fd63784915e05f12bc488128 altered the parameter
'float_mount_height' but was missing the necessary line in the constructor
to get the altered value from 'params'.

Fixes 3D floatland terrain generating everywhere.
2018-06-03 17:31:59 +02:00
Jesse McDonald 46ff2e2cef Fix for empty key/value when reading item string with wear but no metadata (#6058) 2018-06-03 17:31:59 +02:00
paramat a08a93bc9c Mgv7: Clean up divide-by-zero fix 2018-06-03 17:31:59 +02:00
paramat 6e0557e20c Mgv7: Avoid divide-by-zero errors
Some settings of paramters can cause mgv7 variables to be -inf, nan or -nan.
This can cause massive vertical columns of water to appear above sea level.
2018-06-03 17:31:59 +02:00
Dániel Juhász 0c91c65a11 Fix render order of overlays (#6008)
* Fix render order of overlays

* Use C++11 loops

* Fix time_t
2018-06-03 17:31:59 +02:00
Ezhh 849fe19f8c Fix console resize issue when maximising game window (#6023) 2018-06-03 17:31:59 +02:00
Zeno- cfa6216694 Fix console not being properly resized after window size changed (#6020) 2018-06-03 17:31:59 +02:00
Dániel Juhász 322e5aaf92 Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2018-06-03 17:31:59 +02:00
SmallJoker 03bc584f57 find_nodes_in_area: Extend maximal count to U32_MAX (#5277)
Extend documentation, limit area volume
Remove u16 count limitation

* Prevent integer overflow, replace minp/maxp with pos1/pos2
2018-06-03 17:31:59 +02:00
Loïc Blot 5f796f7a04 Verify HudSetParams input when hotbar textures are set (#6013)
* Verify HudSetParams input when hotbar textures are set

This fix #6011
2018-06-03 17:31:59 +02:00
paramat 7aa52fe4e1 (Re)spawn players within 'mapgen_limit'
Previously, findSpawnPos() did not take the 'mapgen_limit' setting into account,
a small limit often resulted in a spawn out in the void.
Use the recently added 'calcMapgenEdges()' to get max spawn range through a new
mapgenParams function 'getSpawnRangeMax()'.

Previously, when a player respawned into a world, 'objectpos_over_limit()' was
used as a check, which was inaccurate.
Use the recently added 'saoPosOverLimit()' to get exact mapgen edges.

Also fix default value of 'm_sao_limit_min'.
2018-06-03 17:31:59 +02:00