Added Destroyer from Ceebot-Teen.

We need a new icon for it.
dev-ui
krzys-h 2013-02-13 16:57:59 +01:00
parent d3106c73ff
commit 8658d6da80
7 changed files with 93 additions and 14 deletions

View File

@ -411,7 +411,8 @@ enum EventType
EVENT_OBJECT_BNUCLEAR = 1060,
EVENT_OBJECT_BPARA = 1061,
EVENT_OBJECT_BINFO = 1062,
EVENT_OBJECT_BXXXX = 1063,
EVENT_OBJECT_BDESTROYER = 1063,
//EVENT_OBJECT_BXXXX = 1063,
EVENT_OBJECT_GFLAT = 1070,
EVENT_OBJECT_FCREATE = 1071,
EVENT_OBJECT_FDELETE = 1072,

View File

@ -213,6 +213,7 @@ enum BuildType
BUILD_LABO = (1<<10), //! < laboratory
BUILD_PARA = (1<<11), //! < lightning protection
BUILD_INFO = (1<<12), //! < information terminal
BUILD_DESTROYER = (1<<13), //! < Destroyer
BUILD_GFLAT = (1<<16), //! < flat floor
BUILD_FLAG = (1<<17) //! < puts / removes colored flag
};

View File

@ -308,6 +308,7 @@ void InitializeRestext()
stringsEvent[EVENT_OBJECT_BNUCLEAR] = "Build a nuclear power plant";
stringsEvent[EVENT_OBJECT_BPARA] = "Build a lightning conductor";
stringsEvent[EVENT_OBJECT_BINFO] = "Build a exchange post";
stringsEvent[EVENT_OBJECT_BDESTROYER] = "Build a destroyer";
stringsEvent[EVENT_OBJECT_GFLAT] = "Show if the ground is flat";
stringsEvent[EVENT_OBJECT_FCREATE] = "Plant a flag";
stringsEvent[EVENT_OBJECT_FDELETE] = "Remove a flag";

View File

@ -111,18 +111,39 @@ bool CAutoDestroyer::EventProcess(const Event &event)
if ( SearchVehicle() )
{
m_phase = ADEP_WAIT; // still waiting ...
m_progress = 0.0f;
m_speed = 1.0f/0.5f;
if ( m_progress < 20.0f ) {
m_phase = ADEP_WAIT; // still waiting ...
//m_progress = 0.0f;
m_speed = 1.0f/0.5f;
} else {
if ( m_object->GetLock() ) { // If still building...
m_phase = ADEP_WAIT; // still waiting ...
m_progress = 0.0f;
m_speed = 1.0f/0.5f;
} else {
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);
m_phase = ADEP_DOWN;
m_progress = 0.0f;
m_speed = 1.0f/1.0f;
m_bExplo = false;
}
}
}
else
{
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);
if ( m_object->GetLock() ) { // If still building...
m_phase = ADEP_WAIT; // still waiting ...
m_progress = 0.0f;
m_speed = 1.0f/0.5f;
} else {
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);
m_phase = ADEP_DOWN;
m_progress = 0.0f;
m_speed = 1.0f/1.0f;
m_bExplo = false;
m_phase = ADEP_DOWN;
m_progress = 0.0f;
m_speed = 1.0f/1.0f;
m_bExplo = false;
}
}
}
}
@ -243,8 +264,55 @@ CObject* CAutoDestroyer::SearchPlastic()
if ( pObj == nullptr ) break;
type = pObj->GetType();
if ( type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
//if ( type != OBJECT_SCRAP4 &&
// type != OBJECT_SCRAP5 ) continue;
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
type != OBJECT_URANIUM &&
type != OBJECT_METAL &&
type != OBJECT_POWER &&
type != OBJECT_ATOMIC &&
type != OBJECT_TNT &&
type != OBJECT_SCRAP1 &&
type != OBJECT_SCRAP2 &&
type != OBJECT_SCRAP3 &&
type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 &&
// Robots:
type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
type != OBJECT_MOBILEwa &&
type != OBJECT_MOBILEia &&
type != OBJECT_MOBILEfc &&
type != OBJECT_MOBILEtc &&
type != OBJECT_MOBILEwc &&
type != OBJECT_MOBILEic &&
type != OBJECT_MOBILEfi &&
type != OBJECT_MOBILEti &&
type != OBJECT_MOBILEwi &&
type != OBJECT_MOBILEii &&
type != OBJECT_MOBILEfs &&
type != OBJECT_MOBILEts &&
type != OBJECT_MOBILEws &&
type != OBJECT_MOBILEis &&
type != OBJECT_MOBILErt &&
type != OBJECT_MOBILErc &&
type != OBJECT_MOBILErr &&
type != OBJECT_MOBILErs &&
type != OBJECT_MOBILEsa &&
type != OBJECT_MOBILEtg &&
type != OBJECT_MOBILEft &&
type != OBJECT_MOBILEtt &&
type != OBJECT_MOBILEwt &&
type != OBJECT_MOBILEit &&
type != OBJECT_MOBILEdr &&
type != OBJECT_MOTHER &&
type != OBJECT_ANT &&
type != OBJECT_SPIDER &&
type != OBJECT_BEE &&
type != OBJECT_WORM ) continue;
oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, sPos);

View File

@ -528,6 +528,10 @@ bool CBrain::EventProcess(const Event &event)
{
err = StartTaskBuild(OBJECT_INFO);
}
if ( action == EVENT_OBJECT_BDESTROYER )
{
err = StartTaskBuild(OBJECT_DESTROYER);
}
if ( action == EVENT_OBJECT_GFLAT )
{
@ -1454,8 +1458,8 @@ bool CBrain::CreateInterface(bool bSelect)
pos.x = ox+sx*5.4f;
pos.y = oy+sy*0.1f;
pw->CreateButton(pos, ddim, 128+56, EVENT_OBJECT_BXXXX);
DeadInterface(pw, EVENT_OBJECT_BXXXX, false);
pw->CreateButton(pos, ddim, 128+41, EVENT_OBJECT_BDESTROYER);
DeadInterface(pw, EVENT_OBJECT_BDESTROYER, g_build&BUILD_DESTROYER);
if ( g_build&BUILD_GFLAT )
{
@ -2181,7 +2185,7 @@ void CBrain::UpdateInterface()
EnableInterface(pw, EVENT_OBJECT_BNUCLEAR, bEnable);
EnableInterface(pw, EVENT_OBJECT_BPARA, bEnable);
EnableInterface(pw, EVENT_OBJECT_BINFO, bEnable);
EnableInterface(pw, EVENT_OBJECT_BXXXX, bEnable);
EnableInterface(pw, EVENT_OBJECT_BDESTROYER,bEnable);
}
pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_GFLAT));

View File

@ -98,6 +98,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
if ( m_type == OBJECT_NUCLEAR ) m_buildingHeight = 40.0f;
if ( m_type == OBJECT_PARA ) m_buildingHeight = 68.0f;
if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f;
if ( m_type == OBJECT_DESTROYER) m_buildingHeight = 35.0f;
m_buildingHeight *= 0.25f;
m_buildingPos = m_building->GetPosition(0);
@ -578,6 +579,7 @@ Error CTaskBuild::FlatFloor()
if ( m_type == OBJECT_NUCLEAR ) radius = 20.0f;
if ( m_type == OBJECT_PARA ) radius = 20.0f;
if ( m_type == OBJECT_INFO ) radius = 5.0f;
if ( m_type == OBJECT_DESTROYER) radius = 20.0f;
if ( radius == 0.0f ) return ERR_GENERIC;
center = m_metal->GetPosition(0);
@ -666,6 +668,7 @@ Error CTaskBuild::FlatFloor()
type == OBJECT_ENERGY ||
type == OBJECT_LABO ||
type == OBJECT_NUCLEAR ||
type == OBJECT_DESTROYER||
type == OBJECT_START ||
type == OBJECT_END ||
type == OBJECT_INFO ||

View File

@ -708,6 +708,7 @@ int GetBuild(char *line, int rank)
if ( Cmd(p, "AutoLab" ) ) return BUILD_LABO;
if ( Cmd(p, "PowerCaptor" ) ) return BUILD_PARA;
if ( Cmd(p, "ExchangePost" ) ) return BUILD_INFO;
if ( Cmd(p, "Destroyer" ) ) return BUILD_DESTROYER;
if ( Cmd(p, "FlatGround" ) ) return BUILD_GFLAT;
if ( Cmd(p, "Flag" ) ) return BUILD_FLAG;