diff options
Diffstat (limited to 'src/object')
-rw-r--r-- | src/object/auto/autodestroyer.cpp | 90 | ||||
-rw-r--r-- | src/object/brain.cpp | 10 | ||||
-rw-r--r-- | src/object/task/taskbuild.cpp | 3 |
3 files changed, 89 insertions, 14 deletions
diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index ecf7c94..644071c 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -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); - - m_phase = ADEP_DOWN; - m_progress = 0.0f; - m_speed = 1.0f/1.0f; - m_bExplo = false; + 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; + } } } } @@ -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); diff --git a/src/object/brain.cpp b/src/object/brain.cpp index bc47cb3..1405201 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -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)); diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index d82874c..5673ea4 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -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 || |