Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10665 in orxonox.OLD for trunk/src/world_entities/effects


Ignore:
Timestamp:
May 31, 2007, 3:45:23 PM (17 years ago)
Author:
snellen
Message:

explosion is now scriptable

Location:
trunk/src/world_entities/effects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/effects/explosion.cc

    r10317 r10665  
    2525#include "particles/sprite_particles.h"
    2626
    27 
    28 
    29 
    3027ObjectListDefinition(Explosion);
    3128CREATE_FAST_FACTORY_STATIC(Explosion);
     29
     30#include "script_class.h"
     31CREATE_SCRIPTABLE_CLASS(Explosion,
     32                        // Coordinates
     33                            addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     34                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     35                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     36                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     37                            ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
     38                        //Explode !
     39                            ->addMethod("explode", Executor3<Explosion, lua_State*, float, float, float>(&Explosion::explode))
     40                       );
    3241
    3342/**
     
    6978  explosion->setAbsCoor(position->getAbsCoor());
    7079  explosion->emitter->setSize(size);
     80  explosion->activate();
     81}
     82
     83
     84void Explosion::explode(float x, float y, float z)
     85{
     86  Explosion* explosion = dynamic_cast<Explosion*>(Explosion::fastFactory->resurrect());
     87  explosion->setAbsCoor(this->getAbsCoor());
     88  explosion->emitter->setSize(Vector(x,y,z));
    7189  explosion->activate();
    7290}
  • trunk/src/world_entities/effects/explosion.h

    r9869 r10665  
    1818  public:
    1919    static void explode (PNode* position, const Vector& size);
    20 
     20    void explode (float x, float y, float z); /// Explode at the current position with size (x,y,z)
     21   
    2122    Explosion ();
    2223    virtual ~Explosion ();
Note: See TracChangeset for help on using the changeset viewer.