Index: /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.cc
===================================================================
--- /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.cc	(revision 10606)
+++ /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.cc	(revision 10607)
@@ -22,23 +22,23 @@
 ObjectListDefinition(ScriptTrigger);
 
-CREATE_SCRIPTABLE_CLASS(ScriptTrigger,
-            // Coordinates
-			addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
-			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
-			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
-			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
-            //Properties
-			    ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
-			    ->addMethod("setTarget", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTarget))
-			    ->addMethod("setTriggerParent", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTriggerParent))
-			    ->addMethod("setTriggerRemains", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setTriggerRemains))
-			    ->addMethod("setActiveOnCreation", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setActiveOnCreation))
-			    ->addMethod("setInvert", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setInvert))
-			    ->addMethod("setRadius", Executor1<ScriptTrigger, lua_State*, float>(&ScriptTrigger::setRadius))
-			    ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript))
-			    ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction))
-			    ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw))
-			    ->addMethod("setAddToScript", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setAddToScript))
-             );
+// CREATE_SCRIPTABLE_CLASS(ScriptTrigger,
+//             // Coordinates
+// 			addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+// 			    ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+// 			    ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+// 			    ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+//             //Properties
+// 			    ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
+// 			    ->addMethod("setTarget", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTarget))
+// 			    ->addMethod("setTriggerParent", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTriggerParent))
+// 			    ->addMethod("setTriggerRemains", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setTriggerRemains))
+// 			    ->addMethod("setActiveOnCreation", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setActiveOnCreation))
+// 			    ->addMethod("setInvert", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setInvert))
+// 			    ->addMethod("setRadius", Executor1<ScriptTrigger, lua_State*, float>(&ScriptTrigger::setRadius))
+// 			    ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript))
+// 			    ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction))
+// 			    ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw))
+// 			    ->addMethod("setAddToScript", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setAddToScript))
+//              );
 
 
@@ -53,16 +53,14 @@
   this->toList(OM_COMMON);
 
-  radius = 10;
   returnCount = 1;
   scriptFinished = false;
   doDebugDraw = false;
-  invert = false;
+
   scriptCalled = false;
   scriptIsOk = false;
   executionStopped = false; // true when something goes wrong and the trigger has to be stopped
-  triggerRemains = true;
   addToScript = false;
   this->activeOnCreation = false;
-  target = NULL;
+
 
   if(root != NULL)
@@ -108,22 +106,10 @@
       .describe("where this script trigger should be located")
       .defaultValues("");
-  LoadParam(root, "radius", this, ScriptTrigger, setRadius)
-      .describe("the fileName of the script, that should be triggered by this script trigger")
-      .defaultValues(0);
   LoadParam(root, "delay", this, ScriptTrigger, setDelay)
       .describe("the delay after which the funtion sould be triggered")
       .defaultValues(0);
-  LoadParam(root, "worldentity", this, ScriptTrigger, setTarget)
-      .describe("The name of the target as it is in the *.oxw file")
-      .defaultValues("");
   LoadParam(root, "triggerparent", this, ScriptTrigger, setTriggerParent)
       .describe("The name of the parent as it is in the *.oxw file")
       .defaultValues("");
-  LoadParam(root, "invert", this, ScriptTrigger, setInvert)
-      .describe("")
-      .defaultValues(false);
-  LoadParam(root, "triggerRemains", this, ScriptTrigger, setTriggerRemains)
-      .describe("")
-      .defaultValues(true);
   LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
       .describe("")
@@ -136,24 +122,6 @@
 
 /**
- * Sets the target(a world entity) of the ScriptTrigger. If the distance between the target and this trigger is smaller than the radius, the script gets triggered.
- * @param target The worldentity that the script supervises.
- */
-void ScriptTrigger::setTarget(const std::string& target)
-{
-
-  WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
-  if (targetEntity != NULL)
-  {
-    this->setTarget(targetEntity);
-  }
-  else
-  {
-    PRINTF(2)("ERROR SCRTIPTTRIGGER : Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassCName(), this->getCName());
-  }
-}
-
-/**
  * Sets the parent of the trigger.
- * @param parent The parrent.
+ * @param parent The parent.
  */
 void ScriptTrigger::setTriggerParent(const std::string& parent)
@@ -174,35 +142,5 @@
 void ScriptTrigger::tick(float timestep)
 {
-  if(scriptFinished) return;
-
-  if(activeOnCreation)
-   {
-     executeAction(timestep);
-     return;
-   }
-
- if(triggerRemains && scriptCalled)
-  {
-    executeAction(timestep);
-    return;
-  }
-
-  if( this->target != NULL)
-  {
-    if( !invert && this->distance(target) < radius)
-    {
-    //printf("Distance is %f \n", this->distance(target));
-    executeAction(timestep);
-    scriptCalled = true;
-    return;
-
-    }
-    else if( invert && this->distance(target) > radius)
-    {
-      executeAction(timestep);
-      scriptCalled = true;
-      return;
-    }
-  }
+
 }
 
Index: /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h
===================================================================
--- /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h	(revision 10606)
+++ /branches/scriptimprovements/src/world_entities/script_triggers/script_trigger.h	(revision 10607)
@@ -33,16 +33,12 @@
 
     /// SET MEMBER
-    void setTarget(const std::string& targetName);
-    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
-    void setTriggerParent(const std::string& name);
-    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
+ 
     void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
-    void setInvert(const bool inv) { this->invert = invert; }
     void setDelay(float delay) { this->delay = delay; };
-    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
     void setScript(const std::string& file);
     void setFunction(const std::string& function){ this->functionName = function;}
     void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
     void setAddToScript(const bool add) { this->addToScript = add; }
+    void setTriggerParent(const std::string& name);
 
     ///DRAWING
@@ -51,9 +47,5 @@
   private:
 
-    WorldEntity* target;
-    bool         triggerRemains;
     bool         activeOnCreation;
-    bool         invert;
-    float        radius;
     float        delay;
     Script*      script;
@@ -61,4 +53,5 @@
     bool         doDebugDraw;
     bool         addToScript;
+    
     //for internal use
     bool         scriptCalled;
Index: /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.cc
===================================================================
--- /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.cc	(revision 10607)
+++ /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.cc	(revision 10607)
@@ -0,0 +1,122 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Silvan Nellen
+   co-programmer: ...
+*/
+
+
+#include "space_trigger.h"
+#include "debug.h"
+
+ObjectListDefinition(SpaceTrigger);
+
+// CREATE_SCRIPTABLE_CLASS(SpaceTrigger,
+//             // Coordinates
+//                         addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
+//                             ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
+//                             ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
+//                             ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
+//             //Properties
+//                             ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
+//                             ->addMethod("setTarget", Executor1<SpaceTrigger, lua_State*, const std::string&>(&SpaceTrigger::setTarget))
+//                             ->addMethod("setTriggerParent", Executor1<SpaceTrigger, lua_State*, const std::string&>(&SpaceTrigger::setTriggerParent))
+//                             ->addMethod("setTriggerRemains", Executor1<SpaceTrigger, lua_State*, bool>(&SpaceTrigger::setTriggerRemains))
+//                             ->addMethod("setActiveOnCreation", Executor1<SpaceTrigger, lua_State*, bool>(&SpaceTrigger::setActiveOnCreation))
+//                             ->addMethod("setInvert", Executor1<SpaceTrigger, lua_State*, bool>(&SpaceTrigger::setInvert))
+//                             ->addMethod("setRadius", Executor1<SpaceTrigger, lua_State*, float>(&SpaceTrigger::setRadius))
+//                             ->addMethod("setScript", Executor1<SpaceTrigger, lua_State*, const std::string&>(&SpaceTrigger::setScript))
+//                             ->addMethod("setFunction", Executor1<SpaceTrigger, lua_State*, const std::string&>(&SpaceTrigger::setFunction))
+//                             ->addMethod("setDebugDraw", Executor1<SpaceTrigger, lua_State*, bool>(&SpaceTrigger::setDebugDraw))
+//                             ->addMethod("setAddToScript", Executor1<SpaceTrigger, lua_State*, bool>(&SpaceTrigger::setAddToScript))
+//                        );
+
+
+/**
+ * Constructs a new SpaceTrigger.
+ * @param root the xml element to load the parameters from.
+ *
+ */
+SpaceTrigger::SpaceTrigger(const TiXmlElement* root)
+{
+  this->registerObject(this, SpaceTrigger::_objectList);
+  this->toList(OM_COMMON);
+
+  radius = 10;
+  invert = false;
+  triggerRemains = true;
+ 
+
+
+}
+
+/**
+ * Deletes the SpaceTrigger.
+ *
+ */
+SpaceTrigger::~SpaceTrigger()
+{
+
+}
+
+/**
+ * Reads the values from the tml element and sets them.
+ * @param root the xml element to load the parameters from.
+ *
+ */
+void SpaceTrigger::loadParams(const TiXmlElement* root)
+{
+
+  ScriptTrigger ::loadParams(root);
+
+ 
+  LoadParam(root, "radius", this, SpaceTrigger, setRadius)
+      .describe("the fileName of the script, that should be triggered by this script trigger")
+      .defaultValues(0);
+  LoadParam(root, "worldentity", this, SpaceTrigger, setTarget)
+      .describe("The name of the target as it is in the *.oxw file")
+      .defaultValues("");
+  LoadParam(root, "invert", this, SpaceTrigger, setInvert)
+      .describe("")
+      .defaultValues(false);
+  LoadParam(root, "triggerRemains", this, SpaceTrigger, setTriggerRemains)
+      .describe("")
+      .defaultValues(true);
+ 
+}
+
+
+/**
+ * Sets the target(a world entity) of the SpaceTrigger. If the distance between the target and this trigger is smaller than the radius, the script gets triggered.
+ * @param target The worldentity that the script supervises.
+ */
+void SpaceTrigger::setTarget(const std::string& target)
+{
+
+  WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
+  if (targetEntity != NULL)
+  {
+    this->setTarget(targetEntity);
+  }
+  else
+  {
+    PRINTF(2)("ERROR SCRTIPTTRIGGER : Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassCName(), this->getCName());
+  }
+}
+
+
+void SpaceTrigger::tick(float timestep)
+{
+
+}
+
+
+
Index: /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.h
===================================================================
--- /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.h	(revision 10607)
+++ /branches/scriptimprovements/src/world_entities/script_triggers/space_trigger.h	(revision 10607)
@@ -0,0 +1,50 @@
+/*!
+ * @file space_trigger.h
+ *  triggeres a script when a world_entity is in range
+ */
+
+#ifndef _SPACE_TRIGGER_H
+#define _SPACE_TRIGGER_H
+
+#include <string>
+
+#include "script.h"
+#include "script_class.h"
+#include "script_trigger.h"
+
+class SpaceTrigger : public ScriptTrigger
+{
+  ObjectListDeclaration(SpaceTrigger);
+  
+  public:
+    SpaceTrigger(const TiXmlElement* root = NULL);
+    ~SpaceTrigger();
+    
+    ///LOADING
+    virtual void loadParams(const TiXmlElement* root);
+
+
+    /// DO WORK
+    virtual void tick(float timestep);
+
+
+    /// SET MEMBER
+    void setTarget(const std::string& targetName);
+    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
+    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
+    void setInvert(const bool inv) { this->invert = invert; }
+    void setRadius(const float radius) { if(radius>0) this->radius = radius; }
+
+
+  private:
+
+    WorldEntity* target;
+    bool         triggerRemains;
+    bool         invert;
+    float        radius;
+
+
+};
+
+
+#endif
