EnergyMake EnergyUse
Moderator: Moderators
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
EnergyMake EnergyUse
In oTA, most units produced a little amount of Energy and, when they started to move, spent that same amount of E too, if i remember well.
Mods still carry that legacy (XTA, AA, TLL) in the FBIs. Most have a same amount of EnergyMake and EnergyUse.
However, EnergyUse doesn't seems to be working... In all those mods, units only produce energy, never see them spending energy and i can't make them correctly spend energy...
So, i am not doing anything wrong, or am i? It's the engine's fault?
Mods still carry that legacy (XTA, AA, TLL) in the FBIs. Most have a same amount of EnergyMake and EnergyUse.
However, EnergyUse doesn't seems to be working... In all those mods, units only produce energy, never see them spending energy and i can't make them correctly spend energy...
So, i am not doing anything wrong, or am i? It's the engine's fault?
-
- MC: Legacy & Spring 1944 Developer
- Posts: 1948
- Joined: 21 Sep 2004, 08:25
-
- MC: Legacy & Spring 1944 Developer
- Posts: 1948
- Joined: 21 Sep 2004, 08:25
Actually, you can, and units do... and as my thread about Spring's economy shows, I've even written a BOS that works... when the economy code actually hits zero 
Units that use M/E call Activate() Deactivate() in the COB code.
But, here's more from Unit.cpp:
And when I'm done fixing the economy code, it will work a lot more smoothly.

Units that use M/E call Activate() Deactivate() in the COB code.
But, here's more from Unit.cpp:
Code: Select all
if(unitDef->activateWhenBuilt)
{
Activate();
}
Code: Select all
void CUnit::Activate()
{
//if(unitDef->tidalGenerator>0)
// cob->Call(COBFN_SetSpeed, (int)(readmap->tidalStrength*3000.0f*unitDef->tidalGenerator));
if(activated)
return;
activated = true;
cob->Call(COBFN_Activate);
if(unitDef->targfac){
radarhandler->radarErrorSize[allyteam]/=radarhandler->targFacEffect;
}
if(hasRadarCapacity)
radarhandler->MoveUnit(this);
if(unitDef->sounds.activate.id)
sound->PlayUnitActivate(unitDef->sounds.activate.id, this, unitDef->sounds.activate.volume);
}
And when I'm done fixing the economy code, it will work a lot more smoothly.