[colobot] 86/100: Make TargetBots explode when they run into something

Didier Raboud odyx at moszumanska.debian.org
Thu Jun 1 18:10:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit d8b0bd4df828d0ca7798602b3e3eef32b668766a
Author: krzys-h <krzys_h at interia.pl>
Date:   Tue May 23 22:02:00 2017 +0200

    Make TargetBots explode when they run into something
---
 src/physics/physics.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp
index 6125a69..1e801d1 100644
--- a/src/physics/physics.cpp
+++ b/src/physics/physics.cpp
@@ -2688,18 +2688,19 @@ bool CPhysics::ExploOther(ObjectType iType,
 {
     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)
         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_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_BOMB    ) { destructionForce =  0.0f; damageType = DamageType::Explosive; } // Mine
 
-        if ( force > destructionForce )
+        if ( force > destructionForce && destructionForce >= 0.0f )
         {
             // TODO: implement "killer"?
             dynamic_cast<CDamageableObject*>(pObj)->DamageObject(damageType);
@@ -2778,7 +2779,8 @@ int CPhysics::ExploHimself(ObjectType iType, ObjectType oType, float force)
     // TODO: CExplosiveObject? derrives from CFragileObject
     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
+    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 ( force > destructionForce && destructionForce >= 0.0f )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list