Heat Performance Curves + Wear & Tear
Added heat variation option for Performance Stats Ability to toggle radiators on/off using H key Item durability loss (Wear) is now heat dependent and incurred only when used Restricted equip/unequip to docked (inactive) entities Fixed race condition causing exceptions in database sync code
This commit is contained in:
parent
1bb058a8dc
commit
4b10923448
44 changed files with 437 additions and 184 deletions
|
|
@ -110,30 +110,34 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
|
||||
if (item != null)
|
||||
if(!entityEvent.Entity.Active)
|
||||
{
|
||||
var itemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
var hullData = GameManager.ItemManager.GetData(entityEvent.Entity.Hull);
|
||||
|
||||
_originalRotation = item.EquippableItem.Rotation;
|
||||
_originalEquippedItem = entityEvent.Entity.GearOccupancy[data.Position.x, data.Position.y];
|
||||
_originalOccupancy = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation);
|
||||
_originalPanel = panel;
|
||||
_dragItem = item.EquippableItem;
|
||||
_dragCellOffset = item.Position - entityEvent.Position;
|
||||
_dragCells = _originalOccupancy.Coordinates
|
||||
.Select(v => Instantiate(panel.CellInstances[v], DragParent, true).transform).ToArray();
|
||||
foreach(var cell in _dragCells)
|
||||
var item = entityEvent.Entity.GearOccupancy[entityEvent.Position.x, entityEvent.Position.y];
|
||||
if (item != null)
|
||||
{
|
||||
foreach (var component in cell.GetComponentsInChildren<ObservableTriggerBase>())
|
||||
component.enabled = false;
|
||||
cell.GetComponentInChildren<Image>().raycastTarget = false;
|
||||
var itemData = GameManager.ItemManager.GetData(item.EquippableItem);
|
||||
var hullData = GameManager.ItemManager.GetData(entityEvent.Entity.Hull);
|
||||
|
||||
_originalRotation = item.EquippableItem.Rotation;
|
||||
_originalEquippedItem = entityEvent.Entity.GearOccupancy[data.Position.x, data.Position.y];
|
||||
_originalOccupancy = hullData.Shape.Inset(itemData.Shape, item.Position, item.EquippableItem.Rotation);
|
||||
_originalPanel = panel;
|
||||
_dragItem = item.EquippableItem;
|
||||
_dragCellOffset = item.Position - entityEvent.Position;
|
||||
_dragCells = _originalOccupancy.Coordinates
|
||||
.Select(v => Instantiate(panel.CellInstances[v], DragParent, true).transform).ToArray();
|
||||
foreach (var cell in _dragCells)
|
||||
{
|
||||
foreach (var component in cell.GetComponentsInChildren<ObservableTriggerBase>())
|
||||
component.enabled = false;
|
||||
cell.GetComponentInChildren<Image>().raycastTarget = false;
|
||||
}
|
||||
|
||||
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
|
||||
panel.IgnoreOccupancy = _originalOccupancy;
|
||||
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
|
||||
AkSoundEngine.PostEvent("Pickup", gameObject);
|
||||
}
|
||||
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
|
||||
panel.IgnoreOccupancy = _originalOccupancy;
|
||||
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
|
||||
AkSoundEngine.PostEvent("Pickup", gameObject);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -166,7 +170,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
if (entityEvent.Entity.Unequip(_originalEquippedItem) != null)
|
||||
if (entityEvent.Entity.TryUnequip(_originalEquippedItem) != null)
|
||||
{
|
||||
_dragTargetPanel.DropItem(_dragItem, _dragTargetPosition);
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
|
|
@ -196,7 +200,7 @@ public class InventoryMenu : MonoBehaviour
|
|||
}
|
||||
else if (data is InventoryEntityEventData entityEvent)
|
||||
{
|
||||
if (entityEvent.Entity.Unequip(_originalEquippedItem) == null)
|
||||
if (entityEvent.Entity.TryUnequip(_originalEquippedItem) == null)
|
||||
{
|
||||
Dialog.Clear();
|
||||
Dialog.Title.text = "Unable to destroy item!";
|
||||
|
|
@ -290,13 +294,15 @@ public class InventoryMenu : MonoBehaviour
|
|||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item))
|
||||
if (otherPanel.CanDropItem(item))
|
||||
{
|
||||
otherPanel.DropItem(item);
|
||||
AkSoundEngine.PostEvent("Equip", gameObject);
|
||||
cargoEvent.CargoBay.Remove(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -336,12 +342,20 @@ public class InventoryMenu : MonoBehaviour
|
|||
if (Mouse.current.clickCount.ReadValue() == 2)
|
||||
{
|
||||
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
|
||||
if (otherPanel.DropItem(item.EquippableItem))
|
||||
if (otherPanel.CanDropItem(item.EquippableItem))
|
||||
{
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
entityEvent.Entity.Unequip(item);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
if (!entityEvent.Entity.Active)
|
||||
{
|
||||
if (entityEvent.Entity.TryUnequip(item) != null)
|
||||
{
|
||||
otherPanel.DropItem(item.EquippableItem);
|
||||
AkSoundEngine.PostEvent("Unequip", gameObject);
|
||||
panel.RefreshCells();
|
||||
otherPanel.RefreshCells();
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
else AkSoundEngine.PostEvent("UI_Fail", gameObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -640,6 +640,21 @@ public class InventoryPanel : MonoBehaviour
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool CanDropItem(ItemInstance item)
|
||||
{
|
||||
if (_displayedEntity != null && item is EquippableItem equippableItem)
|
||||
{
|
||||
return _displayedEntity.TryFindSpace(equippableItem, out _);
|
||||
}
|
||||
|
||||
if (_displayedCargo != null)
|
||||
{
|
||||
return _displayedCargo.TryFindSpace(item);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool DropItem(ItemInstance item)
|
||||
{
|
||||
if (_displayedEntity != null && item is EquippableItem equippableItem)
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ public class PropertiesPanel : MonoBehaviour
|
|||
else if (fieldType == typeof(PerformanceStat))
|
||||
{
|
||||
var stat = (PerformanceStat) field.GetValue(behavior);
|
||||
AddProperty(field.Name, () => $"{Context.Evaluate(stat, gear, entity).SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
AddProperty(field.Name, () => $"{Context.Evaluate(stat, gear).SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ public class SchematicDisplay : MonoBehaviour
|
|||
public Prototype ListElementPrototype;
|
||||
public Prototype TriggerGroupPrototype;
|
||||
|
||||
public Color HeaderElementEnabledColor;
|
||||
public Color HeaderElementDisabledColor;
|
||||
|
||||
public Image HeatsinkBackground;
|
||||
|
||||
public TextMeshProUGUI EnergyLabel;
|
||||
public TextMeshProUGUI CockpitTemperatureLabel;
|
||||
public TextMeshProUGUI RadiatorTemperatureLabel;
|
||||
|
|
@ -209,13 +214,13 @@ public class SchematicDisplay : MonoBehaviour
|
|||
{
|
||||
if (!_enemy)
|
||||
{
|
||||
|
||||
if (_radiators.Length == 1)
|
||||
RadiatorTemperatureLabel.text = $"{((int)(_radiators[0].Temperature - 273.15f)).ToString()}°C";
|
||||
else if (_radiators.Length > 1)
|
||||
RadiatorTemperatureLabel.text =
|
||||
$"{((int)(_radiators.Min(r => r.Temperature) - 273.15f)).ToString()}-" +
|
||||
$"{((int)(_radiators.Max(r => r.Temperature) - 273.15f)).ToString()}°C";
|
||||
HeatsinkBackground.color = _entity.HeatsinksEnabled ? HeaderElementEnabledColor : HeaderElementDisabledColor;
|
||||
|
||||
if (_heatsinks.Length == 1)
|
||||
HeatsinkTemperatureLabel.text = $"{((int)(_heatsinks[0].Item.Temperature - 273.15f)).ToString()}°C";
|
||||
|
|
@ -282,7 +287,7 @@ public class SchematicDisplay : MonoBehaviour
|
|||
|
||||
if (x.Weapon.WeaponData != null)
|
||||
{
|
||||
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.Weapon.WeaponData.Range, x.Item.EquippableItem, _entity)).ToString();
|
||||
x.ListElement.RangeLabel.text = ((int) _entity.ItemManager.Evaluate(x.Weapon.WeaponData.Range, x.Item)).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue