[Client] Clean up more checks by using PlayerList::isDedicatedPlayer()

0.6.1
David Cernat 8 years ago
parent 0a9768860b
commit 53081a6a6f

@ -869,11 +869,18 @@ namespace MWMechanics
* Automatically equip NPCs torches at night and unequip them at day
*/
// tes3mp needs player-controlled NPCs to not automatically unequip
// their light-emitting items, so a 2nd condition has been added
// that should return false only for them
if (!isPlayer && ptr.getBase()->canChangeCell)
/*
Start of tes3mp change (major)
We need player-controlled NPCs to not automatically unequip
their light-emitting items, so a 2nd condition has been added
for them
*/
if (!isPlayer && !mwmp::PlayerList::isDedicatedPlayer(ptr))
{
/*
End of tes3mp change (major)
*/
MWWorld::ContainerStoreIterator torch = inventoryStore.end();
for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it)
{

@ -37,6 +37,7 @@
#include "../mwmp/CellController.hpp"
#include "../mwmp/LocalPlayer.hpp"
#include "../mwmp/LocalActor.hpp"
#include "../mwmp/DedicatedPlayer.hpp"
/*
End of tes3mp addition
*/
@ -1345,11 +1346,16 @@ bool CharacterController::updateWeaponState()
mAttackType = "shoot";
else
{
// tes3mp needs player-controlled NPCs to not have their attacks
// cancelled here, so a 2nd condition has been added that should
// return true only for them
if(mPtr == getPlayer() || !mPtr.getBase()->canChangeCell)
/*
Start of tes3mp change (major)
We need player-controlled NPCs to not have their attacks
cancelled here, so a 2nd condition has been added for them
*/
if(mPtr == getPlayer() || mwmp::PlayerList::isDedicatedPlayer(mPtr))
/*
End of tes3mp change (major)
*/
{
if (isWeapon)
{

@ -9,6 +9,16 @@
#include <components/sceneutil/positionattitudetransform.hpp>
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include "../mwmp/DedicatedPlayer.hpp"
/*
End of tes3mp addition
*/
#include "../mwworld/esmstore.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/class.hpp"
@ -1026,10 +1036,16 @@ namespace MWMechanics
if (playerFollowers.find(*it) != playerFollowers.end())
continue;
// tes3mp needs player-controlled NPCs to not report crimes committed by other players,
// so a condition has been added that should be true only for them
if (!it->getBase()->canChangeCell)
/*
Start of tes3mp addition
We need player-controlled NPCs to not report crimes committed by other players
*/
if (mwmp::PlayerList::isDedicatedPlayer(*it))
continue;
/*
End of tes3mp addition
*/
if (type == OT_Theft || type == OT_Pickpocket)
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");

@ -8,6 +8,16 @@
#include <components/misc/rng.hpp>
#include <components/settings/settings.hpp>
/*
Start of tes3mp addition
Include additional headers for multiplayer purposes
*/
#include "../mwmp/DedicatedPlayer.hpp"
/*
End of tes3mp addition
*/
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/mechanicsmanager.hpp"
@ -212,6 +222,18 @@ bool MWWorld::InventoryStore::canActorAutoEquip(const MWWorld::Ptr& actor, const
if (!Settings::Manager::getBool("prevent merchant equipping", "Game"))
return true;
/*
Start of tes3mp addition
We need player-controlled NPCs to wear whatever their players are
actually wearing, so don't autoequip for them
*/
if (mwmp::PlayerList::isDedicatedPlayer(actor))
return false;
/*
End of tes3mp addition
*/
// Only autoEquip if we are the original owner of the item.
// This stops merchants from auto equipping anything you sell to them.
// ...unless this is a companion, he should always equip items given to him.
@ -224,12 +246,6 @@ bool MWWorld::InventoryStore::canActorAutoEquip(const MWWorld::Ptr& actor, const
return false;
}
// tes3mp needs player-controlled NPCs to wear whatever their players are
// actually wearing, so a condition has been added that should return
// false only for them
else if (!actor.getBase()->canChangeCell)
return false;
return true;
}

Loading…
Cancel
Save