Better Inheritance

Moderator: Graf Zahl

Locked
User avatar
ChupaReaper
Posts: 202
Joined: Fri Jun 15, 2007 16:35
Location: England
Contact:

Better Inheritance

Post by ChupaReaper »

Inherting modeldef classes would make modeldefs much smaller and easier to edit in mass, at the minute I use the same modeldef code on all my creatures in gzdoom, which means making one mistake or changing one little thing forces me to edit loads of modeldefs, having them all inherit important things would save a load of time. (All my models use the same sprite names because I don't bother with sprites anymore.)

Another thing in decorate is Multiple Inheritance, I use inheritance to make 'damagefactors' and 'painchance.<damage type>s'. The problem is, that I sometimes need to inherit both damage factors from one class and certain flags and properties from another. This means instead of making a class which has damage types, etc and another class containing flags and other properties like speed, etc, then inheting them both, I have to make the first class, then a load of the second class inherting from the first class. Heres what I mean:
Instead of:
actor fireelement
{
damagetype "fire"
damagefactor "fire",0.0
damagefactor "water",2.0
}
actor weakmonster
{
speed 8
painchance 200
monster
+nohurtspecies
}
actor strongmonster
{
speed 14
painchance 50
monster
+nohurtspecies
+faster
}actor lavathing : fireelement, weakmonster (or : fireelement : weakmonster)
{
health 95
states
{
...
}
}
I have to do this:
actor fireelement
{
damagetype "fire"
damagefactor "fire",0.0
damagefactor "water",2.0
}
actor weakfiremonster : fireelement
{
speed 8
painchance 200
monster
+nohurtspecies
}actor strongfiremonster : fireelement
{
speed 12
painchance 50
monster
+nohurtspecies
+faster
}
actor lavathing : weakfiremonster
{
health 95
states
{
...
}
}
Now they make look alike, but when there's more than one 'element' like waterelement, that means I've got to make a weakwatermonster and strongwatermonster class. Should I have 10 elements, that means I need to make an extra 20 subclasses, should I want to make a new subclass, I've got to make 10 of them each. I could just add those subclasses onto all the monsters instead, but, for editing in mass, one mistake, or one thing to change means having to edit all the scripts. I have 16 classes and 3 subclasses so far, a very long script... (my project's a large scale one)
User avatar
deded007
Posts: 29
Joined: Fri Jan 25, 2008 2:08
Location: Union AeroSpace Corp. Earth

Post by deded007 »

The inheritance thing would be cool
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany
Contact:

Post by Graf Zahl »

But it won't happen.
Locked

Return to “Closed Feature Suggestions”