[Orxonox-commit 4271] r8942 - in code/branches/gamecontent: data/levels src/orxonox/controllers src/orxonox/gametypes src/orxonox/interfaces src/orxonox/worldentities/pawns
jo at orxonox.net
jo at orxonox.net
Fri Nov 18 18:52:22 CET 2011
Author: jo
Date: 2011-11-18 18:52:21 +0100 (Fri, 18 Nov 2011)
New Revision: 8942
Added:
code/branches/gamecontent/src/orxonox/interfaces/PartyMember.cc
Modified:
code/branches/gamecontent/data/levels/fightInOurBack.oxw
code/branches/gamecontent/data/levels/missionOne.oxw
code/branches/gamecontent/data/levels/pirateAttack.oxw
code/branches/gamecontent/src/orxonox/controllers/ArtificialController.cc
code/branches/gamecontent/src/orxonox/controllers/HumanController.cc
code/branches/gamecontent/src/orxonox/gametypes/Mission.cc
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc
code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h
code/branches/gamecontent/src/orxonox/interfaces/CMakeLists.txt
code/branches/gamecontent/src/orxonox/interfaces/PartyMember.h
code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.h
Log:
Pawn&SpaceShip Colouring via XML works. Quick&Dirty implementation though. A clean version is going to follow.
Modified: code/branches/gamecontent/data/levels/fightInOurBack.oxw
===================================================================
--- code/branches/gamecontent/data/levels/fightInOurBack.oxw 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/data/levels/fightInOurBack.oxw 2011-11-18 17:52:21 UTC (rev 8942)
@@ -109,7 +109,7 @@
<Level
name="Fight in our back"
description="Our fleet is far ahead of us. We need to get rid of all the enemies in its back, because we do not want our enemies to attack from everywhere. So let us clear this Sector!"
- gametype=TeamDeathmatch
+ gametype=Mission
>
<templates>
<Template link=lodtemplate_default />
@@ -213,7 +213,7 @@
<?lua for i=0,0,1 do
x=800
-health=2050
+health=1500
?>
<!--Transporter 1-->
<EventTrigger name="activateTeam1No1" acitvations=1 stayactive="true">
@@ -238,7 +238,7 @@
<?lua for j=0,1,1 do
-health=1600
+health=1300
x=800
z=j*300
?>
Modified: code/branches/gamecontent/data/levels/missionOne.oxw
===================================================================
--- code/branches/gamecontent/data/levels/missionOne.oxw 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/data/levels/missionOne.oxw 2011-11-18 17:52:21 UTC (rev 8942)
@@ -56,7 +56,15 @@
<EventMultiTrigger name=spawntrigger>
<events>
<trigger>
- <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff>
+ <EventTrigger invert=true>
+ <events>
+ <trigger>
+ <EventListener event="attack" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </TeamSpawnPoint>
</trigger>
</events>
</EventMultiTrigger>
@@ -162,6 +170,17 @@
</events>
</QuestEffectBeacon>
+ <QuestEffectBeacon times=1> <!-- alternative quest end -->
+ <effects>
+ <CompleteQuest questId="missionOne.DuballStation" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=toHydroFarmer />
+ </execute>
+ </events>
+ </QuestEffectBeacon>
+
<!--helper trigger to end the getHelp quest -->
<DistanceTrigger name="getHelpEnd" position="-47000,-1000,1300" distance=1400 target="SpaceShip" stayActive="false" delay=0.1>
<EventTrigger>
@@ -228,7 +247,32 @@
</events>
</QuestEffectBeacon>
+<!-- End the quest after own destruction of spacecruiser -->
+ <QuestEffectBeacon position="-100,0,0" times=1>
+ <effects>
+ <FailQuest questId="missionOne.getHelp" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event="failQuest" />
+ </execute>
+ </events>
+ <attached>
+ <DistanceTrigger name="failQuest" position="-47000,-1000,1300" distance=2300 target="SpaceShip">
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="gameEnd" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </DistanceTrigger>
+ </attached>
+ </QuestEffectBeacon>
+
+
+
<LocalQuest id="missionOne.basicFlying">
<QuestDescription title="Flying" description="Can you see the blinking light straight ahead? Your goal is to fly through it.
Use (W) to accelerate and steer with your mouse.
@@ -334,7 +378,7 @@
</SimpleNotification>
<!-- Blinking Billboard should be replaced with WAYPOINT -->
-<BlinkingBillboard position="-900,640,600" frequency=0.4 amplitude=2 material="Flares/lensflare" colour="1,1,0">
+<BlinkingBillboard position="-900,640,600" frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,1,0.05">
<events>
<visibility>
<EventTrigger invert=true>
@@ -465,7 +509,7 @@
</SimpleNotification>
<!-- @Objects: 4 boxes (uncontrolled pawns) -->
- <Pawn health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
+ <Pawn team=1 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
<events>
<visibility>
<EventListener event="flying4" />
@@ -479,7 +523,7 @@
</collisionShapes>
</Pawn>
- <Pawn health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box visible="true">
+ <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box visible="true">
<events>
<visibility>
<EventListener event="flying4" />
@@ -492,7 +536,7 @@
<BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
</collisionShapes>
</Pawn>
- <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
+ <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1>
<events>
<visibility>
<EventListener event="flying4" />
@@ -505,7 +549,7 @@
<BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
</collisionShapes>
</Pawn>
- <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
+ <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1>
<events>
<visibility>
<EventListener event="flying4" />
@@ -888,7 +932,7 @@
</SimpleNotification>
<!-------------------------------------- PART FOUR : Get Help --------------------------------------->
-<!-- TODO: cruiserKilled -->
+
<Trigger name="famer1" mode="and" stayActive="true">
<DistanceTrigger position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=0 />
<EventTrigger name="notGameEnd" activations="1" invert="true">
@@ -931,6 +975,7 @@
<!-- @Objects: HYDROGEN FARMER & DOCKING -->
<SpaceShip
+ team=0
position="-48900,100,0"
roll=90 yaw=0 pitch=20
mass=10000
@@ -1005,6 +1050,7 @@
<!-- at Objects: SpaceCruiser as docking target -->
<SpaceShip
template = "spaceshipspacecruiser"
+ team = "0"
position = "-48900,800,0"
orientation = "-0.14, 0.68, 0.68, 0.223"
health = "400"
@@ -1149,12 +1195,20 @@
<!-------------------------------------- The attack --------------------------------------->
-
<!-- TODO:
- update spaceshipTransporter
- bots do friendly fire (is drone function reusable?)
-->
+<!-- Fallback Spawnpoint: on cruiserdeath caused by pirates. Unfortunately unstable behaviour concerning activity. -->
+ <TeamSpawnPoint team=0 position="2000,1500,-1500" direction="-1,-1,1" spawnclass=SpaceShip pawndesign=spaceshipspacecruiser>
+ <events>
+ <activity>
+ <EventListener event="attack" />
+ </activity>
+ </events>
+ </TeamSpawnPoint>
+
<!-- @Triggers: toHydroFamer <-> first portal usage
ondock <-> successfull docking
attack <-> second portal usage -->
@@ -1606,6 +1660,7 @@
<!-- Script code="artificialcontroller setbotlevel 0.1" /-->
</Scene>
</Level>
+
<!-- TODO:
- Story & more precise Questmessages; more quest hints; fail-quest;
- Colouring: Show who is friend or foe via the colour
Modified: code/branches/gamecontent/data/levels/pirateAttack.oxw
===================================================================
--- code/branches/gamecontent/data/levels/pirateAttack.oxw 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/data/levels/pirateAttack.oxw 2011-11-18 17:52:21 UTC (rev 8942)
@@ -27,7 +27,7 @@
<Level
name="Dani's Testlevel"
description="Erste Versuche mit den Quests"
-gametype=TeamDeathmatch
+gametype=Mission
>
<templates>
@@ -251,7 +251,7 @@
</execute>
</events>
</QuestEffectBeacon>
- <!--Stick found-->
+ <!--Stick found-->zz
<QuestEffectBeacon position="4800,5785,-10725" times=1>
<attached>
<DistanceTrigger name=questbeacon7 position="0,0,0" distance=30 target="Pawn" beaconMode="identify" targetname=Me />
Modified: code/branches/gamecontent/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/controllers/ArtificialController.cc 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/controllers/ArtificialController.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -41,6 +41,7 @@
#include "worldentities/pawns/SpaceShip.h"
#include "gametypes/TeamDeathmatch.h"
#include "gametypes/Dynamicmatch.h"
+#include "gametypes/Mission.h"
#include "controllers/WaypointPatrolController.h"
#include "controllers/NewHumanController.h"
#include "controllers/DroneController.h"
@@ -997,6 +998,16 @@
team2 = tdm->getTeam(entity2->getPlayer());
}
+ Mission* miss = orxonox_cast<Mission*>(gametype);
+ if (miss)
+ {
+ if (entity1->getPlayer())
+ team1 = miss->getTeam(entity1->getPlayer());
+
+ if (entity2->getPlayer())
+ team2 = miss->getTeam(entity2->getPlayer());
+ }
+
TeamBaseMatchBase* base = 0;
base = orxonox_cast<TeamBaseMatchBase*>(entity1);
if (base)
Modified: code/branches/gamecontent/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/controllers/HumanController.cc 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/controllers/HumanController.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -194,8 +194,8 @@
{
this->boosting_ = true;
this->boostingTimeout_.startTimer();
-
- this->controllableEntity_->boost(this->boosting_);
+ if(this->controllableEntity_)
+ this->controllableEntity_->boost(this->boosting_);
// orxout() << "Start boosting" << endl;
}
}
@@ -208,8 +208,8 @@
{
this->boosting_ = false;
this->boostingTimeout_.stopTimer();
-
- this->controllableEntity_->boost(this->boosting_);
+ if(this->controllableEntity_)
+ this->controllableEntity_->boost(this->boosting_);
// orxout() << "Stop boosting" << endl;
}
Modified: code/branches/gamecontent/src/orxonox/gametypes/Mission.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/Mission.cc 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/gametypes/Mission.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -89,9 +89,13 @@
}
void Mission::setTeams()
- {
+ {//Set pawn-colours
for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
- this->setObjectColour(*it);
+ {
+ Pawn* pawn = static_cast<Pawn*>(*it);
+ if(!pawn) continue;
+ this->setDefaultObjectColour(pawn);
+ }
}
Modified: code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -34,6 +34,7 @@
#include "interfaces/TeamColourable.h"
#include "worldentities/TeamSpawnPoint.h"
#include "worldentities/pawns/Pawn.h"
+#include "worldentities/ControllableEntity.h"
#include "controllers/ArtificialController.h"
namespace orxonox
@@ -116,7 +117,7 @@
for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\
{
if(true)//check if dead player is allowed to enter -> if maximum nr of players is exceeded & player was not in game before: disallow
- continue;
+ //continue;
if (it->second.state_ == PlayerState::Dead)
{
if ((it->first->isReadyToSpawn() || this->bForceSpawn_))
@@ -248,48 +249,56 @@
std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size()))
{
- if (pawn)
- {
- pawn->setRadarObjectColour(this->teamcolours_[it_player->second]);
-
- std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
- for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
- {
- if ((*it)->isA(Class(TeamColourable)))
- {
- TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
- tc->setTeamColour(this->teamcolours_[it_player->second]);
- }
- }
- }
+ this->colourPawn(pawn, it_player->second);
}
}
- void TeamGametype::setObjectColour(Pawn* pawn)
+ void TeamGametype::setDefaultObjectColour(Pawn* pawn)
{
if(pawn == NULL)
return;
+
+ int teamnumber = pawn->getTeam();
+
+ if(teamnumber >= 0)
+ {
+ this->colourPawn(pawn, teamnumber); return;
+ }
//get Pawn's controller
- ArtificialController* controller = orxonox_cast<ArtificialController*>(pawn);
- if(controller == NULL)
+ ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn);
+
+ Controller* controller = 0;
+ if (entity->getController())
+ controller = entity->getController();
+ else if (entity->getXMLController())
+ controller = entity->getXMLController();
+ else
return;
+
+ ArtificialController* artificial = orxonox_cast<ArtificialController*>(controller);
//get Teamnumber - get the data
- int teamnumber= controller->getTeam();
- if(teamnumber < 0)
+ if(artificial == NULL)
return;
+ teamnumber= artificial->getTeam();
+
//set ObjectColour
- pawn->setRadarObjectColour(this->teamcolours_[teamnumber]);
+ this->colourPawn(pawn, teamnumber);
+ }
+ void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
+ {// catch no-colouring-case and wrong input
+ if(teamNr < 0 || pawn == NULL) return;
+ pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
+
std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
{
if ((*it)->isA(Class(TeamColourable)))
{
TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
- tc->setTeamColour(this->teamcolours_[teamnumber]);
+ tc->setTeamColour(this->teamcolours_[teamNr]);
}
}
}
-
}
Modified: code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h
===================================================================
--- code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h 2011-11-18 17:52:21 UTC (rev 8942)
@@ -74,7 +74,8 @@
unsigned int maxPlayers_; //<! Defines Maximum for number of players. Value 0 : no maximum!
std::map<PlayerInfo*, bool> allowedInGame_; //!< Only those players are allowed to spawn which are listed here as 'true'.
void setTeamColour(PlayerInfo* player, Pawn* pawn);
- void setObjectColour(Pawn* pawn);
+ void setDefaultObjectColour(Pawn* pawn);
+ void colourPawn(Pawn* pawn, int teamNr);
};
}
Modified: code/branches/gamecontent/src/orxonox/interfaces/CMakeLists.txt
===================================================================
--- code/branches/gamecontent/src/orxonox/interfaces/CMakeLists.txt 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/interfaces/CMakeLists.txt 2011-11-18 17:52:21 UTC (rev 8942)
@@ -5,4 +5,5 @@
PickupCarrier.cc
PickupListener.cc
RadarViewable.cc
+ PartyMember.cc
)
Added: code/branches/gamecontent/src/orxonox/interfaces/PartyMember.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/interfaces/PartyMember.cc (rev 0)
+++ code/branches/gamecontent/src/orxonox/interfaces/PartyMember.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+*/
+
+/**
+ @file PartyMember.cc
+ @brief Implementation of the PartyMember class.
+*/
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/CoreIncludes.h"
+
+#include "PartyMember.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Constructor. Registers the object.
+ */
+ PartyMember::PartyMember()
+ {
+ RegisterRootObject(PartyMember);
+ this->team_ = -1;
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ PartyMember::~PartyMember()
+ {
+
+ }
+
+ /**
+ @brief
+ Static method that is used to notify the PartyMember itself of the change in the used status of a Pickupable.
+ This is called in Pickupable.
+ @param pickup
+ The Pickupable that has changed its used status.
+ @param used
+ Thse value the status has changed to.
+ */
+
+}
Modified: code/branches/gamecontent/src/orxonox/interfaces/PartyMember.h
===================================================================
--- code/branches/gamecontent/src/orxonox/interfaces/PartyMember.h 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/interfaces/PartyMember.h 2011-11-18 17:52:21 UTC (rev 8942)
@@ -51,7 +51,7 @@
{
public:
PartyMember();
- virtual ~PartyMember() {}
+ virtual ~PartyMember();
/**
@brief
Modified: code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc 2011-11-18 17:52:21 UTC (rev 8942)
@@ -59,6 +59,7 @@
this->bAlive_ = true;
this->bReload_ = false;
+ this->team_ = -1;
this->health_ = 0;
this->maxHealth_ = 0;
this->initialHealth_ = 0;
@@ -109,6 +110,8 @@
{
SUPER(Pawn, XMLPort, xmlelement, mode);
+ XMLPortParam(Pawn, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
+
XMLPortParam(Pawn, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
@@ -128,6 +131,8 @@
XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
+
+
}
void Pawn::registerVariables()
Modified: code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.h 2011-11-16 16:02:12 UTC (rev 8941)
+++ code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.h 2011-11-18 17:52:21 UTC (rev 8942)
@@ -34,12 +34,13 @@
#include <string>
#include "interfaces/PickupCarrier.h"
#include "interfaces/RadarViewable.h"
+#include "interfaces/PartyMember.h"
#include "worldentities/ControllableEntity.h"
namespace orxonox // tolua_export
{ // tolua_export
class _OrxonoxExport Pawn // tolua_export
- : public ControllableEntity, public RadarViewable, public PickupCarrier
+ : public ControllableEntity, public RadarViewable, public PickupCarrier//, public PartyMember
{ // tolua_export
friend class WeaponSystem;
@@ -53,6 +54,11 @@
inline bool isAlive() const
{ return this->bAlive_; }
+ inline void setTeam(int team)
+ { this->team_ = team; }
+ inline float getTeam() const
+ { return this->team_; }
+
virtual void setHealth(float health);
inline void addHealth(float health)
{ this->setHealth(this->health_ + health); }
@@ -193,6 +199,8 @@
virtual PickupCarrier* getCarrierParent(void) const
{ return NULL; }
+ int team_;
+
float health_;
float maxHealth_;
float initialHealth_;
More information about the Orxonox-commit
mailing list