mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:23:51 +00:00
[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();
|
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)
|
void LocalPlayer::sendWerewolfState(bool werewolfState)
|
||||||
{
|
{
|
||||||
isWerewolf = werewolfState;
|
isWerewolf = werewolfState;
|
||||||
|
|
|
@ -86,7 +86,6 @@ namespace mwmp
|
||||||
void sendTopic(const std::string& topic);
|
void sendTopic(const std::string& topic);
|
||||||
void sendKill(const std::string& refId, int number);
|
void sendKill(const std::string& refId, int number);
|
||||||
void sendBook(const std::string& bookId);
|
void sendBook(const std::string& bookId);
|
||||||
void sendScale(float newScale);
|
|
||||||
void sendWerewolfState(bool isWerewolf);
|
void sendWerewolfState(bool isWerewolf);
|
||||||
void sendMarkLocation(const ESM::Cell& newMarkCell, const ESM::Position& newMarkPosition);
|
void sendMarkLocation(const ESM::Cell& newMarkCell, const ESM::Position& newMarkPosition);
|
||||||
void sendSelectedSpell(const std::string& newSelectedSpellId);
|
void sendSelectedSpell(const std::string& newSelectedSpellId);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
Include additional headers for multiplayer purposes
|
Include additional headers for multiplayer purposes
|
||||||
*/
|
*/
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwmp/Main.hpp"
|
#include "../mwmp/Main.hpp"
|
||||||
#include "../mwmp/Networking.hpp"
|
#include "../mwmp/Networking.hpp"
|
||||||
#include "../mwmp/LocalPlayer.hpp"
|
#include "../mwmp/LocalPlayer.hpp"
|
||||||
|
@ -59,19 +60,24 @@ namespace MWScript
|
||||||
/*
|
/*
|
||||||
Start of tes3mp addition
|
Start of tes3mp addition
|
||||||
|
|
||||||
Send an ID_PLAYER_SHAPESHIFT every time a player changes
|
Prevent players from changing their own scale
|
||||||
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
|
scale is changed through a script
|
||||||
*/
|
*/
|
||||||
if (ptr == MWMechanics::getPlayer())
|
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
|
// Ignore attempts to change another player's scale
|
||||||
if (mwmp::PlayerList::isDedicatedPlayer(ptr))
|
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
|
else
|
||||||
{
|
{
|
||||||
mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
mwmp::ObjectList *objectList = mwmp::Main::get().getNetworking()->getObjectList();
|
||||||
|
|
Loading…
Reference in a new issue