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

@ -540,6 +540,7 @@ function OnAllChunksAvailable()</pre> All return values from the callbacks are i
Notes = "Creates a new projectile of the specified kind at the specified coords. The projectile's creator is set to Creator (may be nil). The item that created the projectile entity, commonly the {{cPlayer|player}}'s currently equipped item, is used at present for fireworks to correctly set their entity metadata. It is not used for any other projectile. Optional speed indicates the initial speed for the projectile.",
},
DigBlock =
{
{
Params =
{
@ -555,6 +556,11 @@ function OnAllChunksAvailable()</pre> All return values from the callbacks are i
Name = "Z",
Type = "number",
},
{
Name = "Digger",
Type = "cEntity",
IsOptional = true,
},
},
Returns =
{
@ -562,7 +568,29 @@ function OnAllChunksAvailable()</pre> All return values from the callbacks are i
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. 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. 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.",
},
{
Params =
{
{
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.",
},
},
DoExplosionAt =
{

View File

@ -667,14 +667,14 @@ public:
/** 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.
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.
Replaces the specified block with air, and calls the apropriate block handlers (OnBreaking(), OnBroken()).
Wakes up the simulators.
Doesn't produce pickups, use DropBlockAsPickups() for that instead.
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);
}