Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10026 for code


Ignore:
Timestamp:
Apr 10, 2014, 3:18:32 PM (11 years ago)
Author:
mkronig
Message:

Added an initial test for lua execution. Not tested yet.

Location:
code/branches/ScriptableController
Files:
1 added
2 edited

Legend:

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

    r10024 r10026  
    7171    </StaticEntity>
    7272
    73 <!-- Docking  -->
    74     <Dock position="2830,20,50" roll=0 yaw=0 >
    75         <animations>
    76             <MoveToDockingTarget target="destroyer" />
    77         </animations>
    78         <effects>
    79             <DockToShip target="spaceShip" />
    80         </effects>
    81         <events>
    82             <execute>
    83                 <EventListener event="dockMe" />
    84             </execute>
    85 
    86             <undocking>
    87                 <EventListener event="undockMe" />
    88             </undocking>
    89        
    90             <activity>
    91                 <EventListener event=notGameEnd />
    92             </activity>
    93         </events>
    94         <attached>
    95         <!-- Trigger for docking with billboard -->
    96 
    97                 <!-- removed -->
    98 
    99         <!-- Trigger for undocking with billboard -->
    100             <!-- <Billboard position="-2630,-19970,150" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 /> -->
    101             <DistanceTrigger position="-2630,-19970,150" distance="50" target="Pawn"
    102                 beaconMode="identify" targetname="bcnDestroyer" name="undockMe"
    103             />
    104         </attached>
    105     </Dock>
    10673
    10774    <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
    10875    <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
    109       beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
     76      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
    11077    />
    11178
    11279
    113 <!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING -->
     80<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
    11481    <ControllerDirector position="0,0,0">
    11582        <events>
    11683            <party>
    117                 <EventListener event="dockMe" />
     84                <EventListener event="takeControl" />
    11885            </party>
    11986
  • code/branches/ScriptableController/src/orxonox/controllers/ControllerDirector.cc

    r10024 r10026  
    1111#include "interfaces/PlayerTrigger.h"
    1212#include "worldentities/pawns/Pawn.h"
     13#include "LuaState.h"
     14
    1315
    1416namespace orxonox
     
    2729    }
    2830
    29     bool ControllerDirector::party(bool bTriggered, BaseObject* trigger)
    30        {
    31            //XMLPortEventSink seems not to execute the party function
    32            orxout()<<"hello universe party"<< endl;
    33            return true;
    34        }
    35 
    3631
    3732    void ControllerDirector::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    4035
    4136       
    42         orxout()<<"hello universe xmlport"<< endl;
     37        orxout()<<"ControllerDriector::XMLPort An instance of ControllerDirector has been created."<< endl;
    4338    }
    4439
     
    4742        SUPER(ControllerDirector, XMLEventPort, xmlelement, mode);
    4843
    49         XMLPortEventSink(ControllerDirector, BaseObject, "party", party, xmlelement, mode);
     44        XMLPortEventSink(ControllerDirector, BaseObject, "takeControl", takeControl, xmlelement, mode);
    5045
    5146    }
     
    5348
    5449
    55    /* void ControllerDirector::tick(float dt)
    56     {
    57 
    58         //Get controllable entity which is attached to this controller in the XML file.
    59         ControllableEntity* entity = this->getControllableEntity();
    60         if (!entity)
    61             orxout()<<"No controllable entity found"<<endl;
    62             return;
    63 
    64        
    65 
    66         SUPER(ControllerDirector, tick, dt);
    67     }
    68 
    69     */
    7050
    7151    void ControllerDirector::takeControl(Controller * controller, BaseObject * trigger) {
     
    7353        preparationToTakeControl(trigger);
    7454        setNewController(controller);
    75 
     55        LuaState test = new Luastate();
     56        test.doFile("/tmp/myluahelloworld.lua");
     57       
    7658    }
    7759
     
    11395        this->setControllableEntity(this->entity_);
    11496
     97
     98
    11599    }
    116100       
     
    119103}
    120104
    121 /* Detaillierte Planung
    122 Director nimmt event auf und hängt dann einen controller (momentan als erstellt zu betrachten) an objekt, welches event ausgelöst hat.
    123105
    124106
    125107
    126         Klassenvariablen
    127 
    128                 ...? brauchts überhaupt?
    129 
    130         Variablen (in Funktionen auftretend):
    131 
    132                 Playerinfo * player             enthält infos über objekt, welches event ausgelöst hat.Relevant für Inputseite des Directors
    133 
    134         Funktion:
    135 
    136                 Auf Seite des Inputs des Directors:
    137 
    138                         preparationForControlTakeOver(...)      Vorbereitende Massnahmen um neuen Controller anzuhängen, z.B. player = pTrigger->getTriggeringPlayer();
    139                                                                 Orientierung an execute Funktion von Dock.cc
    140        
    141                 Auf Outputseite des Directors:
    142 
    143                         takeControl(...)                        Orientierung an DockingController.cc
    144 
    145                         tick()                                  Soll von Event ausgelöst werden, wenn z.B. Kamera an Endposition angelangt ist. Danach soll wieder ein
    146                                                                 menschlicher Spieler die Kontrolle übernehmen (wie? new human controller? Klasse noch angucken!).
    147 */
    148 
    149 
    150 
Note: See TracChangeset for help on using the changeset viewer.