Skip to content

Commit

Permalink
Remove think of weapon in touch event, preventing bug with further ma…
Browse files Browse the repository at this point in the history
…terialize and secondary attach. Also removes repeating thinking of weapons gave by default.
  • Loading branch information
LevShisterov committed Mar 7, 2012
1 parent 5caf49f commit 29c4d46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions dlls/items.cpp
Expand Up @@ -167,6 +167,7 @@ void CItem::Materialize( void )
}

SetTouch( &CItem::ItemTouch );
SetThink( NULL );
}

#define SF_SUIT_SHORTLOGON 0x0001
Expand Down
9 changes: 5 additions & 4 deletions dlls/weapons.cpp
Expand Up @@ -526,11 +526,10 @@ void CBasePlayerItem::Materialize( void )
}

pev->solid = SOLID_TRIGGER;

UTIL_SetOrigin( pev, pev->origin );// link into world.
SetTouch (&CBasePlayerItem::DefaultTouch);
SetThink (NULL);

SetTouch( &CBasePlayerItem::DefaultTouch );
SetThink( NULL );
}

//=========================================================
Expand Down Expand Up @@ -765,8 +764,9 @@ void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer )
pev->modelindex = 0;// server won't send down to clients if modelindex == 0
pev->model = iStringNull;
pev->owner = pPlayer->edict();
pev->nextthink = gpGlobals->time + .1;
pev->nextthink = 0; // Remove think - prevents futher attempts to materialize
SetTouch( NULL );
SetThink( NULL );
}

// CALLED THROUGH the newly-touched weapon's instance. The existing player weapon is pOriginal
Expand Down Expand Up @@ -1092,6 +1092,7 @@ void CBasePlayerAmmo::Materialize( void )
}

SetTouch( &CBasePlayerAmmo::DefaultTouch );
SetThink( NULL );
}

void CBasePlayerAmmo :: DefaultTouch( CBaseEntity *pOther )
Expand Down

0 comments on commit 29c4d46

Please sign in to comment.