I've noticed a few mods reinventing the wheel so to speak when it comes to reading blueprint data, as well as many requests for being able to easily tell what units build what. To that effect, I am making a generalised blueprint info framework. This loads all the unit, tool and ammo data (and caches it in the session, so it doesn't re-load it all per scene), and then provides a large number of utility functions for it (currently 49). All blueprints include the non-overridden fields of any inherited blueprints, so you don't need to look up the chain. It does not expand weapons/build arms or ammo into the unit or weapon blueprints respectively, but does give many functions to access these separately. This also adds some additional information to the blueprints (added during loading; they are not written to the blueprint files): id - the id of blueprint path - the file path of the blueprint buildIndex (for units) - an integer that determines the order that units appear in the build menu (lowest first) inheritance - an array of blueprints that form the inheritance chain for this blueprint inherited - an array of blueprints that inherit this blueprint unit_types - adds an additional unit type called "UNITTYPE__<unitID>" to all units. Note the extra underscore (to prevent clashes with existing types, such as with bomber). This allows you add or exclude individual units when filtering. buildPicture - The path to the unit's build picture, or null if it's not available. strategicIcon - The path to the unit's strategic icon, or the generic blip icon if a specific one is not available. Documentation for each of these functions can be found within the code; additionally, this will be collated into an online reference. Current functions include: General Functions bif.getBIFReady() bif.registerBIFReadyCallback(functionCallback) bif.sortBlueprintsByAttribute(blueprints, attribute, type, ascending) bif.sortBlueprintAlphabetically(blueprint) bif.getBlueprintIDsFromBlueprints(blueprints) bif.getBlueprintIDFromPath(path) Unit Functions bif.unitBlueprintExists(unitID) bif.unitHasType(unitID, type) bif.getUnitBlueprintsFromArray(unitIDArray) bif.getUnitName(unitID) bif.sortBlueprintsByBuildOrder(blueprints) bif.getUnitBlueprint(unitID) bif.getUnitBlueprintInline(unitID) bif.getUnitBlueprints() bif.getUnitIDs() bif.getUnitBlueprintToolIDs(unitID) bif.getUnitBlueprintTools(unitID) bif.getUnitBlueprintWeaponIDs(unitID) bif.getUnitBlueprintWeapons(unitID) bif.getUnitBlueprintBuildArmIDs(unitID) bif.getUnitBlueprintBuildArms(unitID) bif.getFilteredUnitIDs(filter) bif.getFilteredUnitIDsFromArray(unitIDArray, filter) bif.getFilteredUnitBlueprints(filter) bif.getFilteredUnitBlueprintsFromArray (unitIDArray, filter) bif.getUnitBuildableTypeUnitIDs(unitID) bif.getUnitBuildableTypeBlueprints(unitID) bif.getUnitBuiltByUnitIDs(unitID) bif.getUnitBuiltByBlueprints(unitID) bif.getUnitIDIsBuiltBy(unitID, builderUnitID) bif.getUnitIDIsBuildable(unitID, baseBuilderUnitID) bif.getBuildableUnitIDsFromArray(unitIDArray, baseBuilderUnitID) bif.getBuildableUnitIDs(startUnitID) Tool Functions bif.toolBlueprintExists(toolID) bif.getToolBlueprintsFromArray(toolIDArray) bif.getToolBlueprint(toolID) bif.getToolBlueprintInline(toolID) bif.getToolBlueprints() bif.getToolIDs() bif.getWeaponBlueprints() bif.getWeaponBlueprintIDs() bif.getBuildArmBlueprints() bif.getBuildArmBlueprintIDs() bif.getWeaponBlueprintAmmoID(weaponID) bif.getWeaponBlueprintAmmo(weaponID) Ammo Functions bif.ammoBlueprintExists(ammoID) bif.getAmmoBlueprintsFromArray(ammoIDArray) bif.getAmmoBlueprint(ammoID) bif.getAmmoBlueprints() bif.getAmmoBlueprintIDs() Knockout Observables bif.loaded_units() bif.loaded_tools() bif.loaded_ammo() bif.loaded_images()
Check cola_colin's https://github.com/pamods/uimod-pa_stats/blob/master/pa_stats/lib/unitInfoParser.js And my bastardized version to get it in the preferred hotbuild2 settings format with "is build-able check" ... https://github.com/pietervanh/hotbuild2/blob/master/ui/mods/hotbuild2/settings/hotbuild_settings.js Line 6 and 89 On ideas what's needed
Please add support for figuring out how much build power the fabricators and factories have (i.e. metal and energy usage when fabbing). That would let me remove the current hack that the Build Power mod uses to get that information. The build power is not directly in a unit's specs, but in the tools that they use, as shown below. I wonder that should the "spec_id" reference be inlined, the same way that "base_spec" is, to produce the complete runtime presentation of the unit spec. \pa\units\land\fabrication_bot\fabrication_bot.json Code: ... "tools": [ { "aim_bone": "bone_root", "spec_id": "/pa/units/land/fabrication_bot/fabrication_bot_build_arm.json" } ], ... \pa\units\land\fabrication_bot\fabrication_bot_build_arm.json Code: { "base_spec": "/pa/tools/engineer_build_arm/engineer_build_arm.json", "construction_demand": { "energy": 1000, "metal": 10 }, "pitch_rate": 90, "yaw_rate": 90 }
Build arms, weapons and ammo blueprints are planned to be included also. Added function "getUnitBlueprintsByFilter", plus a few other misc functions. I've changed the name to "Blueprint Info Framework", to avoid possible confusion between actual units and unit blueprints. Edit: Updated to include functions for Tools (Weapons & Build Arms).
Lots of work done here. Current method count is 46; this should be it unless people start thinking of more . I'll hopefully have it up within the next day or two. You'd want to do something like: Code: var theUnitID = "fabrication_bot"; var buildArms = getUnitBlueprintBuildArms(theUnitID); $.each(buildArms, function (key, value) { console.log(value.construction_demand.metal]); console.log(value.construction_demand.energy]); }); This will return the metal & energy demands of all build arms (likely to only ever be 1 of these though ).
v1.0.0 Released. Added some additional functions, as well the "inheritance" attribute & added the unit ID to the unit_types array for easier filtering. Also moved all functions into the bif object to clear up the namespace.
v1.1.0 released. Added attributes "strategicIcon" and "buildPicture" to all units Added function "getUnitBlueprintInline(unitID)" Added function "getToolBlueprintInline(toolID)"
When I boot PA I get the following. It starts off spinning but then stops spinning after a second or two. Waiting for a minute or two changes nothing. Disabling the blueprint mod fixes it. I'm on OS X with the latest version of PA. Any idea what's going on?
Are there any errors shown in the coherent debugger / PA logs? Edit: If no errors are found, can you also try and start it up again, and just try and leave it for a bit longer? Maybe the Mac implementation has bad performance in certain circumstances, or isn't multithreaded or something like that (this would increase the loading time by quite a bit). If this is the case, we can work on narrowing down what the problem function is and how to fix it.
I'm having the same issue (see gist: Alphasite/bc22a31c6448855482b7 for the log). It doesn't look like theres anything related to the mod in there.
Can you copy the log from within the coherent debugger? It includes additional console output from the mod.
Here it is: Alphasite/1fdf8802b66057787461 The game locks up after the spinner spins for a few seconds.
So I can see that it finishes loading the unit blueprints, but doesn't finish the tool/ammo blueprints, and only checks 1 strategic icon. At this stage my hunch is that it's with the strat icon/build pic loading. I *think* the next blueprint that it would attempt to find the icon for would be base_structure,which as a base blueprint wouldn't have an icon. For me, that simply doesn't return a 200 success code, so i mark it as having the blip icon and move on. Maybe something there doesn't work the same way on other OSs.
well, since they're on mac, you could test with an iatkos release in a vm as we try to do for hotbuild2...
Not sure on a mac. Somewhere in the PA directory is a coherent debugger application. You might just have to dig for it.
From what I've seen, all the game files are located in the same places from PC to Mac. I'm looking in the PA folder and I only see unit/building/etc files. There's a "debug" folder, but it has a few .papa files, and that's it. I'm looking elsewhere and I don't see much.