[Orxonox-commit 7382] r11999 - in code/branches/ScriptableController_FS18: data/levels data/levels/scripts data/levels/templates src/libraries/core src/orxonox src/orxonox/scriptablecontroller
adamc at orxonox.net
adamc at orxonox.net
Thu May 24 15:59:27 CEST 2018
Author: adamc
Date: 2018-05-24 15:59:22 +0200 (Thu, 24 May 2018)
New Revision: 11999
Modified:
code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
code/branches/ScriptableController_FS18/src/libraries/core/BaseObject.cc
code/branches/ScriptableController_FS18/src/orxonox/Level.h
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
Log:
Spawning pawn works now, BUT still incompatible with moving spawned pawn
Modified: code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw 2018-05-24 13:59:22 UTC (rev 11999)
@@ -1,6 +1,6 @@
<LevelInfo
- name = "AAAScriptableControllerTest"
- description = "Demonstrates moving and killing a drone by use of a script."
+ name = "Scriptable Controller Moving and Killing Pawn"
+ description = "Demonstrates moving and killing a drone by using a lua script."
tags = "test"
screenshot = "emptylevel.png"
/>
Modified: code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw 2018-05-24 13:59:22 UTC (rev 11999)
@@ -1,6 +1,6 @@
<LevelInfo
- name = "BBBScriptableControllerTest"
- description = "Demonstrates moving and killing a drone by use of a script."
+ name = "Scriptable Controller Spawning Pawn"
+ description = "Demonstrates spawning a drone by using a lua script."
tags = "test"
screenshot = "emptylevel.png"
/>
Modified: code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua 2018-05-24 13:59:22 UTC (rev 11999)
@@ -62,6 +62,7 @@
function spawn_dummy()
orxPrint("Spawning dummy!")
spawnTest("dummy")
+ move_dummy()
end
@@ -106,3 +107,4 @@
spawn_dummy_after_timeout(5)
+
Modified: code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt 2018-05-24 13:59:22 UTC (rev 11999)
@@ -1,7 +1,7 @@
<Template name=AAAAutonomousDroneTemplate>
<AAAAutonomousDrone>
<attached>
- <Model scale="10" position="0,0,0" mesh="drone.mesh"/>
+ <Model scale="10" mesh="drone.mesh"/>
</attached>
<collisionShapes>
<BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
Modified: code/branches/ScriptableController_FS18/src/libraries/core/BaseObject.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/libraries/core/BaseObject.cc 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/src/libraries/core/BaseObject.cc 2018-05-24 13:59:22 UTC (rev 11999)
@@ -76,7 +76,7 @@
if (this->creator_)
{
this->setFile(this->creator_->getFile());
-
+
// store strong-pointers on all four base objects by default (can be overwritten with weak-ptr after the constructor if necessary)
this->setNamespace(this->creator_->namespace_.createStrongPtr());
this->setScene (this->creator_->scene_ .createStrongPtr(), this->creator_->sceneID_);
Modified: code/branches/ScriptableController_FS18/src/orxonox/Level.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/Level.h 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/src/orxonox/Level.h 2018-05-24 13:59:22 UTC (rev 11999)
@@ -63,11 +63,12 @@
{ return this->level_script_; }
void addObject(BaseObject* object);
+ BaseObject* getObject(unsigned int index) const;
private:
void registerVariables();
//void addObject(BaseObject* object);
- BaseObject* getObject(unsigned int index) const;
+ //BaseObject* getObject(unsigned int index) const;
void addLodInfo(MeshLodInformation* object);
void networkCallbackTemplatesChanged();
Modified: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-05-24 13:57:37 UTC (rev 11998)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-05-24 13:59:22 UTC (rev 11999)
@@ -6,7 +6,11 @@
#include "worldentities/pawns/Pawn.h"
#include "infos/Bot.h"
#include "worldentities/pawns/ModularSpaceShip.h"
+//#include "../modules/objects/collisionshapes/SphereCollisionShape.h"
+#include "graphics/Model.h"
+#include "worldentities/pawns/AAAAutonomousDrone.h"
+
namespace orxonox
{
@@ -267,20 +271,20 @@
orxout(user_status) << "Pawn is indeed available!" << std::endl;
}
- //for (Level* level : ObjectList<Level>())
- // level->loadedNewXMLName(this);
+ ///////////////GOLD!!!!!!!!!!!!!!!////////////////////////
+ Pawn* pawn = this->controller_->getPawnByID(id);
+ //Attach to pawn
+ AAAAutonomousDrone* drone = new AAAAutonomousDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
+
+ drone->addTemplate("AAAAutonomousDroneTemplate"); //AAAAutonomousDroneTemplate spaceshipescort
+ Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
+ drone->setPosition(spawnPosition);
+ //drone->moveFrontBack(1.0);
- /////!!!!!!!!!!!!!!!
-
- this->controller_->level_->addObject(orxonox_cast<Pawn*>(entity));
-
-
-
-
orxout(user_status) << "Final hit!" << std::endl;
}
@@ -493,6 +497,7 @@
void ScriptableControllerAPI::moveControllableEntity(std::string id, double x, double y, double z)
{
MobileEntity *entity = this->controller_->getMobileEntityByID(id);
+
if(entity == nullptr)
{
orxout(user_warning) << "Trying to move an unknown object" << std::endl;
@@ -499,19 +504,20 @@
return;
}
-
Identifier *identifier = ClassByString("ControllableEntity");
ControllableEntity *controllable_entity;
-
if(identifier->isA(ClassIdentifier<ControllableEntity>::getIdentifier()))
{
+ orxout(user_info) << "Before final cast..."<< endl;
controllable_entity = orxonox_cast<ControllableEntity*>(entity);
+ orxout(user_info) << "After final cast..."<< endl;
//ATTACHED COLLISION SHAPE is MANDATORY in order to move the entity
controllable_entity->moveFrontBack(x);
controllable_entity->moveRightLeft(y);
controllable_entity->moveUpDown(z);
+ orxout(user_info) << "After move..."<< endl;
}
return;
More information about the Orxonox-commit
mailing list