S44 weapons have always been 'not in the unitdef' because they are shared across multiple units. It is far more efficient and much easier to maintain this way than defining the same machinegun 9 times. And with the inheritance it is now even easier.
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
That is imo a good idea. Would use something like that, if not for two reasons: -not enought similiar weapons -did not use it right from start, now too lazy to change it. easier to pile on top of the existing mess
At top of file there is the "default" rifle, and under that the "variants" of that weapon.
All the sniper rifles are the same, except: -each has a unique sound -the british one reloads faster -us rifle is more accurate when moving (fooking noscope)
So to make all snipers deal more damage (example) you only need to change one number instead of 4.
Personally I think the mortars/arty and tank guns are more interesting examples as they use a form of multiple inheritance (Base class, Armour Piercing or Smoke or High Explosive class, then the weapon specific base class)
Essentially each call of :New just adds all of the new tags to the table, overwriting any that already exist. The first parameter takes a table of the new values, so you can pass an existing table or a new one using {}. The second parameter is whether or not to concatenate (true) or overwrite (false) the name string, I use it here to append ' AP Shell' and ' HE Shell' respectively.
edit:
knorke wrote:
Would use something like that, if not for two reasons: -not enought similiar weapons
Yes - Its really only useful if you have weapons used by multiple units that share many attributes. In that respect it's a solution to an S44 specific problem, but I thought others might find it useful / be inspired to do something similar / just interesting to see an alternative to the CA defs.
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum