Page 1 of 1

Maintance overhaul

Posted: Fri Apr 05, 2013 5:03 pm
by S-P
Anyone know how the cost is calculated and how the amount of upgrades installed effects the overall cost? Also how long is it between overhauls?

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 5:34 pm
by CommRLock78
S-P wrote:Anyone know how the cost is calculated and how the amount of upgrades installed effects the overall cost? Also how long is it between overhauls?
I'm not sure about the details of how things are calculated, but basically it has to do with how much damage you receive, particularly when you shields are spent, and of course, how long since your last overhaul.

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 5:36 pm
by Cody
I think it's 1% of the ship's total value (including kit), and the frequency is variable, depending on how much combat/number of jumps.

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 5:53 pm
by CommRLock78
I was just on the wiki poking around - it doesn't appear to have anything in the manual or FAQ about overhauls - perhaps there should be some details about how overhauls work since it seems to be a common inquiry.

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 6:00 pm
by Cody
[EliteWiki] Maintenance - that covers the basics.

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 6:08 pm
by CommRLock78
Cody wrote:[EliteWiki] Maintenance - that covers the basics.
Ah geez - :oops: - I should have figured :). That's what I get for not typing "maintenance" into the search form :roll: . Although, it does look like the article could be expanded :D.

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 7:43 pm
by Eric Walch
If you want to puzzle. The used formula in original code is:

Code: Select all

- (double) renovationCosts
{
OOCreditsQuantity shipValue = [UNIVERSE tradeInValueForCommanderDictionary:[self commanderDataDictionary]];
double costs = 0.005 * (100 - ship_trade_in_factor) * shipValue;
costs += 0.01 * shipValue * [self missingSubEntitiesAdjustment];
return cunningFee(costs, 0.05); // rounding
}
The value ship_trade_in_factor varies between 75 and 100. (read it as a percentage) It will never drop below 75 during combat.

A renovation is only offered when the ship_trade_in_factor drops below 85. And the resulting repair is calculated as:

Code: Select all

ship_trade_in_factor += 5 + techLevel;	// you get better value at high-tech repair bases
So, anyone that wants to update the wiki page with above in plain English. :D

EDIT: This was still missing in above puzzle:

Code: Select all

- (NSInteger) missingSubEntitiesAdjustment
{
	// each missing subentity depreciates the ship by 5%, up to a maximum of 35% depreciation.
	NSUInteger percent = 5 * ([self maxShipSubEntities] - [[[self shipSubEntityEnumerator] allObjects] count]);
	return (percent > 35 ? 35 : percent);
}

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 7:45 pm
by S-P
Many thanks for clearing that up for me guys. :D

Re: Maintance overhaul

Posted: Fri Apr 05, 2013 7:48 pm
by Eric Walch
The calculation was always a bit vague, but now the value itself is exposed to the JS system, it is better that scripters know how Oolite itself deals with it.