Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10059


Ignore:
Timestamp:
May 15, 2014, 5:09:35 PM (10 years ago)
Author:
samuezu
Message:

works more or less, but big trouble accessing the scriptableController-controlled entity

Location:
code/branches/ScriptableController
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/data/levels/levelTry.oxw

    r10057 r10059  
    7272
    7373
    74     <Billboard position="500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
    75     <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
     74    <Billboard position="3500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
     75    <DistanceTrigger position="3500,0,0" distance="200" target="Pawn"
    7676      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
    7777    />
  • code/branches/ScriptableController/src/orxonox/controllers/ControllerDirector.cc

    r10057 r10059  
    9191       tmp << "newctrlid = " << ctrlid;
    9292       std::string todo = tmp.str();
    93 
     93       
    9494       /* Run the string using the luastate created earlier */
    9595       ls->doString(todo);
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc

    r10057 r10059  
    125125    void ScriptController::tick(float dt)
    126126    {
     127
     128       
     129
    127130        /* If this controller has no entity entry, do nothing */
    128131        if( !(this->entity_) )
     
    152155    void ScriptController::moveToPosition_beta(float x, float y, float z )
    153156    {
     157
     158        orxout()<<"moveToPosition_beta executed"<<endl;
    154159        //const Vector3 local = this->getPosition();
    155160        const Vector3 target = Vector3(100*x,100*y,100*z);
     
    158163       
    159164       
    160         this->entity_->lookAt(target);
    161         this->entity_->moveFrontBack(-1000*target.length());     
    162 
    163  
     165        //this->entity_->lookAt(target);
     166        //this->entity_->moveFrontBack(-1000*target.length());     
     167
     168        if(this->entity_!=NULL)
     169            orxout()<<"not-NULL-entity"<<endl;
     170
     171        if(this->player_!=NULL)
     172            orxout()<<"not-NULL-player"<<endl;
     173
     174        orxout() << this->player_->getClientID() << endl; // IMPOSSIBLE TO ACCESS this->player AND this->entity
     175       
     176        //this->entity_ = this->player_->getClientID();//getControllableEntity();
     177
     178            //if(this->entity_==this->player_->getControllableEntity())
     179            //orxout()<<"same entity"<<endl;
     180
    164181        /* This works fine */
    165182        orxout()<<x<<"  "<<y<<"  "<<z<<endl;
     
    168185    void ScriptController::eventScheduler(std::string instruction, float x, float y, float z, float executionTime)
    169186    {
     187
    170188
    171189        /*put data (from LUA) into time-sorted eventList*/
     
    178196        tmp.eventTime=executionTime;
    179197
    180         for(unsigned int i=0;i<eventList.size();i++)
     198        orxout()<<tmp.fctName<<endl;
     199
     200        if(eventList.size()==0)
    181201        {
    182             if(tmp.eventTime<eventList[i].eventTime)
     202            orxout()<<"eventList empty (01)"<<endl;
     203            eventList.insert(eventList.begin(), tmp);
     204            orxout()<<"first event added"<<endl;
     205        }
     206
     207
     208       for (std::vector<event>::iterator it=eventList.begin(); it<eventList.end(); it++)
    183209            {
    184                 std::vector<event>::iterator it = eventList.begin();
    185 
    186                 eventList.insert(it+(i+1),tmp);
    187                 break;
     210
     211                if(tmp.eventTime<it->eventTime)
     212                {
     213                    eventList.insert(it,tmp);
     214                    orxout()<<"new event added"<<endl;
     215                }
     216
    188217            }
    189             if(i==eventList.size()-1)
    190             {
    191                 std::vector<event>::iterator it = eventList.end();
    192 
    193                 eventList.insert(it,tmp);
    194 
    195             }
    196 
    197         }
    198        
     218
     219       
     220       if(eventList.size()==0)
     221            orxout()<<"eventList empty"<<endl;
     222
     223        else
     224            orxout()<<"eventList is not empty"<<endl;
     225
    199226       
    200227    }
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h

    r10048 r10059  
    6464            void setPlayer(PlayerInfo* player) { this->player_ = player; }
    6565           
     66           
     67
    6668            //void set_luasrc(std::string);
    6769            //void set_controlled(ControllableEntity*);
Note: See TracChangeset for help on using the changeset viewer.