mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-29 03:26:38 +00:00 
			
		
		
		
	Ignore distance when considering aggression due to crime (seems to work better, all balmora mages guild members now come to help when one is attacked)
This commit is contained in:
		
							parent
							
								
									1dc9e151cb
								
							
						
					
					
						commit
						a3ea7cb956
					
				
					 3 changed files with 7 additions and 5 deletions
				
			
		|  | @ -195,7 +195,7 @@ namespace MWBase | ||||||
| 
 | 
 | ||||||
|             /// @param bias Can be used to add an additional aggression bias towards the target,
 |             /// @param bias Can be used to add an additional aggression bias towards the target,
 | ||||||
|             ///             making it more likely for the function to return true.
 |             ///             making it more likely for the function to return true.
 | ||||||
|             virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0) = 0; |             virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false) = 0; | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1001,7 +1001,7 @@ namespace MWMechanics | ||||||
|             } |             } | ||||||
|             else |             else | ||||||
|             { |             { | ||||||
|                 bool aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(*it, player, aggression); |                 bool aggressive = MWBase::Environment::get().getMechanicsManager()->isAggressive(*it, player, aggression, true); | ||||||
|                 if (aggressive) |                 if (aggressive) | ||||||
|                 { |                 { | ||||||
|                     startCombat(*it, player); |                     startCombat(*it, player); | ||||||
|  | @ -1156,12 +1156,14 @@ namespace MWMechanics | ||||||
|         mActors.clear(); |         mActors.clear(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     bool MechanicsManager::isAggressive(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target, int bias) |     bool MechanicsManager::isAggressive(const MWWorld::Ptr &ptr, const MWWorld::Ptr &target, int bias, bool ignoreDistance) | ||||||
|     { |     { | ||||||
|         Ogre::Vector3 pos1 (ptr.getRefData().getPosition().pos); |         Ogre::Vector3 pos1 (ptr.getRefData().getPosition().pos); | ||||||
|         Ogre::Vector3 pos2 (target.getRefData().getPosition().pos); |         Ogre::Vector3 pos2 (target.getRefData().getPosition().pos); | ||||||
| 
 | 
 | ||||||
|         float d = pos1.distance(pos2); |         float d = 0; | ||||||
|  |         if (!ignoreDistance) | ||||||
|  |             d = pos1.distance(pos2); | ||||||
| 
 | 
 | ||||||
|         static int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find( |         static int iFightDistanceBase = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find( | ||||||
|                     "iFightDistanceBase")->getInt(); |                     "iFightDistanceBase")->getInt(); | ||||||
|  |  | ||||||
|  | @ -159,7 +159,7 @@ namespace MWMechanics | ||||||
| 
 | 
 | ||||||
|             /// @param bias Can be used to add an additional aggression bias towards the target,
 |             /// @param bias Can be used to add an additional aggression bias towards the target,
 | ||||||
|             ///             making it more likely for the function to return true.
 |             ///             making it more likely for the function to return true.
 | ||||||
|             virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0); |             virtual bool isAggressive (const MWWorld::Ptr& ptr, const MWWorld::Ptr& target, int bias=0, bool ignoreDistance=false); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue