Oh dear. It appears as if I broke datablock inheritance.
by Maddermadcat · in Torque Game Engine · 02/07/2008 (1:35 pm) · 5 replies
So it turns out that datablocks of any kind refuse to inherit anything from their parents. If you're wondering what I mean by that, here is an item datablock:
Then all ammo datablocks are derived from that, for example:
Unfortunately, MRAmmo inherits nothing from DefaultAmmo. Neither do the Heavy Weapons from the Scouts, or anything. This did not happen before, and I have no clue what could have changed it. If anyone knows what could be wrong, how I should fix it or where to look, please say so. It's extremely important.
datablock ItemData(DefaultAmmo)
{
category = "Ammo";
className = "Ammo";
shapeFile = "~/data/shapes/weapons/ammo.dts";
computeCRC = false;
emap = true;
renderWhenDestroyed = true;
mass = 1;
drag = 0.5;
density = 2;
elasticity = 0.2;
friction = 0.6;
sticky = false;
gravityMod = 1;
maxVelocity = 100;
dynamicType = $TypeMasks::ItemObjectType;
hasLight = true;
lightType = PulsingLight; // NoLight, ConstantLight, PulsingLight
lightRadius = 1;
lightColor = "0.8 0.8 0.8 1";
lightOnlyStatic = false;
pickUpName = 'Ammo';
pickupSound = WeaponPickupSound;
throwSound = WeaponThrowSound;
};Then all ammo datablocks are derived from that, for example:
datablock ItemData(MRAmmo : DefaultAmmo)
{
shapeFile = "~/data/shapes/weapons/ammo.dts";
pickUpName = 'Mag Rifle Ammo';
nameTag = 'Mag Ammo';
};Unfortunately, MRAmmo inherits nothing from DefaultAmmo. Neither do the Heavy Weapons from the Scouts, or anything. This did not happen before, and I have no clue what could have changed it. If anyone knows what could be wrong, how I should fix it or where to look, please say so. It's extremely important.
About the author
#2
02/07/2008 (3:33 pm)
Had that happen this end once or twice. usually means something got munged in the parent definition so it's no longer valid, like say, an improper shapeFile lookup (not saying thats what yours is, but thats what it was this end in that instance)
#3
You should make sure that name is unique. You might have an MRAmmo dataBlock for sound or image ammo.
02/08/2008 (5:06 am)
I had a similar problem with inheriting from the player dataBlock. It turns out I had some radio buttons named the same as my inheriting dataBlock.You should make sure that name is unique. You might have an MRAmmo dataBlock for sound or image ammo.
#4
02/09/2008 (12:48 pm)
Thanks for your replies, guys -- I'll try out your suggestions.
#5
It solved all of my inheritance issues but please read my comment towards the end of the resource if you use Torsion. Without a small edit you can break Torsion's export building process.
02/17/2008 (3:45 am)
Not sure what your particular problem is but I highly recommend the Namespace Upgrade Patch ResourceIt solved all of my inheritance issues but please read my comment towards the end of the resource if you use Torsion. Without a small edit you can break Torsion's export building process.
Torque Owner ChrisG
datablock ItemData(MRAmmo : DefaultAmmo) { className = "DefaultAmmo"; shapeFile = "~/data/shapes/weapons/ammo.dts"; pickUpName = 'Mag Rifle Ammo'; nameTag = 'Mag Ammo'; };