Skip to content

Commit

Permalink
Fix for #173
Browse files Browse the repository at this point in the history
- handle sending of null useConfigName strings
- add printed text to show sizes in the shop (not final design)
  • Loading branch information
loki79uk committed Dec 20, 2024
1 parent 90b8821 commit a8e45ce
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 46 deletions.
43 changes: 0 additions & 43 deletions UniversalAutoloadInstaller.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1453,55 +1453,12 @@ function UniversalAutoloadManager.handleNewVehicleCreation(vehicle)
print("CREATE SHOP VEHICLE: " .. vehicle:getFullName())
spec.isInsideShop = true
UniversalAutoloadManager.shopVehicle = vehicle
-- configuration will be handled in onUpdate loop
return configurationAdded

elseif vehicle.propertyState == VehiclePropertyState.OWNED
or vehicle.propertyState == VehiclePropertyState.LEASED then
print("CREATE REAL VEHICLE: " .. vehicle:getFullName())
spec.isInsideShop = false

-- local importVehicle = nil
-- if UniversalAutoloadManager.shopVehicle then
-- print("SHOP VEHICLE STILL EXISTS " .. UniversalAutoloadManager.shopVehicle.rootNode )
-- importVehicle = UniversalAutoloadManager.shopVehicle
-- elseif UniversalAutoloadManager.lastShopVehicle then
-- print("WORKSHOP VEHICLE STILL EXISTS " .. UniversalAutoloadManager.lastShopVehicle.rootNode )
-- importVehicle = UniversalAutoloadManager.lastShopVehicle
-- UniversalAutoloadManager.lastShopVehicle = nil
-- end

-- local importSpec = importVehicle and importVehicle.spec_universalAutoload
-- if importSpec and UniversalAutoloadManager.shopConfig then
-- local configsMatch = spec.selectedConfigs == importSpec.selectedConfigs
-- local configNamesMatch = spec.useConfigName == nil or importSpec.useConfigName == nil or spec.useConfigName == importSpec.useConfigName

-- if configsMatch and configNamesMatch then

-- print("CLONE SETTINGS FROM SHOP VEHICLE")
-- if not importSpec.loadArea then
-- print("ERROR: importSpec.loadArea is nil")
-- return
-- end

-- local importSpec = importVehicle.spec_universalAutoload
-- for k, v in pairs(UniversalAutoload.OPTIONS_DEFAULTS) do
-- local id = v.id
-- print(tostring(id) .. " = " .. tostring(importSpec[id]))
-- spec[id] = importSpec[id]
-- end

-- spec.loadArea = {}
-- for i, loadArea in (importSpec.loadArea) do
-- spec.loadArea[i] = deepCopy(importSpec.loadArea[i])
-- end
-- configurationAdded = true

-- print("DEBUG: spec after cloning:")
-- DebugUtil.printTableRecursively(spec, " --", 0, 2)
-- end
-- end

return configurationAdded
end
end
Expand Down
3 changes: 2 additions & 1 deletion events/UpdateDefaultSettingsEvent.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function UpdateDefaultSettingsEvent:readStream(streamId, connection)
local selectedConfigs = streamReadString(streamId)
print("selectedConfigs: " .. tostring(selectedConfigs))
local useConfigName = streamReadString(streamId)
useConfigName = useConfigName ~= "" and useConfigName or nil
print("useConfigName: " .. tostring(useConfigName))

local config = {}
Expand Down Expand Up @@ -110,7 +111,7 @@ function UpdateDefaultSettingsEvent:writeStream(streamId, connection)
print("selectedConfigs: " .. tostring(self.selectedConfigs))
streamWriteString(streamId, self.selectedConfigs)
print("useConfigName: " .. tostring(spec.useConfigName))
streamWriteString(streamId, spec.useConfigName)
streamWriteString(streamId, spec.useConfigName or "")

print("options:")
iterateDefaultsTable(UniversalAutoload.OPTIONS_DEFAULTS, "", ".options", spec, sendValues)
Expand Down
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modDesc descVersion="92">

<author>loki_79</author>
<version>0.3.0.0</version>
<version>0.3.0.1</version>

<title>
<en>Universal Autoload</en>
Expand Down
4 changes: 3 additions & 1 deletion scripts/LoadingVolume.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ function LoadingVolume:draw(drawAll)

drawDebugPoint(p[1], p[2], p[3], r, g, b, a, solid)
end


local size = bb:getSize()
renderText(0.4, 0.92-(n*0.035), 0.025, string.format("[%d] W, H, L = %.3f, %.3f, %.3f", n, size.x, size.y, size.z))
end
end
end
Expand Down

0 comments on commit a8e45ce

Please sign in to comment.