1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 22:09:42 +00:00

Make StartCombat a no-op for dead targets and don't play an attack line when already in combat

This commit is contained in:
Evil Eye 2024-01-22 22:07:49 +01:00
parent 76ad680549
commit 4dfe6078c8
3 changed files with 5 additions and 2 deletions

View file

@ -131,6 +131,7 @@
Bug #7758: Water walking is not taken into account to compute path cost on the water Bug #7758: Water walking is not taken into account to compute path cost on the water
Bug #7761: Rain and ambient loop sounds are mutually exclusive Bug #7761: Rain and ambient loop sounds are mutually exclusive
Bug #7765: OpenMW-CS: Touch Record option is broken Bug #7765: OpenMW-CS: Touch Record option is broken
Bug #7769: Sword of the Perithia: Broken NPCs
Bug #7770: Sword of the Perithia: Script execution failure Bug #7770: Sword of the Perithia: Script execution failure
Bug #7780: Non-ASCII texture paths in NIF files don't work Bug #7780: Non-ASCII texture paths in NIF files don't work
Feature #2566: Handle NAM9 records for manual cell references Feature #2566: Handle NAM9 records for manual cell references

View file

@ -1681,6 +1681,7 @@ namespace MWMechanics
return; return;
} }
const bool inCombat = stats.getAiSequence().isInCombat();
stats.getAiSequence().stack(MWMechanics::AiCombat(target), ptr); stats.getAiSequence().stack(MWMechanics::AiCombat(target), ptr);
if (target == getPlayer()) if (target == getPlayer())
{ {
@ -1715,6 +1716,7 @@ namespace MWMechanics
} }
// Must be done after the target is set up, so that CreatureTargetted dialogue filter works properly // Must be done after the target is set up, so that CreatureTargetted dialogue filter works properly
if (!inCombat)
MWBase::Environment::get().getDialogueManager()->say(ptr, ESM::RefId::stringRefId("attack")); MWBase::Environment::get().getDialogueManager()->say(ptr, ESM::RefId::stringRefId("attack"));
} }

View file

@ -507,7 +507,7 @@ namespace MWScript
runtime.pop(); runtime.pop();
MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(targetID, true, false); MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(targetID, true, false);
if (!target.isEmpty()) if (!target.isEmpty() && !target.getClass().getCreatureStats(target).isDead())
MWBase::Environment::get().getMechanicsManager()->startCombat(actor, target); MWBase::Environment::get().getMechanicsManager()->startCombat(actor, target);
} }
}; };