Component placement restrictions based on hull size - possible? |

Namely, is it possible to have components with "this ship is too large to equip this" or "even though you have the space, this hull size is too small to equip this" restrictions?
If not, then I can always think about having 3 Ship-types (actually, would make life easy in many ways)... er wait, is that even possible? I know you can define your own Unit-types, but is there only 1 Ship-type allowed?
Re: Component placement restrictions based on hull size - possib
Playing around with ComponentEnhancements.txt has some interesting potential. The file looks to support "mounts" for things other than just direct fire weapons, and appears to support arbitrary formula for restrictions.
I don't think you can *require* a component to be in a mount, but with some fiddling around you could create a system where components without a mount are basically useless, and the (determined by size or whatever else) mounts provide most of the stats.
Re: Component placement restrictions based on hull size - possib
Scale mounts are a long established tradition of cludgery in SE modding. Please make sure to spam Aaron with emails requesting Get_Vehicle_Size() in Componenents.txt, however!
Another option is to add a special ability tag (AI Tags work nicely) to classes of components that can only be used on a certain hull, or group of hulls. Then, add requirements to those hulls that prevents usage of anything with the ability, for the hulls where you don't want it used. All such components will still appear in the list on the left; unfortunately there is no way to remove them for the restricted hulls. For an example, check out this thread on preventing weapons from being mounted on carrier hulls.

Re: Component placement restrictions based on hull size - possib
Yes, you can have mounts for components other than weapons, such as armor.
~~~
The power of the ancients is now yours to command. You are truly the Master... of the obvious 
Re: Component placement restrictions based on hull size - possib
You CAN use the Get_Vehicle_Size() function in the Components file, but it is limited somewhat.
You can't use Get_Vehicle_Size() to filter the item out of the Availability list.
You can use Get_Vehicle_Size() to make a warning pop up for either Usage or Placement, thereby restricting components based on a ship's size.
I warn you though, the problem I am finding is that IF you have different components for different ship sizes THEN the list of components becomes very long and you have to get good at naming components to be able to find anything in the scroll list.
This problem would be eliminated if the Availability Requirement worked with the Get_Vehicle_Size() function, but it doesn't right now.
Here is an example from my files:
Name := FIGHTER PROJECTILE Shield
Description := FIGHTER/TROOP class shield generator that functions against PROJECTILE and ENERGY BEAM weapons, but is bypassed somewhat by ENERGY BOLT weapons.
Picture Number := 65
Maximum Level := 1
Tonnage Space Taken Formula := 15
Tonnage Structure Formula := 1
Cost Minerals Formula := 10
Cost Organics Formula := 0
Cost Radioactives Formula := 10
Supply Amount Used Formula := 0
Ordnance Amount Used Formula := 0
Can Be Placed On Vehicle Types := Fighter, Troop
Can Be Placed In Ship Sections := Inner Hull, Outer Hull
Component Type List := Technological
General Group := Shields
Custom Group := 0
Number Of Requirements := 3
Requirements Evaluation Availability := 2, 3
Requirements Evaluation Allows Placement := 1
Requirements Evaluation Allows Usage := 2
Requirement 1 Description := The vehicle size must be at least 90kT size.
Requirement 1 Formula := Get_Vehicle_Size_Tonnage() >= 90
Requirement 2 Description := Empire must have at least tech level 1 in Shields.
Requirement 2 Formula := Get_Empire_Tech_Level("Shields") >= [%Level%]
Requirement 3 Description := Empire must have at least tech level 2 in Projectile Weapons.
Requirement 3 Formula := Get_Empire_Tech_Level("Projectile Weapons") >= 2
Number Of Abilities := 1
Ability 1 Type := Shield Generation
Ability 1 Description := Shield Generators provide [%Amount2%] normal shield points.
Ability 1 Scope := Space Object
Ability 1 Range Formula := 0
Ability 1 Amount 1 Formula := "Normal Shields"
Ability 1 Amount 2 Formula := 30
Weapon Type := None
Re: Component placement restrictions based on hull size - possib
Indeed, I've used component mounts to accomplish a few things. I got the idea from the Gritty Galaxy mod, you might look at it for some ideas.
One thing I especially liked was the Drone Component mount that reduces the cost of any component using it by cost/10; this makes drones more cost effective and faster to build and can only be used on drones.
I also created a component-Advanced mount that doesn't accept weapons, but reduces the tonnage and structure of other components (advanced materials/construction but more fragile and expensive). I also added a durable component mount that doesn't increase the tonnage, but 'hardens' it, increasing the structure and cost. Really effective on armor.
Anyway, the way the mounts are designed, you can fix them up so they can only be used on specific components or tonnage sizes, so that might accomplish what you want, albeit indirectly.
ETA:
You might also edit damagetypes.txt to get some of the effects you want. I've been experimenting with that as well.
The added bonus of using mounts is that the AI seems programmed to make use of custom mounts (probably through some hard coded cost/benefit or damage/range equation) pretty well, and I play with a stock AI for the moment. I've noticed that the AI won't always use new weapon or armor types, but modifying those components via mounts seems to have a better effect unless you can mod the AI to use the new stuff too.




Re: Component placement restrictions based on hull size - possib
The Get_Vehicle_Size() function does not work in Components.txt, so you cannot do the "too big/small to equip" trick
There's also no way to define more than one ship type either - I tried making a second by renaming bases to capital ships for the Capship Mod, but that kind of failed as bases seem to be hardcoded to be immobile and spin around in combat
All I can say until someone comes up with a clever workaround is, start asking Aaron for a "VehicleShipTypes.txt" file or a working Get_Vehicle_Size() in Components.txt; as evidenced by the v1.58 patch, if he doesn't have too many bugs to fix he's not averse to adding new features
One other thing I'd like to see BTW is the ability to modify an *arbitrary* ability's values (and weapon fire rate and target types) in a component mount... 
~~~
The power of the ancients is now yours to command. You are truly the Master... of the obvious