Shops & Weapon Icons

Added stations to loadout generator
Overhauled Trade menu to sell station inventory contents
Placing stations in ZoneGenerator
Moved weapons to new item type: WeaponItemData
Implemented icon sets for weapon functionality
Renamed MegaCorporation to Faction
Implemented quality-dependent item pricing
Added unoccupied space helper function for entity
Moved sector generation settings to settings file
This commit is contained in:
Reinier Vens 2021-03-20 04:20:17 +00:00
commit fd81bf267e
33 changed files with 1640 additions and 1077 deletions

View file

@ -13,7 +13,7 @@ using int2 = Unity.Mathematics.int2;
public abstract class Entity
{
public Zone Zone;
public MegaCorporation Faction;
public Faction Faction;
public EquippableItem Hull;
public float3 Position;
@ -78,6 +78,8 @@ public abstract class Entity
}
}
public HullData HullData { get; }
public EntitySettings Settings { get; }
public bool OverrideShutdown { get; set; }
@ -162,6 +164,7 @@ public abstract class Entity
ItemManager = itemManager;
Zone = zone;
Hull = hull;
HullData = itemManager.GetData(hull) as HullData;
Name = hull.Name;
MapEntity();
TriggerGroups = new (List<Weapon> triggers, List<EquippedItem> items)[itemManager.GameplaySettings.TriggerGroupCount];
@ -277,6 +280,21 @@ public abstract class Entity
return CargoBays.FirstOrDefault(c => c.ItemsOfType.ContainsKey(itemDataID));
}
public Shape UnoccupiedSpace
{
get
{
var emptyShape = new Shape(HullData.Shape.Width, HullData.Shape.Height);
foreach (var v in HullData.Shape.Coordinates)
{
if (HullData.InteriorCells[v] && GearOccupancy[v.x, v.y] == null && Hardpoints[v.x,v.y] == null)
emptyShape[v] = true;
}
return emptyShape;
}
}
// Attempts to move a given number of items of the given type to the target Entity
// Returns the number of items successfully transferred
public int TryTransferItems(Entity target, Guid itemDataID, int quantity)
@ -1040,7 +1058,18 @@ public class EquippedCargoBay : EquippedItem
public float Mass { get; private set; }
public float ThermalMass { get; private set; }
public string Name { get; }
public Shape UnoccupiedSpace
{
get
{
var unoccupied = new Shape(Data.InteriorShape.Width, Data.InteriorShape.Height);
foreach (var v in unoccupied.AllCoordinates)
unoccupied[v] = Occupancy[v.x, v.y] == null;
return unoccupied;
}
}
public EquippedCargoBay(ItemManager itemManager, EquippableItem item, int2 position, Entity entity, string name) : base(itemManager, item, position, entity)
{
Data = ItemManager.GetData(EquippableItem) as CargoBayData;
@ -1101,6 +1130,7 @@ public class EquippedCargoBay : EquippedItem
if (remainingQuantity == 0) return true;
}
// TODO: Try alternate item rotations / use Shape.FitsWithin
// Search all the space in the cargo bay for an empty space where the item fits
foreach (var cargoCoord in Data.InteriorShape.Coordinates)
{