Damage System Rewrite
New damage system, much easier to understand Splash damage support Hardpoint armor consolidated with hull armor Minimap shows view cone New industry standard palette for temperature display Temperature range display contains palette Restoring loadouts now ignores temperature and armor Items can ignore thermal mass when adding heat Burst weapons can consume single ammo (mainly shotguns) New missile type that follows crosshairs New airburst projectile type that deals splash damage Auto Shotgun and Charged Shotgun
This commit is contained in:
parent
dbc522a224
commit
3a9ee2ccf7
55 changed files with 14253 additions and 2206 deletions
|
|
@ -88,7 +88,7 @@ public abstract class PersistentBehaviorData
|
|||
}
|
||||
|
||||
[InspectableField,
|
||||
// Union(0, typeof(ProjectileWeaponData)),
|
||||
Union(0, typeof(GuidedWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
Union(2, typeof(ReactorData)),
|
||||
Union(3, typeof(RadiatorData)),
|
||||
|
|
|
|||
|
|
@ -9,38 +9,41 @@ using static Unity.Mathematics.math;
|
|||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class ChargedWeaponData : InstantWeaponData
|
||||
{
|
||||
[InspectableField, JsonProperty("chargeTime"), Key(18), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("chargeTime"), Key(19), RuntimeInspectable]
|
||||
public PerformanceStat ChargeTime = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("chargeEnergy"), Key(19), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("chargeEnergy"), Key(20), RuntimeInspectable]
|
||||
public PerformanceStat ChargeEnergy = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("chargeHeat"), Key(20), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("chargeHeat"), Key(21), RuntimeInspectable]
|
||||
public PerformanceStat ChargeHeat = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("canFireEarly"), Key(21)]
|
||||
[InspectableField, JsonProperty("canFireEarly"), Key(22)]
|
||||
public bool CanFireEarly;
|
||||
|
||||
[InspectableField, JsonProperty("failureCharge"), Key(22)]
|
||||
[InspectableField, JsonProperty("failureCharge"), Key(23)]
|
||||
public float FailureCharge;
|
||||
|
||||
[InspectableField, JsonProperty("failureDamage"), Key(23)]
|
||||
[InspectableField, JsonProperty("failureDamage"), Key(24)]
|
||||
public float FailureDamage = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeDamage"), Key(24)]
|
||||
public float ChargeDamage = 1;
|
||||
[InspectableField, JsonProperty("chargeDamage"), Key(25)]
|
||||
public float ChargeFiringDamageMultiplier = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeSpread"), Key(25)]
|
||||
public float ChargeSpread = 1;
|
||||
[InspectableField, JsonProperty("chargeSpread"), Key(26)]
|
||||
public float ChargeFiringSpreadMultiplier = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeBurstCount"), Key(26)]
|
||||
public float ChargeBurstCount = 1;
|
||||
[InspectableField, JsonProperty("chargeBurstCount"), Key(27)]
|
||||
public float ChargeFiringBurstCountMultiplier = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeVisibility"), Key(27)]
|
||||
public float ChargeVisibility = 1;
|
||||
[InspectableField, JsonProperty("chargeVisibility"), Key(28)]
|
||||
public float ChargeFiringVisibilityMultiplier = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeVelocity"), Key(28)]
|
||||
public float ChargeVelocity = 1;
|
||||
[InspectableField, JsonProperty("chargeVelocity"), Key(29)]
|
||||
public float ChargeFiringVelocityMultiplier = 1;
|
||||
|
||||
[InspectableField, JsonProperty("chargeHeatMul"), Key(30)]
|
||||
public float ChargeFiringHeatMultiplier = 1;
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
|
|
@ -91,11 +94,12 @@ public class ChargedWeapon : InstantWeapon
|
|||
ChargeTime = Context.Evaluate(_data.ChargeTime, Item.EquippableItem, Entity);
|
||||
ChargeEnergy = Context.Evaluate(_data.ChargeEnergy, Item.EquippableItem, Entity);
|
||||
ChargeHeat = Context.Evaluate(_data.ChargeHeat, Item.EquippableItem, Entity);
|
||||
Damage *= lerp(1, _data.ChargeDamage, saturate(_charge));
|
||||
Spread *= lerp(1, _data.ChargeSpread, saturate(_charge));
|
||||
BurstCount *= lerp(1, _data.ChargeBurstCount, saturate(_charge));
|
||||
Visibility *= lerp(1, _data.ChargeVisibility, saturate(_charge));
|
||||
Velocity *= lerp(1, _data.ChargeVelocity, saturate(_charge));
|
||||
Damage *= lerp(1, _data.ChargeFiringDamageMultiplier, saturate(_charge));
|
||||
Heat *= lerp(1, _data.ChargeFiringHeatMultiplier, saturate(_charge));
|
||||
Spread *= lerp(1, _data.ChargeFiringSpreadMultiplier, saturate(_charge));
|
||||
BurstCount *= lerp(1, _data.ChargeFiringBurstCountMultiplier, saturate(_charge));
|
||||
Visibility *= lerp(1, _data.ChargeFiringVisibilityMultiplier, saturate(_charge));
|
||||
Velocity *= lerp(1, _data.ChargeFiringVelocityMultiplier, saturate(_charge));
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ public class InstantWeaponData : WeaponData
|
|||
|
||||
[InspectableField, JsonProperty("cooldown"), Key(17), RuntimeInspectable]
|
||||
public PerformanceStat Cooldown = new PerformanceStat();
|
||||
|
||||
[InspectablePrefab, JsonProperty("ammoInterval"), Key(18)]
|
||||
public bool SingleAmmoBurst;
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
|
|
@ -32,7 +35,7 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
private float _burstTimer;
|
||||
private float _burstInterval;
|
||||
protected float _cooldown; // Normalized
|
||||
private int _ammo = 1;
|
||||
private int _ammo = 0;
|
||||
protected bool _coolingDown;
|
||||
|
||||
public float BurstCount { get; protected set; }
|
||||
|
|
@ -65,6 +68,10 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
|
||||
protected void Trigger()
|
||||
{
|
||||
// If 1 ammo is consumed per burst, perform ammo consumption here
|
||||
// UseAmmo returns false when triggering reload; cancel firing if that is the case
|
||||
if(_data.SingleAmmoBurst && !UseAmmo()) return;
|
||||
|
||||
_burstRemaining = (int) BurstCount;
|
||||
_burstInterval = BurstTime / _burstRemaining;
|
||||
_burstTimer = 0;
|
||||
|
|
@ -78,6 +85,40 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
BurstCount = Context.Evaluate(_data.Count, Item.EquippableItem, Entity);
|
||||
BurstTime = Context.Evaluate(_data.BurstTime, Item.EquippableItem, Entity);
|
||||
Cooldown = Context.Evaluate(_data.Cooldown, Item.EquippableItem, Entity);
|
||||
|
||||
Damage /= (int) BurstCount;
|
||||
Heat /= (int) BurstCount;
|
||||
Energy /= (int) BurstCount;
|
||||
}
|
||||
|
||||
private bool UseAmmo()
|
||||
{
|
||||
if (_data.AmmoType != Guid.Empty)
|
||||
{
|
||||
if (_data.MagazineSize > 1 && _ammo > 0) _ammo--;
|
||||
else
|
||||
{
|
||||
var cargo = Entity.FindItemInCargo(_data.AmmoType);
|
||||
if (cargo != null)
|
||||
{
|
||||
var item = cargo.ItemsOfType[_data.AmmoType][0];
|
||||
if (item is SimpleCommodity simpleCommodity)
|
||||
cargo.Remove(simpleCommodity, 1);
|
||||
|
||||
if(_data.MagazineSize > 1)
|
||||
{
|
||||
OnReloadBegin?.Invoke();
|
||||
_cooldown = 1;
|
||||
_coolingDown = true;
|
||||
_firing = false;
|
||||
}
|
||||
}
|
||||
_burstRemaining = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Execute(float delta)
|
||||
|
|
@ -102,30 +143,9 @@ public class InstantWeapon : Weapon, IProgressBehavior
|
|||
_burstTimer += delta;
|
||||
while (_burstRemaining > 0 && _burstTimer > 0)
|
||||
{
|
||||
if (_data.AmmoType != Guid.Empty)
|
||||
{
|
||||
if (_data.MagazineSize > 1 && _ammo > 0) _ammo--;
|
||||
else
|
||||
{
|
||||
var cargo = Entity.FindItemInCargo(_data.AmmoType);
|
||||
if (cargo != null)
|
||||
{
|
||||
var item = cargo.ItemsOfType[_data.AmmoType][0];
|
||||
if (item is SimpleCommodity simpleCommodity)
|
||||
cargo.Remove(simpleCommodity, 1);
|
||||
|
||||
if(_data.MagazineSize > 1)
|
||||
{
|
||||
OnReloadBegin?.Invoke();
|
||||
_cooldown = 1;
|
||||
_coolingDown = true;
|
||||
_firing = false;
|
||||
}
|
||||
}
|
||||
_burstRemaining = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// If 1 ammo is consumed per shot in the burst, perform ammo consumption here
|
||||
// UseAmmo returns false when triggering reload; cancel firing if that is the case
|
||||
if (!_data.SingleAmmoBurst && !UseAmmo()) return false;
|
||||
|
||||
_burstRemaining--;
|
||||
_burstTimer -= _burstInterval;
|
||||
|
|
|
|||
|
|
@ -9,26 +9,53 @@ using Unity.Mathematics;
|
|||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class LauncherData : LockWeaponData
|
||||
{
|
||||
[InspectableAnimationCurve, JsonProperty("guidance"), Key(23)]
|
||||
[InspectableAnimationCurve, JsonProperty("guidance"), Key(24)]
|
||||
public float4[] GuidanceCurve;
|
||||
|
||||
[InspectableAnimationCurve, JsonProperty("thrustCurve"), Key(24)]
|
||||
[InspectableAnimationCurve, JsonProperty("thrustCurve"), Key(25)]
|
||||
public float4[] ThrustCurve;
|
||||
|
||||
[InspectableAnimationCurve, JsonProperty("liftCurve"), Key(25)]
|
||||
[InspectableAnimationCurve, JsonProperty("liftCurve"), Key(26)]
|
||||
public float4[] LiftCurve;
|
||||
|
||||
[InspectableField, JsonProperty("thrust"), Key(26)]
|
||||
[InspectableField, JsonProperty("thrust"), Key(27)]
|
||||
public PerformanceStat Thrust = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("frequency"), Key(27)]
|
||||
[InspectableField, JsonProperty("frequency"), Key(28)]
|
||||
public float DodgeFrequency;
|
||||
|
||||
[InspectableField, JsonProperty("missileSpeed"), Key(28), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("missileSpeed"), Key(29), RuntimeInspectable]
|
||||
public PerformanceStat MissileVelocity = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
return new LockWeapon(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class GuidedWeaponData : InstantWeaponData
|
||||
{
|
||||
[InspectableAnimationCurve, JsonProperty("guidance"), Key(24)]
|
||||
public float4[] GuidanceCurve;
|
||||
|
||||
[InspectableAnimationCurve, JsonProperty("thrustCurve"), Key(25)]
|
||||
public float4[] ThrustCurve;
|
||||
|
||||
[InspectableAnimationCurve, JsonProperty("liftCurve"), Key(26)]
|
||||
public float4[] LiftCurve;
|
||||
|
||||
[InspectableField, JsonProperty("thrust"), Key(27)]
|
||||
public PerformanceStat Thrust = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("frequency"), Key(28)]
|
||||
public float DodgeFrequency;
|
||||
|
||||
[InspectableField, JsonProperty("missileSpeed"), Key(29), RuntimeInspectable]
|
||||
public PerformanceStat MissileVelocity = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
return new InstantWeapon(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
|
@ -9,19 +9,19 @@ using static Unity.Mathematics.math;
|
|||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public class LockWeaponData : InstantWeaponData
|
||||
{
|
||||
[InspectableField, JsonProperty("speed"), Key(18), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("speed"), Key(19), RuntimeInspectable]
|
||||
public PerformanceStat LockSpeed = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("sensorImpact"), Key(19)]
|
||||
[InspectableField, JsonProperty("sensorImpact"), Key(20)]
|
||||
public PerformanceStat SensorImpact = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("threshold"), Key(20), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("threshold"), Key(21), RuntimeInspectable]
|
||||
public PerformanceStat LockAngle = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("directionImpact"), Key(21)]
|
||||
[InspectableField, JsonProperty("directionImpact"), Key(22)]
|
||||
public PerformanceStat DirectionImpact = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("decay"), Key(22)]
|
||||
[InspectableField, JsonProperty("decay"), Key(23)]
|
||||
public PerformanceStat Decay = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class Radiator : IBehavior
|
|||
{
|
||||
Emissivity = Context.Evaluate(_data.Emissivity, Item.EquippableItem, Entity);
|
||||
var rad = pow(Item.Temperature, Context.GameplaySettings.HeatRadiationExponent) * Context.GameplaySettings.HeatRadiationMultiplier * Emissivity;
|
||||
Item.AddHeat(-rad * delta * Context.GetThermalMass(Item.EquippableItem));
|
||||
Item.AddHeat(-rad * delta);
|
||||
Entity.VisibilitySources[this] = rad;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue