Author Topic: Issue with ProjectileData::OnCollision  (Read 963 times)

I'm editing Kalphiters Infinite Mining mod, and I want to add dynamite. Everything works- the weapon, the model, the function to destroy the bricks when the explosion hits them, but theres one issue. The function that should be called to destroy the brick (because they player will not earn or for using dynamite) is not called. Heres what I'm using:

Code: [Select]
function DynamiteExplosionP::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
   parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
   Dig_explodeBrick(%obj, %col, %pos);
   echo("Dynamite hit brick!"); //Testing Purposes - Will Be Removed
}

ExplodeBrick doesn't need to be added, I tested it, and it does what it should. The datablocks around it like:

Code: [Select]
function gunProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{

    parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
    if(%obj.client.isAdmin)
Dig_mineBrick(%obj, %col, %pos);
}

Are not packaged, so I'm sure this doesn't need to be. The Dynamite weapon is a modifed version of the C4 Item (This edit is for private use, so don't start bitching on credit) and this is what the projectile lookes like:

Code: [Select]
datablock ProjectileData(DynamiteExplosionP : rocketlauncherProjectile)
{
   directDamage        = 70;
   brickexplosionradius = 10;
   brickexplosionMaxVolume = 150;
   brickexplosionforce = 20;
   radiusDamageType = $DamageType::DynamiteRadius;
   radiusDamageType = $DamageType::DynamiteRadius;
   lifetime = 1;
   explosion = gravityRocketExplosion;
   explodeonDeath = true;
   uiName = "Dynamite Explosion";
};

Thanks alot, good night  :cookieMonster:

onCollision is called when the projectile moving actually touches something, not when something is caught in the explosion radius.

There is no projectile for this item. The explosion is a ProjectileData datablock though. Is there a way to make it when the explosion touches? Or would it be easier for the item just to create a zone, break all the bricks in the zone, then delete the zone?

You'd just use a container search then.

I suppose you could try fxdtsbrick::onBlownUp

I suppose you could try fxdtsbrick::onBlownUp

Sorry about the bump, my computer wouldn't let me on for a bit

Thanks a lot man,