Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8942


Ignore:
Timestamp:
Nov 18, 2011, 6:52:21 PM (13 years ago)
Author:
jo
Message:

Pawn&SpaceShip Colouring via XML works. Quick&Dirty implementation though. A clean version is going to follow.

Location:
code/branches/gamecontent
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamecontent/data/levels/fightInOurBack.oxw

    r8891 r8942  
    110110  name="Fight in our back"
    111111  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!"
    112   gametype=TeamDeathmatch
     112  gametype=Mission
    113113>
    114114  <templates>
     
    214214<?lua for i=0,0,1 do
    215215x=800
    216 health=2050
     216health=1500
    217217?>
    218218    <!--Transporter 1-->
     
    239239
    240240<?lua for j=0,1,1 do
    241 health=1600
     241health=1300
    242242x=800
    243243z=j*300
  • code/branches/gamecontent/data/levels/missionOne.oxw

    r8932 r8942  
    5757        <events>
    5858            <trigger>
    59                 <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     59                <TeamSpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff>
     60                  <EventTrigger invert=true>
     61                    <events>
     62                      <trigger>
     63                        <EventListener event="attack" />
     64                      </trigger>
     65                    </events>
     66                  </EventTrigger>
     67                </TeamSpawnPoint>
    6068            </trigger>
    6169        </events>
     
    163171        </QuestEffectBeacon>
    164172
     173        <QuestEffectBeacon times=1> <!--  alternative quest end  -->
     174            <effects>
     175                <CompleteQuest questId="missionOne.DuballStation" />
     176            </effects>
     177            <events>
     178                <execute>
     179                    <EventListener event=toHydroFarmer />
     180                </execute>
     181            </events>
     182        </QuestEffectBeacon>
     183
    165184<!--helper trigger to end the getHelp quest -->
    166185    <DistanceTrigger name="getHelpEnd" position="-47000,-1000,1300" distance=1400 target="SpaceShip" stayActive="false" delay=0.1>
     
    228247            </events>
    229248        </QuestEffectBeacon>
     249
     250<!-- End the quest after own destruction of spacecruiser -->
     251        <QuestEffectBeacon position="-100,0,0" times=1>
     252            <effects>
     253                <FailQuest questId="missionOne.getHelp" />
     254            </effects>
     255            <events>
     256                <execute>
     257                    <EventListener event="failQuest" />
     258                </execute>
     259            </events>
     260            <attached>
     261                <DistanceTrigger name="failQuest" position="-47000,-1000,1300" distance=2300 target="SpaceShip">
     262                  <EventTrigger>
     263                    <events>
     264                      <trigger>
     265                        <EventListener event="gameEnd" />
     266                      </trigger>
     267                    </events>
     268                  </EventTrigger>
     269                </DistanceTrigger>
     270            </attached>
     271        </QuestEffectBeacon>
     272
     273
    230274
    231275
     
    335379
    336380<!-- Blinking Billboard should be replaced with WAYPOINT -->
    337 <BlinkingBillboard position="-900,640,600" frequency=0.4 amplitude=2 material="Flares/lensflare" colour="1,1,0">
     381<BlinkingBillboard position="-900,640,600" frequency=0.6 amplitude=3 material="Flares/lensflare" colour="1,1,0.05">
    338382          <events>
    339383            <visibility>
     
    466510
    467511<!-- @Objects: 4 boxes (uncontrolled pawns) -->
    468                 <Pawn health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
     512                <Pawn team=1 health=30 position="0,0,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
    469513                    <events>
    470514                      <visibility>
     
    480524                </Pawn>
    481525
    482                 <Pawn health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box visible="true">
     526                <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box visible="true">
    483527                    <events>
    484528                      <visibility>
     
    493537                    </collisionShapes>
    494538                </Pawn>
    495                 <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
     539                <Pawn health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1>
    496540                    <events>
    497541                      <visibility>
     
    506550                    </collisionShapes>
    507551                </Pawn>
    508                 <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box >
     552                <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1>
    509553                    <events>
    510554                      <visibility>
     
    889933
    890934<!-------------------------------------- PART FOUR : Get Help --------------------------------------->
    891 <!-- TODO: cruiserKilled -->
     935
    892936    <Trigger name="famer1" mode="and" stayActive="true">
    893937        <DistanceTrigger position="-48200,100,0" target="Pawn" distance=650 stayActive="true" delay=0 />
     
    932976<!-- @Objects: HYDROGEN FARMER & DOCKING -->
    933977    <SpaceShip
     978        team=0
    934979        position="-48900,100,0"
    935980        roll=90 yaw=0 pitch=20
     
    10061051    <SpaceShip
    10071052        template            = "spaceshipspacecruiser"
     1053        team                = "0"
    10081054        position            = "-48900,800,0"
    10091055        orientation         = "-0.14, 0.68, 0.68, 0.223"
     
    11501196
    11511197<!-------------------------------------- The attack --------------------------------------->
    1152 
    11531198<!-- TODO:
    11541199     - update spaceshipTransporter
    11551200     - bots do friendly fire (is drone function reusable?)
    11561201-->
     1202
     1203<!-- Fallback Spawnpoint: on cruiserdeath caused by pirates. Unfortunately unstable behaviour concerning activity. -->
     1204    <TeamSpawnPoint team=0 position="2000,1500,-1500" direction="-1,-1,1" spawnclass=SpaceShip pawndesign=spaceshipspacecruiser>
     1205        <events>
     1206            <activity>
     1207                <EventListener event="attack" />
     1208            </activity>
     1209        </events>
     1210    </TeamSpawnPoint>
    11571211
    11581212<!-- @Triggers: toHydroFamer <-> first  portal usage
     
    16071661  </Scene>
    16081662</Level>
     1663
    16091664<!-- TODO:
    16101665- Story & more precise Questmessages; more quest hints; fail-quest;
  • code/branches/gamecontent/data/levels/pirateAttack.oxw

    r8706 r8942  
    2828name="Dani's Testlevel"
    2929description="Erste Versuche mit den Quests"
    30 gametype=TeamDeathmatch
     30gametype=Mission
    3131>
    3232
     
    252252                    </events>
    253253                </QuestEffectBeacon>
    254         <!--Stick found-->
     254        <!--Stick found-->zz
    255255        <QuestEffectBeacon position="4800,5785,-10725" times=1>
    256256                    <attached>
  • code/branches/gamecontent/src/orxonox/controllers/ArtificialController.cc

    r8923 r8942  
    4242#include "gametypes/TeamDeathmatch.h"
    4343#include "gametypes/Dynamicmatch.h"
     44#include "gametypes/Mission.h"
    4445#include "controllers/WaypointPatrolController.h"
    4546#include "controllers/NewHumanController.h"
     
    996997            if (entity2->getPlayer())
    997998                team2 = tdm->getTeam(entity2->getPlayer());
     999        }
     1000
     1001        Mission* miss = orxonox_cast<Mission*>(gametype);
     1002        if (miss)
     1003        {
     1004            if (entity1->getPlayer())
     1005                team1 = miss->getTeam(entity1->getPlayer());
     1006
     1007            if (entity2->getPlayer())
     1008                team2 = miss->getTeam(entity2->getPlayer());
    9981009        }
    9991010
  • code/branches/gamecontent/src/orxonox/controllers/HumanController.cc

    r8858 r8942  
    195195            this->boosting_ = true;
    196196            this->boostingTimeout_.startTimer();
    197            
    198             this->controllableEntity_->boost(this->boosting_);
     197            if(this->controllableEntity_)
     198                this->controllableEntity_->boost(this->boosting_);
    199199//            orxout() << "Start boosting" << endl;
    200200        }
     
    209209        this->boosting_ = false;
    210210        this->boostingTimeout_.stopTimer();
    211 
    212         this->controllableEntity_->boost(this->boosting_);
     211        if(this->controllableEntity_)
     212            this->controllableEntity_->boost(this->boosting_);
    213213//        orxout() << "Stop boosting" << endl;
    214214    }
  • code/branches/gamecontent/src/orxonox/gametypes/Mission.cc

    r8941 r8942  
    9090
    9191    void Mission::setTeams()
    92     {
     92    {//Set pawn-colours
    9393        for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
    94             this->setObjectColour(*it);
     94        {
     95            Pawn* pawn = static_cast<Pawn*>(*it);
     96            if(!pawn) continue;
     97                this->setDefaultObjectColour(pawn);
     98        }
    9599    }
    96100
  • code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.cc

    r8941 r8942  
    3535#include "worldentities/TeamSpawnPoint.h"
    3636#include "worldentities/pawns/Pawn.h"
     37#include "worldentities/ControllableEntity.h"
    3738#include "controllers/ArtificialController.h"
    3839
     
    117118        {
    118119            if(true)//check if dead player is allowed to enter -> if maximum nr of players is exceeded & player was not in game before: disallow
    119                 continue;
     120                //continue;
    120121            if (it->second.state_ == PlayerState::Dead)
    121122            {
     
    249250        if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size()))
    250251        {
    251             if (pawn)
    252             {
    253                 pawn->setRadarObjectColour(this->teamcolours_[it_player->second]);
    254 
    255                 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
    256                 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)
    257                 {
    258                     if ((*it)->isA(Class(TeamColourable)))
    259                     {
    260                         TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
    261                         tc->setTeamColour(this->teamcolours_[it_player->second]);
    262                     }
    263                 }
    264             }
    265         }
    266     }
    267 
    268     void TeamGametype::setObjectColour(Pawn* pawn)
     252            this->colourPawn(pawn, it_player->second);
     253        }
     254    }
     255
     256    void TeamGametype::setDefaultObjectColour(Pawn* pawn)
    269257    {
    270258        if(pawn == NULL)
    271259            return;
     260       
     261        int teamnumber = pawn->getTeam();
     262
     263        if(teamnumber >= 0)
     264        {
     265            this->colourPawn(pawn, teamnumber); return;
     266        }
    272267        //get Pawn's controller
    273         ArtificialController* controller = orxonox_cast<ArtificialController*>(pawn);
    274         if(controller == NULL)
     268        ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn);
     269
     270        Controller* controller = 0;
     271        if (entity->getController())
     272            controller = entity->getController();
     273        else if (entity->getXMLController())
     274            controller = entity->getXMLController();
     275        else
    275276            return;
     277
     278        ArtificialController* artificial =  orxonox_cast<ArtificialController*>(controller);
    276279        //get Teamnumber - get the data
    277         int teamnumber= controller->getTeam();
    278         if(teamnumber < 0)
     280        if(artificial == NULL)
    279281            return;
     282        teamnumber= artificial->getTeam();
     283
    280284        //set ObjectColour
    281         pawn->setRadarObjectColour(this->teamcolours_[teamnumber]);
     285        this->colourPawn(pawn, teamnumber);
     286    }
     287
     288    void TeamGametype::colourPawn(Pawn* pawn, int teamNr)
     289    {// catch no-colouring-case and wrong input
     290        if(teamNr < 0 || pawn == NULL) return;
     291        pawn->setRadarObjectColour(this->teamcolours_[teamNr]);
    282292
    283293        std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects();
     
    287297            {
    288298                TeamColourable* tc = orxonox_cast<TeamColourable*>(*it);
    289                 tc->setTeamColour(this->teamcolours_[teamnumber]);
     299                tc->setTeamColour(this->teamcolours_[teamNr]);
    290300            }
    291301         }
    292302    }
    293303
    294 
    295304}
  • code/branches/gamecontent/src/orxonox/gametypes/TeamGametype.h

    r8941 r8942  
    7575            std::map<PlayerInfo*, bool> allowedInGame_; //!< Only those players are allowed to spawn which are listed here as 'true'.
    7676            void setTeamColour(PlayerInfo* player, Pawn* pawn);
    77             void setObjectColour(Pawn* pawn);
     77            void setDefaultObjectColour(Pawn* pawn);
     78            void colourPawn(Pawn* pawn, int teamNr);
    7879    };
    7980}
  • code/branches/gamecontent/src/orxonox/interfaces/CMakeLists.txt

    r8706 r8942  
    66  PickupListener.cc
    77  RadarViewable.cc
     8  PartyMember.cc
    89)
  • code/branches/gamecontent/src/orxonox/interfaces/PartyMember.h

    r8907 r8942  
    5252        public:
    5353            PartyMember();
    54             virtual ~PartyMember() {}
     54            virtual ~PartyMember();
    5555
    5656            /**
  • code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.cc

    r8904 r8942  
    6060        this->bReload_ = false;
    6161
     62        this->team_ = -1;
    6263        this->health_ = 0;
    6364        this->maxHealth_ = 0;
     
    110111        SUPER(Pawn, XMLPort, xmlelement, mode);
    111112
     113        XMLPortParam(Pawn, "team", setTeam, getTeam, xmlelement, mode).defaultValues(-1);
     114
    112115        XMLPortParam(Pawn, "health", setHealth, getHealth, xmlelement, mode).defaultValues(100);
    113116        XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
     
    129132        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    130133        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
     134
     135
    131136    }
    132137
  • code/branches/gamecontent/src/orxonox/worldentities/pawns/Pawn.h

    r8891 r8942  
    3535#include "interfaces/PickupCarrier.h"
    3636#include "interfaces/RadarViewable.h"
     37#include "interfaces/PartyMember.h"
    3738#include "worldentities/ControllableEntity.h"
    3839
     
    4041{ // tolua_export
    4142    class _OrxonoxExport Pawn // tolua_export
    42         : public ControllableEntity, public RadarViewable, public PickupCarrier
     43        : public ControllableEntity, public RadarViewable, public PickupCarrier//, public PartyMember
    4344    { // tolua_export
    4445        friend class WeaponSystem;
     
    5354            inline bool isAlive() const
    5455                { return this->bAlive_; }
     56
     57            inline void setTeam(int team)
     58                { this->team_ = team; }
     59            inline float getTeam() const
     60                { return this->team_; }
    5561
    5662            virtual void setHealth(float health);
     
    194200                { return NULL; }
    195201
     202            int team_;
     203
    196204            float health_;
    197205            float maxHealth_;
Note: See TracChangeset for help on using the changeset viewer.