void HELICARRIER::CLOAK()
{
//attached_vessels_mesh_states.clear(); // Forgets everything
for (UINT i = 0; i < 12; i++)
{
ATTACHMENTHANDLE ah = GetAttachmentHandle(false, i);
OBJHANDLE hvessel = GetAttachmentStatus(ah);
if (oapiIsVessel(hvessel))
{
VESSEL2 *v = (VESSEL2*)oapiGetVesselInterface(hvessel);
std::vector<WORD> list(v->GetMeshCount());
for (UINT j = 0; j < v->GetMeshCount(); j++)
{
//list[j] = 0;
list[j] = v->GetMeshVisibilityMode(j);
v->SetMeshVisibilityMode(j, MESHVIS_NEVER);
}
attached_vessels_mesh_states[v] = list;
}
}
AddExhaust(th_hover[0], 0, 0, _V(-140, -40, 113), _V(0, -1, 0));
AddExhaust(th_hover[0], 0, 0, _V(143, -40, 113), _V(0, -1, 0));
AddExhaust(th_hover[0], 0, 0, _V(-164, -40, -212), _V(0, -1, 0));
AddExhaust(th_hover[0], 0, 0, _V(166, -40, -212), _V(0, -1, 0));
//turn beacons off
for (int i = 0; i < 8; i++)
beacon[i].active = false;
this->is_cloaked = true;
}
void HELICARRIER::DECLOAK()
{
for (std::map<VESSEL2*, std::vector<WORD>>::iterator it = attached_vessels_mesh_states.begin(); it != attached_vessels_mesh_states.end(); ++it)
{
for (UINT i = 0; i < it->second.size(); i++)
{
it->first->SetMeshVisibilityMode(i, it->second[i]);
}
}
this->is_cloaked = false;
attached_vessels_mesh_states.clear(); // Forgets everything (and save memory)
AddExhaust(th_hover[0], 150, 50, _V(-140, -40, 113), _V(0, -1, 0));
AddExhaust(th_hover[0], 150, 50, _V(143, -40, 113), _V(0, -1, 0));
AddExhaust(th_hover[0], 150, 50, _V(-164, -40, -212), _V(0, -1, 0));
AddExhaust(th_hover[0], 150, 50, _V(166, -40, -212), _V(0, -1, 0));
for (int i = 0; i < 8; i++)
beacon[0].active = false;
beacon[1].active = true;
beacon[2].active = false;
beacon[3].active = false;
beacon[4].active = false;
beacon[5].active = true;
beacon[6].active = true;
beacon[7].active = true;
}