Add a LOT more dakka (#1033)

* Start adding flashy flash

* Change slop

Might give a smoother decline

* flashy flash

* Add flashbang and flash projectiles

Bang bang bang pull my flash trigger

* Add collision check to area flash

* Flash cleanupo

* flash.ogg mixed to mono
* Adjusted flash curve again

* Enhancing flashes with unshaded and lights and shit

Still a WIP

* Add the other ballistic gun types

Re-organised some of the gun stuff so the powercell guns share the shooting code with the ballistic guns.

* Re-merging branch with master

Also fixed some visualizer bugs

* Last cleanup

Fixed some crashes
Fixed Deckard sprite
Fixed Hitscan effects
Re-applied master changes
Re-factor to using soundsystem
Add some more audio effects

* Cleanup flashes for merge

Can put flashbangs in lockers so you don't get blinded

Fix some bugs

* Fix shotties

Also removed some redundant code

* Bulldoze some legacycode

brrrrrrrrt

* Fix clientignore warnings

* Add the other Stunnable types to StunnableProjectile

* Some gun refactoring

* Removed extra visualizers
* All casing ejections use the same code
* Speed loaders can have their ammo pulled out
* Bolt sound less loud

* Stop ThrowController from throwing

* Fix speed loader visuals

* Update hitscan collision mask and fix typo

* Cleanup

* Fit hitscan and flashbang collisions
* Use the new flags support

* Update taser placeholder description

* Update protonames per style guide

* Add yaml flag support for gun firerates

* Cleanup crew

* Fix Audio up (components, audio file, + remove global sounds)
* Add server-side recoil back-in (forgot that I was testing this client-side)
* Add Flag support for fire-rate selectors

* Wrong int you dolt

* Fix AI conflicts

Haha ranged bulldozer go BRR
(I'll rewrite it after the other AI systems are done).

* Mix bang.ogg from stereo to mono

* Make sure serializer's reading for guns

Fixes integration test

* Change EntitySystem calls to use the static function

Also removed the Pumpbarrel commented-out code

* Change StunnableProjectile defaults to 0

* Fix taser paralyse

Apparently removing defaults means you have to specify the values, whodathunkit

* Add slowdown to stunnableprojectiles and fix tasers

* Remove FlagsFor from gun components

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2020-06-22 05:47:15 +10:00
committed by GitHub
parent ac19ad7eac
commit 95995b6232
1977 changed files with 13600 additions and 11229 deletions

View File

@@ -3,7 +3,6 @@ using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Melee;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Inventory;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
@@ -41,9 +40,6 @@ namespace Content.Server.AI.Utility.Actions.Combat.Melee
protected override Consideration[] Considerations { get; } = {
new MeleeWeaponEquippedCon(
new InverseBoolCurve()),
// We'll prioritise equipping ranged weapons; If we try and score this then it'll just keep swapping between ranged and melee
new RangedWeaponEquippedCon(
new InverseBoolCurve()),
new CanPutTargetInHandsCon(
new BoolCurve()),
new MeleeWeaponSpeedCon(

View File

@@ -1,97 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Combat.Ranged;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Ballistic;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.Utils;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Ballistic
{
public sealed class BallisticAttackEntity : UtilityAction
{
private IEntity _entity;
private MoveToEntityOperator _moveOperator;
public BallisticAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void Shutdown()
{
base.Shutdown();
if (_moveOperator != null)
{
_moveOperator.MovedATile -= InLos;
}
}
public override void SetupOperators(Blackboard context)
{
_moveOperator = new MoveToEntityOperator(Owner, _entity);
_moveOperator.MovedATile += InLos;
// TODO: Accuracy in blackboard
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
_moveOperator,
new ShootAtEntityOperator(Owner, _entity, 0.7f),
});
// We will do a quick check now to see if we even need to move which also saves a pathfind
InLos();
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<MoveTargetState>().SetValue(_entity);
var equipped = context.GetState<EquippedEntityState>().GetValue();
context.GetState<WeaponEntityState>().SetValue(equipped);
}
protected override Consideration[] Considerations { get; } = {
// Check if we have a weapon; easy-out
new BallisticWeaponEquippedCon(
new BoolCurve()),
new BallisticAmmoCon(
new QuadraticCurve(1.0f, 0.15f, 0.0f, 0.0f)),
// Don't attack a dead target
new TargetIsDeadCon(
new InverseBoolCurve()),
// Deprioritise a target in crit
new TargetIsCritCon(
new QuadraticCurve(-0.8f, 1.0f, 1.0f, 0.0f)),
// Somewhat prioritise distance
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.07f, 0.0f)),
// Prefer weaker targets
new TargetHealthCon(
new QuadraticCurve(1.0f, 0.4f, 0.0f, -0.02f)),
};
private void InLos()
{
// This should only be called if the movement operator is the current one;
// if that turns out not to be the case we can just add a check here.
if (Visibility.InLineOfSight(Owner, _entity))
{
_moveOperator.HaveArrived();
var mover = ActionOperators.Dequeue();
mover.Shutdown(Outcome.Success);
}
}
}
}

View File

@@ -1,53 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Ballistic;
using Content.Server.AI.Utility.Considerations.Inventory;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Ballistic
{
public sealed class DropEmptyBallistic : UtilityAction
{
public sealed override float Bonus => 20.0f;
private IEntity _entity;
public DropEmptyBallistic(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new DropEntityOperator(Owner, _entity)
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new TargetInOurInventoryCon(
new BoolCurve()),
// Need to put in hands to drop
new CanPutTargetInHandsCon(
new BoolCurve()),
// Drop that sucker
new BallisticAmmoCon(
new InverseBoolCurve()),
};
}
}

View File

@@ -1,53 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Melee;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Ballistic;
using Content.Server.AI.Utility.Considerations.Inventory;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States.Combat;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Ballistic
{
public sealed class EquipBallistic : UtilityAction
{
private IEntity _entity;
public EquipBallistic(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity)
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new EquippedBallisticCon(
new InverseBoolCurve()),
new MeleeWeaponEquippedCon(
new QuadraticCurve(0.9f, 1.0f, 0.1f, 0.0f)),
new CanPutTargetInHandsCon(
new BoolCurve()),
new BallisticAmmoCon(
new QuadraticCurve(1.0f, 0.15f, 0.0f, 0.0f)),
new RangedWeaponFireRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
};
}
}

View File

@@ -1,46 +0,0 @@
using Content.Server.AI.Operators.Sequences;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Containers;
using Content.Server.AI.Utility.Considerations.Hands;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Ballistic
{
public sealed class PickUpAmmo : UtilityAction
{
private IEntity _entity;
public PickUpAmmo(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
//TODO: Consider ammo's type and what guns we have
new TargetAccessibleCon(
new BoolCurve()),
new FreeHandCon(
new BoolCurve()),
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)),
};
}
}

View File

@@ -1,57 +0,0 @@
using Content.Server.AI.Operators.Sequences;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Ballistic;
using Content.Server.AI.Utility.Considerations.Containers;
using Content.Server.AI.Utility.Considerations.Hands;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Ballistic
{
public sealed class PickUpBallisticMagWeapon : UtilityAction
{
private IEntity _entity;
public PickUpBallisticMagWeapon(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new HeldRangedWeaponsCon(
new QuadraticCurve(-1.0f, 1.0f, 1.0f, 0.0f)),
new TargetAccessibleCon(
new BoolCurve()),
new FreeHandCon(
new BoolCurve()),
// For now don't grab empty guns - at least until we can start storing stuff in inventory
new BallisticAmmoCon(
new BoolCurve()),
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)),
new RangedWeaponFireRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
// TODO: Ballistic accuracy? Depends how the design transitions
};
}
}

View File

@@ -1,69 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.AI.WorldState.States.Movement;
using Content.Server.GameObjects.Components.Power.Chargers;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class PutHitscanInCharger : UtilityAction
{
// Maybe a bad idea to not allow override
public override bool CanOverride => false;
private readonly IEntity _charger;
public PutHitscanInCharger(IEntity owner, IEntity charger, float weight) : base(owner)
{
_charger = charger;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
var weapon = context.GetState<EquippedEntityState>().GetValue();
if (weapon == null || _charger.GetComponent<WeaponCapacitorChargerComponent>().HeldItem != null)
{
ActionOperators = new Queue<AiOperator>();
return;
}
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new MoveToEntityOperator(Owner, _charger),
new InteractWithEntityOperator(Owner, _charger),
// Separate task will deal with picking it up
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<MoveTargetState>().SetValue(_charger);
context.GetState<TargetEntityState>().SetValue(_charger);
}
protected override Consideration[] Considerations { get; } =
{
new HitscanWeaponEquippedCon(
new BoolCurve()),
new HitscanChargerFullCon(
new InverseBoolCurve()),
new HitscanChargerRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)),
new HitscanChargeCon(
new QuadraticCurve(-1.2f, 2.0f, 1.2f, 0.0f)),
};
}
}

View File

@@ -1,52 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Inventory;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class DropEmptyHitscan : UtilityAction
{
private IEntity _entity;
public DropEmptyHitscan(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity),
new DropEntityOperator(Owner, _entity)
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new TargetInOurInventoryCon(
new BoolCurve()),
// Need to put in hands to drop
new CanPutTargetInHandsCon(
new BoolCurve()),
// If completely empty then drop that sucker
new HitscanChargeCon(
new InverseBoolCurve()),
};
}
}

View File

@@ -1,55 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Melee;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Inventory;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States.Combat;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class EquipHitscan : UtilityAction
{
private IEntity _entity;
public EquipHitscan(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new EquipEntityOperator(Owner, _entity)
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new EquippedHitscanCon(
new InverseBoolCurve()),
new MeleeWeaponEquippedCon(
new QuadraticCurve(0.9f, 1.0f, 0.1f, 0.0f)),
new CanPutTargetInHandsCon(
new BoolCurve()),
new HitscanChargeCon(
new QuadraticCurve(1.0f, 1.0f, 0.0f, 0.0f)),
new RangedWeaponFireRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
new HitscanWeaponDamageCon(
new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)),
};
}
}

View File

@@ -1,96 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Combat.Ranged;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.Utils;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Content.Server.AI.WorldState.States.Inventory;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class HitscanAttackEntity : UtilityAction
{
private IEntity _entity;
private MoveToEntityOperator _moveOperator;
public HitscanAttackEntity(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void Shutdown()
{
base.Shutdown();
if (_moveOperator != null)
{
_moveOperator.MovedATile -= InLos;
}
}
public override void SetupOperators(Blackboard context)
{
_moveOperator = new MoveToEntityOperator(Owner, _entity);
_moveOperator.MovedATile += InLos;
// TODO: Accuracy in blackboard
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
_moveOperator,
new ShootAtEntityOperator(Owner, _entity, 0.7f),
});
InLos();
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<MoveTargetState>().SetValue(_entity);
var equipped = context.GetState<EquippedEntityState>().GetValue();
context.GetState<WeaponEntityState>().SetValue(equipped);
}
protected override Consideration[] Considerations { get; } = {
// Check if we have a weapon; easy-out
new HitscanWeaponEquippedCon(
new BoolCurve()),
new HitscanChargeCon(
new QuadraticCurve(1.0f, 0.1f, 0.0f, 0.0f)),
// Don't attack a dead target
new TargetIsDeadCon(
new InverseBoolCurve()),
// Deprioritise a target in crit
new TargetIsCritCon(
new QuadraticCurve(-0.8f, 1.0f, 1.0f, 0.0f)),
// Somewhat prioritise distance
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.07f, 0.0f)),
// Prefer weaker targets
new TargetHealthCon(
new QuadraticCurve(1.0f, 0.4f, 0.0f, -0.02f)),
};
private void InLos()
{
// This should only be called if the movement operator is the current one;
// if that turns out not to be the case we can just add a check here.
if (Visibility.InLineOfSight(Owner, _entity))
{
_moveOperator.HaveArrived();
var mover = ActionOperators.Dequeue();
mover.Shutdown(Outcome.Success);
}
}
}
}

View File

@@ -1,65 +0,0 @@
using System.Collections.Generic;
using Content.Server.AI.Operators;
using Content.Server.AI.Operators.Combat.Ranged;
using Content.Server.AI.Operators.Inventory;
using Content.Server.AI.Operators.Movement;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Containers;
using Content.Server.AI.Utility.Considerations.Hands;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class PickUpHitscanFromCharger : UtilityAction
{
private IEntity _entity;
private IEntity _charger;
public PickUpHitscanFromCharger(IEntity owner, IEntity entity, IEntity charger, float weight) : base(owner)
{
_entity = entity;
_charger = charger;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new Queue<AiOperator>(new AiOperator[]
{
new MoveToEntityOperator(Owner, _charger),
new WaitForHitscanChargeOperator(_entity),
new PickupEntityOperator(Owner, _entity),
});
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new HeldRangedWeaponsCon(
new QuadraticCurve(-1.0f, 1.0f, 1.0f, 0.0f)),
new TargetAccessibleCon(
new BoolCurve()),
new FreeHandCon(
new BoolCurve()),
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)),
// TODO: ChargerHasPower
new RangedWeaponFireRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
new HitscanWeaponDamageCon(
new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)),
};
}
}

View File

@@ -1,59 +0,0 @@
using Content.Server.AI.Operators.Sequences;
using Content.Server.AI.Utility.Considerations;
using Content.Server.AI.Utility.Considerations.Combat.Ranged;
using Content.Server.AI.Utility.Considerations.Combat.Ranged.Hitscan;
using Content.Server.AI.Utility.Considerations.Containers;
using Content.Server.AI.Utility.Considerations.Hands;
using Content.Server.AI.Utility.Considerations.Movement;
using Content.Server.AI.Utility.Curves;
using Content.Server.AI.WorldState;
using Content.Server.AI.WorldState.States;
using Content.Server.AI.WorldState.States.Combat;
using Content.Server.AI.WorldState.States.Movement;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.AI.Utility.Actions.Combat.Ranged.Hitscan
{
public sealed class PickUpHitscanWeapon : UtilityAction
{
private IEntity _entity;
public PickUpHitscanWeapon(IEntity owner, IEntity entity, float weight) : base(owner)
{
_entity = entity;
Bonus = weight;
}
public override void SetupOperators(Blackboard context)
{
ActionOperators = new GoPickupEntitySequence(Owner, _entity).Sequence;
}
protected override void UpdateBlackboard(Blackboard context)
{
base.UpdateBlackboard(context);
context.GetState<MoveTargetState>().SetValue(_entity);
context.GetState<TargetEntityState>().SetValue(_entity);
context.GetState<WeaponEntityState>().SetValue(_entity);
}
protected override Consideration[] Considerations { get; } = {
new HeldRangedWeaponsCon(
new QuadraticCurve(-1.0f, 1.0f, 1.0f, 0.0f)),
new TargetAccessibleCon(
new BoolCurve()),
new FreeHandCon(
new BoolCurve()),
// For now don't grab empty guns - at least until we can start storing stuff in inventory
new HitscanChargeCon(
new BoolCurve()),
new DistanceCon(
new QuadraticCurve(1.0f, 1.0f, 0.02f, 0.0f)),
// TODO: Weapon charge level
new RangedWeaponFireRateCon(
new QuadraticCurve(1.0f, 0.5f, 0.0f, 0.0f)),
new HitscanWeaponDamageCon(
new QuadraticCurve(1.0f, 0.25f, 0.0f, 0.0f)),
};
}
}