Data-driven NPC behaviors (#3271)

* Data-driven NPC behaviors

* Nuked AiLogicProcessor
* BehaviorSets are now all stored in yaml (might try making actions also yaml someday)
* Added a test to validate all BehaviorSets
* Might also try pooling actions in the future to reduce allocs but that'll be way down the line (cough physics).

* Forgot to re-add sorting nothing suss

* Remove last references

* Proper vector2i serialization for tile atmos (#3266)

* update map files

* update submodule

Co-authored-by: cyclowns <cyclowns@protonmail.ch>

* Remove weird "S" jumpsuit from existence (#3267)

* Change character names to use datasets prototypes (#3259)

* Remove old name lists in .txts

* Fix tests

* LATEST MASTER TECHNOLOGY

* Converts AdminMenu to partially use XAML (#3231)

* Cleans up Hydroponics content. (#3025)

* Adds to IgnoredComponents.cs

* Jackboots

* Half Done

* Moved to diff PR

* Everything functional

* Fixed Sprays

* Nice

* Fixed

* Update submodule

* Fix tests

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>

* Stacked sprite visualizer (#3096)

* Add Stack Visualizer

* Add cigarette pack resources

Adds transparent layers for visualizing cigarettes

* Add Bag Open/Close Visualizer

So storage opened in inventory can have different icons when opened
or closed.

* Create a component that only enumerates single item

Used for creating stuff like matchbox, or cigarettes. As a bonus.
It will only update stack visualizer for that particullar item.

* Refactoring stuff

* Fix other usage of stack in Resources

* Add docs

* Apply suggestions from code review

Apply metalgearsloth suggestions

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Applied suggestions from metalgearsloth

* Changed SingleItemStorageComponent to StorageCounterComponent

Difference. New component doesn't spawn items, merely counts them.

* Refactored StackVisualizer

* Fix breakage with master

* Update Resources/Prototypes/Entities/Objects/Consumable/fancy.yml

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Update with MGS suggestions

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* ApcNet updating fix (#3078)

* GridPowerComponent

* ApcNet Powered update bugfix

* PowerTest fix

* Add GridPower to Saltern

* test fix

* Update canceling cleanup

* code cleanup

* nullable & code cleanup for test

* undo power test nullable

* Replaces GridPowerSystem with ApcNetSystem

* build fix

* Update Content.Server/GameObjects/EntitySystems/ApcNetSystem.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Change all XAML to use spacestation14.io namespace (#3277)

* fix pizzaboxes (#3291)

Co-authored-by: cyclowns <cyclowns@protonmail.ch>

* Spikes fix reopened (#3203)

* DoAfter, dead and stun check, DragDropOn

* Not ignored anymore

* Copied comment deleted

* Herbert's an ass

* Woops

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>

* Make component states dependant on the player getting them (#3280)

* Make component states dependant on the player getting them

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>

* Updated submodule to v0.3.7.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Acruid <shatter66@gmail.com>

* Hoe fix (#3296)

* Initial (#3297)

* Sort reagent dispenser entries (#3272)

* Sort reagent dispenser entries

Saves manually doing it.

* zumzum's suggestion

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>

* Made firelocks damageable & destructible (#3303)

* Move job priority enum parity test ot unit tests (#3300)

* Spill hand contents when dropping them in a fall (#3304)

* Spill hand contents when dropping them due to falling down

* Better approach

* cleanup

* grammar

* stupid

* PauseManager moved to Shared (#3288)

* Namespace changes for moving IPauseManager to shared.

* Namespace changes for moving ITimerManager from Timers to Timing.

* Rebase Fixes.

* Update engine submodule to v0.3.8

* Improves kick, teleport and ban menus (#3312)

* Fix the admin panel not showing the account name (#3322)

* Fix name serialization for secret stashes (#3301)

* Fix name serialization for secret stashes

* Fix old usages of secret part name

* Separate ghost warp message into two (#3310)

* Separate ghost warp message into two

* Remove redundant arguments

* Address reviews

* Move properties up

* Add health overlay and a command to toggle it (#3278)

* Add health overlay bar and a command to toggle it

* Remove empty line

* Content PR for YAML hot reloading (#3319)

* Content PR for YAML hot reloading

* Add CanAdminReloadPrototypes (host permission)

* IndexedPrototype fixes

* Update RobustToolbox

* Update RobustToolbox

* Add an unconspicuous, meaningless and in no way motivated by any external force XML doc to buckle component

* Update RobustToolbox

* Update submodule to v0.3.12.

* Removed unused using statements that prevented compiling.
Removed references to IIndexedPrototype that does not exist anymore in the engine.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: mirrorcult <notzombiedude@gmail.com>
Co-authored-by: cyclowns <cyclowns@protonmail.ch>
Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: Leo <lzimann@users.noreply.github.com>
Co-authored-by: Swept <sweptwastaken@protonmail.com>
Co-authored-by: Ygg01 <y.laughing.man.y@gmail.com>
Co-authored-by: collinlunn <60152240+collinlunn@users.noreply.github.com>
Co-authored-by: komunre <49118681+komunre@users.noreply.github.com>
Co-authored-by: Acruid <shatter66@gmail.com>
Co-authored-by: Peptide90 <78795277+Peptide90@users.noreply.github.com>
Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
metalgearsloth
2021-02-20 17:37:17 +11:00
committed by GitHub
parent 6f72f8f553
commit 4437fc7a1b
74 changed files with 548 additions and 707 deletions

View File

@@ -13,27 +13,21 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves
{
public sealed class EquipGloves : UtilityAction
{
private readonly IEntity _entity;
public EquipGloves(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseItemInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseItemInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -14,25 +14,19 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves
{
public sealed class PickUpGloves : UtilityAction
{
private readonly IEntity _entity;
public PickUpGloves(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -13,27 +13,21 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Head
{
public sealed class EquipHead : UtilityAction
{
private readonly IEntity _entity;
public EquipHead(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseItemInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseItemInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -14,23 +14,17 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Head
{
public sealed class PickUpHead : UtilityAction
{
private readonly IEntity _entity;
public PickUpHead(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -13,27 +13,21 @@ namespace Content.Server.AI.Utility.Actions.Clothing.OuterClothing
{
public sealed class EquipOuterClothing : UtilityAction
{
private readonly IEntity _entity;
public EquipOuterClothing(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseItemInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseItemInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -14,23 +14,17 @@ namespace Content.Server.AI.Utility.Actions.Clothing.OuterClothing
{
public sealed class PickUpOuterClothing : UtilityAction
{
private readonly IEntity _entity;
public PickUpOuterClothing(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -13,27 +13,21 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Shoes
{
public sealed class EquipShoes : UtilityAction
{
private readonly IEntity _entity;
public EquipShoes(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseItemInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseItemInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -14,23 +14,17 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Shoes
{
public sealed class PickUpShoes : UtilityAction
{
private readonly IEntity _entity;
public PickUpShoes(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -15,27 +15,21 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class EquipMelee : UtilityAction
{
private readonly IEntity _entity;
public EquipMelee(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity)
new EquipEntityOperator(Owner, Target)
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<WeaponEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(Target);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -21,13 +21,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class MeleeWeaponAttackEntity : UtilityAction
{
private readonly IEntity _entity;
public MeleeWeaponAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
@@ -35,26 +29,26 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
var equipped = context.GetState<EquippedEntityState>().GetValue();
if (equipped != null && equipped.TryGetComponent(out MeleeWeaponComponent meleeWeaponComponent))
{
moveOperator = new MoveToEntityOperator(Owner, _entity, meleeWeaponComponent.Range - 0.01f);
moveOperator = new MoveToEntityOperator(Owner, Target, meleeWeaponComponent.Range - 0.01f);
}
else
{
// TODO: Abort
moveOperator = new MoveToEntityOperator(Owner, _entity);
moveOperator = new MoveToEntityOperator(Owner, Target);
}
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
moveOperator,
new SwingMeleeWeaponOperator(Owner, _entity),
new SwingMeleeWeaponOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
context.GetState<MoveTargetState>().SetValue(Target);
var equipped = context.GetState<EquippedEntityState>().GetValue();
context.GetState<WeaponEntityState>().SetValue(equipped);
}

View File

@@ -15,24 +15,18 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class PickUpMeleeWeapon : UtilityAction
{
private readonly IEntity _entity;
public PickUpMeleeWeapon(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
context.GetState<WeaponEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -19,40 +19,34 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class UnarmedAttackEntity : UtilityAction
{
private readonly IEntity _entity;
public UnarmedAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
MoveToEntityOperator moveOperator;
if (Owner.TryGetComponent(out UnarmedCombatComponent unarmedCombatComponent))
{
moveOperator = new MoveToEntityOperator(Owner, _entity, unarmedCombatComponent.Range - 0.01f);
moveOperator = new MoveToEntityOperator(Owner, Target, unarmedCombatComponent.Range - 0.01f);
}
// I think it's possible for this to happen given planning is time-sliced?
// TODO: At this point we should abort
else
{
moveOperator = new MoveToEntityOperator(Owner, _entity);
moveOperator = new MoveToEntityOperator(Owner, Target);
}
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
moveOperator,
new UnarmedCombatOperator(Owner, _entity),
new UnarmedCombatOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
context.GetState<MoveTargetState>().SetValue(Target);
// Can just set ourselves as entity given unarmed just inherits from meleeweapon
context.GetState<WeaponEntityState>().SetValue(Owner);
}

View File

@@ -1,7 +1,17 @@
using Robust.Shared.GameObjects;
namespace Content.Server.AI.Utility.Actions
{
public interface IAiUtility
{
/// <summary>
/// NPC this action is attached to.
/// </summary>
IEntity Owner { get; set; }
/// <summary>
/// Highest possible score for this action.
/// </summary>
float Bonus { get; }
}
}

View File

@@ -21,17 +21,15 @@ namespace Content.Server.AI.Utility.Actions.Idle
public sealed class CloseLastEntityStorage : UtilityAction
{
public override float Bonus => IdleBonus + 0.01f;
public CloseLastEntityStorage(IEntity owner) : base(owner) {}
public override void SetupOperators(Blackboard context)
{
var lastStorage = context.GetState<LastOpenedStorageState>().GetValue();
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new MoveToEntityOperator(Owner, lastStorage),
new CloseLastStorageOperator(Owner),
new CloseLastStorageOperator(Owner),
});
}

View File

@@ -23,8 +23,6 @@ namespace Content.Server.AI.Utility.Actions.Idle
public override bool CanOverride => false;
public override float Bonus => 1.0f;
public WanderAndWait(IEntity owner) : base(owner) {}
public override void SetupOperators(Blackboard context)
{
var robustRandom = IoCManager.Resolve<IRobustRandom>();

View File

@@ -14,23 +14,17 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
{
public sealed class PickUpDrink : UtilityAction
{
private readonly IEntity _entity;
public PickUpDrink(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -15,27 +15,21 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
{
public sealed class UseDrinkInInventory : UtilityAction
{
private readonly IEntity _entity;
public UseDrinkInInventory(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseDrinkInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseDrinkInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -14,23 +14,17 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
public sealed class PickUpFood : UtilityAction
{
private readonly IEntity _entity;
public PickUpFood(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
ActionOperators = new GoPickupEntitySequence(Owner, Target).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -15,27 +15,21 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
public sealed class UseFoodInInventory : UtilityAction
{
private readonly IEntity _entity;
public UseFoodInInventory(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public IEntity Target { get; set; }
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseFoodInInventoryOperator(Owner, _entity),
new EquipEntityOperator(Owner, Target),
new UseFoodInInventoryOperator(Owner, Target),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(Target);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)

View File

@@ -17,8 +17,6 @@ namespace Content.Server.AI.Utility.Actions.Test
{
public override bool CanOverride => false;
public MoveRightAndLeftTen(IEntity owner) : base(owner) {}
public override void SetupOperators(Blackboard context)
{
var currentPosition = Owner.Transform.Coordinates;

View File

@@ -24,7 +24,7 @@ namespace Content.Server.AI.Utility.Actions
/// Threshold doesn't necessarily mean we'll do an action at a higher threshold;
/// if it's really un-optimal (i.e. low score) then we'll also check lower tiers
/// </summary>
public virtual float Bonus { get; protected set; } = IdleBonus;
public virtual float Bonus { get; set; } = IdleBonus;
// For GW2 they had the bonuses close together but IMO it feels better when they're more like discrete tiers.
// These are just baselines to make mass-updates easier; actions can do whatever
@@ -36,7 +36,7 @@ namespace Content.Server.AI.Utility.Actions
public const float CombatBonus = 30.0f;
public const float DangerBonus = 50.0f;
protected IEntity Owner { get; }
public IEntity Owner { get; set; }
/// <summary>
/// All the considerations are multiplied together to get the final score; a consideration of 0.0 means the action is not possible.
@@ -58,10 +58,8 @@ namespace Content.Server.AI.Utility.Actions
/// <param name="context"></param>
protected virtual void UpdateBlackboard(Blackboard context) {}
protected UtilityAction(IEntity owner)
{
Owner = owner;
}
// Needs to be able to be instantiated without args via typefactory.
public UtilityAction() {}
public virtual void Shutdown() {}