Yet another bug - quite major this time
I've been replicating some diamond, but it hasn't given me everything it should. I first noticed this when I tried to do diamond->carbon and it should have given me 31256 but gave me about 30000. Next I did diamond->gold and got 2600 or so instead of the 3126 I should have; then finally (I took screenshots of this one) diamond->ice which gave only 4251 instead of 5001. In each case I put 1275 diamond in to start with as it says "replication is 1275 diamond into..."
I have 5 replication output modules and 3 replication input modules. Hence I should get a 25% bonus to output, and the input should be 1275 (100-15% = 85% of 1500 which seems to be the default without any modules)
I think the code for replication output may be missing the input module adjustment - if you take the amount I should be getting and multiply by 0.85, it gives the amount I got in each case. This is because it looks for 1500 resources instead of 1275. (I'll do a test in a minute, putting in 1500. I imagine I'll get the right amount of output but it will only take 1275. I'll edit the post to confirm what happens)
EDIT: Yes that's what happened. 1500 diamond -> 5001 ice and 225 spare diamond. So it seems at the moment you have code like (sorry it's C-style but I think Java is similar):
in_resource_qty = replication_production * 5 * (1-0.05*replication_input_modules); // what happens if you have 20 modules?
out_resource_qty = replication_production * 5 * (1+0.05*replication_output_modules) * (reptable[in_resource] / reptable[out_resource);
if (mining_facility.resources[in_resource] < 1500) // this may in fact say (5 * replication_production), I haven't tested it enough to be sure)
{
out_resource_qty *= (mining_facility.resources[in_resource] / 1500); // same here
// see * below, there is a line missing here!
}
mining_facility.add_resource(in_resource, -in_resource_qty);
mining_facility.add_resource(out_resource, out_resource_qty);
You need to change the 1500's in the if block to in_resource_qty's and add a line as follows:
if (mining_facility.resources[in_resource] < in_resource_qty)
{
out_resource_qty *= (mining_facility.resources[in_resource] / in_resource_qty]);
in_resource_qty = mining_facility.resources[in_resource]; // you need to add this to prevent negative resource amounts appearing
}
*: There's another bug here. If you put 1 diamond in it will produce 1 ice but leave you with -1274 diamond... You can counter this with yet another bug
if you have negative of a resource, select that resource, type a number into the box and click "Withdraw", it resets to zero!
Please fix this ASAP. With this bug in place, for any replication under 1500 resources you get penalised for no reason and your input modules become effectively useless.
ahydra
ps. I'm not worried about a refund of the 750 missing ice. I can nick that from the unfortunate guy next door. ^^
pps. Small typo - it should say "replication for this structure successfully chanGed", not "chanced".