Make Wrecks destroyable; make TargetBot more fragile

modernize-cmake-1
Fiftytwo 2019-07-17 02:57:47 +02:00
parent ed8dc04d94
commit 62620a93cd
2 changed files with 25 additions and 13 deletions

View File

@ -356,12 +356,18 @@ bool COldObject::DamageObject(DamageType type, float force, CObject* killer)
}
else if ( Implements(ObjectInterfaceType::Fragile) )
{
if ((m_type == OBJECT_BOMB ||
m_type == OBJECT_RUINfactory ||
m_type == OBJECT_RUINdoor ||
m_type == OBJECT_RUINsupport ||
m_type == OBJECT_RUINradar ||
m_type == OBJECT_RUINconvert ) && type != DamageType::Explosive ) return false; // Mines and ruins can't be destroyed by shooting
if ((m_type == OBJECT_BOMB ||
m_type == OBJECT_RUINmobilew1 ||
m_type == OBJECT_RUINmobilew2 ||
m_type == OBJECT_RUINmobilet1 ||
m_type == OBJECT_RUINmobilet2 ||
m_type == OBJECT_RUINmobiler1 ||
m_type == OBJECT_RUINmobiler2 ||
m_type == OBJECT_RUINfactory ||
m_type == OBJECT_RUINdoor ||
m_type == OBJECT_RUINsupport ||
m_type == OBJECT_RUINradar ||
m_type == OBJECT_RUINconvert ) && type != DamageType::Explosive ) return false; // Mines and ruins can't be destroyed by shooting
if ( m_type == OBJECT_URANIUM ) return false; // UraniumOre is not destroyable (see #777)
DestroyObject(DestructionType::Explosion, killer);
@ -840,11 +846,17 @@ void COldObject::SetType(ObjectType type)
m_implementedInterfaces[static_cast<int>(ObjectInterfaceType::Fragile)] = false;
m_implementedInterfaces[static_cast<int>(ObjectInterfaceType::Shielded)] = false;
}
else if (m_type == OBJECT_RUINfactory ||
m_type == OBJECT_RUINdoor ||
m_type == OBJECT_RUINsupport ||
m_type == OBJECT_RUINradar ||
m_type == OBJECT_RUINconvert )
else if (m_type == OBJECT_RUINmobilew1 ||
m_type == OBJECT_RUINmobilew2 ||
m_type == OBJECT_RUINmobilet1 ||
m_type == OBJECT_RUINmobilet2 ||
m_type == OBJECT_RUINmobiler1 ||
m_type == OBJECT_RUINmobiler2 ||
m_type == OBJECT_RUINfactory ||
m_type == OBJECT_RUINdoor ||
m_type == OBJECT_RUINsupport ||
m_type == OBJECT_RUINradar ||
m_type == OBJECT_RUINconvert )
{
m_implementedInterfaces[static_cast<int>(ObjectInterfaceType::Damageable)] = true;
m_implementedInterfaces[static_cast<int>(ObjectInterfaceType::Destroyable)] = true;

View File

@ -2720,7 +2720,7 @@ bool CPhysics::ExploOther(ObjectType iType,
if (pObj->GetType() == OBJECT_STONE ) { destructionForce = 25.0f; } // TitaniumOre
if (pObj->GetType() == OBJECT_URANIUM ) { destructionForce = 25.0f; } // UraniumOre
if (pObj->GetType() == OBJECT_MOBILEtg) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TargetBot (something running into it)
if (iType == OBJECT_MOBILEtg) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TargetBot (it running into something)
if (iType == OBJECT_MOBILEtg) { destructionForce = 0.0f; damageType = DamageType::Explosive; } // TargetBot (it running into something)
if (pObj->GetType() == OBJECT_TNT ) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TNT
if (pObj->GetType() == OBJECT_BOMB ) { destructionForce = 0.0f; damageType = DamageType::Explosive; } // Mine
@ -2810,7 +2810,7 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
float destructionForce = -1.0f; // minimal force required to destroy an object using this explosive, default: not explosive
if ( oType == OBJECT_TNT ) destructionForce = 10.0f; // TNT
if ( oType == OBJECT_MOBILEtg ) destructionForce = 10.0f; // TargetBot (something running into it)
if ( iType == OBJECT_MOBILEtg ) destructionForce = 10.0f; // TargetBot (it running into something)
if ( iType == OBJECT_MOBILEtg ) destructionForce = 0.0f; // TargetBot (it running into something)
if ( oType == OBJECT_BOMB ) destructionForce = 0.0f; // Mine
if ( force > destructionForce && destructionForce >= 0.0f )