1
0

Add default value nullptr for parameter a_Digger and added digger to

cWorld:DigBlock in lua api
This commit is contained in:
Lukas Pioch 2020-10-09 18:25:34 +02:00 committed by Tiger Wang
parent 2ca2a50b47
commit 6ddc03db09
2 changed files with 42 additions and 14 deletions

View File

@ -541,28 +541,56 @@ function OnAllChunksAvailable()</pre> All return values from the callbacks are i
}, },
DigBlock = DigBlock =
{ {
Params =
{ {
Params =
{ {
Name = "X", {
Type = "number", Name = "X",
Type = "number",
},
{
Name = "Y",
Type = "number",
},
{
Name = "Z",
Type = "number",
},
{
Name = "Digger",
Type = "cEntity",
IsOptional = true,
},
}, },
Returns =
{ {
Name = "Y", {
Type = "number", Type = "boolean",
}, },
{
Name = "Z",
Type = "number",
}, },
Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors. The optional Digger parameter specifies the entity who dug the block, usually a player. Returns true on success, or false if the chunk is not loaded or invalid coords. See also DropBlockAsPickups() for the version that drops pickups.",
}, },
Returns =
{ {
Params =
{ {
Type = "boolean", {
Name = "BlockPos",
Type = "Vector3i",
},
{
Name = "Digger",
Type = "cEntity",
IsOptional = true,
},
}, },
Returns =
{
{
Type = "boolean",
},
},
Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors. The optional Digger parameter specifies the entity who dug the block, usually a player. Returns true on success, or false if the chunk is not loaded or invalid coords. See also DropBlockAsPickups() for the version that drops pickups.",
}, },
Notes = "Replaces the specified block with air, without dropping the usual pickups for the block. Wakes up the simulators for the block and its neighbors. Returns true on success, or false if the chunk is not loaded or invalid coords. See also DropBlockAsPickups() for the version that drops pickups.",
}, },
DoExplosionAt = DoExplosionAt =
{ {

View File

@ -667,14 +667,14 @@ public:
/** Replaces the specified block with air, and calls the OnBroken block handler. /** Replaces the specified block with air, and calls the OnBroken block handler.
Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead. Wakes up the simulators. Doesn't produce pickups, use DropBlockAsPickups() for that instead.
Returns true on success, false if the chunk is not loaded. */ Returns true on success, false if the chunk is not loaded. */
bool DigBlock(Vector3i a_BlockPos, const cEntity * a_Digger); bool DigBlock(Vector3i a_BlockPos, const cEntity * a_Digger = nullptr);
/** OBSOLETE, use the Vector3-based overload instead. /** OBSOLETE, use the Vector3-based overload instead.
Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()). Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()).
Wakes up the simulators. Wakes up the simulators.
Doesn't produce pickups, use DropBlockAsPickups() for that instead. Doesn't produce pickups, use DropBlockAsPickups() for that instead.
Returns true on success, false if the chunk is not loaded. */ Returns true on success, false if the chunk is not loaded. */
bool DigBlock(int a_X, int a_Y, int a_Z, cEntity * a_Digger) bool DigBlock(int a_X, int a_Y, int a_Z, cEntity * a_Digger = nullptr)
{ {
return DigBlock({a_X, a_Y, a_Z}, a_Digger); return DigBlock({a_X, a_Y, a_Z}, a_Digger);
} }