Is the cloak an energy unit?

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

Post Reply
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Is the cloak an energy unit?

Post by Screet »

Hi,

searching for something else, I stumbled about some code in playerentity.m which makes me worry that the cloaking device is being used as an energy unit if it's disabled:

Code: Select all

	if ([self hasCloakingDevice])
	{
		if (cloaking_device_active)
		{
			energy -= (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
			if (energy < CLOAKING_DEVICE_MIN_ENERGY)
				[self deactivateCloakingDevice];
		}
		else
		{
			if (energy < maxEnergy)
			{
				energy += (float)delta_t * CLOAKING_DEVICE_ENERGY_RATE;
				if (energy > maxEnergy)
					energy = maxEnergy;
			}
		}
	}
Why does the disabled cloak add CLOACKING_DEVICE_ENERGY_RATE to the energy? I believe that's a big bug and that the else clause should simply be cut out of the code?!?

Screet, still on the look for the annoying "BANG, you're dead" bug...
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Post by Screet »

29 reads and no comments...does this mean that you all prefer the cloak to work as an extra energy unit???

The code does define
#define CLOAKING_DEVICE_ENERGY_RATE 12.8f

Thus the cloak, when inactive, adds 12.8 to the energy each time the energy is updated! That's much more than a good ship with naval energy unit does get on each update!

Screet
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

It means for me, that I am not certain what the correct behaviour is.

I expect you are right, but I dont want to comment until I understand it better.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6632
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

It is the same code that has been there since 1.65. For this reason, and although I personally agree that it should be changed as Screet mentions, I think a little bit more investigation is required to try and see if there was a particular reason behind this.
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Post by Screet »

another_commander wrote:
It is the same code that has been there since 1.65. For this reason, and although I personally agree that it should be changed as Screet mentions, I think a little bit more investigation is required to try and see if there was a particular reason behind this.
My only guess would be that the idea behind this is to give NPCs an extremely higher recharge if they have the cloak so that they would not be too easy to shoot down once the cloak uses up all their energy.

Probably a copy&paste mistake from NPC to player...

Screet
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6632
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

I have commented out in the trunk (but not deleted yet) the code that charges up the energy banks upon switching the device off. If anyone can provide a reason why this behaviour should remain, please do so and we can bring it back.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Anyone know what happened in elite? maybe its just an oddity from the original?
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Post by Screet »

Cmdr James wrote:
Anyone know what happened in elite? maybe its just an oddity from the original?
I don't really remember, but I am pretty sure that I first saw the ultra-rapid recharging of energy banks in Oolite.

With the old behaviour of the cloak working as an energy unit, completely depleted banks did reload so quickly that it was almost no time delay to re-enable the cloak from full banks again...I'm sure that the modification of removing the energy unit behaviour for player ships is good and won't harm the game as it stays as an energy unit for NPCs. Still NPCs would benefit from the addition of shields...as then they could deplete their banks without losing all defensive ability.

Screet
Post Reply