Inventory Events
Added an event system allowing the UI to subscribe to changes in entity cargo, hardpoints or on specific items Fixed bugs in colony tab caused by recent refactoring
This commit is contained in:
parent
d8d542f438
commit
39ce6809c0
11 changed files with 370 additions and 249 deletions
|
|
@ -99,13 +99,14 @@ public class MiningController : ControllerBase, IBehavior, IPersistentBehavior,
|
|||
foreach (var item in _entity.Cargo
|
||||
.Select(id => _context.Cache.Get<ItemInstance>(id))
|
||||
.Where(item => item is SimpleCommodity)
|
||||
.Cast<SimpleCommodity>())
|
||||
.Cast<SimpleCommodity>()
|
||||
.ToArray())
|
||||
{
|
||||
int supportedQuantity = (int) ((homeEntity.Capacity - homeEntity.OccupiedCapacity) / item.ItemData.Size);
|
||||
var newItem = _entity.RemoveCargo(item, supportedQuantity);
|
||||
int quantity = min((int) ((homeEntity.Capacity - homeEntity.OccupiedCapacity) / item.ItemData.Size), item.Quantity);
|
||||
var newItem = _entity.RemoveCargo(item, quantity);
|
||||
homeEntity.AddCargo(newItem);
|
||||
|
||||
if (supportedQuantity < item.Quantity)
|
||||
if (quantity < item.Quantity)
|
||||
{
|
||||
homeEntity.SetMessage("Colony is out of cargo space. Closing Mining Task.");
|
||||
FinishTask();
|
||||
|
|
|
|||
Loading…
Reference in a new issue