Target Schematic & Various Improvements

Targeting an enemy now shows their schematic
Added Longinus Hull
Fixed projectile overpenetration
Fixed projectiles colliding with minimap icons
Added Schematic hit flashing
Thruster torque multiplier
Thruster torque threshold
This commit is contained in:
Reinier Vens 2021-01-11 02:56:37 +00:00
commit 20e9f89228
24 changed files with 5519 additions and 386 deletions

View file

@ -58,7 +58,13 @@ ScriptedImporter:
graphDescIndex: 0
generateAllOutputs: 0
generateMipMaps: 1
preset: " <sbspreset pkgurl=\"pkg://metal_steel\" label=\"\" >\n </sbspreset>\n"
preset: " <sbspreset pkgurl=\"pkg://metal_steel\" label=\"\" >\n <presetinput
identifier=\"$outputsize\" uid=\"1318093408\" type=\"8\" value=\"9,9\" />\n
<presetinput identifier=\"dirt\" uid=\"854373931\" type=\"0\" value=\"0.903\"
/>\n <presetinput identifier=\"rust\" uid=\"854346221\" type=\"0\" value=\"0\"
/>\n <presetinput identifier=\"surface_imperfections\" uid=\"863227179\" type=\"0\"
value=\"0.413\" />\n <presetinput identifier=\"steel_roughness\" uid=\"863268384\"
type=\"0\" value=\"0.292\" />\n </sbspreset>\n"
shaderName: Standard
materialProperties:
shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
@ -354,8 +360,8 @@ ScriptedImporter:
- label: Default
bOverride: 0
bLockRatio: 1
textureWidth: 256
textureHeight: 256
textureWidth: 512
textureHeight: 512
textureFormatMode: 0
normalCompressed: 0
bGenerateOnLoad: 1

BIN
Assets/Models/Longinus.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: 8d782a44e1004d9458415dc40c13af65
ModelImporter:
serializedVersion: 20200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 1
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4a3db6090789ca24cb57c43666754017
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Schematics/schema_Longinus.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 51702555e534a7a4fb39eb105b80bbaf
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Resources/Settings.asset (Stored with Git LFS)

Binary file not shown.

View file

@ -50,6 +50,7 @@ Box by Rajive
storage by Gajah Mada Studio
Tank by Creative Stall
Satellite by Amelia
distance by Anthony Ledoux
Other

BIN
Assets/Resources/Sprites/Icons/distance.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 079213bab50401f438afb03b707532a3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -34,8 +34,10 @@ public class ActionGameManager : MonoBehaviour
public MenuPanel Menu;
public MapRenderer MenuMap;
public SchematicDisplay SchematicDisplay;
public SchematicDisplay TargetSchematicDisplay;
public InventoryMenu Inventory;
public InventoryPanel ShipPanel;
public InventoryPanel TargetShipPanel;
public ConfirmationDialog ConfirmationDialog;
public float2 Sensitivity;
@ -120,7 +122,7 @@ public class ActionGameManager : MonoBehaviour
GameplayUI.SetActive(true);
SchematicDisplay.ShowShip(_currentShip);
ShipPanel.Display(_currentShip);
ShipPanel.Display(_currentShip, true);
}
return;
@ -145,7 +147,7 @@ public class ActionGameManager : MonoBehaviour
GameplayUI.SetActive(true);
SchematicDisplay.ShowShip(_currentShip);
ShipPanel.Display(_currentShip);
ShipPanel.Display(_currentShip, true);
}
return;
}
@ -173,7 +175,6 @@ public class ActionGameManager : MonoBehaviour
{
var underReticle = Zone.Entities.MaxBy(x => dot(normalize(x.Position - _currentShip.Position), _currentShip.LookDirection));
_currentShip.Target.Value = _currentShip.Target.Value == underReticle ? null : underReticle;
TargetIndicator.gameObject.SetActive(_currentShip.Target.Value != null);
};
_input.Player.TargetNearest.performed += context =>
@ -184,21 +185,15 @@ public class ActionGameManager : MonoBehaviour
_input.Player.TargetNext.performed += context =>
{
var targets = Zone.Entities.OrderBy(x => length(x.Position - _currentShip.Position)).ToArray();
if(_currentShip.Target.Value != null)
{
var currentTargetIndex = Array.IndexOf(targets, _currentShip.Target.Value);
_currentShip.Target.Value = targets[(currentTargetIndex + 1) % targets.Length];
}
var currentTargetIndex = Array.IndexOf(targets, _currentShip.Target.Value);
_currentShip.Target.Value = targets[(currentTargetIndex + 1) % targets.Length];
};
_input.Player.TargetPrevious.performed += context =>
{
var targets = Zone.Entities.OrderBy(x => length(x.Position - _currentShip.Position)).ToArray();
if (_currentShip.Target.Value != null)
{
var currentTargetIndex = Array.IndexOf(targets, _currentShip.Target.Value);
_currentShip.Target.Value = targets[(currentTargetIndex + targets.Length - 1) % targets.Length];
}
var currentTargetIndex = Array.IndexOf(targets, _currentShip.Target.Value);
_currentShip.Target.Value = targets[(currentTargetIndex + targets.Length - 1) % targets.Length];
};
#region Trigger Groups
@ -456,6 +451,16 @@ public class ActionGameManager : MonoBehaviour
var ship = new Ship(ItemManager, Zone, shipHull);
PlayerShips.Add(ship);
_currentShip = ship;
_currentShip.Target.Subscribe(target =>
{
TargetIndicator.gameObject.SetActive(_currentShip.Target.Value != null);
TargetShipPanel.gameObject.SetActive(target != null);
if (target != null)
{
TargetShipPanel.Display(target, true);
TargetSchematicDisplay.ShowShip(target, _currentShip);
}
});
ship.ArmorDamage.Subscribe(hit =>
{
var direction = _directions.MaxBy(d => dot(d.direction, normalize(hit.pos - hullType.Shape.CenterOfMass)));

View file

@ -81,15 +81,17 @@ public class GuidedProjectile : MonoBehaviour
}
var ray = new Ray(t.position, Velocity);
if (Physics.Raycast(ray, out var hit, Velocity.magnitude * Time.deltaTime))
if (Physics.Raycast(ray, out var hit, Velocity.magnitude * Time.deltaTime, 1))
{
var hull = hit.collider.GetComponent<HullCollider>();
if (hull)
{
hull.SendHit(Damage, Penetration, Spread, DamageType, SourceEntity, hit, Velocity.normalized);
}
if (hit.transform.gameObject.layer == 1)
//if (hit.transform.gameObject.layer == 1)
//{
StartCoroutine(Kill());
//}
}
if(_alive)
t.position += Velocity * Time.deltaTime;

View file

@ -45,25 +45,30 @@ public class Projectile : MonoBehaviour
var position = transform.position;
Velocity += Vector3.up * (Gravity * Time.deltaTime);
var ray = new Ray(position, Velocity);
if (Physics.Raycast(ray, out var hit, Velocity.magnitude * Time.deltaTime))
if (Physics.Raycast(ray, out var hit, Velocity.magnitude * Time.deltaTime, 1))
{
var hull = hit.collider.GetComponent<HullCollider>();
if (hull)
{
if(hull.Entity != SourceEntity)
if (hull.Entity != SourceEntity)
{
hull.SendHit(Damage, Penetration, Spread, DamageType, SourceEntity, hit, Velocity.normalized);
transform.position = hit.point;
StartCoroutine(Kill());
if(HitEffect!=null)
if (HitEffect != null)
{
var t = HitEffect.Instantiate<Transform>();
t.SetParent(hit.collider.transform);
t.position = hit.point;
return;
}
}
}
else StartCoroutine(Kill());
else// if (hit.transform.gameObject.layer == 1)
{
StartCoroutine(Kill());
return;
}
}
transform.position += Velocity * Time.deltaTime;

View file

@ -20,6 +20,7 @@ public class SchematicDisplay : MonoBehaviour
public TextMeshProUGUI CargoTemperatureLabel;
public TextMeshProUGUI VisibilityLabel;
public TextMeshProUGUI HullDurabilityLabel;
public TextMeshProUGUI DistanceLabel;
public RectTransform EnergyFill;
public RectTransform HullDurabilityFill;
@ -32,7 +33,7 @@ public class SchematicDisplay : MonoBehaviour
public Color TriggerGroupColor;
private Ship _ship;
private Entity _entity;
private EquippableItem _hull;
private Radiator[] _radiators;
private Cockpit _cockpit;
@ -48,6 +49,9 @@ public class SchematicDisplay : MonoBehaviour
private bool _triggerGroupsVisible;
private float _triggerGroupsFadeOutTime;
private bool _enemy;
private Entity _player;
public SchematicDisplayItem[] SchematicItems
{
get { return _schematicItems; }
@ -83,52 +87,62 @@ public class SchematicDisplay : MonoBehaviour
public WeaponData WeaponData;
}
public void ShowShip(Ship ship)
public void ShowShip(Entity entity, Entity player = null)
{
_enemy = player != null;
_player = player;
if (_schematicItems != null)
foreach (var item in _schematicItems)
{
item.ListElement.GetComponent<Prototype>().ReturnToPool();
item.TriggerGroupElement?.GetComponent<Prototype>().ReturnToPool();
}
_ship = ship;
_cockpit = ship.GetBehavior<Cockpit>();
_reactor = ship.GetBehavior<Reactor>();
_capacitors = ship.GetBehaviors<Capacitor>().ToArray();
_entity = entity;
if (!_enemy)
{
_cockpit = entity.GetBehavior<Cockpit>();
_reactor = entity.GetBehavior<Reactor>();
_capacitors = entity.GetBehaviors<Capacitor>().ToArray();
_radiators = entity.GetBehaviors<Radiator>().ToArray();
if (_radiators.Length == 0)
RadiatorTemperatureLabel.text = "N/A";
_heatsinks = entity.GetBehaviors<Heatsink>().ToArray();
if (_heatsinks.Length == 0)
HeatsinkTemperatureLabel.text = "N/A";
_cargoBays = entity.CargoBays.ToArray();
if (_cargoBays.Length == 0)
CargoTemperatureLabel.text = "N/A";
}
_radiators = ship.GetBehaviors<Radiator>().ToArray();
if (_radiators.Length == 0)
RadiatorTemperatureLabel.text = "N/A";
_heatsinks = ship.GetBehaviors<Heatsink>().ToArray();
if (_heatsinks.Length == 0)
HeatsinkTemperatureLabel.text = "N/A";
_cargoBays = ship.CargoBays.ToArray();
if (_cargoBays.Length == 0)
CargoTemperatureLabel.text = "N/A";
_schematicItems = ship.Equipment
_schematicItems = entity.Equipment
.Where(x => x.Behaviors.Any(b => b.Data is WeaponData))
.Select(x => new SchematicDisplayItem
{
Item = x,
ListElement = ListElementPrototype.Instantiate<SchematicListElement>(),
TriggerGroupElement = TriggerGroupPrototype.Instantiate<SchematicTriggerGroupElement>(),
Cooldown = (IProgressBehavior) x.Behaviors.FirstOrDefault(b=> b is IProgressBehavior),
ItemUsage = (ItemUsage) x.Behaviors.FirstOrDefault(b=> b is ItemUsage),
TriggerGroupElement = _enemy ? null : TriggerGroupPrototype.Instantiate<SchematicTriggerGroupElement>(),
Cooldown = _enemy ? null : (IProgressBehavior) x.Behaviors.FirstOrDefault(b=> b is IProgressBehavior),
ItemUsage = _enemy ? null : (ItemUsage) x.Behaviors.FirstOrDefault(b=> b is ItemUsage),
WeaponData = (WeaponData) x.Behaviors.FirstOrDefault(b=>b.Data is WeaponData)?.Data
})
.ToArray();
foreach (var x in _schematicItems)
{
x.ListElement.Icon.sprite = Settings.ItemIcons[(int) ship.Hardpoints[x.Item.Position.x, x.Item.Position.y].Type];
x.ListElement.Icon.sprite = Settings.ItemIcons[(int) (entity.Hardpoints[x.Item.Position.x, x.Item.Position.y]?.Type ?? HardpointType.Tool)];
x.ListElement.Label.text = x.Item.EquippableItem.Name;
x.ListElement.InfiniteAmmoIcon.gameObject.SetActive(x.ItemUsage == null);
x.ListElement.AmmoLabel.gameObject.SetActive(x.ItemUsage != null);
foreach (var group in x.TriggerGroupElement.GroupBackgrounds)
group.color = TriggerGroupColor;
if (!_enemy)
{
x.ListElement.InfiniteAmmoIcon.gameObject.SetActive(x.ItemUsage == null);
x.ListElement.AmmoLabel.gameObject.SetActive(x.ItemUsage != null);
foreach (var group in x.TriggerGroupElement.GroupBackgrounds)
group.color = TriggerGroupColor;
}
}
if (!_enemy)
UpdateTriggerGroups();
}
@ -152,7 +166,7 @@ public class SchematicDisplay : MonoBehaviour
backgroundColor.a *= 2;
item.TriggerGroupElement.GroupBackgrounds[groupIndex].color = backgroundColor;
item.TriggerGroupElement.GroupLabel[groupIndex].color =
_ship.TriggerGroups[groupIndex].Contains(item.Item) ? Color.white : Color.gray;
_entity.TriggerGroups[groupIndex].Contains(item.Item) ? Color.white : Color.gray;
}
}
}
@ -190,70 +204,81 @@ public class SchematicDisplay : MonoBehaviour
_triggerGroupsVisible = false;
StartCoroutine(FadeOutTriggerGroups());
}
if (_ship != null)
if (_entity != null)
{
VisibilityLabel.text = ((int) _ship.Visibility).ToString();
if(_radiators.Length == 1)
RadiatorTemperatureLabel.text = $"{(_radiators[0].Item.Temperature - 273.15f).SignificantDigits(3)}°C";
else if(_radiators.Length > 1)
RadiatorTemperatureLabel.text =
$"{(_radiators.Min(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_radiators.Max(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}°C";
if(_heatsinks.Length == 1)
HeatsinkTemperatureLabel.text = $"{(_heatsinks[0].Item.Temperature - 273.15f).SignificantDigits(3)}°C";
else if(_heatsinks.Length > 1)
HeatsinkTemperatureLabel.text =
$"{(_heatsinks.Min(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_heatsinks.Max(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}°C";
if(_cargoBays.Length == 1)
CargoTemperatureLabel.text = $"{(_cargoBays[0].Temperature - 273.15f).SignificantDigits(3)}°C";
else if(_cargoBays.Length > 1)
CargoTemperatureLabel.text =
$"{(_cargoBays.Min(r => r.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_cargoBays.Max(r => r.Temperature) - 273.15f).SignificantDigits(3)}°C";
CockpitTemperatureLabel.text = $"{(_cockpit.Item.Temperature - 273.15f).SignificantDigits(3)}°C";
HeatstrokeMeterFill.anchorMax = new Vector2(_cockpit.Heatstroke, 1);
HeatstrokeLimitFill.anchorMax = new Vector2(_cockpit.Item.Temperature / Settings.GameplaySettings.HeatstrokeTemperature, 1);
_hull = _ship.Hull;
var hullData = _ship.ItemManager.GetData(_hull);
var dur = _hull.Durability / hullData.Durability;
HullDurabilityFill.anchorMax = new Vector2(dur, 1);
HullDurabilityLabel.text = $"{(dur*100).SignificantDigits(3)}%";
if (_capacitors.Length == 0)
if (!_enemy)
{
EnergyFill.anchorMax = Vector2.up;
EnergyLabel.text = _reactor.Surplus.SignificantDigits(3);
if (_radiators.Length == 1)
RadiatorTemperatureLabel.text = $"{(_radiators[0].Item.Temperature - 273.15f).SignificantDigits(3)}°C";
else if (_radiators.Length > 1)
RadiatorTemperatureLabel.text =
$"{(_radiators.Min(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_radiators.Max(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}°C";
if (_heatsinks.Length == 1)
HeatsinkTemperatureLabel.text = $"{(_heatsinks[0].Item.Temperature - 273.15f).SignificantDigits(3)}°C";
else if (_heatsinks.Length > 1)
HeatsinkTemperatureLabel.text =
$"{(_heatsinks.Min(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_heatsinks.Max(r => r.Item.Temperature) - 273.15f).SignificantDigits(3)}°C";
if (_cargoBays.Length == 1)
CargoTemperatureLabel.text = $"{(_cargoBays[0].Temperature - 273.15f).SignificantDigits(3)}°C";
else if (_cargoBays.Length > 1)
CargoTemperatureLabel.text =
$"{(_cargoBays.Min(r => r.Temperature) - 273.15f).SignificantDigits(3)}-" +
$"{(_cargoBays.Max(r => r.Temperature) - 273.15f).SignificantDigits(3)}°C";
CockpitTemperatureLabel.text = $"{(_cockpit.Item.Temperature - 273.15f).SignificantDigits(3)}°C";
HeatstrokeMeterFill.anchorMax = new Vector2(_cockpit.Heatstroke, 1);
HeatstrokeLimitFill.anchorMax = new Vector2(_cockpit.Item.Temperature / Settings.GameplaySettings.HeatstrokeTemperature, 1);
if (_capacitors.Length == 0)
{
EnergyFill.anchorMax = Vector2.up;
EnergyLabel.text = _reactor.Surplus.SignificantDigits(3);
}
else
{
var charge = _capacitors.Sum(x => x.Charge);
var maxCharge = _capacitors.Sum(x => x.Capacity);
EnergyFill.anchorMax = new Vector2(charge / maxCharge, 1);
EnergyLabel.text = $"{charge.SignificantDigits(3)}/{maxCharge.SignificantDigits(3)} ({_reactor.Surplus.SignificantDigits(3)})";
}
}
else
{
var charge = _capacitors.Sum(x => x.Charge);
var maxCharge = _capacitors.Sum(x => x.Capacity);
EnergyFill.anchorMax = new Vector2(charge / maxCharge, 1);
EnergyLabel.text = $"{charge.SignificantDigits(3)}/{maxCharge.SignificantDigits(3)} ({_reactor.Surplus.SignificantDigits(3)})";
DistanceLabel.text = $"{(int)length(_entity.Position - _player.Position)}";
}
VisibilityLabel.text = ((int)_entity.Visibility).ToString();
_hull = _entity.Hull;
var hullData = _entity.ItemManager.GetData(_hull);
var dur = _hull.Durability / hullData.Durability;
HullDurabilityFill.anchorMax = new Vector2(dur, 1);
HullDurabilityLabel.text = $"{(dur*100).SignificantDigits(3)}%";
foreach (var x in _schematicItems)
{
var itemData = _ship.ItemManager.GetData(x.Item.EquippableItem);
x.ListElement.HeatFill.anchorMax = new Vector2(unlerp(itemData.MinimumTemperature,itemData.MaximumTemperature, x.Item.Temperature), 0);
if(x.Cooldown!=null)
x.ListElement.CooldownFill.anchorMax = new Vector2(x.Cooldown.Progress,1);
x.ListElement.DurabilityLabel.text = $"{(int)(x.Item.EquippableItem.Durability / itemData.Durability * 100)}%";
if (x.ItemUsage != null)
if (!_enemy)
{
x.ListElement.AmmoLabel.text = _ship.CountItemsInCargo(((ItemUsageData) x.ItemUsage.Data).Item).ToString();
var itemData = _entity.ItemManager.GetData(x.Item.EquippableItem);
x.ListElement.HeatFill.anchorMax = new Vector2(unlerp(itemData.MinimumTemperature, itemData.MaximumTemperature, x.Item.Temperature), 0);
if (x.Cooldown != null)
x.ListElement.CooldownFill.anchorMax = new Vector2(x.Cooldown.Progress, 1);
x.ListElement.DurabilityLabel.text = $"{(int)(x.Item.EquippableItem.Durability / itemData.Durability * 100)}%";
if (x.ItemUsage != null)
{
x.ListElement.AmmoLabel.text = _entity.CountItemsInCargo(((ItemUsageData)x.ItemUsage.Data).Item).ToString();
}
}
if (x.WeaponData != null)
{
x.ListElement.RangeLabel.text = ((int) _ship.ItemManager.Evaluate(x.WeaponData.Range, x.Item.EquippableItem, _ship)).ToString();
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.WeaponData.Range, x.Item.EquippableItem, _entity)).ToString();
}
}
}

View file

@ -629,7 +629,9 @@ public class SectorRenderer : MonoBehaviour
for (int i = 0; i < shipInstance.Thrusters.Length; i++)
{
var emissionModule = shipInstance.ThrusterParticles[i].emission;
emissionModule.rateOverTimeMultiplier = shipInstance.ThrusterBaseEmission[i] * shipInstance.Thrusters[i].Axis;
var item = shipInstance.Thrusters[i].Item.EquippableItem;
var data = shipInstance.Entity.ItemManager.GetData(item);
emissionModule.rateOverTimeMultiplier = shipInstance.ThrusterBaseEmission[i] * shipInstance.Thrusters[i].Axis * (item.Durability / data.Durability);
}
entity.Value.Transform.rotation = ((Ship) entity.Key).Rotation;

View file

@ -60,14 +60,14 @@ public class Thruster : IAnalogBehavior
var itemData = context.GetData(item.EquippableItem);
var itemCenter = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation).CenterOfMass;
var toCenter = hullCenter - itemCenter;
Torque = -dot(toCenter, float2(1, 0).Rotate(item.EquippableItem.Rotation));
Torque = -dot(normalize(toCenter), float2(1, 0).Rotate(item.EquippableItem.Rotation));
}
public bool Execute(float delta)
{
Thrust = Context.Evaluate(_data.Thrust, Item.EquippableItem, Entity);
Entity.Velocity -= Entity.Direction.Rotate(Item.EquippableItem.Rotation) * _input * Thrust / Entity.Mass * delta;
Entity.Direction = mul(Entity.Direction, Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust / Entity.Mass / 100 * delta));
Entity.Direction = mul(Entity.Direction, Unity.Mathematics.float2x2.Rotate(_input * Torque * Thrust * Context.GameplaySettings.TorqueMultiplier / Entity.Mass * delta));
Item.AddHeat(_input * Context.Evaluate(_data.Heat, Item.EquippableItem, Entity) * delta);
Entity.VisibilitySources[this] = _input * Context.Evaluate(_data.Visibility, Item.EquippableItem, Entity);
return true;

View file

@ -107,4 +107,6 @@ public class GameplaySettings
public float LockIndicatorNoiseAmplitude = 50f;
public ExponentialLerp LockIndicatorFrequency;
public ExponentialLerp LockSpinSpeed;
public float TorqueFloor;
public float TorqueMultiplier;
}

View file

@ -42,8 +42,8 @@ public class Ship : Entity
_reverseThrusters = _allThrusters.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.None).ToArray();
_rightThrusters = _allThrusters.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.CounterClockwise).ToArray();
_leftThrusters = _allThrusters.Where(x => x.Item.EquippableItem.Rotation == ItemRotation.Clockwise).ToArray();
_counterClockwiseThrusters = _allThrusters.Where(x => x.Torque < -.05f).ToArray();
_clockwiseThrusters = _allThrusters.Where(x => x.Torque > .05f).ToArray();
_counterClockwiseThrusters = _allThrusters.Where(x => x.Torque < -ItemManager.GameplaySettings.TorqueFloor).ToArray();
_clockwiseThrusters = _allThrusters.Where(x => x.Torque > ItemManager.GameplaySettings.TorqueFloor).ToArray();
}
public Ship(ItemManager itemManager, Zone zone, EquippableItem hull) : base(itemManager, zone, hull)

View file

@ -19,6 +19,7 @@ using int2 = Unity.Mathematics.int2;
public class InventoryPanel : MonoBehaviour
{
public bool Flip;
public GameSettings Settings;
public ActionGameManager GameManager;
public ContextMenu ContextMenu;
@ -335,7 +336,7 @@ public class InventoryPanel : MonoBehaviour
bool HardpointMatch(int2 offset)
{
var v2 = v + offset;
var v2 = v + offset * (Flip ? -1 : 1);
return !(
hullData.Shape[v2] &&
_displayedEntity.Hardpoints[v2.x, v2.y] == hardpoint &&
@ -345,7 +346,7 @@ public class InventoryPanel : MonoBehaviour
bool NoHardpointMatch(int2 offset)
{
var v2 = v + offset;
var v2 = v + offset * (Flip ? -1 : 1);
return !(
hullData.Shape[v2] && (
!interior && !hullData.InteriorCells[v2] && _displayedEntity.Hardpoints[v2.x, v2.y] == null ||