diff --git a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs index fe2f5e24e1..c7c21ae3f2 100644 --- a/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs +++ b/Content.Server/AI/Operators/Inventory/OpenStorageOperator.cs @@ -3,6 +3,7 @@ using Content.Server.AI.WorldState.States.Inventory; using Content.Server.GameObjects.Components; using Content.Server.GameObjects.EntitySystems; using Content.Server.Utility; +using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.Containers; using Robust.Shared.Interfaces.GameObjects; @@ -24,15 +25,15 @@ namespace Content.Server.AI.Operators.Inventory public override Outcome Execute(float frameTime) { - if (!InteractionChecks.InRangeUnobstructed(_owner, _target.Transform.MapPosition)) - { - return Outcome.Failed; - } - if (!ContainerHelpers.TryGetContainer(_target, out var container)) { return Outcome.Success; } + + if (!InteractionChecks.InRangeUnobstructed(_owner, container.Owner.Transform.MapPosition, ignoredEnt: container.Owner)) + { + return Outcome.Failed; + } if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) || storageComponent.IsWeldedShut) diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeAttackEntity.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeAttackEntity.cs index 403ad6411a..081a569423 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeAttackEntity.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/MeleeAttackEntity.cs @@ -64,7 +64,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee new QuadraticCurve(-0.8f, 1.0f, 1.0f, 0.0f)), // Somewhat prioritise distance new DistanceCon( - new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)), + new QuadraticCurve(-1.0f, 1.0f, 1.02f, 0.0f)), // Prefer weaker targets new TargetHealthCon( new QuadraticCurve(1.0f, 0.4f, 0.0f, -0.02f)), diff --git a/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs b/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs index ae4e8da589..216152e4d8 100644 --- a/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs +++ b/Content.Server/AI/Utility/Actions/Combat/Melee/PickUpMeleeWeapon.cs @@ -42,7 +42,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee new HasMeleeWeaponCon( new InverseBoolCurve()), new DistanceCon( - new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)), + new QuadraticCurve(-1.0f, 1.0f, 1.02f, 0.0f)), new MeleeWeaponDamageCon( new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)), new MeleeWeaponSpeedCon( diff --git a/Content.Server/AI/Utility/Actions/Idle/CloseLastEntityStorage.cs b/Content.Server/AI/Utility/Actions/Idle/CloseLastEntityStorage.cs index 1fd934cdc2..29b7e7b918 100644 --- a/Content.Server/AI/Utility/Actions/Idle/CloseLastEntityStorage.cs +++ b/Content.Server/AI/Utility/Actions/Idle/CloseLastEntityStorage.cs @@ -26,7 +26,7 @@ namespace Content.Server.AI.Utility.Actions.Idle new StoredStateIsNullCon( new InverseBoolCurve()), new DistanceCon( - new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)), + new QuadraticCurve(-1.0f, 1.0f, 1.02f, 0.0f)), }; public override void SetupOperators(Blackboard context) { diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs b/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs index e9c181c5b7..c376641bb9 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Drink/PickUpDrink.cs @@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink new ThirstCon( new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)), new DistanceCon( - new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)), + new QuadraticCurve(-1.0f, 1.0f, 1.02f, 0.0f)), new DrinkValueCon( new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)), }; diff --git a/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs b/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs index 9db0b814dd..cd12fab1c7 100644 --- a/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs +++ b/Content.Server/AI/Utility/Actions/Nutrition/Food/PickUpFood.cs @@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food new HungerCon( new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)), new DistanceCon( - new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)), + new QuadraticCurve(-1.0f, 1.0f, 1.02f, 0.0f)), new FoodValueCon( new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)), }; diff --git a/Content.Server/AI/Utility/BehaviorSets/SpirateBehaviorSet.cs b/Content.Server/AI/Utility/BehaviorSets/SpirateBehaviorSet.cs index 2275cb317f..0c6360a6dd 100644 --- a/Content.Server/AI/Utility/BehaviorSets/SpirateBehaviorSet.cs +++ b/Content.Server/AI/Utility/BehaviorSets/SpirateBehaviorSet.cs @@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.BehaviorSets // TODO: Ideally long-term we should just store the weapons in backpack new EquipMeleeExp(), new PickUpMeleeWeaponExp(), - new MeleeAttackNearbySpeciesExp(), + new MeleeAttackNearbyPlayerExp(), }; } } diff --git a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs index a9af493745..4265db6abd 100644 --- a/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs +++ b/Content.Server/AI/Utility/Considerations/Containers/TargetAccessibleCon.cs @@ -31,6 +31,12 @@ namespace Content.Server.AI.Utility.Considerations.Containers return 0.0f; } } + else + { + // If we're in a container (e.g. held or whatever) then we probably can't get it. Only exception + // Is a locker / crate + return 0.0f; + } } return 1.0f; diff --git a/Content.Server/AI/Utility/Considerations/Movement/DistanceCon.cs b/Content.Server/AI/Utility/Considerations/Movement/DistanceCon.cs index 3ecb715c8a..b8dfee7354 100644 --- a/Content.Server/AI/Utility/Considerations/Movement/DistanceCon.cs +++ b/Content.Server/AI/Utility/Considerations/Movement/DistanceCon.cs @@ -16,10 +16,9 @@ namespace Content.Server.AI.Utility.Considerations.Movement { return 0.0f; } - - // TODO: Remove 1 - + // Kind of just pulled a max distance out of nowhere. Add 0.01 just in case it's reaally far and we have no choice so it'll still be considered at least. - return 1 - ((target.Transform.GridPosition.Position - self.Transform.GridPosition.Position).Length / 100 + 0.01f); + return (target.Transform.GridPosition.Position - self.Transform.GridPosition.Position).Length / 100 + 0.01f; } } }