Page 1 of 1

EnergyMake EnergyUse

Posted: 06 Nov 2006, 01:09
by PauloMorfeo
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?

Posted: 06 Nov 2006, 01:59
by FLOZi
Engines fault. Can be fixed via the script by setting ACTIVATION to true when moving.

Posted: 06 Nov 2006, 04:01
by MadRat
Do units refuse to move when there is no energy?

Posted: 06 Nov 2006, 04:03
by Argh
No. Which is a major flaw, but meh.

Posted: 06 Nov 2006, 23:46
by SpikedHelmet
Is there a way to fix that via script? Or, simply, add a "NeedEnergy" tag feature added to Spring.

Posted: 06 Nov 2006, 23:46
by FLOZi
Read my post you crazy fool! :P

Posted: 06 Nov 2006, 23:50
by SpikedHelmet
I mean fix what Argh pointed out, that units stop moving when no energy.

Posted: 06 Nov 2006, 23:55
by FLOZi
Oh. No not easily.

Posted: 07 Nov 2006, 14:27
by aGorm
Which is realy annoying as somthing I wanna do in my mod will depend on that being the case... :(

aGorm

Posted: 08 Nov 2006, 03:06
by MadRat
How hard would it be to just apply maximum brake rate whenever energy runs empty?

Posted: 09 Nov 2006, 02:40
by Argh
I'm working on this issue now.

Posted: 09 Nov 2006, 20:24
by KDR_11k
You cannot know the ressource situation from within the script AFAIK.

Posted: 10 Nov 2006, 02:46
by Argh
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 :P

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.

Posted: 10 Nov 2006, 11:54
by KDR_11k
Since when do units call Activate/Deactivate when out of energy? I've never seen that happen.

Posted: 10 Nov 2006, 11:56
by Argh
Try out a Metal Maker. Run your Energy dry.

Posted: 10 Nov 2006, 17:39
by FLOZi
Indeed. I should have thought of that. :cry:

Posted: 10 Nov 2006, 21:39
by KDR_11k
It doesn't deactivate. It stops producing metal but if Deactivate() was called it'd close.