Misc. AI fixes for CM test (#1165)
* Dumped ranged behaviors * Fixed some 1-liners (open storage, distancecon todo) Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.AI.WorldState.States.Inventory;
|
|||||||
using Content.Server.GameObjects.Components;
|
using Content.Server.GameObjects.Components;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.Interfaces.GameObjects;
|
using Robust.Shared.Interfaces.GameObjects;
|
||||||
|
|
||||||
@@ -24,15 +25,15 @@ namespace Content.Server.AI.Operators.Inventory
|
|||||||
|
|
||||||
public override Outcome Execute(float frameTime)
|
public override Outcome Execute(float frameTime)
|
||||||
{
|
{
|
||||||
if (!InteractionChecks.InRangeUnobstructed(_owner, _target.Transform.MapPosition))
|
|
||||||
{
|
|
||||||
return Outcome.Failed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ContainerHelpers.TryGetContainer(_target, out var container))
|
if (!ContainerHelpers.TryGetContainer(_target, out var container))
|
||||||
{
|
{
|
||||||
return Outcome.Success;
|
return Outcome.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!InteractionChecks.InRangeUnobstructed(_owner, container.Owner.Transform.MapPosition, ignoredEnt: container.Owner))
|
||||||
|
{
|
||||||
|
return Outcome.Failed;
|
||||||
|
}
|
||||||
|
|
||||||
if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) ||
|
if (!container.Owner.TryGetComponent(out EntityStorageComponent storageComponent) ||
|
||||||
storageComponent.IsWeldedShut)
|
storageComponent.IsWeldedShut)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
|
|||||||
new QuadraticCurve(-0.8f, 1.0f, 1.0f, 0.0f)),
|
new QuadraticCurve(-0.8f, 1.0f, 1.0f, 0.0f)),
|
||||||
// Somewhat prioritise distance
|
// Somewhat prioritise distance
|
||||||
new DistanceCon(
|
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
|
// Prefer weaker targets
|
||||||
new TargetHealthCon(
|
new TargetHealthCon(
|
||||||
new QuadraticCurve(1.0f, 0.4f, 0.0f, -0.02f)),
|
new QuadraticCurve(1.0f, 0.4f, 0.0f, -0.02f)),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
|
|||||||
new HasMeleeWeaponCon(
|
new HasMeleeWeaponCon(
|
||||||
new InverseBoolCurve()),
|
new InverseBoolCurve()),
|
||||||
new DistanceCon(
|
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 MeleeWeaponDamageCon(
|
||||||
new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)),
|
new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)),
|
||||||
new MeleeWeaponSpeedCon(
|
new MeleeWeaponSpeedCon(
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Content.Server.AI.Utility.Actions.Idle
|
|||||||
new StoredStateIsNullCon<LastOpenedStorageState, IEntity>(
|
new StoredStateIsNullCon<LastOpenedStorageState, IEntity>(
|
||||||
new InverseBoolCurve()),
|
new InverseBoolCurve()),
|
||||||
new DistanceCon(
|
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)
|
public override void SetupOperators(Blackboard context)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
|
|||||||
new ThirstCon(
|
new ThirstCon(
|
||||||
new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)),
|
new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)),
|
||||||
new DistanceCon(
|
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 DrinkValueCon(
|
||||||
new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)),
|
new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
|
|||||||
new HungerCon(
|
new HungerCon(
|
||||||
new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)),
|
new LogisticCurve(1000f, 1.3f, -1.0f, 0.5f)),
|
||||||
new DistanceCon(
|
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 FoodValueCon(
|
||||||
new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)),
|
new QuadraticCurve(1.0f, 0.4f, 0.0f, 0.0f)),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.BehaviorSets
|
|||||||
// TODO: Ideally long-term we should just store the weapons in backpack
|
// TODO: Ideally long-term we should just store the weapons in backpack
|
||||||
new EquipMeleeExp(),
|
new EquipMeleeExp(),
|
||||||
new PickUpMeleeWeaponExp(),
|
new PickUpMeleeWeaponExp(),
|
||||||
new MeleeAttackNearbySpeciesExp(),
|
new MeleeAttackNearbyPlayerExp(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ namespace Content.Server.AI.Utility.Considerations.Containers
|
|||||||
return 0.0f;
|
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;
|
return 1.0f;
|
||||||
|
|||||||
@@ -16,10 +16,9 @@ namespace Content.Server.AI.Utility.Considerations.Movement
|
|||||||
{
|
{
|
||||||
return 0.0f;
|
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.
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user