Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9298 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jul 17, 2006, 9:29:22 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the branche scripting back here.

merged with command:
svn merge -r9239:HEAD https://svn.orxonox.net/orxonox/branches/scripting .
no conflicts

Location:
trunk/src/world_entities
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/gate.cc

    r9235 r9298  
    1313   ### File Specific
    1414   main-programmer: Patrick Boenzli
    15    co-programmer:
     15   co-programmer: Silvan Nellen
    1616*/
    1717#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     
    4141                            addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    4242                            ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    43                            // ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy()))   
     43                            ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))   
    4444                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    4545                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     
    6666  this->scale = 1.0f;
    6767  this->actionRadius = 1.0;
     68  this->destroyed = false;
    6869
    6970  if( root != NULL)
     
    151152void Gate::open()
    152153{
    153   if( this->bLocked)
     154  if( this->bLocked || this->destroyed)
    154155    return;
    155156
     
    164165void Gate::close()
    165166{
     167 
     168  if( this->destroyed)
     169    return;
     170 
    166171  this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE);
    167172  this->bOpen = false;
     
    171176void Gate::destroy()
    172177{
     178  if( this->destroyed)
     179    return;
     180 
    173181  this->setAnimation(GATE_DIE, MD2_ANIM_ONCE);
    174182
    175   Explosion::explode(this, Vector(10,10,10));
     183  Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160));
     184 
     185 
     186  this->destroyed = true;
    176187}
    177188
  • trunk/src/world_entities/npcs/gate.h

    r9235 r9298  
    5050
    5151  private:
     52    bool           destroyed;         //!< true if the door is destroyed
    5253    bool           bOpen;             //!< true if the door is open
    5354    bool           bLocked;           //!< true if this door is locked
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r9235 r9298  
    4343  this->lifeSpan = 4.0;
    4444  this->agility = 3.5;
    45   this->maxVelocity = 75;
     45  this->maxVelocity = 100;
    4646
    4747  this->emitter = new DotEmitter(100, 5, M_2_PI);
  • trunk/src/world_entities/script_trigger.cc

    r9235 r9298  
    3232             ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))
    3333             ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))
    34              ->addMethod("setTriggerLasts", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerLasts))
     34             ->addMethod("setTriggerRemains", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerRemains))
     35             ->addMethod("setActiveOnCreation", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setActiveOnCreation))
    3536             ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setInvert))
    3637             ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float>(&ScriptTrigger::setRadius))
     
    4849 */
    4950ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
    50 {
     51{ PRINT(1)("testerror\n");
    5152  this->setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");
    5253  this->toList(OM_COMMON);
     
    5960  scriptCalled = false;
    6061  scriptIsOk = false;
    61   triggerLasts = true;
     62  triggerRemains = true;
    6263  addToScript = false;
     64  this->activeOnCreation = false;
    6365 
    6466  if(root != NULL)
     
    119121      .describe("")
    120122      .defaultValues(false);
    121   LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
     123  LoadParam(root, "triggerRemains", this, ScriptTrigger, setTriggerRemains)
    122124      .describe("")
    123125      .defaultValues(true);
     
    172174  if(scriptFinished) return;
    173175
    174   if(triggerLasts && scriptCalled)
     176  if(activeOnCreation)
     177   {
     178     executeAction(timestep);
     179     return;
     180   }
     181   
     182  if(triggerRemains && scriptCalled)
    175183  {
    176184    executeAction(timestep);
     
    182190    executeAction(timestep);
    183191    scriptCalled = true;
     192    return;
    184193 
    185194  }
     
    188197    executeAction(timestep);
    189198    scriptCalled = true;
     199    return;
    190200  }
    191201 //else
     
    202212       //testScriptingFramework();
    203213    if(!(script->selectFunction(this->functionName,returnCount)) )
    204       printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
     214      PRINT(1)("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
    205215     
    206216    script->pushParam( timestep, this->functionName);
    207217     
    208218    if( !(script->executeFunction()) )
    209       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
     219      PRINT(1)("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
    210220     
    211221    scriptFinished = script->getReturnedBool();
  • trunk/src/world_entities/script_trigger.h

    r9006 r9298  
    3535    void setTarget(WorldEntity* target) { if(target!=NULL) this->target=target; }
    3636    void setTriggerParent(const std::string& name);
    37     void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
     37    void setTriggerRemains(const bool lasts) { this->triggerRemains = lasts; }
     38    void setActiveOnCreation(const bool avtive) { this->activeOnCreation = avtive; }
    3839    void setInvert(const bool inv) { this->invert = invert; }
    3940    void setDelay(float delay) { this->delay = delay; };
     
    5051
    5152    WorldEntity* target;
    52     bool         triggerLasts;
     53    bool         triggerRemains;
     54    bool         activeOnCreation;
    5355    bool         invert;
    5456    float        radius;
  • trunk/src/world_entities/space_ships/spacecraft_2d.cc

    r9235 r9298  
    498498    this->bForward = event.bPressed; //this->shiftCoor(0,.1,0);
    499499  else if( event.type == KeyMapper::PEV_BACKWARD)
    500     this->bBackward = event.bPressed; //this->shiftCoor(0,-.1,0);
     500  {this->bBackward = event.bPressed; printf(" %f, %f, %f \n",getAbsCoorX(),getAbsCoorY(),getAbsCoorZ());} //this->shiftCoor(0,-.1,0);
    501501  else if( event.type == EV_MOUSE_MOTION)
    502502  {
  • trunk/src/world_entities/weapons/aiming_system.cc

    r9235 r9298  
    115115  if( this->owner != killer)
    116116  {
    117     PRINTF(0)("real hit: %s\n", killer->getClassName());
     117    //PRINTF(0)("real hit: %s\n", killer->getClassName());
    118118    this->selectionList.push_back(killer);
    119119  }
  • trunk/src/world_entities/world_entity.h

    r9235 r9298  
    129129
    130130  /* --- Character Attribute Block --- */
     131  /** @returns the scaling of the model */
     132  float getScaling(){return this->scaling;}
    131133  /** @returns the damage dealt by this world entity */
    132134  float getDamage() const { return this->damage; }
Note: See TracChangeset for help on using the changeset viewer.