forked from mirror/openmw-tes3mp
[Server] Add script functions for getting world object placement info
This commit is contained in:
parent
27ac314cb1
commit
2c5cc82f49
3 changed files with 36 additions and 1 deletions
|
@ -83,6 +83,31 @@ int WorldFunctions::GetObjectRefNumIndex(unsigned int i) noexcept
|
|||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].refNumIndex;
|
||||
}
|
||||
|
||||
int WorldFunctions::GetObjectCount(unsigned int i) noexcept
|
||||
{
|
||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].count;
|
||||
}
|
||||
|
||||
int WorldFunctions::GetObjectGoldValue(unsigned int i) noexcept
|
||||
{
|
||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].goldValue;
|
||||
}
|
||||
|
||||
double WorldFunctions::GetObjectPosX(unsigned int i) noexcept
|
||||
{
|
||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].pos.pos[0];
|
||||
}
|
||||
|
||||
double WorldFunctions::GetObjectPosY(unsigned int i) noexcept
|
||||
{
|
||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].pos.pos[1];
|
||||
}
|
||||
|
||||
double WorldFunctions::GetObjectPosZ(unsigned int i) noexcept
|
||||
{
|
||||
return mwmp::Networking::getPtr()->getLastEvent()->objectChanges.objects[i].pos.pos[2];
|
||||
}
|
||||
|
||||
void WorldFunctions::SendObjectDelete() noexcept
|
||||
{
|
||||
mwmp::Networking::get().getWorldController()->GetPacket(ID_OBJECT_DELETE)->Send(worldEvent, worldEvent->guid);
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
\
|
||||
{"GetObjectRefId", WorldFunctions::GetObjectRefId},\
|
||||
{"GetObjectRefNumIndex", WorldFunctions::GetObjectRefNumIndex},\
|
||||
{"GetObjectCount", WorldFunctions::GetObjectCount},\
|
||||
{"GetObjectGoldValue", WorldFunctions::GetObjectGoldValue},\
|
||||
{"GetObjectPosX", WorldFunctions::GetObjectPosX},\
|
||||
{"GetObjectPosY", WorldFunctions::GetObjectPosY},\
|
||||
{"GetObjectPosZ", WorldFunctions::GetObjectPosZ},\
|
||||
\
|
||||
{"SendObjectDelete", WorldFunctions::SendObjectDelete},\
|
||||
{"SendObjectPlace", WorldFunctions::SendObjectPlace},\
|
||||
|
@ -40,6 +45,11 @@ public:
|
|||
|
||||
static const char *GetObjectRefId(unsigned int i) noexcept;
|
||||
static int GetObjectRefNumIndex(unsigned int i) noexcept;
|
||||
static int GetObjectCount(unsigned int i) noexcept;
|
||||
static int GetObjectGoldValue(unsigned int i) noexcept;
|
||||
static double GetObjectPosX(unsigned int i) noexcept;
|
||||
static double GetObjectPosY(unsigned int i) noexcept;
|
||||
static double GetObjectPosZ(unsigned int i) noexcept;
|
||||
|
||||
static void SendObjectDelete() noexcept;
|
||||
static void SendObjectPlace() noexcept;
|
||||
|
|
|
@ -35,9 +35,9 @@ void PacketObjectPlace::Packet(RakNet::BitStream *bs, WorldEvent *event, bool se
|
|||
|
||||
RW(worldObject.refId, send);
|
||||
RW(worldObject.refNumIndex, send);
|
||||
RW(worldObject.count, send);
|
||||
RW(worldObject.goldValue, send);
|
||||
RW(worldObject.pos, send);
|
||||
RW(worldObject.count, send);
|
||||
|
||||
if (!send)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue