Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8386


Ignore:
Timestamp:
May 2, 2011, 5:17:20 PM (13 years ago)
Author:
simonmie
Message:

New shielddamage implemented, depending functions changed, bugs fixed.

LightningGun →fire changed
Other weapons still need to be edited

Location:
code/branches/gameimmersion
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw

    r8187 r8386  
    11<LevelInfo
    2  name = "shield-test-01"
    3  description = "LEVELINFO-DESCRIPTION"
     2 name = "shield-test-level"
     3 description = "A simple Level with one shielded drone to shoot at"
    44/>
    55
     
    77  include("HUDTemplates3.oxo")
    88  include("stats.oxo")
    9   include("templates/spaceshipAssff.oxt")
     9  include("templates/spaceshipImmTest.oxt")
    1010  include("templates/lodInformation.oxt")
    1111?>
    1212
    1313<Level
    14  name         = "LEVEL-NAME"
     14 name         = "shieldTL"
    1515 description  = "LEVEL-DESCRIPTION"
    1616>
    1717
    18   <templates>
    19     <Template link=lodtemplate_default />
    20   </templates>
     18<templates>
     19  <Template link=lodtemplate_default />
     20</templates>
    2121
    22   <Scene
     22<Scene
    2323   ambientlight = "0.8, 0.5, 0.5"
    2424   skybox       = "Orxonox/Starbox"
    25   >
     25>
    2626
    2727
     
    6464      for i = 1, 10, 1 do
    6565    ?>
    66       <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     66      <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipimmtest />
    6767    <?lua end ?>
    6868
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc

    r8183 r8386  
    4848        this->bDestroy_ = false;
    4949        this->owner_ = 0;
    50         this->damage_ = 15;
     50        this->damage_ = 115;
     51///////////////////me
     52        this->healthdamage_ = 0;
     53        this->shielddamage_ = 0;
     54///////////////////end me
    5155
    5256        // Get notification about collisions
     
    139143            if (victim)
    140144            {
    141                 victim->hit(this->owner_, contactPoint, this->damage_);
     145                victim->hit(this->owner_, contactPoint, this->damage_, this->healthdamage_, this->shielddamage_);
    142146                victim->startReloadCountdown();
    143147            }
  • code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.h

    r5929 r8386  
    5050
    5151            inline void setDamage(float damage)
    52                 { this->damage_ = damage; }
     52                { this->damage_ = damage;  COUT(3) << "DAMAGE-SET-FUNKTION WIRD AUFGERUFEN" << endl; }
    5353            inline float getDamage() const
    5454                { return this->damage_; }
     
    5858                { return this->owner_; }
    5959
     60////////////////////me
     61
     62            inline void setHealthDamage(float healthdamage)
     63                { this->healthdamage_ = healthdamage; }
     64            inline float getHealthDamage() const
     65                { return this->healthdamage_; }
     66
     67            inline void setShieldDamage(float shielddamage)
     68                { this->shielddamage_ = shielddamage; COUT(3) << "SHIELDDAMAGE SET TO " << shielddamage << endl; } //ShieldDamage wird korrekt gesettet vom XML-File
     69            inline float getShieldDamage() const
     70                { return this->shielddamage_; }
     71
     72///////////////////end me
     73
     74
    6075        private:
    6176            WeakPtr<Pawn> owner_;
    6277            float lifetime_;
    6378            float damage_;
     79///////me
     80            float healthdamage_;
     81            float shielddamage_;
     82///////end me
    6483            bool bDestroy_;
    6584            Timer destroyTimer_;
  • code/branches/gameimmersion/src/modules/weapons/weaponmodes/LightningGun.cc

    r6732 r8386  
    6969        projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7070        projectile->setDamage(this->getDamage());
     71        projectile->setShieldDamage(this->getShieldDamage());
    7172    }
    7273}
  • code/branches/gameimmersion/src/orxonox/controllers/Controller.h

    r6417 r8386  
    5252            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
    5353
     54/* Override needed for different visual effects (e.g. in "NewHumanController.cc") depending on
     55   the DIFFERENT AMOUNT OF DAMAGE done to the shield and to the health of "victim" (see Projectile.cc, Pawn.cc)
     56
     57//            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) {};
     58*/
     59
    5460            void setGodMode( bool mode ){ this->bGodMode_ = mode; }
    5561            bool getGodMode(){ return this->bGodMode_; }
  • code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.cc

    r7847 r8386  
    6666
    6767        this->damage_ = 0;
    68 
     68///////////////////me
     69        this->healthdamage_ = 0;
     70        this->shielddamage_ = 0;
     71///////////////////end me
    6972        this->muzzleOffset_ = Vector3::ZERO;
    7073        this->muzzlePosition_ = Vector3::ZERO;
     
    106109
    107110        XMLPortParam(WeaponMode, "damage",           setDamage,           getDamage,           xmlelement, mode);
     111//////////me
     112        XMLPortParam(WeaponMode, "healthdamage",     setHealthDamage,     getHealthDamage,     xmlelement, mode);
     113        XMLPortParam(WeaponMode, "shielddamage",     setShieldDamage,     getShieldDamage,     xmlelement, mode);
     114/////////end me
    108115        XMLPortParam(WeaponMode, "muzzleoffset",     setMuzzleOffset,     getMuzzleOffset,     xmlelement, mode);
    109116    }
  • code/branches/gameimmersion/src/orxonox/weaponsystem/WeaponMode.h

    r7163 r8386  
    104104            // Fire
    105105            inline void setDamage(float damage)
    106                 { this->damage_ = damage; }
     106                { this->damage_ = damage; COUT(3) << "DAMAGE-SET-FUNKTION (WeaponMode) WIRD AUFGERUFEN" << endl;}
    107107            inline float getDamage() const
    108108                { return this->damage_; }
     109////////////////////me, copied to projectile.cc
    109110
     111            inline void setHealthDamage(float healthdamage)
     112                { this->healthdamage_ = healthdamage; }
     113            inline float getHealthDamage() const
     114                { return this->healthdamage_; }
     115
     116            inline void setShieldDamage(float shielddamage)
     117                { this->shielddamage_ = shielddamage;} //ShieldDamage wird korrekt gesettet vom XML-File
     118            inline float getShieldDamage() const
     119                { return this->shielddamage_; }
     120
     121///////////////////end me
    110122            inline void setMuzzleOffset(const Vector3& offset)
    111123                { this->muzzleOffset_ = offset; }
     
    146158
    147159            float damage_;
     160            float healthdamage_;
     161            float shielddamage_;
    148162            Vector3 muzzleOffset_;
    149163
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc

    r8187 r8386  
    265265////////////////////end edit
    266266
     267
     268/////////////////////me override
     269    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     270    {
     271        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
     272        {
     273            if (shielddamage >= this->getShieldHealth())
     274            {
     275                this->setShieldHealth(0);
     276                this->setHealth(this->health_ - (healthdamage + damage));
     277            }
     278            else
     279            {
     280                this->setShieldHealth(this->shieldHealth_ - shielddamage);
     281
     282                // remove remaining shieldAbsorpton-Part of damage from shield
     283                shielddamage = damage * this->shieldAbsorption_;
     284                shielddamage = std::min(this->getShieldHealth(),shielddamage);
     285                this->setShieldHealth(this->shieldHealth_ - shielddamage);
     286
     287                // set remaining damage to health
     288                this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
     289            }
     290
     291            this->lastHitOriginator_ = originator;
     292
     293            // play damage effect
     294        }
     295        COUT(3) << "neue damage-Funktion wurde aufgerufen // " << "Shield:" << this->getShieldHealth() << endl;
     296    }
     297
     298/////////////end me
     299
     300
     301/* HIT-Funktionen
     302        Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden!
     303
     304*/
     305
     306
    267307    void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    268308    {
     
    276316    }
    277317
     318/////////////me override
     319    void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
     320    {
     321        COUT(3) << "neue hit-Funktion wurde aufgerufen // " << std::flush;
     322        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
     323        {
     324            this->damage(damage, healthdamage, shielddamage, originator);
     325            this->setVelocity(this->getVelocity() + force);
     326
     327            // play hit effect
     328        }
     329    }
     330/////////////end me
     331
    278332    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    279333    {
     
    288342        }
    289343    }
     344
     345/////////////me override
     346    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
     347    {
     348        COUT(3) << "neue hit2-Funktion wurde aufgerufen // shielddamage: " << shielddamage << std::flush;
     349        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
     350        {
     351            this->damage(damage, healthdamage, shielddamage, originator);
     352
     353            if ( this->getController() )
     354                this->getController()->hit(originator, contactpoint, shielddamage);
     355
     356            // play hit effect
     357        }
     358    }
     359/////////////end me
    290360
    291361    void Pawn::kill()
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h

    r8187 r8386  
    127127            virtual void hit(Pawn* originator, const Vector3& force, float damage);
    128128            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
     129/////////me
     130            virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage);
     131            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage);
     132////////end me
    129133            virtual void kill();
    130134
     
    183187
    184188            virtual void damage(float damage, Pawn* originator = 0);
     189//////////me
     190            virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
     191/////////end me
    185192
    186193            bool bAlive_;
Note: See TracChangeset for help on using the changeset viewer.