You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a suggestion to change the script HoseSystemRegister.lua:
function HoseSystemRegistrationHelper.loadVehicle(super, vehicleData, asyncCallbackFunction, asyncCallbackObject, asyncCallbackArguments)
local customEnvironment, _ = Utils.getModNameAndBaseDirectory(vehicleData.filename)
--if customEnvironment ~= nil then
local typeDef = VehicleTypeUtil.vehicleTypes[vehicleData.typeName]
local specializations = typeDef.specializations
local specializationNames = typeDef.specializationNames
for i = 1, #specializations do
local specializationName = specializationNames[i]
--if specializationName ~= nil and specializationName:lower() == string.format('%s.%s', customEnvironment, HoseSystemRegistrationHelper.HOSE_SYSTEM_SPEC_KEY):lower() then
local specialization = specializations[i]
if specialization.preLoadHoseSystem ~= nil then
super.xmlFile = loadXMLFile('TempConfig', vehicleData.filename)
local vehicleLoadState = specializations[i].preLoadHoseSystem(super, vehicleData.savegame)
if vehicleLoadState ~= nil and vehicleLoadState ~= BaseMission.VEHICLE_LOAD_OK then
HoseSystemUtil:log(HoseSystemUtil.ERROR, specializationName .. "-specialization 'preLoadHoseSystem' failed!")
if asyncCallbackFunction ~= nil then
asyncCallbackFunction(asyncCallbackObject, nil, vehicleLoadState, asyncCallbackArguments)
end
return vehicleLoadState
end
if not super.hoseSystemLoaded then
HoseSystemRegistrationHelper:register(super, typeDef.specializations, vehicleData.filename)
end
delete(super.xmlFile)
super.xmlFile = nil
end
--end
end
--end
end
Hey there are reasons why i check on those fields. I don't want to hook into every vehicle.
Also the fact by just deleting the check on nil values which uses a different index to iterate isn't going to be 'safe', if we talk about the range of scripts we currently have available in the modding scene.
Really cool that you want to make a script extension for inserting the functionality into the default vehicles.. but that can be done without touching the main script.
Think about mocking the HoseSystemVehicle.lua and insert that after you did the xml related stuff.
I have a suggestion to change the script HoseSystemRegister.lua:
To support Mods / Scripts like this:
zzz_ExtendStdVeh_HoseSystem.zip
The text was updated successfully, but these errors were encountered: