diff --git a/Runtime/MP1/World/CDrone.cpp b/Runtime/MP1/World/CDrone.cpp index 1b0d59f9b..62e6f691a 100644 --- a/Runtime/MP1/World/CDrone.cpp +++ b/Runtime/MP1/World/CDrone.cpp @@ -5,6 +5,7 @@ #include "Runtime/CSimplePool.hpp" #include "Runtime/CStateManager.hpp" #include "Runtime/GameGlobalObjects.hpp" +#include "Runtime/MP1/World/CDroneLaser.hpp" #include "Runtime/Particle/CWeaponDescription.hpp" #include "Runtime/Weapon/CGameProjectile.hpp" #include "Runtime/Weapon/CWeapon.hpp" @@ -32,7 +33,7 @@ CDrone::CDrone(TUniqueId uid, std::string_view name, EFlavorType flavor, const C s32 sId, bool b1) : CPatterned(ECharacter::Drone, uid, name, flavor, info, xf, std::move(mData), pInfo, movement, colliderType, bodyType, actParms, flavor == EFlavorType::Zero ? EKnockBackVariant::Medium : EKnockBackVariant::Large) -, x568_(aId1) +, x568_laserParticlesId(aId1) , x56c_(g_SimplePool->GetObj({SBIG('CRSC'), crscId})) , x57c_flares(std::move(flares)) , x590_(dInfo1) @@ -347,7 +348,7 @@ void CDrone::Touch(CActor& act, CStateManager& mgr) { if (TCastToPtr weapon = act) { if (IsAlive()) { x834_24_ = weapon->GetType() == EWeaponType::Wave; - if (HitShield(weapon->GetTranslation() - GetTranslation())) { + if (x3fc_flavor == CPatterned::EFlavorType::One && HitShield(weapon->GetTranslation() - GetTranslation())) { x5e8_shieldTime = 1.f; } } @@ -942,8 +943,16 @@ void CDrone::RemoveFromTeam(CStateManager& mgr) const { } } -void CDrone::UpdateLaser(CStateManager& mgr, u32 laserIdx, bool b1) { - // TODO: Finish +void CDrone::UpdateLaser(CStateManager& mgr, u32 laserIdx, bool active) { + if (active) { + if (x7d8_[laserIdx] == kInvalidUniqueId) { + x7d8_[laserIdx] = mgr.AllocateUniqueId(); + mgr.AddObject(new CDroneLaser(x7d8_[laserIdx], GetAreaIdAlways(), GetTransform(), x568_laserParticlesId)); + } + } + if (CEntity* ent = mgr.ObjectById(x7d8_[laserIdx])) { + mgr.SendScriptMsg(ent, GetUniqueId(), active ? EScriptObjectMessage::Activate : EScriptObjectMessage::Deactivate); + } } void CDrone::FireProjectile(CStateManager& mgr, const zeus::CTransform& xf, const TToken& weapon) { diff --git a/Runtime/MP1/World/CDrone.hpp b/Runtime/MP1/World/CDrone.hpp index 5f3dd990c..84560110f 100644 --- a/Runtime/MP1/World/CDrone.hpp +++ b/Runtime/MP1/World/CDrone.hpp @@ -9,7 +9,7 @@ namespace urde { class CWeaponDescription; namespace MP1 { class CDrone : public CPatterned { - CAssetId x568_; + CAssetId x568_laserParticlesId; TLockedToken x56c_; TUniqueId x578_lightId = kInvalidUniqueId; TUniqueId x57a_ = kInvalidUniqueId; @@ -98,7 +98,7 @@ class CDrone : public CPatterned { bool HitShield(const zeus::CVector3f& dir) const; void AddToTeam(CStateManager& mgr) const; void RemoveFromTeam(CStateManager& mgr) const; - void UpdateLaser(CStateManager& mgr, u32 laserIdx, bool b1); + void UpdateLaser(CStateManager& mgr, u32 laserIdx, bool active); void FireProjectile(CStateManager& mgr, const zeus::CTransform& xf, const TToken& weapon); void StrafeFromCompanions(CStateManager& mgr); void UpdateScanner(CStateManager& mgr, float dt); diff --git a/Runtime/MP1/World/CDroneLaser.cpp b/Runtime/MP1/World/CDroneLaser.cpp index da4ee05e3..22a400929 100644 --- a/Runtime/MP1/World/CDroneLaser.cpp +++ b/Runtime/MP1/World/CDroneLaser.cpp @@ -13,10 +13,11 @@ namespace urde::MP1 { CDroneLaser::CDroneLaser(TUniqueId uid, TAreaId aId, const zeus::CTransform& xf, CAssetId particle) : CActor(uid, true, "DroneLaser"sv, CEntityInfo(aId, CEntity::NullConnectionList), xf, CModelData::CModelDataNull(), - CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None(), kInvalidUniqueId) + CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None().HotInThermal(true), kInvalidUniqueId) , xf8_beamDesc(g_SimplePool->GetObj({SBIG('PART'), particle})) , x104_beamParticle(std::make_unique(xf8_beamDesc, CElementGen::EModelOrientationType::Normal, CElementGen::EOptionalSystemFlags::One)) {} + void CDroneLaser::Accept(IVisitor& visitor) { visitor.Visit(this); } void CDroneLaser::Think(float dt, CStateManager& mgr) { x104_beamParticle->Update(dt); }