towaterweapon tag for weapons

towaterweapon tag for weapons

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

towaterweapon tag for weapons

Post 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.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post 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.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post 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.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post 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..
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post 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).
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post 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.
Post Reply

Return to “Feature Requests”