File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
src/core/modules/entities Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -370,7 +370,24 @@ bool CBaseEntityWrapper::IsPlayer()
370370bool CBaseEntityWrapper::IsWeapon ()
371371{
372372 static object is_weapon = import (" weapons" ).attr (" manager" ).attr (" weapon_manager" ).attr (" __contains__" );
373- return is_weapon (str (IServerUnknownExt::GetClassname (GetThis ())));
373+
374+ bool result = is_weapon (str (IServerUnknownExt::GetClassname (GetThis ())));
375+
376+ // If the manager does not know about this classname, let's see if the
377+ // entity inherits from the base weapon class instead. This can happens
378+ // when a plugin change the classname of a valid weapon.
379+ if (!result)
380+ {
381+ datamap_t *pDatamap = GetDataDescMap ();
382+ while (pDatamap)
383+ {
384+ if (strcmp (pDatamap->dataClassName , " CBaseCombatWeapon" ) == 0 )
385+ return true ;
386+ pDatamap = pDatamap->baseMap ;
387+ }
388+ }
389+
390+ return result;
374391}
375392
376393IPhysicsObjectWrapper* CBaseEntityWrapper::GetPhysicsObject ()
You can’t perform that action at this time.
0 commit comments