Skip to content

Commit 9701519

Browse files
committed
CEntity::KillEntity: Detach Actor from Vehicle or Mounted Weapon upon death to circumvent crash with character_physics_support
1 parent 473004e commit 9701519

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/xrGame/Actor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,14 @@ struct SDefNewsMsg{
244244
void detach_Vehicle ();
245245
void steer_Vehicle (float angle);
246246
void attach_Vehicle (CHolderCustom* vehicle);
247-
247+
bool use_MountedWeapon (CHolderCustom* object);
248248
virtual bool can_attach (const CInventoryItem *inventory_item) const;
249249
protected:
250250
CHolderCustom* m_holder;
251251
u16 m_holderID;
252252
bool use_Holder (CHolderCustom* holder);
253253

254254
bool use_Vehicle (CHolderCustom* object);
255-
bool use_MountedWeapon (CHolderCustom* object);
256255
void ActorUse ();
257256

258257
protected:

src/xrGame/Entity.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ void CEntity::net_Destroy ()
246246

247247
void CEntity::KillEntity(u16 whoID)
248248
{
249+
if (this->ID() == Actor()->ID())
250+
{
251+
Actor()->detach_Vehicle();
252+
Actor()->use_MountedWeapon(NULL);
253+
}
249254
if (whoID != ID()) {
250255
#ifdef DEBUG
251256
if (m_killer_id != ALife::_OBJECT_ID(-1)) {

0 commit comments

Comments
 (0)