Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2018, 4:42:43 PM (7 years ago)
Author:
adamc
Message:

first final draft

Location:
code/branches/ScriptableController_FS18
Files:
3 edited
7 moved

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw

    r11999 r12006  
    11<LevelInfo
    2  name = "Scriptable Controller Spawning Pawn"
    3  description = "Demonstrates spawning a drone by using a lua script."
     2 name = "Scriptable Controller Moving and Killing Pawn"
     3 description = "Demonstrates moving and killing a drone by using a lua script."
    44 tags = "test"
    55 screenshot = "emptylevel.png"
     
    1818?>
    1919
    20 <Level script="scripts/BBBScriptableControllerTest.lua">
     20<Level script="scripts/ScriptableControllerMoveKill.lua">
    2121  <templates>
    2222    <Template link=lodtemplate_default />
     
    3333
    3434
    35   <AAAAutonomousDrone id="dummy" position="0,0,0">
     35  <ScriptableControllerDrone id="dummy" position="0,0,0">
    3636    <attached>
    3737      <Model scale="10" mesh="drone.mesh"/>
     
    4040      <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
    4141    </collisionShapes>
    42   </AAAAutonomousDrone>
     42  </ScriptableControllerDrone>
    4343   
    4444 
  • code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw

    r11999 r12006  
    11<LevelInfo
    2  name = "Scriptable Controller Moving and Killing Pawn"
    3  description = "Demonstrates moving and killing a drone by using a lua script."
     2 name = "Scriptable Controller Spawning Pawn"
     3 description = "Demonstrates spawning a drone by using a lua script."
    44 tags = "test"
    55 screenshot = "emptylevel.png"
     
    1616  include("templates/spaceshipEscort.oxt")
    1717  include("templates/endurancetest_template.oxt")
    18   include("templates/AAAAutonomousDroneTemplate.oxt")
     18  include("templates/ScriptableControllerDroneTemplate.oxt")
    1919?>
    2020
    21 <Level script="scripts/AAAScriptableControllerTest.lua">
     21<Level script="scripts/ScriptableControllerSpawn.lua">
    2222  <templates>
    2323    <Template link=lodtemplate_default />
     
    3232    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    3333    <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
    34     <!-- <SpawnPoint team=2 position="0,0,0" lookat="0,0,0" spawnclass=AAAAutonomousDrone pawndesign=AAAAutonomousDroneTemplate />  -->
    3534   
    3635
  • code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt

    r11999 r12006  
    1 <Template name=AAAAutonomousDroneTemplate>
    2   <AAAAutonomousDrone>
     1<Template name=ScriptableControllerDroneTemplate>
     2  <ScriptableControllerDrone>
    33    <attached>
    44      <Model scale="10" mesh="drone.mesh"/>
     
    77      <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
    88    </collisionShapes>
    9   </AAAAutonomousDrone>
     9  </ScriptableControllerDrone>
    1010</Template>
  • code/branches/ScriptableController_FS18/src/orxonox/Level.cc

    r11974 r12006  
    5858        this->xmlfile_ = nullptr;
    5959        this->controller_.reset(new ScriptableController());
    60         this->controller_->level_ = this;
    6160    }
    6261
  • code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc

    r11999 r12006  
    99//#include "../modules/objects/collisionshapes/SphereCollisionShape.h"
    1010#include "graphics/Model.h"
    11 #include "worldentities/pawns/AAAAutonomousDrone.h"
     11#include "worldentities/pawns/ScriptableControllerDrone.h"
    1212
    1313
     
    210210       
    211211
    212         Identifier *identifier = ClassByString("AAAAutonomousDrone");
     212        Identifier *identifier = ClassByString("ScriptableControllerDrone");
    213213       
    214214       
     
    277277        Pawn* pawn = this->controller_->getPawnByID(id);
    278278        //Attach to pawn
    279         AAAAutonomousDrone* drone = new AAAAutonomousDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
    280        
    281         drone->addTemplate("AAAAutonomousDroneTemplate"); //AAAAutonomousDroneTemplate spaceshipescort
     279        ScriptableControllerDrone* drone = new ScriptableControllerDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
     280       
     281        drone->addTemplate("ScriptableControllerDroneTemplate"); //ScriptableControllerDroneTemplate spaceshipescort
    282282
    283283        Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
  • code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt

    r11906 r12006  
    44  Pawn.cc
    55  SpaceShip.cc
    6   AAAAutonomousDrone.cc
     6  ScriptableControllerDrone.cc
    77  ModularSpaceShip.cc
    88  TeamBaseMatchBase.cc
  • code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc

    r11961 r12006  
    2727 */
    2828
    29 #include "AAAAutonomousDrone.h"
     29#include "ScriptableControllerDrone.h"
    3030
    3131#include "core/CoreIncludes.h"
     
    4444    */
    4545
    46     RegisterClass(AAAAutonomousDrone);
     46    RegisterClass(ScriptableControllerDrone);
    4747   
    48     AAAAutonomousDrone::AAAAutonomousDrone(Context* context) : Pawn(context)
     48    ScriptableControllerDrone::ScriptableControllerDrone(Context* context) : Pawn(context)
    4949    {
    5050        //TODO: Put your code in here:
    5151        // Register the drone class to the core.
    5252
    53         RegisterObject(AAAAutonomousDrone);
     53        RegisterObject(ScriptableControllerDrone);
    5454     
    5555        //this->myController_ = NULL;
     
    7070        //this->setCollisionType(CollisionType::Dynamic);
    7171
    72         //this->myController_ = new AAAAutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
     72        //this->myController_ = new ScriptableControllerDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
    7373    }
    7474
     
    7777        Destructor. Destroys controller, if present.
    7878    */
    79     AAAAutonomousDrone::~AAAAutonomousDrone()
     79    ScriptableControllerDrone::~ScriptableControllerDrone()
    8080    {
    8181        // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
     
    8686    /**
    8787    @brief
    88         Method for creating a AAAAutonomousDrone through XML.
    89     */
    90     void AAAAutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     88        Method for creating a ScriptableControllerDrone through XML.
     89    */
     90    void ScriptableControllerDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    9191    {
    9292        // This calls the XMLPort function of the parent class
    93         SUPER(AAAAutonomousDrone, XMLPort, xmlelement, mode);
    94 
    95         XMLPortParam(AAAAutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
     93        SUPER(ScriptableControllerDrone, XMLPort, xmlelement, mode);
     94
     95        XMLPortParam(ScriptableControllerDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
    9696        //TODO: Put your code in here:
    9797        // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
    9898        // Variables can be added by the following command
    9999        // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
    100         // Also make sure that you also create the get- and set-functions in AAAAutonomousDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
    101         XMLPortParam(AAAAutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
    102     XMLPortParam(AAAAutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
    103         XMLPortParam(AAAAutonomousDrone, "mass", setMass, getMass, xmlelement, mode);
    104         XMLPortParam(AAAAutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
    105         XMLPortParam(AAAAutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
     100        // Also make sure that you also create the get- and set-functions in ScriptableControllerDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
     101        XMLPortParam(ScriptableControllerDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
     102    XMLPortParam(ScriptableControllerDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
     103        XMLPortParam(ScriptableControllerDrone, "mass", setMass, getMass, xmlelement, mode);
     104        XMLPortParam(ScriptableControllerDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
     105        XMLPortParam(ScriptableControllerDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
    106106
    107107   
     
    113113    /**
    114114    @brief
    115         Defines which actions the AAAAutonomousDrone has to take in each tick.
     115        Defines which actions the ScriptableControllerDrone has to take in each tick.
    116116    @param dt
    117117        The length of the tick.
    118118    */
    119     void AAAAutonomousDrone::tick(float dt)
    120     {
    121         SUPER(AAAAutonomousDrone, tick, dt);
     119    void ScriptableControllerDrone::tick(float dt)
     120    {
     121        SUPER(ScriptableControllerDrone, tick, dt);
    122122
    123123
     
    141141    /**
    142142    @brief
    143         Moves the AAAAutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
     143        Moves the ScriptableControllerDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
    144144    @param value
    145145        The vector determining the amount of the movement.
    146146    */
    147     void AAAAutonomousDrone::moveFrontBack(const Vector2& value)
     147    void ScriptableControllerDrone::moveFrontBack(const Vector2& value)
    148148    {
    149149        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
     
    152152    /**
    153153    @brief
    154         Moves the AAAAutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
     154        Moves the ScriptableControllerDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
    155155    @param value
    156156        The vector determining the amount of the movement.
    157157    */
    158     void AAAAutonomousDrone::moveRightLeft(const Vector2& value)
     158    void ScriptableControllerDrone::moveRightLeft(const Vector2& value)
    159159    {
    160160        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
     
    163163    /**
    164164    @brief
    165         Moves the AAAAutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
     165        Moves the ScriptableControllerDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
    166166    @param value
    167167        The vector determining the amount of the movement.
    168168    */
    169     void AAAAutonomousDrone::moveUpDown(const Vector2& value)
     169    void ScriptableControllerDrone::moveUpDown(const Vector2& value)
    170170    {
    171171        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
     
    174174    /**
    175175    @brief
    176         Rotates the AAAAutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
     176        Rotates the ScriptableControllerDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
    177177    @param value
    178178        The vector determining the amount of the angular movement.
    179179    */
    180     void AAAAutonomousDrone::rotateYaw(const Vector2& value)
     180    void ScriptableControllerDrone::rotateYaw(const Vector2& value)
    181181    {
    182182        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
     
    185185    /**
    186186    @brief
    187         Rotates the AAAAutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
     187        Rotates the ScriptableControllerDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
    188188    @param value
    189189        The vector determining the amount of the angular movement.
    190190    */
    191     void AAAAutonomousDrone::rotatePitch(const Vector2& value)
     191    void ScriptableControllerDrone::rotatePitch(const Vector2& value)
    192192    {
    193193        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
     
    196196    /**
    197197    @brief
    198         Rotates the AAAAutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
     198        Rotates the ScriptableControllerDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
    199199    @param value
    200200        The vector determining the amount of the angular movement.
    201201    */
    202     void AAAAutonomousDrone::rotateRoll(const Vector2& value)
     202    void ScriptableControllerDrone::rotateRoll(const Vector2& value)
    203203    {
    204204        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
  • code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h

    r11961 r12006  
    2727 */
    2828
    29 #ifndef _AAAAutonomousDrone_H__
    30 #define _AAAAutonomousDrone_H__
     29#ifndef _ScriptableControllerDrone_H__
     30#define _ScriptableControllerDrone_H__
    3131
    3232#include "OrxonoxPrereqs.h"
     
    4646        Oli Scheuss
    4747    */
    48     class _OrxonoxExport AAAAutonomousDrone : public Pawn
     48    class _OrxonoxExport ScriptableControllerDrone : public Pawn
    4949    {
    5050        public:
    51             AAAAutonomousDrone(Context* context);
    52             virtual ~AAAAutonomousDrone();
     51            ScriptableControllerDrone(Context* context);
     52            virtual ~ScriptableControllerDrone();
    5353
    5454            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
Note: See TracChangeset for help on using the changeset viewer.