Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CONSTRUCTION.as
- void addSupportShipConstruction(Object& obj, int id, const Design@ dsg, uint amount) {
- int index = shipConsIndex(id);
- if(index == -1)
- return;
- ShipConstructible@ cons = cast<ShipConstructible>(queue[index]);
- if(cons is null)
- return;
- uint maxAmount = floor(cons.getSupportSupplyFree() / pow(dsg.size,0.6)); //SCALING
- amount = min(amount, maxAmount);
- if(amount == 0)
- return;
- int cost = getBuildCost(dsg, amount);
- int take = obj.owner.consumeBudget(cost, true);
- if(take == -1)
- return;
- if(!cons.addSupports(obj, dsg, amount, cycle=take))
- obj.owner.refundBudget(cost, take);
- int maint = getMaintenanceCost(dsg, amount);
- cons.maintainCost += maint;
- cons.buildCost += cost;
- if(cons.started)
- obj.owner.modMaintenance(maint, MoT_Construction);
- deltaConstruction = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement