icedown
New member
- Joined
- Sep 5, 2011
- Messages
- 115
- Reaction score
- 0
- Points
- 0
Ok, I've been working on this one on and off all day and I really don't know what I'm doing wrong.
Here's The function
No matter which line I use, EatCloser always return -1.0. There are 4 full space fuel onboard.
t is a timer that is updated every frame by t += simdt and this is dispatched with t > 1.0 and t is reset to 0.
SK_FUEL_TRANS is 1.0 for 1kg/sec fuel transfer.
The GrappleOneCargo works just fine.
What am I doing wrong?
Here's The function
Code:
void StationKeeper::updateCargo(double t)
{
//Auto refuel tanks
double fuelMax;
double fuelCur;
PROPELLANT_HANDLE mTank = GetPropellantHandleByIndex(0);
fuelMax = GetPropellantMaxMass(mTank);
fuelCur = GetPropellantMass(mTank);
if((fuelMax - fuelCur) > 1.0) {
double fuelNeeded = fuelMax - fuelCur;
if(fuelNeeded > t * SK_FUEL_TRANS){
fuelNeeded = t * SK_FUEL_TRANS;
}
// double fuelAte = hUcgo.EatCloserFuelCargo(fuelNeeded);
double fuelAte = hUcgo.EatCloserCargoByType("fuel", fuelNeeded);
if(fuelAte > 0) {
SetPropellantMass(mTank, fuelCur + fuelAte);
}
}
//Auto grapple nearby fuel cargo
if(hUcgo.GetNbrCargoLoaded() < 4) {
hUcgo.GrappleOneCargoByType("fuel");
}
}
No matter which line I use, EatCloser always return -1.0. There are 4 full space fuel onboard.
t is a timer that is updated every frame by t += simdt and this is dispatched with t > 1.0 and t is reset to 0.
SK_FUEL_TRANS is 1.0 for 1kg/sec fuel transfer.
The GrappleOneCargo works just fine.
What am I doing wrong?