Template talk:CD/superclass
Using {{CD}}
If I want to use this (pretty useful) template on an entity whose class isn't in the superclass, do I just go and add it there?
Or can it be used (or made to use) to specify the derived class in the template tag and then its base class? Something like {{CD|CAI_RadialLinkController|base=CBaseEntity|file1=ai_dynamiclink.cpp}}
(P. S. writing here as trying to add a topic on {{CD}}'s Talk redirects to {{CDA}}'s Talk... decided not to risk messing it up somehow) Cvoxalury (talk) 11:10, 27 June 2024 (PDT)
- Yes can go ahead and add it there. Other option is using Template:CDA which simply builds the hierarchy from the specified parameters without calling CD superclass (added documentation there). Currently not planning to add the base parameter but it might be needed at some point when there are 2 classes with same name that have different superclass. Also moved the CDA talk page to the CD talk page so it's not confusing. Nescius (talk) 13:07, 27 June 2024 (PDT)
- Ah, I missed the fact CDA would let me build the 'staircase'. Thanks. Cvoxalury (talk) 13:09, 27 June 2024 (PDT)
- Added the base parameter and also bunch of classes to this and made these pages to make it easier to check classname List of Source SDK 2013 Entities , List of Alien Swarm: Reactive Drop Entities Nescius (talk) 00:13, 29 June 2024 (PDT)
- Ah, I missed the fact CDA would let me build the 'staircase'. Thanks. Cvoxalury (talk) 13:09, 27 June 2024 (PDT)
- Tried to add CD to Weapon_crowbar but something's not going right. I added CBaseHLBludgeonWeapon to the superclass and the classlink, but I seem to have made a mistake somewhere. Any ideas what? Cvoxalury (talk) 04:34, 3 July 2024 (PDT)
- CD calls CD/superclass template only once for a given classname and then rest is build from smaller templates that need to be created too which represent each step in the hierarchy. In this case I had to make Template:CD CBaseHLBludgeonWeapon and Template:CD CBaseHLCombatWeapon so that the rest got built properly. CD2 works by repeatedly calling the CD/superclass and building it like that but currently doesn't have the classlink and base stuff. Nescius (talk) 05:41, 3 July 2024 (PDT)
- Yes CD2 is more expensive since it makes repeated lookups in the whole CD/superclass #switch. Added some quick performance tests on the Template:CD doc page for the difference. Not sure if the difference is considered too big but if possible good to use CD instead. Another difference is that for example Template:CD CBaseAnimating which is used by CD adds Category:CBaseAnimating to the page which CD2 doesn't do. Nescius (talk) 06:22, 3 July 2024 (PDT)