PreFabs

From Battletech Modding Wiki
Jump to: navigation, search

The PreFabName and PreFabIdentifier tags in the different files are used to give the mech model in the game its correct equipment look.

Equipment, like AmmunitionBox or jumpjets, weapons and vehicles/mechs all have PrefabIdentifier tags, these defined the asset to be used for the item.

    "WeaponEffectID": "WeaponEffect-Weapon_PPC",
    "PrefabIdentifier": "ppc",

For weapons the WeaponEffectID assigns an effect for the weaponeffects assetbundle to the weapon

For mechs and vehicles it is a reference to the assetbundle in SteamLibrary\SteamApps\common\BattleTech - Private Beta\BattleTech_Data\StreamingAssets\data\assetbundles\.

    "PrefabIdentifier": "chrPrfMech_atlasBase-001",
    "PrefabBase": "atlas",</nowiki<

Currently only weapons have visuals, neither ammunitionboxes nor jumpjets do.

But not all mechs have all the weapons available in all locations, what is available can be checked in the harpointdatadef for the mech/vehicle in SteamLibrary\SteamApps\common\BattleTech - Private Beta\BattleTech_Data\StreamingAssets\data\hardpoints\

 <nowiki>   "ID" : "hardpointdatadef_locust",
   "HardpointData" : [
      {
         "location" : "centertorso",
         "weapons" : [
            "chrPrfWeap_locust_centertorso_flamer_eh1",
            "chrPrfWeap_locust_centertorso_flamer_eh2",
            "chrPrfWeap_locust_centertorso_laser_eh1",
            "chrPrfWeap_locust_centertorso_laser_eh2"
         ]
      },

For example the locust has only a flamer and a laser for the center torso.

WARNING:

  1. not all prefabs look different, some might still be placeholders
  2. some prefabs might be listed in the hardpointdatadef, but do not exist in the assestbundle

So the game takes the PrefabIdentifier from the mech and gets the model, now it checks all PrefabIdentifier assigned in the weapons and displays the prefab specified in the hardpointdatadef for the weapon at that location on the mech.

This is the regular flow, but it is possible to change the prefab for a specific part in the mechdef

   "inventory": [
        {
            "ComponentDefID": "Weapon_Laser_Medium",
            "ComponentDefType": "Weapon",
            "MountedLocation": "LeftArm",
            "HardpointSlot": 0,
            "DamageLevel": "Functional",
            "prefabName": null,
            "hasPrefabName": false
        },

The hasPrefabName flag can be used to assign a specific prefab to that pieces of equipment.


At least all this is the theory, because so far testing was not that succesfful and we can use some help in that area.

What we know:

  1. changing the PrefabIdentifier in the weapon give a generic weapon as a result, it might be that the identifier is not everything ?
  2. setting a prefabName in the mechdef results in a hang as the game can't find the prefab, maybe it needs to be a file or a different way to reference the assetbundle ?