Ice anomaly buff (anti-box maneuvers) (#17293)
This commit is contained in:
@@ -6,33 +6,33 @@ namespace Content.Server.Anomaly.Components;
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class ProjectileAnomalyComponent : Component
|
public sealed class ProjectileAnomalyComponent : Component
|
||||||
{
|
{
|
||||||
/// <sumarry>
|
/// <summary>
|
||||||
/// The prototype of the projectile that will be shot when the anomaly pulses
|
/// The prototype of the projectile that will be shot when the anomaly pulses
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("projectilePrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
[DataField("projectilePrototype", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>)), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public string ProjectilePrototype = default!;
|
public string ProjectilePrototype = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MAXIMUM speed <see cref="ProjectilePrototype"/> can travel
|
/// The speed <see cref="ProjectilePrototype"/> can travel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("maxProjectileSpeed")]
|
[DataField("projectileSpeed"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float MaxProjectileSpeed = 30f;
|
public float ProjectileSpeed = 30f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum number of projectiles shot per pulse
|
||||||
|
/// </summary>
|
||||||
|
[DataField("minProjectiles"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public int MinProjectiles = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MAXIMUM number of projectiles shot per pulse
|
/// The MAXIMUM number of projectiles shot per pulse
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("maxProjectiles")]
|
[DataField("maxProjectiles"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int MaxProjectiles = 5;
|
public int MaxProjectiles = 9;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The MAXIMUM range for targeting entities
|
/// The MAXIMUM range for targeting entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField("projectileRange")]
|
[DataField("projectileRange"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public float ProjectileRange = 50f;
|
public float ProjectileRange = 50f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Chance that a non sentient entity will be targeted, value must be between 0.0-1.0
|
|
||||||
/// </summary>
|
|
||||||
[DataField("targetNonSentientChance")]
|
|
||||||
public float TargetNonSentientChance = 0.5f;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
|
using System.Linq;
|
||||||
using Content.Server.Anomaly.Components;
|
using Content.Server.Anomaly.Components;
|
||||||
using Content.Server.Mind.Components;
|
|
||||||
using Content.Server.Weapons.Ranged.Systems;
|
using Content.Server.Weapons.Ranged.Systems;
|
||||||
using Content.Shared.Anomaly.Components;
|
using Content.Shared.Anomaly.Components;
|
||||||
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Projectiles;
|
using Content.Shared.Projectiles;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
|
|
||||||
namespace Content.Server.Anomaly.Effects;
|
namespace Content.Server.Anomaly.Effects;
|
||||||
@@ -38,29 +40,36 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
|||||||
|
|
||||||
private void ShootProjectilesAtEntities(EntityUid uid, ProjectileAnomalyComponent component, float severity)
|
private void ShootProjectilesAtEntities(EntityUid uid, ProjectileAnomalyComponent component, float severity)
|
||||||
{
|
{
|
||||||
var xform = Transform(uid);
|
var projectileCount = (int) MathF.Round(MathHelper.Lerp(component.MinProjectiles, component.MaxProjectiles, severity));
|
||||||
var projectilesShot = 0;
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var range = component.ProjectileRange * severity;
|
var mobQuery = GetEntityQuery<MobStateComponent>();
|
||||||
var mobQuery = GetEntityQuery<MindComponent>();
|
var xform = xformQuery.GetComponent(uid);
|
||||||
|
|
||||||
foreach (var entity in _lookup.GetEntitiesInRange(uid, range, LookupFlags.Dynamic))
|
var inRange = _lookup.GetEntitiesInRange(uid, component.ProjectileRange * severity, LookupFlags.Dynamic).ToList();
|
||||||
|
_random.Shuffle(inRange);
|
||||||
|
var priority = new List<EntityUid>();
|
||||||
|
foreach (var entity in inRange)
|
||||||
{
|
{
|
||||||
if (projectilesShot >= component.MaxProjectiles * severity)
|
if (mobQuery.HasComponent(entity))
|
||||||
return;
|
priority.Add(entity);
|
||||||
|
}
|
||||||
|
|
||||||
// Sentient entities are more likely to be shot at than non sentient
|
Logger.Debug($"shots: {projectileCount}");
|
||||||
if (!mobQuery.HasComponent(entity) && !_random.Prob(component.TargetNonSentientChance))
|
while (projectileCount > 0)
|
||||||
continue;
|
{
|
||||||
|
Logger.Debug($"{projectileCount}");
|
||||||
|
var target = priority.Any()
|
||||||
|
? _random.PickAndTake(priority)
|
||||||
|
: _random.Pick(inRange);
|
||||||
|
|
||||||
var targetCoords = Transform(entity).Coordinates.Offset(_random.NextVector2(-1, 1));
|
var targetCoords = xformQuery.GetComponent(target).Coordinates.Offset(_random.NextVector2(0.5f));
|
||||||
|
|
||||||
ShootProjectile(
|
ShootProjectile(
|
||||||
uid, component,
|
uid, component,
|
||||||
xform.Coordinates,
|
xform.Coordinates,
|
||||||
targetCoords,
|
targetCoords,
|
||||||
severity
|
severity);
|
||||||
);
|
projectileCount--;
|
||||||
projectilesShot++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,8 +78,7 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
|||||||
ProjectileAnomalyComponent component,
|
ProjectileAnomalyComponent component,
|
||||||
EntityCoordinates coords,
|
EntityCoordinates coords,
|
||||||
EntityCoordinates targetCoords,
|
EntityCoordinates targetCoords,
|
||||||
float severity
|
float severity)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
var mapPos = coords.ToMap(EntityManager, _xform);
|
var mapPos = coords.ToMap(EntityManager, _xform);
|
||||||
|
|
||||||
@@ -86,6 +94,6 @@ public sealed class ProjectileAnomalySystem : EntitySystem
|
|||||||
|
|
||||||
comp.Damage *= severity;
|
comp.Damage *= severity;
|
||||||
|
|
||||||
_gunSystem.ShootProjectile(ent, direction, Vector2.Zero, uid, uid, component.MaxProjectileSpeed * severity);
|
_gunSystem.ShootProjectile(ent, direction, Vector2.Zero, uid, uid, component.ProjectileSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
types:
|
types:
|
||||||
Piercing: 20
|
Piercing: 20
|
||||||
Cold: 20
|
Cold: 20
|
||||||
Structural: 40
|
Structural: 50
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: ProjectilePolyboltBase
|
parent: ProjectilePolyboltBase
|
||||||
|
|||||||
@@ -215,9 +215,9 @@
|
|||||||
Cold: 10
|
Cold: 10
|
||||||
- type: ExplosionAnomaly
|
- type: ExplosionAnomaly
|
||||||
supercriticalExplosion: Cryo
|
supercriticalExplosion: Cryo
|
||||||
explosionTotalIntensity: 1000
|
explosionTotalIntensity: 300
|
||||||
explosionDropoff: 1
|
explosionDropoff: 2
|
||||||
explosionMaxTileIntensity: 10
|
explosionMaxTileIntensity: 20
|
||||||
- type: ProjectileAnomaly
|
- type: ProjectileAnomaly
|
||||||
projectilePrototype: ProjectileIcicle
|
projectilePrototype: ProjectileIcicle
|
||||||
targetNonSentientChance: 0.1
|
targetNonSentientChance: 0.1
|
||||||
|
|||||||
Reference in New Issue
Block a user