2016-12-22 19:57:21 +00:00
|
|
|
#include "CScriptBeam.hpp"
|
|
|
|
#include "CActorParameters.hpp"
|
|
|
|
#include "Particle/CWeaponDescription.hpp"
|
|
|
|
#include "Weapon/CPlasmaProjectile.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-12-22 19:57:21 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
CScriptBeam::CScriptBeam(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
2016-12-22 19:57:21 +00:00
|
|
|
bool active, const TToken<CWeaponDescription>& weaponDesc, const CBeamInfo& bInfo,
|
|
|
|
const CDamageInfo& dInfo)
|
|
|
|
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(),
|
|
|
|
kInvalidUniqueId)
|
|
|
|
, xe8_weaponDescription(weaponDesc)
|
|
|
|
, xf4_beamInfo(bInfo)
|
|
|
|
, x138_damageInfo(dInfo)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void CScriptBeam::Accept(IVisitor& visitor)
|
|
|
|
{
|
|
|
|
visitor.Visit(this);
|
|
|
|
}
|
|
|
|
|
2016-12-22 19:57:21 +00:00
|
|
|
void CScriptBeam::Think(float dt, CStateManager& mgr)
|
|
|
|
{
|
2017-08-13 05:26:14 +00:00
|
|
|
CPlasmaProjectile* proj = static_cast<CPlasmaProjectile*>(mgr.ObjectById(x154_projectileId));
|
2016-12-22 19:57:21 +00:00
|
|
|
if (proj)
|
|
|
|
{
|
|
|
|
if (proj->GetActive())
|
|
|
|
proj->UpdateFx(x34_transform, dt, mgr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
x154_projectileId = kInvalidUniqueId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CScriptBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
if (msg == EScriptObjectMessage::Increment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if (msg == EScriptObjectMessage::Decrement)
|
|
|
|
{
|
|
|
|
}
|
2017-03-24 05:30:16 +00:00
|
|
|
else if (msg == EScriptObjectMessage::Registered)
|
2016-12-22 19:57:21 +00:00
|
|
|
{
|
|
|
|
x154_projectileId = mgr.AllocateUniqueId();
|
|
|
|
mgr.AddObject(new CPlasmaProjectile(xe8_weaponDescription, x10_name + "-Projectile",
|
|
|
|
x138_damageInfo.GetWeaponMode().GetType(), xf4_beamInfo, x34_transform,
|
2016-12-29 21:38:59 +00:00
|
|
|
EMaterialTypes::Projectile, x138_damageInfo, x8_uid, x4_areaId,
|
2018-02-12 05:30:21 +00:00
|
|
|
x154_projectileId, 8, false, EProjectileAttrib::PlasmaProjectile));
|
2016-12-22 19:57:21 +00:00
|
|
|
}
|
2017-02-14 04:27:20 +00:00
|
|
|
else if (msg == EScriptObjectMessage::Deleted)
|
2016-12-22 19:57:21 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CActor::AcceptScriptMsg(msg, objId, mgr);
|
|
|
|
}
|
|
|
|
}
|