Changeset 9746 in orxonox.OLD for branches/new_class_id/src/world_entities/npcs
- Timestamp:
- Sep 16, 2006, 3:34:04 PM (18 years ago)
- Location:
- branches/new_class_id/src/world_entities/npcs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/npcs/attractor_mine.cc
r9716 r9746 38 38 #include "script_class.h" 39 39 CREATE_SCRIPTABLE_CLASS(AttractorMine, AttractorMine::classID(), 40 addMethod("setName", Executor Lua1<BaseObject,const std::string&>(&BaseObject::setName))41 //Coordinates42 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))43 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))44 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))45 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))40 addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName)) 41 //Coordinates 42 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 43 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 44 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 45 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 46 46 ); 47 47 -
branches/new_class_id/src/world_entities/npcs/gate.cc
r9716 r9746 38 38 #include "script_class.h" 39 39 CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(), 40 addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))41 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))42 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))45 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))46 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))40 addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 41 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 42 ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy)) 43 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 44 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 45 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 46 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 47 47 ); 48 48 -
branches/new_class_id/src/world_entities/npcs/generic_npc.cc
r9716 r9746 39 39 CREATE_SCRIPTABLE_CLASS(GenericNPC, GenericNPC::classID(), 40 40 // Move 41 addMethod("walkTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))42 ->addMethod("runTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::runTo))43 ->addMethod("turnTo", Executor Lua1<GenericNPC,float>(&GenericNPC::turnTo))44 ->addMethod("finalGoalReached", Executor Lua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))45 ->addMethod("stop", Executor Lua0<GenericNPC>(&GenericNPC::stop))46 ->addMethod("resume", Executor Lua0<GenericNPC>(&GenericNPC::resume))47 ->addMethod("playAnimation", Executor Lua2<GenericNPC,int,int>(&GenericNPC::playAnimation))41 addMethod("walkTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::walkTo)) 42 ->addMethod("runTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::runTo)) 43 ->addMethod("turnTo", Executor1<GenericNPC, lua_State*,float>(&GenericNPC::turnTo)) 44 ->addMethod("finalGoalReached", Executor0ret<GenericNPC, lua_State*,bool>(&GenericNPC::finalGoalReached)) 45 ->addMethod("stop", Executor0<GenericNPC, lua_State*>(&GenericNPC::stop)) 46 ->addMethod("resume", Executor0<GenericNPC, lua_State*>(&GenericNPC::resume)) 47 ->addMethod("playAnimation", Executor2<GenericNPC, lua_State*,int,int>(&GenericNPC::playAnimation)) 48 48 // Display 49 ->addMethod("hide", Executor Lua0<WorldEntity>(&WorldEntity::hide))50 ->addMethod("unhide", Executor Lua0<WorldEntity>(&WorldEntity::unhide))49 ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 50 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 51 51 // Coordinates 52 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))53 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))54 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))55 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))56 ->addMethod("setAbsDir", Executor Lua4<PNode,float,float,float,float>(&PNode::setAbsDir))52 ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX)) 53 ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY)) 54 ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ)) 55 ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor)) 56 ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir)) 57 57 ); 58 58 … … 234 234 this->setAnimationSpeed(0.5f); 235 235 } 236 236 break; 237 237 case Run: 238 238 { … … 247 247 this->setAnimationSpeed(1.0f); 248 248 } 249 249 break; 250 250 case Crouch: 251 251 { … … 260 260 this->setAnimationSpeed(1.0f); 261 261 } 262 262 break; 263 263 case LookAt: 264 265 266 264 if( this->getAnimation() != STAND) 265 this->setAnimation(STAND, MD2_ANIM_LOOP); 266 break; 267 267 case Shoot: 268 269 270 268 if( this->getAnimation() != STAND) 269 this->setAnimation(STAND, MD2_ANIM_LOOP); 270 break; 271 271 272 272 default: 273 274 275 273 if( this->getAnimation() != STAND) 274 this->setAnimation(STAND, MD2_ANIM_LOOP); 275 break; 276 276 277 277 } … … 307 307 this->setAnimationSpeed(0.5f); 308 308 } 309 309 break; 310 310 case Run: 311 311 { … … 320 320 this->setAnimationSpeed(1.0f); 321 321 } 322 322 break; 323 323 case Crouch: 324 324 { … … 333 333 this->setAnimationSpeed(1.0f); 334 334 } 335 335 break; 336 336 case LookAt: 337 337 { … … 339 339 this->setAnimation(STAND, MD2_ANIM_LOOP); 340 340 } 341 341 break; 342 342 case Shoot: 343 343 if( this->getAnimation() != STAND) 344 344 this->setAnimation(STAND, MD2_ANIM_LOOP); 345 345 break; 346 346 347 347 default: 348 348 if( this->getAnimation() != STAND) 349 349 this->setAnimation(STAND, MD2_ANIM_LOOP); 350 350 break; 351 351 352 352 } … … 510 510 { 511 511 case Walk: 512 { 513 Vector dest = currentAnimation.v - this->getAbsCoor(); 514 dest.y = 0.0f; 515 if (dest.len() < .5) 512 516 { 513 Vector dest = currentAnimation.v - this->getAbsCoor(); 514 dest.y = 0.0f; 515 if (dest.len() < .5) 516 { 517 this->nextStep(); 518 } 519 else 520 { 521 Vector move = dest.getNormalized() * currentAnimation.speed * dt; 522 this->shiftCoor(move); 523 } 517 this->nextStep(); 524 518 } 525 break; 519 else 520 { 521 Vector move = dest.getNormalized() * currentAnimation.speed * dt; 522 this->shiftCoor(move); 523 } 524 } 525 break; 526 526 527 527 case Run: … … 552 552 553 553 case TurnTo: 554 555 554 //Quaternion direction = this-> 555 break; 556 556 557 557 case LookAt: 558 558 break; 559 559 560 560 case Shoot: 561 561 break; 562 562 563 563 default: 564 564 break; 565 565 566 566 } … … 572 572 this->fallVelocity += 300.0f * dt; 573 573 //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity; 574 // PRINTF(0)("%s is not on ground\n", this->getName());574 // PRINTF(0)("%s is not on ground\n", this->getName()); 575 575 this->shiftCoor(Vector(0, -this->fallVelocity * dt,0)); 576 576
Note: See TracChangeset
for help on using the changeset viewer.