forked from mirror/openmw-tes3mp
[Client] Clean up more checks by using PlayerList::isDedicatedPlayer()
This commit is contained in:
parent
0a9768860b
commit
53081a6a6f
4 changed files with 63 additions and 18 deletions
|
@ -869,11 +869,18 @@ namespace MWMechanics
|
||||||
* Automatically equip NPCs torches at night and unequip them at day
|
* 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
|
Start of tes3mp change (major)
|
||||||
// that should return false only for them
|
|
||||||
if (!isPlayer && ptr.getBase()->canChangeCell)
|
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();
|
MWWorld::ContainerStoreIterator torch = inventoryStore.end();
|
||||||
for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it)
|
for (MWWorld::ContainerStoreIterator it = inventoryStore.begin(); it != inventoryStore.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "../mwmp/CellController.hpp"
|
#include "../mwmp/CellController.hpp"
|
||||||
#include "../mwmp/LocalPlayer.hpp"
|
#include "../mwmp/LocalPlayer.hpp"
|
||||||
#include "../mwmp/LocalActor.hpp"
|
#include "../mwmp/LocalActor.hpp"
|
||||||
|
#include "../mwmp/DedicatedPlayer.hpp"
|
||||||
/*
|
/*
|
||||||
End of tes3mp addition
|
End of tes3mp addition
|
||||||
*/
|
*/
|
||||||
|
@ -1345,11 +1346,16 @@ bool CharacterController::updateWeaponState()
|
||||||
mAttackType = "shoot";
|
mAttackType = "shoot";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// tes3mp needs player-controlled NPCs to not have their attacks
|
/*
|
||||||
// cancelled here, so a 2nd condition has been added that should
|
Start of tes3mp change (major)
|
||||||
// return true only for them
|
|
||||||
|
|
||||||
if(mPtr == getPlayer() || !mPtr.getBase()->canChangeCell)
|
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)
|
if (isWeapon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,16 @@
|
||||||
|
|
||||||
#include <components/sceneutil/positionattitudetransform.hpp>
|
#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/esmstore.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
@ -1026,10 +1036,16 @@ namespace MWMechanics
|
||||||
if (playerFollowers.find(*it) != playerFollowers.end())
|
if (playerFollowers.find(*it) != playerFollowers.end())
|
||||||
continue;
|
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
|
Start of tes3mp addition
|
||||||
if (!it->getBase()->canChangeCell)
|
|
||||||
|
We need player-controlled NPCs to not report crimes committed by other players
|
||||||
|
*/
|
||||||
|
if (mwmp::PlayerList::isDedicatedPlayer(*it))
|
||||||
continue;
|
continue;
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
|
|
||||||
if (type == OT_Theft || type == OT_Pickpocket)
|
if (type == OT_Theft || type == OT_Pickpocket)
|
||||||
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");
|
MWBase::Environment::get().getDialogueManager()->say(*it, "thief");
|
||||||
|
|
|
@ -8,6 +8,16 @@
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
#include <components/settings/settings.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/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.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"))
|
if (!Settings::Manager::getBool("prevent merchant equipping", "Game"))
|
||||||
return true;
|
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.
|
// Only autoEquip if we are the original owner of the item.
|
||||||
// This stops merchants from auto equipping anything you sell to them.
|
// This stops merchants from auto equipping anything you sell to them.
|
||||||
// ...unless this is a companion, he should always equip items given to him.
|
// ...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;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue