Page 1 of 1
towaterweapon tag for weapons
Posted: 03 Mar 2007, 03:25
by MadRat
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.
Posted: 03 Mar 2007, 07:18
by yuritch
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:
Code: Select all
if(atoi(sunparser->SGetValueDef("0", weaponname + "\\toairweapon").c_str())){
weaponDefs[id].onlyTargetCategory=CCategoryHandler::Instance()->GetCategories("VTOL");
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.
Posted: 03 Mar 2007, 08:46
by MadRat
Ah, its waterweapon, not wateronly. Brain fart.
I wonder why they don't check for air units actually being off the ground rather than testing for a category that may or may not be there.
Posted: 03 Mar 2007, 08:50
by KDR_11k
Because this is Spring and Spring works in a way that roughly approximates OTA when using OTA datasets, it wasn't designed with situations in mind that don't happen in OTA.
Posted: 03 Mar 2007, 09:37
by Fanger
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..
Posted: 03 Mar 2007, 10:20
by KDR_11k
Fanger: Normal weapons explode when they hit the water surface, I think the tag is necessary because of that but I don't like how it forces OTA-style torpedo behaviour (i.e. free fall outside of water).
Posted: 03 Mar 2007, 15:34
by MadRat
With limitations like that then a towaterweapon tag that behaves like the waterweapon tag - that is it checks for the targets y-coordinates, but with no dropped effects - would be warranted.