mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-30 02:56:44 +00:00 
			
		
		
		
	Don't add combat AI to player
This commit is contained in:
		
							parent
							
								
									3067082534
								
							
						
					
					
						commit
						d69ed78ccd
					
				
					 1 changed files with 13 additions and 10 deletions
				
			
		|  | @ -675,17 +675,20 @@ namespace MWClass | ||||||
| 
 | 
 | ||||||
|         // NOTE: 'object' and/or 'attacker' may be empty.
 |         // NOTE: 'object' and/or 'attacker' may be empty.
 | ||||||
| 
 | 
 | ||||||
|         // Attacking peaceful NPCs is a crime
 |         if (ptr != MWBase::Environment::get().getWorld()->getPlayerPtr()) | ||||||
|         if (!attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).isHostile() && |  | ||||||
|                 !MWBase::Environment::get().getMechanicsManager()->isAggressive(ptr, attacker)) |  | ||||||
|             MWBase::Environment::get().getMechanicsManager()->commitCrime(attacker, ptr, MWBase::MechanicsManager::OT_Assault); |  | ||||||
| 
 |  | ||||||
|         if (!attacker.isEmpty() && attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(ptr) |  | ||||||
|                 && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)) |  | ||||||
|         { |         { | ||||||
|             // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back.
 |             // Attacking peaceful NPCs is a crime
 | ||||||
|             // Note: accidental or collateral damage attacks are ignored.
 |             if (!attacker.isEmpty() && !ptr.getClass().getCreatureStats(ptr).isHostile() && | ||||||
|             MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, attacker); |                     !MWBase::Environment::get().getMechanicsManager()->isAggressive(ptr, attacker)) | ||||||
|  |                 MWBase::Environment::get().getMechanicsManager()->commitCrime(attacker, ptr, MWBase::MechanicsManager::OT_Assault); | ||||||
|  | 
 | ||||||
|  |             if (!attacker.isEmpty() && attacker.getClass().getCreatureStats(attacker).getAiSequence().isInCombat(ptr) | ||||||
|  |                     && !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat(attacker)) | ||||||
|  |             { | ||||||
|  |                 // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back.
 | ||||||
|  |                 // Note: accidental or collateral damage attacks are ignored.
 | ||||||
|  |                 MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, attacker); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         bool wasDead = getCreatureStats(ptr).isDead(); |         bool wasDead = getCreatureStats(ptr).isDead(); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue