Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 4, 2015, 11:51:01 AM (9 years ago)
Author:
landauf
Message:

merged r10499 from presentationFS15 into this branch

Location:
code/branches/SciptableControllerFS15
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/SciptableControllerFS15

  • code/branches/SciptableControllerFS15/data/gui/scripts/testscript.lua

    r10448 r10609  
    3939
    4040end
    41 
    42 -- Output the newctrlid variable we set from the C++ code
    43 if newctrlid ~= nil then
    44   orxonox.execute("orxout message test " .. newctrlid)
    45 end
    46 
    47 --orxonox.execute("setPause 1")
  • code/branches/SciptableControllerFS15/data/levels/scriptController.oxw

    r10262 r10609  
    11<!-- First levelFile of mkronig and samuezu. It was copied from dockingToASpaceStation.oxw and modified a little bit -->
    22<LevelInfo
    3  name = "Fancy orxout tests"
    4  description = "Docking into a spacestation."
     3 name = "Scriptable Controller"
     4 description = "Showcase for Scriptable Controller"
    55 tags = "showcase"
    66 screenshot = "emptylevel.png"
     
    1111  include("HUDTemplates3.oxo")
    1212  include("templates/lodInformation.oxt")
    13   include("templates/pickupRepresentationTemplates.oxt")
    1413?>
    1514
    1615<?lua
    17   include("templates/spaceshipAssff.oxt")
    18   include("templates/spaceshipPirate.oxt")
    1916  include("templates/spaceshipEscort.oxt")
    20   include("templates/bigship.oxt")
    21   include("templates/spaceshipTurret.oxt")
    22   include("templates/spaceshipCollateralDamage.oxt")
    23   include("templates/FPS.oxt")
    2417?>
    2518
     
    4033  >
    4134
    42     <?lua
    43       include("includes/pickups.oxi")
    44     ?>
     35    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
    4536
    46     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0,1.0,1.0,0.5" specular="1.0, 0.9, 0.9, 1.0"/>
    4737    <SpawnPoint team=0 position="3200,0,0" lookat="2800,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    4838
    49     <StaticEntity position  = "2800,0,0" mass=10000 collisionType=static >
     39    <Billboard position="2500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />
     40    <DistanceTrigger position="2500,0,0" distance="200" target="Pawn"
     41      beaconMode="exclude" targetname="bcnDestroyer" name="takeControl"
     42    />
     43
     44    <StaticEntity position  = "2000,500,2000" mass=10000 collisionType=static >
    5045      <attached>
    51         <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=50 />
     46        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=10 />
    5247      </attached>
    53       <collisionShapes>
    54         <BoxCollisionShape  position="-560,0,0" halfExtents="115,100,245" /><!-- Three lower boxes -->
    55         <BoxCollisionShape  position="290,0,-480" halfExtents="115,100,245" yaw=-120 />
    56         <BoxCollisionShape  position="290,0,480" halfExtents="115,100,245" yaw=-240 />
    57         <BoxCollisionShape  position="-280,0,0" halfExtents="163,50,50" /><!-- Three lower connections -->
    58         <BoxCollisionShape  position="140,0,-240" halfExtents="163,50,50" yaw=-120 />
    59         <BoxCollisionShape  position="140,0,240" halfExtents="163,50,50" yaw=-240 />
    60         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" /><!-- Upper Tower -->
    61         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-120 />
    62         <BoxCollisionShape  position="0,530,0" halfExtents="172,52,298" yaw=-240 />
    63         <BoxCollisionShape  position="0,400,0" halfExtents="43,110,26" yaw=-30 /><!-- Middle one-->
    64         <BoxCollisionShape  position="-200,100,0" halfExtents="26,50,43" /><!--Three lower legs -->
    65         <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=-30 />
    66         <BoxCollisionShape  position="100,100,-173" halfExtents="43,50,26" yaw=30 />
    67         <BoxCollisionShape  position="-100,264,0" halfExtents="26,105,43" roll=-49 /><!--Three upper legs -->
    68         <BoxCollisionShape  position="50,264,-87" halfExtents="26,105,43" roll=-49 yaw=-120 />
    69         <BoxCollisionShape  position="50,264,87" halfExtents="26,105,43" roll=-49 yaw=-240 />
    70       </collisionShapes>
    7148    </StaticEntity>
    7249
    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>
     50    <StaticEntity position  = "-1000,3000,-1000" mass=10000 collisionType=static >
     51      <attached>
     52        <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=80 />
     53      </attached>
     54    </StaticEntity>
     55
     56<!-- ControllerDirector waits for the event takeControl to attach a new Controller -->
     57    <ControllerDirector position="0,0,0" scriptname="presentation">
    8158        <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>
     59            <takeControl>
     60                <EventListener event="takeControl" />
     61            </takeControl>
    9362        </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>
    106 
    107     <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=100 />
    108     <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
    109       beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
    110     />
    111 
    112 
    113 <!-- Object, which orxouts the message "hello Universe!". EVENT NOT WORKING  -->
    114     <ScriptController position="0,0,0">
    115         <events>
    116             <party>
    117                 <EventListener event="dockMe" />
    118             </party>
    119 
    120         </events>
    121 
    122     </ScriptController>
    123 
    124 
    125 <!-- FPS Player as destination of the dock -->
    126 <FpsPlayer template = "fps" radarname = "First Person Player" position = "0,-19900,0" >
    127       <attached>
    128         <DockingTarget name="spaceShip" />
    129         <DistanceTriggerBeacon name="bcnDestroyer" />
    130         <DockingTarget name="destroyer" />
    131       </attached>
    132 </FpsPlayer>
    133 
    134 
    135 <!-- Cube as test SpaceStation
    136 
    137 The station can either be hidden outside of the skybox, within the hull of the space station if it is big enough or within a planet.
    138 Complex spacestations can be placed very far away from the spaceship so it is rendered at low resolution while the player uses the space ship.
    139 
    140 -->
    141   <StaticEntity position="0,-20000,0" direction="0,-1,0" collisionType=static mass=100000 friction=0.01 >
    142       <attached>
    143         <Model position="0,0,0" mesh="crate.mesh" scale3D="80,80,5" />
    144       </attached>
    145       <collisionShapes>
    146         <BoxCollisionShape position="0,0,0" halfExtents="400,400,25" />
    147       </collisionShapes>
    148   </StaticEntity>
    149 
    150 <!-- Homogenous gravitationfield to simulate local gravity (activating the normal gravity will affect the spaceship terribly) -->
    151 <ForceField position="0,-20000,0" mode="homogen" diameter="2000" forcedirection = "0,-500,0" />
    152 
    153 
    154 <!-- Some more stuff -->
    155 
    156     <!-- triple large belt around the planet  -->
    157     <?lua
    158         dofile("includes/asteroidField.lua")
    159         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1)
    160     ?>
    161     <?lua
    162         dofile("includes/asteroidField.lua")
    163         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1)
    164     ?>
    165     <?lua
    166         dofile("includes/asteroidField.lua")
    167         asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1)
    168     ?>
    169 
    170     <Planet
    171       position="15000,0,-1000"
    172       scale="5000"
    173       collisionType="dynamic"
    174       linearDamping="0.8"
    175       angularDamping="0"
    176       mass="10000000"
    177       pitch="0"
    178       mesh="planets/ganymede.mesh"
    179       atmosphere="atmosphere1"
    180       rotationaxis="1,0,0"
    181       rotationrate="1.0"
    182       atmospheresize="80.0f"
    183       imagesize="1024.0f"
    184       collisiondamage = 2
    185       enablecollisiondamage = true
    186     >
    187       <attached>
    188         <ForceField position="5000,0,0" mode="sphere" diameter="10000" velocity="-50" />
    189       </attached>
    190       <collisionShapes>
    191         <SphereCollisionShape radius="5000" position="0,0,0" />
    192       </collisionShapes>
    193     </Planet>
     63    </ControllerDirector>
    19464
    19565  </Scene>
    196 
    19766</Level>
    19867
  • code/branches/SciptableControllerFS15/src/orxonox/controllers/ControllerDirector.cc

    r10262 r10609  
    4141    {
    4242        SUPER(ControllerDirector, XMLPort, xmlelement, mode);
     43        XMLPortParam(ControllerDirector, "scriptname", setScriptName, getScriptName, xmlelement, mode).defaultValues("testscript");
    4344
    4445        orxout(verbose)<< "ControllerDirector::XMLPort "
     
    8384       else
    8485         return;
    85        
     86
    8687       /* Set up a luastate to use for running the scripts */
    8788       LuaState * ls = new LuaState();
     
    9899        * variable "newctrlid" defined, which means it can make use of it.
    99100        */
    100 
    101        ls->doFile("testscript.lua");
     101       std::string scr = this->scriptname_ + ".lua";
     102       ls->doFile(scr);
    102103
    103104       /* Increase the controller ID so we have a different one for
  • code/branches/SciptableControllerFS15/src/orxonox/controllers/ControllerDirector.h

    r10262 r10609  
    4747            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    4848
     49            inline void setScriptName(const std::string& name) { this->scriptname_ = name; }
     50            inline const std::string& getScriptName() const { return this->scriptname_; }
     51
    4952
    5053            /* Take over control of a given object */
     
    5558            //void setNewController(Controller * controller);
    5659
    57         private:
     60        protected:
     61            std::string scriptname_;   
    5862            PlayerInfo* player_;
    5963            ControllableEntity* entity_;
Note: See TracChangeset for help on using the changeset viewer.