still haven't got it working
the base projectile grenade was useless, it wasnt even included in the
project and seems part of the sdk code? or whatever..
more usefull seems all the code I can gather from bugbait, rpg and
basegrenade_shared
together like that I have the following code in my grenade_melon.cpp
(copied off grenade_frag.cpp)
in Datadesc:
DEFINE_ENTITYFUNC( ExplodeTouch ),
related code in Spawn:
(unrelated stuff above)
// Explode on contact
SetTouch( &CGrenadeMelon::ExplodeTouch );
SetSize( -Vector(6,6,6), Vector(6,6,6) );
CreateVPhysics();
CreateEffects();
BlipSound();
AddSolidFlags( FSOLID_NOT_STANDABLE );
m_combineSpawned = false;
BaseClass::Spawn();
}
and for the actual touch:
void CGrenadeMelon::ExplodeTouch( CBaseEntity *pOther )
{
trace_t tr;
Vector traceDir = GetAbsVelocity();
// Don't hit triggers or water
Assert( pOther );
if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER|FSOLID_VOLUME_CONTENTS)
&& pOther->GetCollisionGroup() != COLLISION_GROUP_WEAPON )
return;
VectorNormalize( traceDir );
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + traceDir * 64,
MASK_SHOT, this, COLLISION_GROUP_NONE, &tr );
if( tr.fraction == 1.0 || !(tr.surface.flags & SURF_SKY) )
{
Explode( &tr, DMG_BLAST );
}
}
the DelayThink orignally in the grenade_ code is removed as explode
touch does that now.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders