Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
6.01.00167 Workaround for vehicles with articulated axis
Browse files Browse the repository at this point in the history
Workaround for a Giants bug in ArticulatedAxis to fix maxRotation, see
issue #3538.

Also fixed the Attachable postload function, it wasn't doing anything
as the function name changed.
  • Loading branch information
pvaiko committed Apr 8, 2019
1 parent b2f7841 commit fff31df
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modDesc.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<modDesc descVersion="40">
<version>6.01.00165</version>
<version>6.01.00167</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title>
<br>CoursePlay SIX</br>
Expand Down
12 changes: 11 additions & 1 deletion register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,17 @@ function courseplay:attachablePostLoad(xmlFile)
self.name = courseplay:getObjectName(self, xmlFile);
end;
end;
Attachable.postLoad = Utils.appendedFunction(Attachable.postLoad, courseplay.attachablePostLoad);
Attachable.onPostLoad = Utils.appendedFunction(Attachable.onPostLoad, courseplay.attachablePostLoad);

function courseplay:articulatedAxisOnLoad()
-- Due to a bug in Giant's ArticulatedAxis:onLoad() maxRotation has a value in degrees instead of radians,
-- fix that here.
if self.maxRotation > math.pi then
print(string.format('## %s: fixing maxRotation, setting to %.0f degrees', self:getName(), self.maxRotation))
self.maxRotation = math.rad(self.maxRotation)
end
end
ArticulatedAxis.onLoad = Utils.appendedFunction(ArticulatedAxis.onLoad, courseplay.articulatedAxisOnLoad)

function courseplay:attachableDelete()
if self.cp ~= nil then
Expand Down
2 changes: 1 addition & 1 deletion specialTools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ function courseplay:setCustomSpecVariables(vehicle)
end;
end;

for i, spec in ipairs(VehicleTypeUtil.vehicleTypes[vehicle.typeName].specializations) do
for i, spec in ipairs(g_vehicleTypeManager.vehicleTypes[vehicle.typeName].specializations) do
if specToSpecClassName[spec] ~= nil then
local varName = specToSpecClassName[spec]:gsub('^%l', string.upper):gsub('_', ''); -- first char uppercase, remove underscores
vehicle.cp['hasSpecialization' .. varName] = true;
Expand Down

0 comments on commit fff31df

Please sign in to comment.