cWorld: Manually bind deprecated broadcast functions (#4265)
Ref: https://github.com/cuberite/cuberite/pull/4264#discussion_r204769193
This commit is contained in:
parent
950aeffff8
commit
cdd8e42587
@ -293,6 +293,38 @@ return
|
|||||||
IsOptional = true,
|
IsOptional = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}. <b>OBSOLETE</b>, use the vector-based overload instead",
|
||||||
|
},
|
||||||
|
BroadcastParticleEffect =
|
||||||
|
{
|
||||||
|
Params =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Name = "ParticleName",
|
||||||
|
Type = "string",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "SourcePos",
|
||||||
|
Type = "Vector3f"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "Offset",
|
||||||
|
Type = "Vector3f",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "ParticleData",
|
||||||
|
Type = "number",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "ParticleAmount",
|
||||||
|
Type = "number",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "ExcludeClient",
|
||||||
|
Type = "cClientHandle",
|
||||||
|
IsOptional = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}",
|
Notes = "Spawns the specified particles to all players in the world exept the optional ExeptClient. A list of available particles by thinkofdeath can be found {{https://gist.github.com/thinkofdeath/5110835|Here}}",
|
||||||
},
|
},
|
||||||
BroadcastSoundEffect =
|
BroadcastSoundEffect =
|
||||||
@ -389,6 +421,30 @@ return
|
|||||||
IsOptional = true,
|
IsOptional = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient. <b>OBSOLETE</b>, use the vector overload instead",
|
||||||
|
},
|
||||||
|
BroadcastSoundParticleEffect =
|
||||||
|
{
|
||||||
|
Params =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Name = "EffectID",
|
||||||
|
Type = "number",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "SourcePos",
|
||||||
|
Type = "Vector3i"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "EffectData",
|
||||||
|
Type = "string",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name = "ExcludeClient",
|
||||||
|
Type = "cClientHandle",
|
||||||
|
IsOptional = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient",
|
Notes = "Sends the specified effect to all players in this world, except the optional ExceptClient",
|
||||||
},
|
},
|
||||||
CastThunderbolt =
|
CastThunderbolt =
|
||||||
|
@ -13,48 +13,258 @@
|
|||||||
#include "LuaChunkStay.h"
|
#include "LuaChunkStay.h"
|
||||||
|
|
||||||
|
|
||||||
|
/** Check that a Lua parameter is either a vector or 3 numbers in sequence
|
||||||
|
\param L The Lua state
|
||||||
|
\param a_VectorName name of the vector class e.g. "Vector3<int>"
|
||||||
|
\param a_Index Index to the start of the vector in the parameter list
|
||||||
|
\param[out] a_NextIndex Index of the next parameter after the vector
|
||||||
|
\retval true if the parameter is a vector or 3 numbers */
|
||||||
|
static bool CheckParamVectorOr3Numbers(cLuaState & L, const char * a_VectorName, int a_Index, int & a_NextIndex)
|
||||||
|
{
|
||||||
|
if (L.IsParamUserType(a_Index, a_VectorName))
|
||||||
|
{
|
||||||
|
a_NextIndex = a_Index + 1;
|
||||||
|
return L.CheckParamUserType(a_Index, a_VectorName);
|
||||||
|
}
|
||||||
|
|
||||||
|
a_NextIndex = a_Index + 3;
|
||||||
|
return L.CheckParamNumber(a_Index, a_Index + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Get a vector from the stack, which may be represented in lua as either a `Vector3<T>` or 3 numbers */
|
||||||
|
template <typename T>
|
||||||
|
static bool GetStackVectorOr3Numbers(cLuaState & L, int a_Index, Vector3<T> & a_Return)
|
||||||
|
{
|
||||||
|
Vector3<T> * UserType;
|
||||||
|
if (L.GetStackValue(a_Index, UserType))
|
||||||
|
{
|
||||||
|
a_Return = *UserType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return L.GetStackValues(a_Index, a_Return.x, a_Return.y, a_Return.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cWorld_BroadcastBlockAction(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
/* Function signature:
|
||||||
|
void BroadcastBlockAction(number a_BlockX, number a_BlockY, number a_BlockZ, number a_number1, number a_number2, number a_BlockType, cClientHandle a_Exclude)
|
||||||
|
--or--
|
||||||
|
void BroadcastBlockAction(Vector3<int> a_BlockPos, number a_Byte1, number a_Byte2, number a_BlockType, cClientHandle a_Exclude)
|
||||||
|
*/
|
||||||
|
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
int Byte1Index;
|
||||||
|
if (
|
||||||
|
!L.CheckParamSelf("cWorld") ||
|
||||||
|
!CheckParamVectorOr3Numbers(L, "Vector3<int>", 2, Byte1Index) ||
|
||||||
|
!L.CheckParamNumber(Byte1Index, Byte1Index + 2)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Byte1Index != 3) // Not the vector overload
|
||||||
|
{
|
||||||
|
L.LogStackTrace();
|
||||||
|
LOGWARN("BroadcastBlockAction with 3 position arguments is deprecated, use vector-parametered version instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the params:
|
||||||
|
cWorld * Self;
|
||||||
|
Vector3i BlockPos;
|
||||||
|
Byte Byte1, Byte2;
|
||||||
|
BLOCKTYPE BlockType;
|
||||||
|
const cClientHandle * Exclude = nullptr;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!L.GetStackValues(1, Self) ||
|
||||||
|
!GetStackVectorOr3Numbers(L, 2, BlockPos) ||
|
||||||
|
!L.GetStackValues(Byte1Index, Byte1, Byte2, BlockType)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional param
|
||||||
|
L.GetStackValue(Byte1Index + 3, Exclude);
|
||||||
|
|
||||||
|
Self->BroadcastBlockAction(BlockPos, Byte1, Byte2, BlockType, Exclude);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cWorld_BroadcastSoundEffect(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
/* Function signature:
|
||||||
|
void BroadcastSoundEffect(string a_SoundName, number a_X, number a_Y, number a_Z, number a_Volume, number a_Pitch, [cClientHandle * a_Exclude])
|
||||||
|
--or--
|
||||||
|
void BroadcastSoundEffect(string a_SoundName, Vector3d, number a_Volume, number a_Pitch, [cClientHandle a_Exclude])
|
||||||
|
*/
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
int VolumeIndex;
|
||||||
|
if (
|
||||||
|
!L.CheckParamSelf("cWorld") ||
|
||||||
|
!L.CheckParamString(2) ||
|
||||||
|
!CheckParamVectorOr3Numbers(L, "Vector3<double>", 3, VolumeIndex) ||
|
||||||
|
!L.CheckParamNumber(VolumeIndex, VolumeIndex + 1)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VolumeIndex != 4) // Not the vector overload
|
||||||
|
{
|
||||||
|
L.LogStackTrace();
|
||||||
|
LOGWARN("BroadcastSoundEffect with 3 position arguments is deprecated, use vector-parametered version instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the params:
|
||||||
|
cWorld * Self;
|
||||||
|
AString SoundName;
|
||||||
|
Vector3d BlockPos;
|
||||||
|
float Volume, Pitch;
|
||||||
|
const cClientHandle * Exclude = nullptr;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!L.GetStackValues(1, Self, SoundName) ||
|
||||||
|
!GetStackVectorOr3Numbers(L, 3, BlockPos) ||
|
||||||
|
!L.GetStackValues(VolumeIndex, Volume, Pitch)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional param
|
||||||
|
L.GetStackValue(VolumeIndex + 2, Exclude);
|
||||||
|
|
||||||
|
Self->BroadcastSoundEffect(SoundName, BlockPos, Volume, Pitch, Exclude);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int tolua_cWorld_BroadcastSoundParticleEffect(lua_State * tolua_S)
|
||||||
|
{
|
||||||
|
/* Function signature:
|
||||||
|
World:BroadcastSoundParticleEffect(EffectID a_EffectID, Vector3i a_SrcPos, number a_Data, [cClientHandle a_Exclude])
|
||||||
|
--or--
|
||||||
|
void BroadcastSoundParticleEffect(EffectID a_EffectID, number a_SrcX, number a_SrcY, number a_SrcZ, number a_Data, [cClientHandle a_Exclude])
|
||||||
|
*/
|
||||||
|
cLuaState L(tolua_S);
|
||||||
|
int DataIndex;
|
||||||
|
if (
|
||||||
|
!L.CheckParamSelf("cWorld") ||
|
||||||
|
!L.CheckParamNumber(2) ||
|
||||||
|
!CheckParamVectorOr3Numbers(L, "Vector3<int>", 3, DataIndex) ||
|
||||||
|
!L.CheckParamNumber(DataIndex)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DataIndex != 4) // Not the vector overload
|
||||||
|
{
|
||||||
|
L.LogStackTrace();
|
||||||
|
LOGWARN("BroadcastSoundParticleEffect with 3 position arguments is deprecated, use vector-parametered version instead.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the params:
|
||||||
|
cWorld * World = nullptr;
|
||||||
|
Int32 EffectId;
|
||||||
|
Vector3i SrcPos;
|
||||||
|
int Data;
|
||||||
|
cClientHandle * ExcludeClient = nullptr;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!L.GetStackValues(1, World, EffectId) ||
|
||||||
|
!GetStackVectorOr3Numbers(L, 3, SrcPos) ||
|
||||||
|
!L.GetStackValue(DataIndex, Data)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optional param
|
||||||
|
L.GetStackValue(DataIndex + 1, ExcludeClient);
|
||||||
|
|
||||||
|
World->BroadcastSoundParticleEffect(static_cast<EffectID>(EffectId), SrcPos, Data, ExcludeClient);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S)
|
static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S)
|
||||||
{
|
{
|
||||||
/* Function signature:
|
/* Function signature:
|
||||||
World:BroadcastParticleEffect("Name", PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2]
|
World:BroadcastParticleEffect("Name", PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2])
|
||||||
|
--or--
|
||||||
|
World:BroadcastParticleEffect("Name", SrcPos, Offset, ParticleData, ParticleAmount, [ExcludeClient], [OptionalParam1], [OptionalParam2])
|
||||||
*/
|
*/
|
||||||
cLuaState L(tolua_S);
|
cLuaState L(tolua_S);
|
||||||
|
int OffsetIndex, ParticleDataIndex;
|
||||||
if (
|
if (
|
||||||
!L.CheckParamUserType(1, "cWorld") ||
|
!L.CheckParamSelf("cWorld") ||
|
||||||
!L.CheckParamString (2) ||
|
!L.CheckParamString(2) ||
|
||||||
!L.CheckParamNumber (3, 10)
|
!CheckParamVectorOr3Numbers(L, "Vector3<float>", 3, OffsetIndex) ||
|
||||||
|
!CheckParamVectorOr3Numbers(L, "Vector3<float>", OffsetIndex, ParticleDataIndex)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((OffsetIndex != 4) || (ParticleDataIndex != 5)) // Not the vector overload
|
||||||
|
{
|
||||||
|
L.LogStackTrace();
|
||||||
|
LOGWARN("BroadcastParticleEffect with 3 position and 3 offset arguments is deprecated, use vector-parametered version instead.");
|
||||||
|
}
|
||||||
|
|
||||||
// Read the params:
|
// Read the params:
|
||||||
cWorld * World = nullptr;
|
cWorld * World = nullptr;
|
||||||
AString Name;
|
AString Name;
|
||||||
float PosX, PosY, PosZ, OffX, OffY, OffZ;
|
Vector3f SrcPos, Offset;
|
||||||
float ParticleData;
|
float ParticleData;
|
||||||
int ParticleAmount;
|
int ParticleAmount;
|
||||||
cClientHandle * ExcludeClient = nullptr;
|
cClientHandle * ExcludeClient = nullptr;
|
||||||
L.GetStackValues(1, World, Name, PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmount, ExcludeClient);
|
|
||||||
if (World == nullptr)
|
if (
|
||||||
|
!L.GetStackValues(1, World, Name) ||
|
||||||
|
!GetStackVectorOr3Numbers(L, 3, SrcPos) ||
|
||||||
|
!GetStackVectorOr3Numbers(L, OffsetIndex, Offset) ||
|
||||||
|
!L.GetStackValues(ParticleDataIndex, ParticleData, ParticleAmount)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
LOGWARNING("World:BroadcastParticleEffect(): invalid world parameter");
|
|
||||||
L.LogStackTrace();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read up to 2 more optional data params:
|
// Read up to 3 more optional params:
|
||||||
std::array<int, 2> data;
|
L.GetStackValue(ParticleDataIndex + 2, ExcludeClient);
|
||||||
for (int i = 0; (i < 2) && L.IsParamNumber(11 + i); i++)
|
|
||||||
|
std::array<int, 2> Data;
|
||||||
|
bool HasData = L.GetStackValues(ParticleDataIndex + 3, Data[0], Data[1]);
|
||||||
|
|
||||||
|
if (HasData)
|
||||||
{
|
{
|
||||||
L.GetStackValue(11 + i, data[static_cast<size_t>(i)]);
|
World->BroadcastParticleEffect(Name, SrcPos, Offset, ParticleData, ParticleAmount, Data, ExcludeClient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
World->BroadcastParticleEffect(Name, SrcPos, Offset, ParticleData, ParticleAmount, ExcludeClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
World->BroadcastParticleEffect(Name, Vector3f(PosX, PosY, PosZ), Vector3f(OffX, OffY, OffZ), ParticleData, ParticleAmount, ExcludeClient);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,6 +878,9 @@ void cManualBindings::BindWorld(lua_State * tolua_S)
|
|||||||
{
|
{
|
||||||
tolua_beginmodule(tolua_S, nullptr);
|
tolua_beginmodule(tolua_S, nullptr);
|
||||||
tolua_beginmodule(tolua_S, "cWorld");
|
tolua_beginmodule(tolua_S, "cWorld");
|
||||||
|
tolua_function(tolua_S, "BroadcastBlockAction", tolua_cWorld_BroadcastBlockAction);
|
||||||
|
tolua_function(tolua_S, "BroadcastSoundEffect", tolua_cWorld_BroadcastSoundEffect);
|
||||||
|
tolua_function(tolua_S, "BroadcastSoundParticleEffect", tolua_cWorld_BroadcastSoundParticleEffect);
|
||||||
tolua_function(tolua_S, "BroadcastParticleEffect", tolua_cWorld_BroadcastParticleEffect);
|
tolua_function(tolua_S, "BroadcastParticleEffect", tolua_cWorld_BroadcastParticleEffect);
|
||||||
tolua_function(tolua_S, "ChunkStay", tolua_cWorld_ChunkStay);
|
tolua_function(tolua_S, "ChunkStay", tolua_cWorld_ChunkStay);
|
||||||
tolua_function(tolua_S, "DoExplosionAt", tolua_cWorld_DoExplosionAt);
|
tolua_function(tolua_S, "DoExplosionAt", tolua_cWorld_DoExplosionAt);
|
||||||
|
@ -96,7 +96,7 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
|
|||||||
case E_META_DROPSPENSER_FACING_ZM: SmokeDir = static_cast<int>(SmokeDirection::SOUTH); break;
|
case E_META_DROPSPENSER_FACING_ZM: SmokeDir = static_cast<int>(SmokeDirection::SOUTH); break;
|
||||||
case E_META_DROPSPENSER_FACING_ZP: SmokeDir = static_cast<int>(SmokeDirection::NORTH); break;
|
case E_META_DROPSPENSER_FACING_ZP: SmokeDir = static_cast<int>(SmokeDirection::NORTH); break;
|
||||||
}
|
}
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, m_PosX, m_PosY, m_PosZ, SmokeDir);
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPos(), SmokeDir);
|
||||||
m_World->BroadcastSoundEffect("block.dispenser.dispense", Vector3d(m_PosX, m_PosY, m_PosZ), 1.0f, 1.0f);
|
m_World->BroadcastSoundEffect("block.dispenser.dispense", Vector3d(m_PosX, m_PosY, m_PosZ), 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ bool cJukeboxEntity::PlayRecord(int a_Record)
|
|||||||
EjectRecord();
|
EjectRecord();
|
||||||
}
|
}
|
||||||
m_Record = a_Record;
|
m_Record = a_Record;
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, m_PosX, m_PosY, m_PosZ, m_Record);
|
m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, GetPos(), m_Record);
|
||||||
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_ON);
|
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_ON);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ bool cJukeboxEntity::EjectRecord(void)
|
|||||||
Drops.push_back(cItem(static_cast<short>(m_Record), 1, 0));
|
Drops.push_back(cItem(static_cast<short>(m_Record), 1, 0));
|
||||||
m_Record = 0;
|
m_Record = 0;
|
||||||
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
|
m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8);
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, m_PosX, m_PosY, m_PosZ, 0);
|
m_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_PLAY_MUSIC_DISC, GetPos(), 0);
|
||||||
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_OFF);
|
m_World->SetBlockMeta(m_PosX, m_PosY, m_PosZ, E_META_JUKEBOX_OFF);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ bool cBlockDoorHandler::OnUse(cChunkInterface & a_ChunkInterface, cWorldInterfac
|
|||||||
case E_BLOCK_OAK_DOOR:
|
case E_BLOCK_OAK_DOOR:
|
||||||
{
|
{
|
||||||
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
ChangeDoor(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player.GetClientHandle());
|
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0, a_Player.GetClientHandle());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Prevent iron door from opening on player click
|
// Prevent iron door from opening on player click
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
// Standing aside - use last direction
|
// Standing aside - use last direction
|
||||||
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, OldMetaData);
|
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, OldMetaData);
|
||||||
}
|
}
|
||||||
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_FENCE_GATE_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0, a_Player.GetClientHandle());
|
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_FENCE_GATE_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0, a_Player.GetClientHandle());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1361,7 +1361,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
|
|||||||
// The ItemHandler is also responsible for spawning the pickups
|
// The ItemHandler is also responsible for spawning the pickups
|
||||||
cChunkInterface ChunkInterface(World->GetChunkMap());
|
cChunkInterface ChunkInterface(World->GetChunkMap());
|
||||||
BlockHandler(a_OldBlock)->OnDestroyedByPlayer(ChunkInterface, *World, *m_Player, a_BlockX, a_BlockY, a_BlockZ);
|
BlockHandler(a_OldBlock)->OnDestroyedByPlayer(ChunkInterface, *World, *m_Player, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, a_BlockX, a_BlockY, a_BlockZ, a_OldBlock, this);
|
World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, {a_BlockX, a_BlockY, a_BlockZ}, a_OldBlock, this);
|
||||||
// This call would remove the water, placed from the ice block handler
|
// This call would remove the water, placed from the ice block handler
|
||||||
if (!((a_OldBlock == E_BLOCK_ICE) && (ChunkInterface.GetBlock({a_BlockX, a_BlockY, a_BlockZ}) == E_BLOCK_WATER)))
|
if (!((a_OldBlock == E_BLOCK_ICE) && (ChunkInterface.GetBlock({a_BlockX, a_BlockY, a_BlockZ}) == E_BLOCK_WATER)))
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ void cExpBottleEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
|
|||||||
void cExpBottleEntity::Break(Vector3d a_HitPos)
|
void cExpBottleEntity::Break(Vector3d a_HitPos)
|
||||||
{
|
{
|
||||||
// Spawn an experience orb with a reward between 3 and 11.
|
// Spawn an experience orb with a reward between 3 and 11.
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, POSX_TOINT, POSY_TOINT, POSZ_TOINT, 0);
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SPLASH_POTION, GetPosition().Floor(), 0);
|
||||||
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), GetRandomProvider().RandInt(3, 11));
|
m_World->SpawnExperienceOrb(GetPosX(), GetPosY(), GetPosZ(), GetRandomProvider().RandInt(3, 11));
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,7 @@ void cSplashPotionEntity::Splash(Vector3d a_HitPos)
|
|||||||
|
|
||||||
m_World->BroadcastSoundParticleEffect(
|
m_World->BroadcastSoundParticleEffect(
|
||||||
EffectID::PARTICLE_SPLASH_POTION,
|
EffectID::PARTICLE_SPLASH_POTION,
|
||||||
FloorC(a_HitPos.x),
|
a_HitPos.Floor(),
|
||||||
FloorC(a_HitPos.y),
|
|
||||||
FloorC(a_HitPos.z),
|
|
||||||
m_PotionColor
|
m_PotionColor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
if (Random.RandBool(0.02))
|
if (Random.RandBool(0.02))
|
||||||
{
|
{
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::SOUTH_EAST));
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::SOUTH_EAST));
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::SOUTH_WEST));
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::SOUTH_WEST));
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::NORTH_EAST));
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::NORTH_EAST));
|
||||||
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), int(SmokeDirection::NORTH_WEST));
|
m_World->BroadcastSoundParticleEffect(EffectID::PARTICLE_SMOKE, GetPosition().Floor(), int(SmokeDirection::NORTH_WEST));
|
||||||
|
|
||||||
m_World->BroadcastSoundEffect("entity.horse.angry", GetPosition(), 1.0f, 1.0f);
|
m_World->BroadcastSoundEffect("entity.horse.angry", GetPosition(), 1.0f, 1.0f);
|
||||||
m_Attachee->Detach();
|
m_Attachee->Detach();
|
||||||
|
@ -117,7 +117,7 @@ void cSheep::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
// The sheep ate the grass so we change it to dirt
|
// The sheep ate the grass so we change it to dirt
|
||||||
m_World->SetBlock(PosX, PosY, PosZ, E_BLOCK_DIRT, 0);
|
m_World->SetBlock(PosX, PosY, PosZ, E_BLOCK_DIRT, 0);
|
||||||
GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_BLOCK_BREAK, PosX, PosY, PosX, E_BLOCK_GRASS);
|
GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_BLOCK_BREAK, {PosX, PosY, PosX}, E_BLOCK_GRASS);
|
||||||
m_IsSheared = false;
|
m_IsSheared = false;
|
||||||
m_World->BroadcastEntityMetadata(*this);
|
m_World->BroadcastEntityMetadata(*this);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
{
|
{
|
||||||
cChunkInterface ChunkInterface(a_World.GetChunkMap());
|
cChunkInterface ChunkInterface(a_World.GetChunkMap());
|
||||||
cBlockDoorHandler::SetOpen(ChunkInterface, a_Position.x, a_Position.y, a_Position.z, (a_PoweringData.PowerLevel != 0));
|
cBlockDoorHandler::SetOpen(ChunkInterface, a_Position.x, a_Position.y, a_Position.z, (a_PoweringData.PowerLevel != 0));
|
||||||
a_World.BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_Position.x, a_Position.y, a_Position.z, 0);
|
a_World.BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_DOOR_OPEN, a_Position, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@ -276,7 +276,7 @@ void cSandSimulator::FinishFalling(
|
|||||||
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_FallingBlockType, a_FallingBlockMeta);
|
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_FallingBlockType, a_FallingBlockMeta);
|
||||||
if (a_FallingBlockType == E_BLOCK_ANVIL)
|
if (a_FallingBlockType == E_BLOCK_ANVIL)
|
||||||
{
|
{
|
||||||
a_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_LAND, a_BlockX, a_BlockY, a_BlockZ, 0);
|
a_World->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_LAND, {a_BlockX, a_BlockY, a_BlockZ}, 0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1003,6 +1003,7 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
|
|||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
a_Player.GetWorld()->GetBlockTypeMeta(PosX, PosY, PosZ, Block, BlockMeta);
|
a_Player.GetWorld()->GetBlockTypeMeta(PosX, PosY, PosZ, Block, BlockMeta);
|
||||||
|
|
||||||
|
const Vector3i BlockPos{PosX, PosY, PosZ};
|
||||||
if (!a_Player.IsGameModeCreative() && (Block == E_BLOCK_ANVIL) && GetRandomProvider().RandBool(0.12))
|
if (!a_Player.IsGameModeCreative() && (Block == E_BLOCK_ANVIL) && GetRandomProvider().RandBool(0.12))
|
||||||
{
|
{
|
||||||
NIBBLETYPE Orientation = BlockMeta & 0x3;
|
NIBBLETYPE Orientation = BlockMeta & 0x3;
|
||||||
@ -1013,18 +1014,18 @@ void cSlotAreaAnvil::OnTakeResult(cPlayer & a_Player)
|
|||||||
{
|
{
|
||||||
// Anvil will break
|
// Anvil will break
|
||||||
a_Player.GetWorld()->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0);
|
a_Player.GetWorld()->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0);
|
||||||
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_BREAK, PosX, PosY, PosZ, 0);
|
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_BREAK, BlockPos, 0);
|
||||||
a_Player.CloseWindow(false);
|
a_Player.CloseWindow(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a_Player.GetWorld()->SetBlockMeta(PosX, PosY, PosZ, static_cast<NIBBLETYPE>(Orientation | (AnvilDamage << 2)));
|
a_Player.GetWorld()->SetBlockMeta(PosX, PosY, PosZ, static_cast<NIBBLETYPE>(Orientation | (AnvilDamage << 2)));
|
||||||
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, PosX, PosY, PosZ, 0);
|
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, BlockPos, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, PosX, PosY, PosZ, 0);
|
a_Player.GetWorld()->BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_ANVIL_USE, BlockPos, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1730,12 +1730,13 @@ void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal)
|
bool cWorld::GrowRipePlant(const int a_BlockX, const int a_BlockY, const int a_BlockZ, bool a_IsByBonemeal)
|
||||||
{
|
{
|
||||||
auto & random = GetRandomProvider();
|
auto & random = GetRandomProvider();
|
||||||
BLOCKTYPE BlockType;
|
BLOCKTYPE BlockType;
|
||||||
NIBBLETYPE BlockMeta;
|
NIBBLETYPE BlockMeta;
|
||||||
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
|
const Vector3i BlockPos{a_BlockX, a_BlockY, a_BlockZ};
|
||||||
switch (BlockType)
|
switch (BlockType)
|
||||||
{
|
{
|
||||||
case E_BLOCK_BEETROOTS:
|
case E_BLOCK_BEETROOTS:
|
||||||
@ -1754,7 +1755,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(3));
|
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(3));
|
||||||
}
|
}
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1774,7 +1775,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
||||||
}
|
}
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1789,7 +1790,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
}
|
}
|
||||||
++GrowState;
|
++GrowState;
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, static_cast<NIBBLETYPE>(GrowState << 2 | TypeMeta));
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, static_cast<NIBBLETYPE>(GrowState << 2 | TypeMeta));
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1809,7 +1810,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
||||||
}
|
}
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1844,7 +1845,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1864,7 +1865,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
BlockMeta = std::min(BlockMeta, static_cast<NIBBLETYPE>(7));
|
||||||
}
|
}
|
||||||
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta);
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,7 +1900,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1930,7 +1931,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
{
|
{
|
||||||
GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
|
GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta);
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1970,7 +1971,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
}
|
}
|
||||||
} // switch (random spawn block type)
|
} // switch (random spawn block type)
|
||||||
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
|
FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta);
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, {a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ}, 0);
|
||||||
} // for i - 50 times
|
} // for i - 50 times
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1985,7 +1986,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1999,7 +2000,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2013,7 +2014,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2040,7 +2041,7 @@ bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsBy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// spawn flower item
|
// spawn flower item
|
||||||
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::PARTICLE_HAPPY_VILLAGER, BlockPos, 0);
|
||||||
cItems FlowerItem;
|
cItems FlowerItem;
|
||||||
FlowerItem.Add(E_BLOCK_BIG_FLOWER, 1, BlockMeta);
|
FlowerItem.Add(E_BLOCK_BIG_FLOWER, 1, BlockMeta);
|
||||||
SpawnItemPickups(FlowerItem, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5);
|
SpawnItemPickups(FlowerItem, a_BlockX + 0.5, a_BlockY + 0.5, a_BlockZ + 0.5);
|
||||||
@ -3085,7 +3086,7 @@ bool cWorld::SetTrapdoorOpen(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_Op
|
|||||||
if (a_Open != IsOpen)
|
if (a_Open != IsOpen)
|
||||||
{
|
{
|
||||||
SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta ^ 0x4);
|
SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta ^ 0x4);
|
||||||
BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_TRAPDOOR_OPEN, a_BlockX, a_BlockY, a_BlockZ, 0);
|
BroadcastSoundParticleEffect(EffectID::SFX_RANDOM_WOODEN_TRAPDOOR_OPEN, {a_BlockX, a_BlockY, a_BlockZ}, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
31
src/World.h
31
src/World.h
@ -162,7 +162,7 @@ public:
|
|||||||
// Implemented in Broadcaster.cpp
|
// Implemented in Broadcaster.cpp
|
||||||
// (Please keep these alpha-sorted)
|
// (Please keep these alpha-sorted)
|
||||||
virtual void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
|
virtual void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
|
||||||
virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
|
virtual void BroadcastBlockAction (Vector3i a_BlockPos, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
|
||||||
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastBlockBreakAnimation(UInt32 a_EntityID, Vector3i a_BlockPos, Int8 a_Stage, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override; ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
|
virtual void BroadcastBlockEntity (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override; ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
|
||||||
|
|
||||||
@ -191,8 +191,8 @@ public:
|
|||||||
virtual void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastEntityAnimation (const cEntity & a_Entity, Int8 a_Animation, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
|
virtual void BroadcastEntityAnimation (const cEntity & a_Entity, Int8 a_Animation, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
|
||||||
virtual void BroadcastLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
|
virtual void BroadcastLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo) override;
|
||||||
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
|
||||||
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
|
||||||
virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastPlayerListAddPlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastPlayerListRemovePlayer (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastPlayerListUpdateGameMode (const cPlayer & a_Player, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
@ -202,8 +202,8 @@ public:
|
|||||||
virtual void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
virtual void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
|
||||||
virtual void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
virtual void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
|
||||||
virtual void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
|
virtual void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
|
||||||
virtual void BroadcastSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // tolua_export
|
virtual void BroadcastSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
|
||||||
virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastSoundParticleEffect (const EffectID a_EffectID, Vector3i a_SrcPos, int a_Data, const cClientHandle * a_Exclude = nullptr) override; // Exported in ManualBindings_World.cpp
|
||||||
virtual void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
virtual void BroadcastThunderbolt (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastThunderbolt (Vector3i a_BlockPos, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
@ -212,27 +212,6 @@ public:
|
|||||||
virtual void BroadcastUseBed (const cEntity & a_Entity, Vector3i a_BlockPos) override;
|
virtual void BroadcastUseBed (const cEntity & a_Entity, Vector3i a_BlockPos) override;
|
||||||
virtual void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = nullptr) override;
|
virtual void BroadcastWeather (eWeather a_Weather, const cClientHandle * a_Exclude = nullptr) override;
|
||||||
|
|
||||||
// Deprecated broadcasts maintained for lua compatibility
|
|
||||||
|
|
||||||
// tolua_begin
|
|
||||||
void BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, Byte a_Byte1, Byte a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude)
|
|
||||||
{
|
|
||||||
LOG("BroadcastBlockAction with integer position is deprecated, use vector-parametered version instead.");
|
|
||||||
BroadcastBlockAction({ a_BlockX, a_BlockY, a_BlockZ }, a_Byte1, a_Byte2, a_BlockType, a_Exclude);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BroadcastSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = nullptr)
|
|
||||||
{
|
|
||||||
LOG("BroadcastSoundEffect with double position arguments is deprecated, use vector-parametered version instead.");
|
|
||||||
BroadcastSoundEffect(a_SoundName, { a_X, a_Y, a_Z }, a_Volume, a_Pitch, a_Exclude);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BroadcastSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = nullptr)
|
|
||||||
{
|
|
||||||
BroadcastSoundParticleEffect(a_EffectID, { a_SrcX, a_SrcY, a_SrcZ }, a_Data, a_Exclude);
|
|
||||||
}
|
|
||||||
// tolua_end
|
|
||||||
|
|
||||||
virtual cBroadcastInterface & GetBroadcastManager(void) override
|
virtual cBroadcastInterface & GetBroadcastManager(void) override
|
||||||
{
|
{
|
||||||
return *this;
|
return *this;
|
||||||
|
Loading…
Reference in New Issue
Block a user