Thermal Performance Threshold & Thermal Override
Items will switch themselves off below a customizable threshold to avoid damage Player can toggle thermal override to disable safety shutdown Selecting an item allows player to select whether the item will override Clicking on the background of an inventory panel will display general ship settings (including thermal shutdown threshold) Performance Stat evaluation has been moved to EquippedItem, slight performance improvement Item online and active status are now reactive properties Created player settings file to store e.g. shutdown threshold Fixed crash when entering wormhole while enemies are visible
This commit is contained in:
parent
2f088b5590
commit
1092159063
66 changed files with 756 additions and 206 deletions
|
|
@ -52,6 +52,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
// private CinemachineFramingTransposer _transposer;
|
||||
// private CinemachineComposer _composer;
|
||||
|
||||
public PlayerSettings PlayerSettings { get; private set; }
|
||||
private DirectoryInfo _filePath;
|
||||
private DirectoryInfo _loadoutPath;
|
||||
private bool _editMode;
|
||||
|
|
@ -112,7 +113,10 @@ public class ActionGameManager : MonoBehaviour
|
|||
|
||||
if (CurrentShip != null)
|
||||
{
|
||||
CurrentShip.Deactivate();
|
||||
CurrentShip.Zone = Zone;
|
||||
Zone.Entities.Add(CurrentShip);
|
||||
CurrentShip.Activate();
|
||||
}
|
||||
|
||||
SectorRenderer.LoadZone(Zone);
|
||||
|
|
@ -128,11 +132,20 @@ public class ActionGameManager : MonoBehaviour
|
|||
ConsoleController.MessageReceiver = this;
|
||||
_filePath = new DirectoryInfo(Application.dataPath).Parent.CreateSubdirectory("GameData");
|
||||
_loadoutPath = _filePath.CreateSubdirectory("Loadouts");
|
||||
|
||||
ItemData = new DatabaseCache();
|
||||
ItemData.Load(_filePath.FullName);
|
||||
ItemData.Load(Path.Combine(_filePath.FullName, "AetherDB.msgpack"));
|
||||
ItemManager = new ItemManager(ItemData, Settings.GameplaySettings, Debug.Log);
|
||||
SectorRenderer.ItemManager = ItemManager;
|
||||
|
||||
FileInfo playerSettingsFile = new FileInfo(Path.Combine(_filePath.FullName, "PlayerSettings.msgpack"));
|
||||
if (!playerSettingsFile.Exists)
|
||||
{
|
||||
File.WriteAllBytes(playerSettingsFile.FullName, MessagePackSerializer.Serialize(Settings.DefaultPlayerSettings));
|
||||
}
|
||||
PlayerSettings = MessagePackSerializer.Deserialize<PlayerSettings>(
|
||||
File.ReadAllBytes(playerSettingsFile.FullName));
|
||||
|
||||
Loadouts.AddRange(_loadoutPath.EnumerateFiles("*.preset")
|
||||
.Select(fi => MessagePackSerializer.Deserialize<EntityPack>(File.ReadAllBytes(fi.FullName))));
|
||||
|
||||
|
|
@ -230,6 +243,11 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
};
|
||||
|
||||
_input.Player.OverrideShutdown.performed += context =>
|
||||
{
|
||||
CurrentShip.OverrideShutdown = !CurrentShip.OverrideShutdown;
|
||||
};
|
||||
|
||||
_input.Player.ToggleHeatsinks.performed += context =>
|
||||
{
|
||||
CurrentShip.HeatsinksEnabled = !CurrentShip.HeatsinksEnabled;
|
||||
|
|
@ -240,8 +258,8 @@ public class ActionGameManager : MonoBehaviour
|
|||
{
|
||||
if (CurrentShip.Shield != null)
|
||||
{
|
||||
CurrentShip.Shield.Item.Enabled = !CurrentShip.Shield.Item.Enabled;
|
||||
AkSoundEngine.PostEvent(CurrentShip.Shield.Item.Enabled ? "UI_Success" : "UI_Fail", gameObject);
|
||||
CurrentShip.Shield.Item.Enabled.Value = !CurrentShip.Shield.Item.Enabled.Value;
|
||||
AkSoundEngine.PostEvent(CurrentShip.Shield.Item.Enabled.Value ? "UI_Success" : "UI_Fail", gameObject);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class GameSettings : ScriptableObject
|
|||
public PlanetSettings PlanetSettings;
|
||||
public ZoneGenerationSettings ZoneSettings;
|
||||
public GameplaySettings GameplaySettings;
|
||||
public PlayerSettings DefaultPlayerSettings;
|
||||
public Color HullHitColor;
|
||||
public Color ArmorHitColor;
|
||||
public Color HardpointHitColor;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class ConstantLaser : MonoBehaviour
|
|||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield)
|
||||
{
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ public class ConstantLaserManager : ConstantWeaponEffectManager
|
|||
p.SourceEntity = source.Entity;
|
||||
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
|
||||
var barrel = source.GetBarrel(hp);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item);
|
||||
p.Range = item.Evaluate(data.Range);
|
||||
var t = p.transform;
|
||||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item);
|
||||
p.Damage = item.Evaluate(data.Damage);
|
||||
p.Penetration = item.Evaluate(data.Penetration);
|
||||
p.Spread = item.Evaluate(data.DamageSpread);
|
||||
p.DamageType = data.DamageType;
|
||||
_lasers.Add(item, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,14 +55,14 @@ public class ConstantLightning : MonoBehaviour
|
|||
foreach (var hit in hits)
|
||||
{
|
||||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (shield.Entity == Source.Entity) continue;
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage * Time.deltaTime);
|
||||
shield.ShowHit(hit.point, sqrt(Damage));
|
||||
}
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (hull.Entity == Source.Entity) continue;
|
||||
hull.SendHit(Damage * Time.deltaTime, Penetration, Spread, DamageType, Source.Entity, hit.textureCoord, Barrel.forward);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ 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 = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.Range = source.Entity.ItemManager.Evaluate(data.Range, item);
|
||||
p.Penetration = source.Entity.ItemManager.Evaluate(data.Penetration, item);
|
||||
p.Spread = source.Entity.ItemManager.Evaluate(data.DamageSpread, item);
|
||||
p.Damage = item.Evaluate(data.Damage);
|
||||
p.Range = item.Evaluate(data.Range);
|
||||
p.Penetration = item.Evaluate(data.Penetration);
|
||||
p.Spread = item.Evaluate(data.DamageSpread);
|
||||
p.DamageType = data.DamageType;
|
||||
_bolts.Add(item, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class ConstantParticleWeaponManager : ConstantWeaponEffectManager
|
|||
t.SetParent(barrel);
|
||||
t.forward = barrel.forward;
|
||||
t.position = barrel.position;
|
||||
p.Damage = source.Entity.ItemManager.Evaluate(data.Damage, item);
|
||||
p.Damage = item.Evaluate(data.Damage);
|
||||
p.DamageType = data.DamageType;
|
||||
_weapons.Add(item, p);
|
||||
p.Initialize();
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield)
|
||||
{
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
|
|
@ -155,7 +155,7 @@ public class GuidedProjectile : MonoBehaviour
|
|||
}
|
||||
}
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (hull.Entity != SourceEntity)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
p.LiftCurve = launcher.LiftCurve.ToCurve();
|
||||
p.ThrustCurve = launcher.ThrustCurve.ToCurve();
|
||||
p.Velocity = barrel.forward * weapon.Velocity;
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(launcher.Thrust, item);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(launcher.MissileVelocity, item);
|
||||
p.Thrust = item.Evaluate(launcher.Thrust);
|
||||
p.TopSpeed = item.Evaluate(launcher.MissileVelocity);
|
||||
}
|
||||
else if(weapon.Data is GuidedWeaponData guidance)
|
||||
{
|
||||
|
|
@ -51,8 +51,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager
|
|||
p.LiftCurve = guidance.LiftCurve.ToCurve();
|
||||
p.ThrustCurve = guidance.ThrustCurve.ToCurve();
|
||||
p.Velocity = barrel.forward * weapon.Velocity;
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(guidance.Thrust, item);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(guidance.MissileVelocity, item);
|
||||
p.Thrust = item.Evaluate(guidance.Thrust);
|
||||
p.TopSpeed = item.Evaluate(guidance.MissileVelocity);
|
||||
p.TargetPosition = () => source.Entity.Position + length( (float3)source.LookAtPoint.position - source.Entity.Position) * source.Entity.LookDirection;
|
||||
}
|
||||
else Debug.LogError($"Weapon {item.EquippableItem.Name} linked to {name} effect, but is not a Launcher!");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class HitscanEffect : MonoBehaviour
|
|||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield)
|
||||
{
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public class Laser : MonoBehaviour
|
|||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield)
|
||||
{
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public class Lightning : MonoBehaviour
|
|||
foreach (var hit in hits)
|
||||
{
|
||||
var shield = hit.collider.GetComponent<ShieldManager>();
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (shield.Entity == Source.Entity) continue;
|
||||
LightningCompute.OnLeaderComplete = () =>
|
||||
|
|
@ -46,7 +46,7 @@ public class Lightning : MonoBehaviour
|
|||
};
|
||||
}
|
||||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (hull.Entity == Source.Entity) continue;
|
||||
LightningCompute.OnLeaderComplete = () =>
|
||||
|
|
|
|||
|
|
@ -109,13 +109,13 @@ public class Mine : MonoBehaviour
|
|||
foreach (var collider in Physics.OverlapSphere(t.position, BlastRange, 1 | (1 << 17)))
|
||||
{
|
||||
var shield = collider.GetComponent<ShieldManager>();
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (shield && (shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage);
|
||||
shield.ShowHit(t.position, sqrt(Damage));
|
||||
}
|
||||
var hull = collider.GetComponent<HullCollider>();
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
hull.SendSplash(Damage, DamageType, Source.Entity, (collider.transform.position - t.position).normalized);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ public class Projectile : MonoBehaviour
|
|||
var hull = hit.collider.GetComponent<HullCollider>();
|
||||
if (shield)
|
||||
{
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (!(shield.Entity.Shield != null && shield.Entity.Shield.Item.Active.Value && shield.Entity.Shield.CanTakeHit(DamageType, Damage))) continue;
|
||||
if (shield.Entity != SourceEntity)
|
||||
{
|
||||
shield.Entity.Shield.TakeHit(DamageType, Damage*DirectHitDamageMultiplier);
|
||||
shield.ShowHit(hit.point, sqrt(Damage * DirectHitDamageMultiplier));
|
||||
}
|
||||
}
|
||||
else if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
else if (hull && !(hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value && hull.Entity.Shield.CanTakeHit(DamageType, Damage)))
|
||||
{
|
||||
if (hull.Entity != SourceEntity)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue