forked from mirror/openmw-tes3mp
Implement ID_WORLD_OBJECT_SCALE and send it from ingame scripts
This commit is contained in:
parent
52d156e136
commit
7264f13b8e
4 changed files with 42 additions and 0 deletions
|
@ -767,6 +767,27 @@ void Networking::ProcessWorldPacket(RakNet::Packet *packet)
|
|||
|
||||
break;
|
||||
}
|
||||
case ID_WORLD_OBJECT_SCALE:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_OBJECT_SCALE");
|
||||
LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s",
|
||||
event->cellRef.mRefID.c_str(),
|
||||
event->cellRef.mRefNum.mIndex,
|
||||
event->cell.getDescription().c_str());
|
||||
|
||||
MWWorld::Ptr ptrFound = ptrCellStore->searchByRefNum(event->cellRef.mRefNum);
|
||||
|
||||
if (ptrFound)
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Found %s, %i",
|
||||
ptrFound.getCellRef().getRefId().c_str(),
|
||||
ptrFound.getCellRef().getRefNum());
|
||||
|
||||
MWBase::Environment::get().getWorld()->scaleObject(ptrFound, event->scale);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ID_WORLD_VIDEO_PLAY:
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "%s", "Received ID_WORLD_VIDEO_PLAY");
|
||||
|
|
|
@ -44,6 +44,15 @@ namespace MWScript
|
|||
Interpreter::Type_Float scale = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
// Added by tes3mp
|
||||
mwmp::WorldEvent *event = mwmp::Main::get().getNetworking()->createWorldEvent();
|
||||
event->cell = *ptr.getCell()->getCell();
|
||||
event->cellRef.mRefID = ptr.getCellRef().getRefId();
|
||||
event->cellRef.mRefNum = ptr.getCellRef().getRefNum();
|
||||
event->cellRef.mPos = ptr.getCellRef().getPosition();
|
||||
event->scale = scale;
|
||||
mwmp::Main::get().getNetworking()->GetWorldPacket(ID_WORLD_OBJECT_SCALE)->Send(event);
|
||||
|
||||
MWBase::Environment::get().getWorld()->scaleObject(ptr,scale);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,9 @@ namespace mwmp
|
|||
|
||||
ESM::Cell cell;
|
||||
ESM::CellRef cellRef;
|
||||
|
||||
int lockLevel;
|
||||
float scale;
|
||||
|
||||
std::string video;
|
||||
bool allowSkipping;
|
||||
|
|
|
@ -11,4 +11,14 @@ PacketObjectScale::PacketObjectScale(RakNet::RakPeerInterface *peer) : WorldPack
|
|||
void PacketObjectScale::Packet(RakNet::BitStream *bs, WorldEvent *event, bool send)
|
||||
{
|
||||
WorldPacket::Packet(bs, event, send);
|
||||
|
||||
RW(event->cellRef.mRefID, send);
|
||||
RW(event->cellRef.mRefNum.mIndex, send);
|
||||
|
||||
RW(event->cell.mData.mFlags, send);
|
||||
RW(event->cell.mData.mX, send);
|
||||
RW(event->cell.mData.mY, send);
|
||||
RW(event->cell.mName, send);
|
||||
|
||||
RW(event->scale, send);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue