Demote Unity weapon effects to presentation
This commit is contained in:
parent
70607384fc
commit
da6ab814c8
19 changed files with 52 additions and 84 deletions
|
|
@ -16451,6 +16451,32 @@ static void RequireUnityPhysicsIsNotGameplayAuthority(string root)
|
|||
}
|
||||
|
||||
var weaponEffectRoot = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Weapons");
|
||||
var forbiddenWeaponCombatSymbols = new[]
|
||||
{
|
||||
"public float Damage",
|
||||
"public float Penetration",
|
||||
"public float Spread",
|
||||
"public DamageType",
|
||||
".Damage =",
|
||||
".Penetration =",
|
||||
".Spread =",
|
||||
".DamageType =",
|
||||
".DamageSpread"
|
||||
};
|
||||
var weaponCombatAuthorityHits = Directory.EnumerateFiles(weaponEffectRoot, "*.cs", SearchOption.TopDirectoryOnly)
|
||||
.SelectMany(path => File.ReadLines(path)
|
||||
.Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
|
||||
.Where(line => forbiddenWeaponCombatSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal)))
|
||||
.Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}")
|
||||
.ToArray();
|
||||
|
||||
if (weaponCombatAuthorityHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Unity weapon effects are presentation only; combat damage, penetration, spread, and damage type belong to daemon/Ymir state: " +
|
||||
string.Join("; ", weaponCombatAuthorityHits));
|
||||
}
|
||||
|
||||
var weaponSingletonHits = Directory.EnumerateFiles(weaponEffectRoot, "*.cs", SearchOption.TopDirectoryOnly)
|
||||
.SelectMany(path => File.ReadLines(path)
|
||||
.Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
|
||||
|
|
|
|||
|
|
@ -11,10 +11,7 @@ public class ConstantLaser : MonoBehaviour
|
|||
public float CycleDuration;
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public Entity SourceEntity { get; set; }
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
|
@ -84,7 +81,7 @@ public class ConstantLaser : MonoBehaviour
|
|||
var entity = hull.Entity;
|
||||
if (entity.Shield != null && entity.Shield.Item.Active.Value)
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
LineRenderer.SetPosition(1, hit.Point);
|
||||
hitFound = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -20,10 +20,7 @@ public class ConstantLaserManager : ConstantWeaponEffectManager
|
|||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
_lasers.Add(item, p);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ public class ConstantLightning : MonoBehaviour
|
|||
public float FadeDuration;
|
||||
|
||||
public Transform Barrel { get; set; }
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public EntityInstance Source { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
||||
|
|
@ -63,7 +60,7 @@ public class ConstantLightning : MonoBehaviour
|
|||
var entity = hull.Entity;
|
||||
if (entity.Shield != null && entity.Shield.Item.Active.Value)
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,11 +16,8 @@ public class ConstantLightningManager : ConstantWeaponEffectManager
|
|||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Barrel = barrel;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
_bolts.Add(item, p);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ public class ConstantParticleWeapon : MonoBehaviour
|
|||
public ParticleSystem[] Particles;
|
||||
public float CastRadius = 0.25f;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Range { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public EntityInstance Source { get; set; }
|
||||
public EntityInstance Target { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ public class ConstantParticleWeaponManager : ConstantWeaponEffectManager
|
|||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = weapon.Damage;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.Range = weapon.Range;
|
||||
_weapons.Add(item, p);
|
||||
p.Initialize();
|
||||
|
|
|
|||
|
|
@ -34,10 +34,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
public Vector3 StartPosition { get; set; }
|
||||
public float Range { get; set; }
|
||||
public Vector3 Velocity { get; set; }
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public Entity SourceEntity { get; set; }
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
|
||||
|
|
@ -106,10 +103,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
var perpendicularRandom = randomDirection.x * right + randomDirection.y * up;
|
||||
child.Velocity = Vector3.Lerp(perpendicularRandom, dir, SplitSeparationForwardness).normalized * Velocity.magnitude * SplitSeparationVelocity;
|
||||
child.Range = Range;
|
||||
child.Damage = Damage / Children;
|
||||
child.Penetration = Penetration;
|
||||
child.Spread = Spread;
|
||||
child.DamageType = DamageType;
|
||||
child.ImpactIntensity = ImpactIntensity;
|
||||
child.Source = Source;
|
||||
child.Target = Target;
|
||||
child.SourceEntity = SourceEntity;
|
||||
|
|
@ -160,7 +154,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
var entity = hull.Entity;
|
||||
if (entity.Shield != null && entity.Shield.Item.Active.Value)
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,11 +31,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.StartPosition = p.transform.position = barrel.position;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
p.GuidanceCurve = weapon.GuidedProjectileGuidanceCurve.ToCurve();
|
||||
p.LiftCurve = weapon.GuidedProjectileLiftCurve.ToCurve();
|
||||
p.ThrustCurve = weapon.GuidedProjectileThrustCurve.ToCurve();
|
||||
|
|
@ -54,11 +51,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.StartPosition = p.transform.position = barrel.position;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
p.GuidanceCurve = weapon.GuidedProjectileGuidanceCurve.ToCurve();
|
||||
p.LiftCurve = weapon.GuidedProjectileLiftCurve.ToCurve();
|
||||
p.ThrustCurve = weapon.GuidedProjectileThrustCurve.ToCurve();
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ public class HitscanEffect : MonoBehaviour
|
|||
public ParticleSystem LineEffect;
|
||||
public Prototype HitEffect;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public Entity SourceEntity { get; set; }
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
|
@ -38,7 +35,7 @@ public class HitscanEffect : MonoBehaviour
|
|||
var entity = hull.Entity;
|
||||
if (entity.Shield != null && entity.Shield.Item.Active.Value)
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
hitFound = true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ public class HitscanManager : InstantWeaponEffectManager
|
|||
// t.position = barrel.position;
|
||||
// t.forward = barrel.forward;
|
||||
p.Range = weapon.Range;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
p.Fire();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ public class Laser : MonoBehaviour
|
|||
public float Duration;
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public Entity SourceEntity { get; set; }
|
||||
public ZoneRenderer ZoneRenderer { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
|
@ -51,7 +48,7 @@ public class Laser : MonoBehaviour
|
|||
var entity = hull.Entity;
|
||||
if (entity.Shield != null && entity.Shield.Item.Active.Value)
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
LineRenderer.SetPosition(1, hit.Point);
|
||||
hitFound = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,7 @@ public class LaserManager : InstantWeaponEffectManager
|
|||
t.position = barrel.position;
|
||||
p.SourceEntity = source.Entity;
|
||||
p.ZoneRenderer = source.ZoneRenderer;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ public class Lightning : MonoBehaviour
|
|||
public LightningCompute LightningCompute;
|
||||
public float HitRadius;
|
||||
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public EntityInstance Source { get; set; }
|
||||
public float Range { get; set; }
|
||||
public EntityInstance Target { get; set; }
|
||||
|
|
@ -43,7 +40,7 @@ public class Lightning : MonoBehaviour
|
|||
{
|
||||
LightningCompute.OnLeaderComplete = () =>
|
||||
{
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage));
|
||||
hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity));
|
||||
};
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -13,11 +13,8 @@ public class LightningGunManager : InstantWeaponEffectManager
|
|||
var barrel = source.GetBarrel(hp);
|
||||
p.Barrel = barrel;
|
||||
p.Source = source;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
p.Target = target;
|
||||
p.Fire();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@ public class Mine : MonoBehaviour
|
|||
private Material _material;
|
||||
private float _pulseLerp;
|
||||
private float _emission;
|
||||
public float Damage { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public EntityInstance Source { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ public class MineManager : InstantWeaponEffectManager
|
|||
Random.Range(-angle, angle)) *
|
||||
barrel.forward *
|
||||
weapon.Velocity;
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,16 +13,13 @@ public class Projectile : MonoBehaviour
|
|||
|
||||
public float AirburstDistance;
|
||||
public float AirburstRange;
|
||||
public float DirectHitDamageMultiplier = 1;
|
||||
public float DirectHitIntensityMultiplier = 1;
|
||||
|
||||
private bool _alive;
|
||||
|
||||
public Vector3 StartPosition { get; set; }
|
||||
public Vector3 Velocity { get; set; }
|
||||
public float Damage { get; set; }
|
||||
public float Penetration { get; set; }
|
||||
public float Spread { get; set; }
|
||||
public DamageType DamageType { get; set; }
|
||||
public float ImpactIntensity { get; set; } = 1;
|
||||
public Entity SourceEntity { get; set; }
|
||||
public EntityInstance TargetInstance { get; set; }
|
||||
public float Range { get; set; }
|
||||
|
|
@ -99,11 +96,7 @@ public class Projectile : MonoBehaviour
|
|||
|
||||
if (hull.Entity.Shield != null &&
|
||||
hull.Entity.Shield.Item.Active.Value)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
hull.Entity.Shield.ShowHit(step.Hit.Point, Mathf.Max(0.01f, ImpactIntensity * DirectHitIntensityMultiplier));
|
||||
|
||||
transform.position = step.Hit.Point;
|
||||
if (HitEffect != null)
|
||||
|
|
|
|||
|
|
@ -25,11 +25,8 @@ public class ProjectileManager : InstantWeaponEffectManager
|
|||
p.StartPosition = p.transform.position = barrel.position + p.Velocity * (Random.value * Time.deltaTime);
|
||||
if(InheritVelocity)
|
||||
p.Velocity += (Vector3)AetheriaMath.ToUnityXZ(source.Entity.CultVelocity);
|
||||
p.Damage = weapon.Damage;
|
||||
p.Range = weapon.Range;
|
||||
p.Penetration = weapon.Penetration;
|
||||
p.Spread = weapon.DamageSpread;
|
||||
p.DamageType = weapon.DamageType;
|
||||
p.ImpactIntensity = 1;
|
||||
p.AirburstDistance = target != null
|
||||
? CultMath.math.length(source.Entity.CultPosition - target.Entity.CultPosition)
|
||||
: (weapon.Range * .75f);
|
||||
|
|
|
|||
Loading…
Reference in a new issue