Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2010, 11:50:24 PM (15 years ago)
Author:
dafrick
Message:

Merged pickup branch into presentation3 branch.
Seems to be working just fine so not much changes at all. (Except for some representations that had the parameters 'name' instead of 'pickupName' and 'description' instead of 'pickupDescription').

Location:
code/branches/presentation3
Files:
2 deleted
9 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3

  • code/branches/presentation3/data/levels/includes/pickups.oxi

    r6725 r6998  
     1<!-- Shield pickups -->
     2
     3<PickupRepresentation
     4    pickupName = "Small Shield Pickup"
     5    pickupDescription = "Gives you a small shield for 10 seconds."
     6    inventoryRepresentation = "SmallShield"
     7    spawnerTemplate = "smallshieldpickupRepresentation"
     8>
     9    <pickup>
     10        <ShieldPickup template=smallshieldpickup />
     11    </pickup>
     12</PickupRepresentation>
     13
     14<PickupRepresentation
     15    pickupName = "Medium Shield Pickup"
     16    pickupDescription = "Gives you a medium-sized shield for 30 seconds."
     17    inventoryRepresentation = "MediumShield"
     18    spawnerTemplate = "mediumshieldpickupRepresentation"
     19>
     20    <pickup>
     21        <ShieldPickup template=mediumshieldpickup />
     22    </pickup>
     23</PickupRepresentation>
     24
     25<PickupRepresentation
     26    pickupName = "Huge Shield Pickup"
     27    pickupDescription = "Gives you a big shield for 60 seconds."
     28    inventoryRepresentation = "HugeShield"
     29    spawnerTemplate = "hugeshieldpickupRepresentation"
     30>
     31    <pickup>
     32        <ShieldPickup template=hugeshieldpickup />
     33    </pickup>
     34</PickupRepresentation>
    135
    236<!-- Health pickups -->
     
    73107
    74108<PickupRepresentation
    75     name = "Small Speed Boost"
    76     description = "Multiplies Speed of the Ship by a small amount."
     109    pickupName = "Small Speed Boost"
     110    pickupDescription = "Multiplies Speed of the Ship by a small amount."
    77111    spawnerTemplate = "smallspeedpickupRepresentation"
     112    inventoryRepresentation = "SmallSpeed"
    78113>
    79114    <pickup>
     
    83118
    84119<PickupRepresentation
    85     name = "Medium Speed Boost"
    86     description = "Multiplies Speed of the Ship by a bigger amount."
     120    pickupName = "Medium Speed Boost"
     121    pickupDescription = "Multiplies Speed of the Ship by a bigger amount."
    87122    spawnerTemplate = "mediumspeedpickupRepresentation"
     123    inventoryRepresentation = "MediumSpeed"
    88124>
    89125    <pickup>
     
    93129
    94130<PickupRepresentation
    95     name = "Huge Speed Boost"
    96     description = "Multiplies Speed of the Ship by a huge amount."
     131    pickupName = "Huge Speed Boost"
     132    pickupDescription = "Multiplies Speed of the Ship by a huge amount."
    97133    spawnerTemplate = "hugespeedpickupRepresentation"
     134    inventoryRepresentation = "HugeSpeed"
    98135>
    99136    <pickup>
     
    103140
    104141<PickupRepresentation
    105     name = "Small Jump Boost"
    106     description = "Boosts the Ship with a massive amount for a very short time."
     142    pickupName = "Small Jump Boost"
     143    pickupDescription = "Boosts the Ship with a massive amount for a very short time."
    107144    spawnerTemplate = "smalljumppickupRepresentation"
     145    inventoryRepresentation = "SmallSpeed"
    108146>
    109147    <pickup>
     
    115153
    116154<PickupRepresentation
    117     name = "small Invisibility"
    118     description = "Makes you invisible for 5 seconds."
     155    pickupName = "Small Invisibility"
     156    pickupDescription = "Makes you invisible for 5 seconds."
    119157    spawnerTemplate = "smallinvisiblepickupRepresentation"
     158    inventoryRepresentation = "SmallInvisible"
    120159>
    121160    <pickup>
     
    125164
    126165<PickupRepresentation
    127     name = "medium Invisibility"
    128     description = "Makes you invisible for 10 seconds."
     166    pickupName = "Medium Invisibility"
     167    pickupDescription = "Makes you invisible for 10 seconds."
    129168    spawnerTemplate = "mediuminvisiblepickupRepresentation"
     169    inventoryRepresentation = "MediumInvisible"
    130170>
    131171    <pickup>
     
    135175
    136176<PickupRepresentation
    137     name = "hunge Invisibility"
    138     description = "Makes you invisible for 20 seconds."
     177    pickupName = "Huge Invisibility"
     178    pickupDescription = "Makes you invisible for 20 seconds."
    139179    spawnerTemplate = "hugeinvisiblepickupRepresentation"
     180    inventoryRepresentation = "HugeInvisible"
    140181>
    141182    <pickup>
  • code/branches/presentation3/data/levels/pickup.oxw

    r6901 r6998  
    2626    <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    2727
     28
     29    <!-- Shield pickups -->
     30   
     31    <PickupSpawner position="-25,-25,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
     32        <pickup>
     33            <ShieldPickup template=smallshieldpickup />
     34        </pickup>
     35    </PickupSpawner>
     36
     37    <PickupSpawner position="0,-25,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
     38        <pickup>
     39            <ShieldPickup template=mediumshieldpickup />
     40        </pickup>
     41    </PickupSpawner>
     42
     43    <PickupSpawner position="25,-25,-100" triggerDistance="10" respawnTime="5" maxSpawnedItems="10">
     44        <pickup>
     45            <ShieldPickup template=hugeshieldpickup />
     46        </pickup>
     47    </PickupSpawner>
     48   
    2849    <!-- Health pickups -->
    2950   
     
    114135    <!-- Pickup Collection pickups -->
    115136   
    116     <PickupSpawner position="0,-25,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
     137    <PickupSpawner position="0,100,-100" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
    117138        <pickup>
    118139            <PickupCollection template=triplehealthspeedinvisibilitypickup />
  • code/branches/presentation3/data/levels/templates/pickup_representation_templates.oxt

    r6712 r6998  
     1<!-- Shield pickups: -->
     2
     3<Template name=smallshieldpickupRepresentation>
     4    <PickupRepresentation>
     5        <spawner-representation>
     6            <StaticEntity>
     7                <attached>
     8                    <Billboard position="0,0,0" colour="1,1,1" material="Sphere2" scale=0.1>
     9                        <attached>
     10                            <Billboard position="0,0,0" colour="1,1,1" material="Shield" scale=0.3 />
     11                        </attached>
     12                    </Billboard>
     13                </attached>
     14            </StaticEntity>
     15        </spawner-representation>
     16    </PickupRepresentation>
     17</Template>
     18
     19<Template name=smallshieldpickup>
     20  <ShieldPickup
     21    duration = 10
     22    shieldabsorption = 0.7
     23    shieldhealth = 300
     24    activationType = "immediate"
     25    durationType = "once"
     26  />
     27</Template>
     28
     29
     30<Template name=mediumshieldpickupRepresentation>
     31    <PickupRepresentation>
     32        <spawner-representation>
     33            <StaticEntity>
     34                <attached>
     35                    <Billboard position="0,0,0" colour="1,1,1" material="Sphere2" scale=0.1>
     36                        <attached>
     37                            <Billboard position="0,0,0" colour="1,1,1" material="Shield" scale=0.5 />
     38                        </attached>
     39                    </Billboard>
     40                </attached>
     41            </StaticEntity>
     42        </spawner-representation>
     43    </PickupRepresentation>
     44</Template>
     45
     46<Template name=mediumshieldpickup>
     47  <ShieldPickup
     48    duration = 30
     49    shieldabsorption = 0.8
     50    shieldhealth = 500
     51    activationType = "immediate"
     52    durationType = "once"
     53  />
     54</Template>
     55
     56
     57<Template name=hugeshieldpickupRepresentation>
     58    <PickupRepresentation>
     59        <spawner-representation>
     60            <StaticEntity>
     61                <attached>
     62                    <Billboard position="0,0,0" colour="1,1,1" material="Sphere2" scale=0.1>
     63                        <attached>
     64                            <Billboard position="0,0,0" colour="1,1,1" material="Shield" scale=0.7 />
     65                        </attached>
     66                    </Billboard>
     67                </attached>
     68            </StaticEntity>
     69        </spawner-representation>
     70    </PickupRepresentation>
     71</Template>
     72
     73<Template name=hugeshieldpickup>
     74  <ShieldPickup
     75    duration = 60
     76    shieldabsorption = 0.95
     77    shieldhealth = 700
     78    activationType = "immediate"
     79    durationType = "once"
     80  />
     81</Template>
    182
    283<!-- Health pickups: -->
  • code/branches/presentation3/src/modules/pickup/PickupPrereqs.h

    r6711 r6998  
    7979    class MetaPickup;
    8080    class SpeedPickup;
     81    class ShieldPickup;
    8182
    8283}
  • code/branches/presentation3/src/modules/pickup/items/CMakeLists.txt

    r6710 r6998  
    44  MetaPickup.cc
    55  SpeedPickup.cc
     6  ShieldPickup.cc
    67)
  • code/branches/presentation3/src/orxonox/controllers/AIController.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.cc

    r6942 r6998  
    6666        this->maxHealth_ = 0;
    6767        this->initialHealth_ = 0;
     68        this->shieldHealth_ = 0;
     69        this->shieldAbsorption_ = 0.5;
    6870
    6971        this->lastHitOriginator_ = 0;
     
    8082        else
    8183            this->weaponSystem_ = 0;
    82        
     84
    8385        this->setCarrierName("Pawn");
    8486
     
    107109        XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
    108110        XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
     111
     112        XMLPortParam(Pawn, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);
     113        XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
     114
    109115        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
    110116        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
     
    118124    void Pawn::registerVariables()
    119125    {
    120         registerVariable(this->bAlive_,        VariableDirection::ToClient);
    121         registerVariable(this->health_,        VariableDirection::ToClient);
    122         registerVariable(this->initialHealth_, VariableDirection::ToClient);
    123         registerVariable(this->bReload_,       VariableDirection::ToServer);
    124         registerVariable(this->aimPosition_,   Bidirectionality::ServerMaster, 0, true);
     126        registerVariable(this->bAlive_,           VariableDirection::ToClient);
     127        registerVariable(this->health_,           VariableDirection::ToClient);
     128        registerVariable(this->initialHealth_,    VariableDirection::ToClient);
     129        registerVariable(this->shieldHealth_,     VariableDirection::ToClient);
     130        registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
     131        registerVariable(this->bReload_,          VariableDirection::ToServer);
     132        registerVariable(this->aimPosition_,      Bidirectionality::ServerMaster, 0, true);
    125133    }
    126134
     
    164172        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    165173        {
    166             this->setHealth(this->health_ - damage);
     174            //share the dealt damage to the shield and the Pawn.
     175            float shielddamage = damage*this->shieldAbsorption_;
     176            float healthdamage = damage*(1-this->shieldAbsorption_);
     177
     178            // In case the shield can not take all the shield damage.
     179            if (shielddamage > this->getShieldHealth())
     180            {
     181                healthdamage += shielddamage-this->getShieldHealth();
     182                this->setShieldHealth(0);
     183            }
     184
     185            this->setHealth(this->health_ - healthdamage);
     186
     187            if (this->getShieldHealth() > 0)
     188            {
     189                this->setShieldHealth(this->shieldHealth_ - shielddamage);
     190            }
     191
    167192            this->lastHitOriginator_ = originator;
    168193
  • code/branches/presentation3/src/orxonox/worldentities/pawns/Pawn.h

    r6711 r6998  
    7373                { return this->initialHealth_; }
    7474
     75            inline void setShieldHealth(float shieldHealth)
     76            { this->shieldHealth_ = shieldHealth; }
     77            inline float getShieldHealth()
     78            { return this->shieldHealth_; }
     79           
     80            inline void setShieldAbsorption(float shieldAbsorption)
     81            { this->shieldAbsorption_ = shieldAbsorption; }
     82            inline float getShieldAbsorption()
     83            { return this->shieldAbsorption_; }
     84
    7585            inline ControllableEntity* getLastHitOriginator() const
    7686                { return this->lastHitOriginator_; }
     
    141151            float maxHealth_;
    142152            float initialHealth_;
     153            float shieldHealth_;
     154            float shieldAbsorption_; // Has to be between 0 and 1
    143155
    144156            Pawn* lastHitOriginator_;
Note: See TracChangeset for help on using the changeset viewer.