When a client enters ENGINE KILL and then activates the CRUISE, the server does not register internally to enable the engine again. This is usually not a problem, until you want to make sure the server does track the correct POWER DRAW of the engine in the cruise state here.
The fix can be done with an existing hook interface:
/**
* This fixes a Vanilla Server Bug.
* The Server is not receiving an information about Engine Kill being disabled when Cruise is activated by the Client.
* So while Engine Kill is active, and Cruise gets activated, the Server thinks the Engine is off and does not draw any Cruise Power.
* This makes Server-Side power state of the Client's ship become asynchronous with the Client's own power state.
* To fix this, the Server enables the Engine again once Cruise goes online. The Client does this anyway.
*/
void __stdcall ActivateCruise(unsigned int clientId, struct XActivateCruise const& activateCruise)
{
returncode = DEFAULT_RETURNCODE;
if (activateCruise.bActivate)
{
uint shipId;
pub::Player::GetShip(clientId, shipId);
if (shipId)
{
for (const auto& equip : Players[clientId].equipDescList.equip)
{
if (!equip.is_internal() && equip.get_count() != 1)
continue;
const Archetype::Equipment* equipment = Archetype::GetEquipment(equip.iArchID);
if (equipment && equipment->get_class_type() == Archetype::AClassType::ENGINE)
{
XActivateEquip activateEquipment;
activateEquipment.bActivate = activateCruise.bActivate;
activateEquipment.iSpaceID = shipId;
activateEquipment.sID = equip.sID;
Server.ActivateEquip(clientId, activateEquipment);
return;
}
}
}
}
}```
When a client enters ENGINE KILL and then activates the CRUISE, the server does not register internally to enable the engine again. This is usually not a problem, until you want to make sure the server does track the correct POWER DRAW of the engine in the cruise state here.
The fix can be done with an existing hook interface: