Defaults to 0.5 for aircraft (to maintain backwards compatibility with current mods balance) and 1 for all other units. Many thanks to trepan and tvo.
Code: Select all
Index: ExternalAI/AICallback.cpp
===================================================================
--- ExternalAI/AICallback.cpp (revision 3391)
+++ ExternalAI/AICallback.cpp (working copy)
@@ -1080,14 +1080,14 @@
float CAICallback::GetUnitDefRadius(int def)
{
UnitDef *ud = &unitDefHandler->unitDefs[def];
- S3DOModel* mdl = modelParser->Load3DO(ud->model.modelpath,ud->canfly?0.5f:1,0);
+ S3DOModel* mdl = modelParser->Load3DO(ud->model.modelpath,ud->collisionSphereScale,0);
return mdl->radius;
}
float CAICallback::GetUnitDefHeight(int def)
{
UnitDef *ud = &unitDefHandler->unitDefs[def];
- S3DOModel* mdl = modelParser->Load3DO(ud->model.modelpath,ud->canfly?0.5f:1,0);
+ S3DOModel* mdl = modelParser->Load3DO(ud->model.modelpath,ud->collisionSphereScale,0);
return mdl->height;
}
Index: Sim/Units/UnitDef.h
===================================================================
--- Sim/Units/UnitDef.h (revision 3391)
+++ Sim/Units/UnitDef.h (working copy)
@@ -103,6 +103,7 @@
int armorType;
UnitModelDef model;
+ float collisionSphereScale;
struct UnitDefWeapon {
UnitDefWeapon(std::string name,WeaponDef* def,int slavedTo,float3 mainDir,float maxAngleDif,unsigned int badTargetCat,unsigned int onlyTargetCat,float fuelUse)
Index: Sim/Units/UnitDefHandler.cpp
===================================================================
--- Sim/Units/UnitDefHandler.cpp (revision 3391)
+++ Sim/Units/UnitDefHandler.cpp (working copy)
@@ -641,7 +641,9 @@
ud.smoothAnim = !!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\SmoothAnim").c_str());
ud.canLoopbackAttack = !!atoi(tdfparser.SGetValueDef("0", "UNITINFO\\CanLoopbackAttack").c_str());
ud.levelGround = !!atoi(tdfparser.SGetValueDef("1", "UNITINFO\\LevelGround").c_str());
-
+ ud.collisionSphereScale = atof(tdfparser.SGetValueDef(ud.canfly?"0.5f":"1", "UNITINFO\\CollisionSphereScale").c_str()); //this is a hack to make aircrafts less likely to collide and get hit by nontracking weapons, by default to preserve old behaviour
+
+
ud.seismicRadius=atoi(tdfparser.SGetValueDef("0", "UNITINFO\\seismicDistance").c_str());
ud.seismicSignature=atoi(tdfparser.SGetValueDef("-1", "UNITINFO\\seismicSignature").c_str());
if(ud.seismicSignature==-1)
Index: Sim/Units/UnitLoader.cpp
===================================================================
--- Sim/Units/UnitLoader.cpp (revision 3391)
+++ Sim/Units/UnitLoader.cpp (working copy)
@@ -273,7 +273,7 @@
// unit->mainDamageType=unit->weapons.front()->damageType;
//unit->model=unitModelLoader->GetModel(ud->model.modelname,side);
- unit->model = modelParser->Load3DO((ud->model.modelpath).c_str(),ud->canfly?0.5f:1,side); //this is a hack to make aircrafts less likely to collide and get hit by nontracking weapons
+ unit->model = modelParser->Load3DO((ud->model.modelpath).c_str(),ud->collisionSphereScale,side);
unit->SetRadius(unit->model->radius);
if(ud->floater)

Default aircraft 0.5 scale vs 10 scale.