forked from mirror/openmw-tes3mp
[Client] Disallow clients from scaling their associated players
Additionally, display messages when trying to scale players.
This commit is contained in:
parent
8ca29dbaac
commit
59a56ca35e
4 changed files with 13 additions and 18 deletions
|
@ -1596,16 +1596,6 @@ void LocalPlayer::sendBook(const std::string& bookId)
|
|||
getNetworking()->getPlayerPacket(ID_PLAYER_BOOK)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendScale(float newScale)
|
||||
{
|
||||
scale = newScale;
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Sending ID_PLAYER_SHAPESHIFT with scale of %f", scale);
|
||||
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_SHAPESHIFT)->setPlayer(this);
|
||||
getNetworking()->getPlayerPacket(ID_PLAYER_SHAPESHIFT)->Send();
|
||||
}
|
||||
|
||||
void LocalPlayer::sendWerewolfState(bool werewolfState)
|
||||
{
|
||||
isWerewolf = werewolfState;
|
||||
|
|
|
@ -86,7 +86,6 @@ namespace mwmp
|
|||
void sendTopic(const std::string& topic);
|
||||
void sendKill(const std::string& refId, int number);
|
||||
void sendBook(const std::string& bookId);
|
||||
void sendScale(float newScale);
|
||||
void sendWerewolfState(bool isWerewolf);
|
||||
void sendMarkLocation(const ESM::Cell& newMarkCell, const ESM::Position& newMarkPosition);
|
||||
void sendSelectedSpell(const std::string& newSelectedSpellId);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
Include additional headers for multiplayer purposes
|
||||
*/
|
||||
#include <components/openmw-mp/Log.hpp>
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwmp/Main.hpp"
|
||||
#include "../mwmp/Networking.hpp"
|
||||
#include "../mwmp/LocalPlayer.hpp"
|
||||
|
@ -59,19 +60,24 @@ namespace MWScript
|
|||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Send an ID_PLAYER_SHAPESHIFT every time a player changes
|
||||
their own scale
|
||||
Prevent players from changing their own scale
|
||||
|
||||
Otherwise, send an ID_OBJECT_SCALE every time an object's
|
||||
Send an ID_OBJECT_SCALE every time an object's
|
||||
scale is changed through a script
|
||||
*/
|
||||
if (ptr == MWMechanics::getPlayer())
|
||||
mwmp::Main::get().getLocalPlayer()->sendScale(scale);
|
||||
else if (ptr.isInCell() && (ptr.getCellRef().getScale() != scale))
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("You can't change your own scale in multiplayer. Only the server can.");
|
||||
}
|
||||
else if (ptr.isInCell() && ptr.getCellRef().getScale() != scale)
|
||||
{
|
||||
// Ignore attempts to change another player's scale
|
||||
if (mwmp::PlayerList::isDedicatedPlayer(ptr))
|
||||
return;
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("You can't change the scales of other players. Only the server can.");
|
||||
}
|
||||
else
|
||||
{
|
||||
mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||
|
|
Loading…
Reference in a new issue