[Orxonox-commit 4428] r9099 - in code/branches/pickup2012: data/levels/templates src/modules/pickup src/modules/pickup/items src/orxonox/worldentities/pawns
lkevin at orxonox.net
lkevin at orxonox.net
Fri Apr 20 16:06:10 CEST 2012
Author: lkevin
Date: 2012-04-20 16:06:09 +0200 (Fri, 20 Apr 2012)
New Revision: 9099
Modified:
code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt
code/branches/pickup2012/src/modules/pickup/PickupPrereqs.h
code/branches/pickup2012/src/modules/pickup/items/CMakeLists.txt
code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h
Log:
Found a way to implement damage modifiers by
adding a flag to the pawn and then using this
flag in pawn::damage().
More compilation errors to be fixed though, a tick
function seems to be missing.
Modified: code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt 2012-04-20 13:00:32 UTC (rev 9098)
+++ code/branches/pickup2012/data/levels/templates/pickupRepresentationTemplates.oxt 2012-04-20 14:06:09 UTC (rev 9099)
@@ -215,6 +215,33 @@
</PickupRepresentation>
</Template>
+<!-- DamageBoost pickups -->
+
+<Template name=normaldamageboostpickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="0.99,0.96,0.52" material="Sphere2" scale=0.5>
+ <attached>
+ <Billboard position="0,0,0" colour="0.98,0.94,0.22" material="asterisk" scale=0.5 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=smallspeedpickup>
+ <SpeedPickup
+ duration = 10.0
+ damageBoost = damageBoost*2
+ activationType = "immediate"
+ durationType = "continuous"
+ />
+</Template>
+
<!-- Speed pickups -->
<Template name=smallspeedpickupRepresentation>
Modified: code/branches/pickup2012/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/branches/pickup2012/src/modules/pickup/PickupPrereqs.h 2012-04-20 13:00:32 UTC (rev 9098)
+++ code/branches/pickup2012/src/modules/pickup/PickupPrereqs.h 2012-04-20 14:06:09 UTC (rev 9099)
@@ -85,7 +85,7 @@
class SpeedPickup;
class ShieldPickup;
class ShrinkPickup;
-
+ class DamageBoostPickup;
}
#endif /* _PickupPrereqs_H__ */
Modified: code/branches/pickup2012/src/modules/pickup/items/CMakeLists.txt
===================================================================
--- code/branches/pickup2012/src/modules/pickup/items/CMakeLists.txt 2012-04-20 13:00:32 UTC (rev 9098)
+++ code/branches/pickup2012/src/modules/pickup/items/CMakeLists.txt 2012-04-20 14:06:09 UTC (rev 9099)
@@ -6,4 +6,5 @@
SpeedPickup.cc
ShieldPickup.cc
ShrinkPickup.cc
+ DamageBoostPickup.cc
)
Modified: code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc 2012-04-20 13:00:32 UTC (rev 9098)
+++ code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.cc 2012-04-20 14:06:09 UTC (rev 9099)
@@ -74,6 +74,9 @@
this->lastHitOriginator_ = 0;
+ // set damage multiplier to default value 1, meaning nominal damage
+ this->damageMultiplier_ = 1;
+
this->spawnparticleduration_ = 3.0f;
this->aimPosition_ = Vector3::ZERO;
@@ -227,7 +230,10 @@
void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
{
- if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
+ // apply multiplier
+ damage *= originator->getDamageMultiplier();
+
+ if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
{
if (shielddamage >= this->getShieldHealth())
{
Modified: code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h 2012-04-20 13:00:32 UTC (rev 9098)
+++ code/branches/pickup2012/src/orxonox/worldentities/pawns/Pawn.h 2012-04-20 14:06:09 UTC (rev 9099)
@@ -161,6 +161,13 @@
inline unsigned int getExplosionChunks() const
{ return this->numexplosionchunks_; }
+ // not that beautiful yet
+ inline void setDamageMultiplier(float multiplier)
+ { this->damageMultiplier_ = multiplier; }
+ inline float getDamageMultiplier()
+ { return this->damageMultiplier_; }
+
+
virtual void startLocalHumanControl();
void setAimPosition( Vector3 position )
@@ -207,6 +214,9 @@
float reloadWaitTime_;
float reloadWaitCountdown_;
+ // modifiers
+ float damageMultiplier_;
+
WeakPtr<Pawn> lastHitOriginator_;
WeaponSystem* weaponSystem_;
More information about the Orxonox-commit
mailing list