Add readonly where it is missing and fix those field names according to their modifiers (#2589)

This commit is contained in:
DrSmugleaf
2020-11-21 14:02:00 +01:00
committed by GitHub
parent c7f2b67297
commit 749cd11d33
94 changed files with 344 additions and 374 deletions

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves
{
public sealed class EquipGloves : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public EquipGloves(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -35,7 +35,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Gloves
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Head
{
public sealed class EquipHead : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public EquipHead(IEntity owner, IEntity entity, float weight) : base(owner)
{

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.OuterClothing
{
public sealed class EquipOuterClothing : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public EquipOuterClothing(IEntity owner, IEntity entity, float weight) : base(owner)
{

View File

@@ -13,7 +13,7 @@ namespace Content.Server.AI.Utility.Actions.Clothing.Shoes
{
public sealed class EquipShoes : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public EquipShoes(IEntity owner, IEntity entity, float weight) : base(owner)
{

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class EquipMelee : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public EquipMelee(IEntity owner, IEntity entity, float weight) : base(owner)
{

View File

@@ -21,7 +21,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class MeleeWeaponAttackEntity : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public MeleeWeaponAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -58,7 +58,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
var equipped = context.GetState<EquippedEntityState>().GetValue();
context.GetState<WeaponEntityState>().SetValue(equipped);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class PickUpMeleeWeapon : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public PickUpMeleeWeapon(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -34,7 +34,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -19,7 +19,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
{
public sealed class UnarmedAttackEntity : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public UnarmedAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -44,7 +44,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
moveOperator,
new UnarmedCombatOperator(Owner, _entity),
new UnarmedCombatOperator(Owner, _entity),
});
}
@@ -60,7 +60,7 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
return new[]
{
considerationsManager.Get<TargetIsDeadCon>()

View File

@@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
{
public sealed class PickUpDrink : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public PickUpDrink(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -26,17 +26,17 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();
return new[]
{
considerationsManager.Get<TargetDistanceCon>()

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
{
public sealed class UseDrinkInInventory : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public UseDrinkInInventory(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -31,13 +31,13 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Drink
new UseDrinkInInventoryOperator(Owner, _entity),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
}
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -14,7 +14,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
public sealed class PickUpFood : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public PickUpFood(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -31,8 +31,8 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
}
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();

View File

@@ -15,7 +15,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
public sealed class UseFoodInInventory : UtilityAction
{
private IEntity _entity;
private readonly IEntity _entity;
public UseFoodInInventory(IEntity owner, IEntity entity, float weight) : base(owner)
{
@@ -28,7 +28,7 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new UseFoodInInventoryOperator(Owner, _entity),
new UseFoodInInventoryOperator(Owner, _entity),
});
}
@@ -36,8 +36,8 @@ namespace Content.Server.AI.Utility.Actions.Nutrition.Food
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
}
}
protected override IReadOnlyCollection<Func<float>> GetConsiderations(Blackboard context)
{
var considerationsManager = IoCManager.Resolve<ConsiderationsManager>();