Make TargetBots explode when they run into something
parent
149d1f8156
commit
d8b0bd4df8
|
@ -2688,18 +2688,19 @@ bool CPhysics::ExploOther(ObjectType iType,
|
||||||
{
|
{
|
||||||
JostleObject(pObj, 1.0f); // shakes the object
|
JostleObject(pObj, 1.0f); // shakes the object
|
||||||
|
|
||||||
if (pObj->Implements(ObjectInterfaceType::Fragile))
|
if (pObj->Implements(ObjectInterfaceType::Damageable))
|
||||||
{
|
{
|
||||||
// TODO: CFragileObject::GetDestructionForce (I can't do this now because you can't inherit both in COldObject ~krzys_h)
|
// TODO: CFragileObject::GetDestructionForce (I can't do this now because you can't inherit both in COldObject ~krzys_h)
|
||||||
DamageType damageType = DamageType::Collision;
|
DamageType damageType = DamageType::Collision;
|
||||||
float destructionForce = 50.0f; // Titanium, PowerCell, NuclearCell, default
|
float destructionForce = pObj->Implements(ObjectInterfaceType::Fragile) ? 50.0f : -1.0f; // Titanium, PowerCell, NuclearCell, default
|
||||||
if (pObj->GetType() == OBJECT_STONE ) { destructionForce = 25.0f; } // TitaniumOre
|
if (pObj->GetType() == OBJECT_STONE ) { destructionForce = 25.0f; } // TitaniumOre
|
||||||
if (pObj->GetType() == OBJECT_URANIUM ) { destructionForce = 25.0f; } // UraniumOre
|
if (pObj->GetType() == OBJECT_URANIUM ) { destructionForce = 25.0f; } // UraniumOre
|
||||||
if (pObj->GetType() == OBJECT_MOBILEtg) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TargetBot
|
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 (pObj->GetType() == OBJECT_TNT ) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TNT
|
if (pObj->GetType() == OBJECT_TNT ) { destructionForce = 10.0f; damageType = DamageType::Explosive; } // TNT
|
||||||
if (pObj->GetType() == OBJECT_BOMB ) { destructionForce = 0.0f; damageType = DamageType::Explosive; } // Mine
|
if (pObj->GetType() == OBJECT_BOMB ) { destructionForce = 0.0f; damageType = DamageType::Explosive; } // Mine
|
||||||
|
|
||||||
if ( force > destructionForce )
|
if ( force > destructionForce && destructionForce >= 0.0f )
|
||||||
{
|
{
|
||||||
// TODO: implement "killer"?
|
// TODO: implement "killer"?
|
||||||
dynamic_cast<CDamageableObject*>(pObj)->DamageObject(damageType);
|
dynamic_cast<CDamageableObject*>(pObj)->DamageObject(damageType);
|
||||||
|
@ -2778,7 +2779,8 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
|
||||||
// TODO: CExplosiveObject? derrives from CFragileObject
|
// TODO: CExplosiveObject? derrives from CFragileObject
|
||||||
float destructionForce = -1.0f; // minimal force required to destroy an object using this explosive, default: not explosive
|
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_TNT ) destructionForce = 10.0f; // TNT
|
||||||
if ( oType == OBJECT_MOBILEtg ) destructionForce = 10.0f; // TargetBot
|
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 ( oType == OBJECT_BOMB ) destructionForce = 0.0f; // Mine
|
if ( oType == OBJECT_BOMB ) destructionForce = 0.0f; // Mine
|
||||||
|
|
||||||
if ( force > destructionForce && destructionForce >= 0.0f )
|
if ( force > destructionForce && destructionForce >= 0.0f )
|
||||||
|
|
Loading…
Reference in New Issue