void CObject::Explode() { CVector pos = GetPos(); pos.z += 0.5; CExplosion::AddExplosion(this, GetPlayerPed(-1), 9, pos, 100, 1, -1.0, 0); if (m_colDamageEffect == 202 || m_colDamageEffect == 200) { pos.z -= 1.0; ObjectDamage(10000.0f, pos, 0, GetPlayerPed(-1), 51); } else if (!m_disableFriction) { m_linearVelocity.z += 0.5; m_linearVelocity.x += (rand() - 128) * 0.000199999994947575; m_linearVelocity.y += (rand() - 128) * 0.000199999994947575; if (bIsStatic || bIsStaticWaitingForCollision) { SetIsStatic(false); AddToMovingList(); } } if (m_objectInfo->fxType == 2) { CMatrix pos = GetMatrix(); // to object space CVector fxObjPos = Multiply3x3(pos, m_objectInfo->fxOffset); fxObjPos += GetPos(); // to world space FxSystem_c *sys = FxManager.InitialiseFxSystem(m_objectInfo->fxSystem, fxObjPos, 0, 0); if (sys) { sys->Start(); } } }
void CObject::Explode() { CVector pos = Placeable.GetPos(); pos.z += 0.5; CExplosion::AddExplosion(this, getPlayerPed(-1), 9, pos, 100, 1, -1.0, 0); if(m_colDamageEffect == 0xCA || m_colDamageEffect == 0xc8) { pos.z -= 1.0; Break(10000.0, pos, 0, getPlayerPed(-1), 51); } else if(!bDisableFriction) { m_vecLinearVelocity.z += 0.5; m_vecLinearVelocity.x += (rand() - 128) * 0.000199999994947575; m_vecLinearVelocity.y += (rand() - 128) * 0.000199999994947575; if(bIsStatic || bIsStaticWaitingForCollision) { SetIsStatic(false); AddToMovingList(); } } if(m_pObjectInfo->fxType == 2) { CMatrix pos = CMatrix::FromXYZ(m_xyz); // to object space CVector fx_obj_pos = pos * m_pObjectInfo->fxOffset; fx_obj_pos += GetPos(); // to world space FxSystem_c *sys = FxManager.InitialiseFxSystem(m_pObjectInfo->pFxSystemBP, fx_obj_pos, 0, 0); if(sys) { sys->Start(); } } }
void Daggerstorm::Cast(ObjectRef user, ObjectRef enemy) { for (int i = 0; i < 8; i++) { auto projectileObject = Object::Create(); projectileObject->SetJustEnabled(); static int projectileNumber = 0; std::string name = std::string("projectile") + std::to_string(projectileNumber++); projectileObject->SetName(name); auto projectileComp = projectileObject->AddComponent<ProjectileComponent>(); auto spriteComp = projectileObject->AddComponent<SpriteComponent>(); auto colliderComp = projectileObject->AddComponent<ColliderComponent>(); Vector2f direction = directions[i]; projectileComp->SetDirection(direction); projectileComp->SetSpeed(projectileSpeed); projectileComp->SetSpell(this); projectileComp->SetUser(user); projectileComp->SetCanApplyOnUser(false); spriteComp->SetTexture("dagger.png"); spriteComp->SetSize(Vector2f(20, 40)); colliderComp->InitShape("rectangle", "20, 20"); colliderComp->SetIsStatic(false); colliderComp->SetIsPhantom(true); Vector2f userPos = user->GetComponent<SpriteComponent>()->GetSize(); Vector2f startingPos = user->GetPos() + userPos/2.f; Vector2f projectileSize = spriteComp->GetSize(); float magic = (sqrt(pow(projectileSize.x, 2) + pow(projectileSize.y, 2))) / 2; projectileObject->SetPos(startingPos + magic * direction); g_menuHandler->GetCurrentMenu()->AddChild(std::move(projectileObject)); } r_cooldown = cooldown; }