void ComponentUseOnCollision::handleEventCollisionOccurred( const EventCollisionOccurred *event ) { ActorID a2id = PhysicsEngine::getActorFromGeom(event->o2); if (!onlyPlayers || (onlyPlayers && world->isAPlayer(a2id))) { ActorID a1id = PhysicsEngine::getActorFromGeom(event->o1); ActorID uid = getActorID(); if (a1id == uid) { EventUsesObject m(uid); sendEvent(&m); } } }
void ComponentExplodeAfterTimeout::explode() { ASSERT(world, "world has not yet been set"); const vec2 x = lastReportedOrientation.getAxisX().xy(); const float rotation = getAngle(x, vec2(1,0)); ActorID actor = getActorID(); world->generateExplosion(actor, lastReportedPosition, rotation, baseDamage, soundFileName, particlesFileName); broadcastDeleteActor(); }
void ComponentDestroySelfOnCollision::handleEventCollisionOccurred( const EventCollisionOccurred *message ) { if (!onlyPlayers) { shouldActivate=true; return; } ActorID a2id = PhysicsEngine::getActorFromGeom(message->o2); if (world->isAPlayer(a2id)) { ActorID a1id = PhysicsEngine::getActorFromGeom(message->o1); ActorID uid = getActorID(); if (a1id == uid) { shouldActivate=true; } } }
void EnObjectWood::onObjectUse() { // TODO: make something useful StoryEvent event( StoryEvent::eTypePickItem, getActorType(), getActorID(), StoryEvent::eTypePickItem, StorageClient::get()->getUserID(), StoryEvent::eFilterStoryPublic, getNetworkID(), 10, 20, 10.0f, 20.0f, "picking wood" ); StorySystem::get()->sendEvent( event ); }
void ComponentExplodeAfterTimeout::broadcastDeleteActor() { ActionDeleteActor m(getActorID()); sendGlobalAction(&m); }
void ComponentDestroySelfOnCollision::broadcastDeleteSelfActor() { ActionDeleteActor m(getActorID()); sendGlobalAction(&m); }