Skip to content

Commit

Permalink
Drop poltergeist body after death (#392)
Browse files Browse the repository at this point in the history
Update poltergeist abilities only if he's alive
And deactivate CTelekinesis when poltergeist dies or despawns
Also added XXX for poltergeist
  • Loading branch information
Xottab-DUTY committed May 15, 2019
1 parent cca595b commit cd5a9da
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
32 changes: 19 additions & 13 deletions src/xrGame/ai/monsters/poltergeist/poltergeist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,28 +368,34 @@ BOOL CPoltergeist::net_Spawn(CSE_Abstract* DC)
void CPoltergeist::net_Destroy()
{
inherited::net_Destroy();
CTelekinesis::deactivate();
Energy::disable();

ability()->on_destroy();
}

void CPoltergeist::Die(IGameObject* who)
{
// if (m_tele) {
// if (state_invisible) {
// setVisible(true);
//
// if (PPhysicsShell()) {
// Fmatrix M;
// M.set (XFORM());
// M.translate_over (m_current_position);
// PPhysicsShell()->SetTransform (M);
// } else
// Position() = m_current_position;
// }
// }
if (m_tele)
{
if (state_invisible)
{
setVisible(true);

if (PPhysicsShell())
{
Fmatrix M;
M.set(XFORM());
M.translate_over(m_current_position);
PPhysicsShell()->SetTransform(M, mh_unspecified);
}
else
Position() = m_current_position;
}
}

inherited::Die(who);
CTelekinesis::deactivate();
Energy::disable();

ability()->on_die();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ void CPolterTele::update_schedule()
{
inherited::update_schedule();

if (!m_object->g_Alive() || m_object->get_actor_ignore())
return;

Fvector const actor_pos = Actor()->Position();
float const dist2actor = actor_pos.distance_to(m_object->Position());

Expand All @@ -47,9 +50,6 @@ void CPolterTele::update_schedule()
if (m_object->get_current_detection_level() < m_object->get_detection_success_level())
return;

if (m_object->get_actor_ignore())
return;

switch (m_state)
{
case eStartRaiseObjects:
Expand Down Expand Up @@ -294,6 +294,7 @@ void CPolterTele::tele_fire_objects()
if ((tele_object.get_state() == TS_Raise) || (tele_object.get_state() == TS_Keep))
{
Fvector enemy_pos;
// XXX: Allow headshooting not only for actor, but another enemies
enemy_pos = get_head_position(Actor());
CPhysicsShellHolder* hobj = tele_object.get_object();

Expand Down

0 comments on commit cd5a9da

Please sign in to comment.