public void VolumeStorage_BasicChecks() { var cookies = SetupCookieTradeGood(); var cookiePile = new VolumeStorageDB(); cookiePile.TypeStores.Add(cookies.CargoTypeID, new TypeStore(100)); var added = cookiePile.AddCargoByUnit(cookies, 99); var storedCookies = cookiePile.GetUnitsStored(cookies); var storedCookieMass = cookiePile.GetMassStored(cookies); var storedCookieVolume = cookiePile.GetVolumeStored(cookies); Assert.AreEqual(99, added); Assert.AreEqual(99, storedCookies); Assert.AreEqual(99, storedCookieMass); Assert.AreEqual(99, storedCookieVolume); var addMore = cookiePile.AddCargoByUnit(cookies, 100); var storedCookies2 = cookiePile.GetUnitsStored(cookies); var storedCookieMass2 = cookiePile.GetMassStored(cookies); var storedCookieVolume2 = cookiePile.GetVolumeStored(cookies); Assert.AreEqual(1, addMore); Assert.AreEqual(100, storedCookies2); Assert.AreEqual(100, storedCookieMass2); Assert.AreEqual(100, storedCookieVolume2); }
public void OnConstructionComplete(Entity industryEntity, VolumeStorageDB storage, Guid productionLine, IndustryJob batchJob, IConstrucableDesign designInfo) { var colonyConstruction = industryEntity.GetDataBlob <IndustryAbilityDB>(); batchJob.NumberCompleted++; batchJob.ResourcesRequired = designInfo.ResourceCosts; batchJob.ProductionPointsLeft = designInfo.IndustryPointCosts; if (batchJob.InstallOn != null) { ComponentInstance specificComponent = new ComponentInstance((ComponentDesign)designInfo); if (batchJob.InstallOn == industryEntity || StorageSpaceProcessor.HasEntity(storage, batchJob.InstallOn.GetDataBlob <CargoAbleTypeDB>())) { EntityManipulation.AddComponentToEntity(batchJob.InstallOn, specificComponent); ReCalcProcessor.ReCalcAbilities(batchJob.InstallOn); } } else { storage.AddCargoByUnit((ComponentDesign)designInfo, 1); //StorageSpaceProcessor.AddCargo(storage, (ComponentDesign)designInfo, 1); } if (batchJob.NumberCompleted == batchJob.NumberOrdered) { colonyConstruction.ProductionLines[productionLine].Jobs.Remove(batchJob); if (batchJob.Auto) { colonyConstruction.ProductionLines[productionLine].Jobs.Add(batchJob); } } }