towaterweapon tag for weapons
Moderator: Moderators
towaterweapon tag for weapons
We have an 'toairweapon' tag for weapons to only fire on air units. Does the old-but-broken TA tag 'wateronly' work in Spring? I don't see any difference with it on a weapon or not, so I assume its not implemented. What would be nice is to see a real 'towaterweapon' tag so that we can make units target only ones on the water, be them ships (including subs) or hovers. Once those units would for whatever reason leave water then they should be ignored.
toairweapon does not allow to fire at all flying units but only on those with VTOL category (so it is the same as OnlyTargetCategory<number>=VTOL). This means that such weapons will fire on VTOL units even if they are on the ground, and won't fire at flying units without VTOL in category string.
This is the code in WeaponDefHandler.cpp:
Strangely enough, waterweapon works differently and actually checks for target's y (height/depth) coordinate, so that all water units will be targeted regardless of category tags.
Water tag is waterweapon=1, btw, and not wateronly.
This is the code in WeaponDefHandler.cpp:
Code: Select all
if(atoi(sunparser->SGetValueDef("0", weaponname + "\\toairweapon").c_str())){
weaponDefs[id].onlyTargetCategory=CCategoryHandler::Instance()->GetCategories("VTOL");
Water tag is waterweapon=1, btw, and not wateronly.
Onlytargetcatagory is a unit fbi, to waterweapon is a weapon fbi, and will alter the class of the weapon making it work like a torpedo in most instances, In fact I think this tag only functions with missile type weapons and acts very strangely, it would be easier to simply set a land based weapon to use the onlytargetcatagory as you can easily control this..