1
Mods / Re: [0.8.1a] Omnifactory Rebooted 2.2.7
« on: September 22, 2017, 07:30:07 PM »
When omnifactoryCosts<1,factory tells me "insufficient resources, order cancelled" but there have enough resources in storge.
I think i have found the point afte check the code.
lw_Omnifactory.jar\org\lazywizard\omnifac\Shipyard.java line 383 to line 397
383 public void startProduction(int requested)
384 {
385 boolean canAfford = true;
386 for (Map.Entry<String, Integer> commodity : cost.entrySet())
387 canAfford = canAfford && getStorageCargo().getQuantity(CargoAPI.CargoItemType.RESOURCES, commodity.getKey()) >= commodity.getValue() * requested;
388 if (canAfford)
389 {
390 removeMaterials(requested);
391 goal = ordered = requested;
392 lastUpdate = numHeartbeats;
393 } else
394 {
395 Global.getSector().getCampaignUI().addMessage("Insufficient resources, order cancelled.");
396 }
397 }
This is the product code after ording a ship in factory.
Look at line 387.There has a check before product.But this check don't consider OmniFacSettings.getCostMult() at all.
Line 430 and line 431 both have a OmniFacSettings.getCostMult() to calculate the removeMaterials(requested).
Maybe this is why factory only product the ship when storge have enough resources for omnifactoryCosts=1(no matter what omnifactoryCosts is).
I think i have found the point afte check the code.
lw_Omnifactory.jar\org\lazywizard\omnifac\Shipyard.java line 383 to line 397
383 public void startProduction(int requested)
384 {
385 boolean canAfford = true;
386 for (Map.Entry<String, Integer> commodity : cost.entrySet())
387 canAfford = canAfford && getStorageCargo().getQuantity(CargoAPI.CargoItemType.RESOURCES, commodity.getKey()) >= commodity.getValue() * requested;
388 if (canAfford)
389 {
390 removeMaterials(requested);
391 goal = ordered = requested;
392 lastUpdate = numHeartbeats;
393 } else
394 {
395 Global.getSector().getCampaignUI().addMessage("Insufficient resources, order cancelled.");
396 }
397 }
This is the product code after ording a ship in factory.
Look at line 387.There has a check before product.But this check don't consider OmniFacSettings.getCostMult() at all.
Line 430 and line 431 both have a OmniFacSettings.getCostMult() to calculate the removeMaterials(requested).
Maybe this is why factory only product the ship when storge have enough resources for omnifactoryCosts=1(no matter what omnifactoryCosts is).