diff options
Diffstat (limited to 'src/object/auto/autodestroyer.cpp')
-rw-r--r-- | src/object/auto/autodestroyer.cpp | 97 |
1 files changed, 83 insertions, 14 deletions
diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index ecf7c94..b62a45a 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -19,7 +19,9 @@ #include "object/auto/autodestroyer.h" #include "common/iman.h" + #include "script/cmdtoken.h" + #include "ui/interface.h" #include "ui/window.h" @@ -29,8 +31,7 @@ // Object's constructor. -CAutoDestroyer::CAutoDestroyer(CInstanceManager* iMan, CObject* object) - : CAuto(iMan, object) +CAutoDestroyer::CAutoDestroyer(CObject* object) : CAuto(object) { Init(); m_phase = ADEP_WAIT; // paused until the first Init () @@ -111,18 +112,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; + } } } } @@ -135,7 +157,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) scrap = SearchPlastic(); if ( scrap != nullptr ) { - pyro = new Gfx::CPyro(m_iMan); + pyro = new Gfx::CPyro(); pyro->Create(Gfx::PT_FRAGT, scrap); } m_bExplo = true; @@ -243,8 +265,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); |