1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 06:36:44 +00:00

Don't send packets for floating objects

This commit is contained in:
David Cernat 2016-10-25 16:30:31 +03:00
parent b1051255e0
commit cc40b85034

View file

@ -570,18 +570,23 @@ namespace MWScript
float az = ptr.getRefData().getPosition().rot[2]; float az = ptr.getRefData().getPosition().rot[2];
// Added by tes3mp // Added by tes3mp
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); //
event->cell = *ptr.getCell()->getCell(); // Only send packet for objects that don't have the spammy Float script
event->cellRef.mRefID = ptr.getCellRef().getRefId(); if (!Misc::StringUtils::ciEqual(ptr.getClass().getScript(ptr), "Float"))
event->cellRef.mRefNum = ptr.getCellRef().getRefNum(); {
event->pos.rot[0] = axis == "x" ? ax + rotation : ax; mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
event->pos.rot[1] = axis == "y" ? ay + rotation : ay; event->cell = *ptr.getCell()->getCell();
event->pos.rot[2] = axis == "z" ? az + rotation : az; event->cellRef.mRefID = ptr.getCellRef().getRefId();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ROTATE)->Send(event); event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->pos.rot[0] = axis == "x" ? ax + rotation : ax;
event->pos.rot[1] = axis == "y" ? ay + rotation : ay;
event->pos.rot[2] = axis == "z" ? az + rotation : az;
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ROTATE)->Send(event);
printf("Sending ID_OBJECT_ROTATE about %s\n%i\n", printf("Sending ID_OBJECT_ROTATE about %s\n%i\n",
event->cellRef.mRefID.c_str(), event->cellRef.mRefID.c_str(),
event->cellRef.mRefNum.mIndex); event->cellRef.mRefNum.mIndex);
}
if (axis == "x") if (axis == "x")
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax+rotation,ay,az); MWBase::Environment::get().getWorld()->rotateObject(ptr,ax+rotation,ay,az);
@ -662,13 +667,18 @@ namespace MWScript
float zr = ptr.getCellRef().getPosition().rot[2]; float zr = ptr.getCellRef().getPosition().rot[2];
// Added by tes3mp // Added by tes3mp
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent(); //
event->cell = *ptr.getCell()->getCell(); // Only send packet for objects that don't have the spammy Float script
event->cellRef.mRefID = ptr.getCellRef().getRefId(); if (!Misc::StringUtils::ciEqual(ptr.getClass().getScript(ptr), "Float"))
event->cellRef.mRefNum = ptr.getCellRef().getRefNum(); {
event->pos = ptr.getCellRef().getPosition(); mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ROTATE)->Send(event); event->cell = *ptr.getCell()->getCell();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_MOVE)->Send(event); event->cellRef.mRefID = ptr.getCellRef().getRefId();
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
event->pos = ptr.getCellRef().getPosition();
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_ROTATE)->Send(event);
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_OBJECT_MOVE)->Send(event);
}
MWBase::Environment::get().getWorld()->rotateObject(ptr, xr, yr, zr); MWBase::Environment::get().getWorld()->rotateObject(ptr, xr, yr, zr);