diff --git a/doc/pr-changelogs/3397.md b/doc/pr-changelogs/3397.md new file mode 100644 index 0000000000..058d7e4527 --- /dev/null +++ b/doc/pr-changelogs/3397.md @@ -0,0 +1 @@ +* add `subMissile` boolean export to the Lua weaponDefs. Non-torpedo weapon types always have subMissile=false. \ No newline at end of file diff --git a/rts/Lua/LuaWeaponDefs.cpp b/rts/Lua/LuaWeaponDefs.cpp index b2815d8cf7..fc57f18fba 100644 --- a/rts/Lua/LuaWeaponDefs.cpp +++ b/rts/Lua/LuaWeaponDefs.cpp @@ -519,6 +519,7 @@ static bool InitParamMap() ADD_BOOL("turret", wd.turret); ADD_BOOL("onlyForward", wd.onlyForward); ADD_BOOL("waterWeapon", wd.waterweapon); + ADD_BOOL("subMissile", wd.submissile); ADD_BOOL("tracks", wd.tracks); ADD_BOOL("paralyzer", wd.paralyzer); diff --git a/rts/Sim/Weapons/WeaponDef.cpp b/rts/Sim/Weapons/WeaponDef.cpp index 7dbd55a08c..a5468060d4 100644 --- a/rts/Sim/Weapons/WeaponDef.cpp +++ b/rts/Sim/Weapons/WeaponDef.cpp @@ -570,6 +570,7 @@ WeaponDef::WeaponDef(const LuaTable& wdTable, const std::string& name_, int id_) isShield = (type == "Shield"); noAutoTarget = (manualfire || interceptor || isShield); onlyForward = !turret && (projectileType != WEAPON_STARBURST_PROJECTILE); + submissile &= (projectileType == WEAPON_TORPEDO_PROJECTILE); }