Time to describe my method of limiting weapons for certain structures
for example: we dont want see weapons from fortresses on bunker bodies
1) Added size parameter to structure bodies
*note1: each structure body can have any size, even string like "i dont know size"
set of sizes for structures: METAL_TOWER, HARDCRETE_TOWER, HARDPOINT, FORTRESS, BUNKER_INSIDE, BUNKER_ROOF, EMPLACEMENT, ARTILLERY_EMPLACEMENT, AA_EMPLACEMENT, PIT
2) Added parameter "weaponDesignType" to list of weapons
*note1: each weapon can have any design type (any string)
set of weapon design types: AA, CYBORG_LIGHT, CYBORG_HEAVY, DIRECT_LIGHT, DIRECT_MEDIUM, DIRECT_HEAVY, DIRECT_SUPERHEAVY, INDIRECT_LIGHT, INDIRECT_MEDIUM, INDIRECT_HEAVY, VTOL_LIGHT, VTOL_HEAVY, MISC
3) Added JS function (as trigger)
IsComponentFits
if function returns "true" this means component can be added to current design
Code: Select all
function eventIsComponentFits(template, component)
{
switch(component.componentType)
{
......................................................................
case 8: //COMP_WEAPON
if(template.Body.size == "BUNKER_ROOF" || template.Body.size == "BUNKER_INSIDE")
{
if(component.weaponDesignType != "DIRECT_LIGHT")
{
return false;
}
}
break;
}
return true;
}