mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-04-11 11:36:45 +00:00
[Client] Send ActorAI with combat when an NPC's fight is set to 100
This commit is contained in:
parent
743933134d
commit
6d43c8d63d
1 changed files with 19 additions and 0 deletions
|
@ -297,6 +297,25 @@ namespace MWScript
|
||||||
MWMechanics::Stat<int> stat = ptr.getClass().getCreatureStats(ptr).getAiSetting(setting);
|
MWMechanics::Stat<int> stat = ptr.getClass().getCreatureStats(ptr).getAiSetting(setting);
|
||||||
stat.setModified(value, 0);
|
stat.setModified(value, 0);
|
||||||
ptr.getClass().getCreatureStats(ptr).setAiSetting(setting, stat);
|
ptr.getClass().getCreatureStats(ptr).setAiSetting(setting, stat);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Start of tes3mp addition
|
||||||
|
|
||||||
|
Setting an actor's AI_Fight to 100 is equivalent to starting combat with the local player,
|
||||||
|
so send a combat packet regardless of whether we're the cell authority or not; the server
|
||||||
|
can decide if it wants to comply with them by forwarding them to the cell authority
|
||||||
|
*/
|
||||||
|
if (setting == MWMechanics::CreatureStats::AI_Fight && value == 100)
|
||||||
|
{
|
||||||
|
mwmp::ActorList *actorList = mwmp::Main::get().getNetworking()->getActorList();
|
||||||
|
actorList->reset();
|
||||||
|
actorList->cell = *ptr.getCell()->getCell();
|
||||||
|
actorList->addAiActor(ptr, MWBase::Environment::get().getWorld()->getPlayerPtr(), mwmp::BaseActorList::COMBAT);
|
||||||
|
actorList->sendAiActors();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
End of tes3mp addition
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue