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

Commit

Permalink
Revert "v01.0166 Fixed bouncing speed in turn"
Browse files Browse the repository at this point in the history
This reverts commit c53abd6.
  • Loading branch information
pvaiko committed Apr 7, 2019
1 parent c53abd6 commit b2f7841
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 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.00166</version>
<version>6.01.00165</version>
<author><![CDATA[Courseplay.devTeam]]></author>
<title>
<br>CoursePlay SIX</br>
Expand Down
4 changes: 2 additions & 2 deletions register.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ AIVehicleUtil.driveInDirection = function (self, dt, steeringAngleLimit, acceler
if math.abs(angle) >= slowAngleLimit then
maxSpeed = maxSpeed * slowDownFactor;
end
self:getMotor():setSpeedLimit(maxSpeed);
if self:getCruiseControlState() ~= Drivable.CRUISECONTROL_STATE_ACTIVE then
self.spec_motorized.motor:setSpeedLimit(maxSpeed);
if self.spec_drivable.cruiseControl.state ~= Drivable.CRUISECONTROL_STATE_ACTIVE then
self:setCruiseControlState(Drivable.CRUISECONTROL_STATE_ACTIVE);
end
else
Expand Down
22 changes: 14 additions & 8 deletions turn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -807,16 +807,22 @@ function courseplay:turn(vehicle, dt)
local holdInTurn = not vehicle.cp.headlandTurn and vehicle.cp.driver and vehicle.cp.driver:holdInTurnManeuver(vehicle.cp.turnStage == 0)
allowedToDrive = not holdInTurn and allowedToDrive

if math.abs(vehicle.lastSpeedReal) < 0.0001 and not g_currentMission.missionInfo.stopAndGoBraking then
if not moveForwards then
vehicle.nextMovingDirection = -1
else
vehicle.nextMovingDirection = 1
--courseplay.debugVehicle(14, vehicle, 'turn speed = %.1f, allowedToDrive %s', refSpeed, allowedToDrive)
--vehicle,dt,steeringAngleLimit,acceleration,slowAcceleration,slowAngleLimit,allowedToDrive,moveForwards,lx,lz,maxSpeed,slowDownFactor,angle
if curTurnTarget and ((curTurnTarget.turnReverse and reversingWorkTool ~= nil) or (courseplay:onAlignmentCourse( vehicle ) and vehicle.cp.curTurnIndex < 2 )) then
if math.abs(vehicle.lastSpeedReal) < 0.0001 and not g_currentMission.missionInfo.stopAndGoBraking then
if not moveForwards then
vehicle.nextMovingDirection = -1
else
vehicle.nextMovingDirection = 1
end
end
end

AIVehicleUtil.driveInDirection(vehicle, dt, vehicle.cp.steeringAngle, directionForce, 0.5, 20, allowedToDrive, moveForwards, lx, lz, refSpeed, 1);

AIVehicleUtil.driveInDirection(vehicle, dt, vehicle.cp.steeringAngle, directionForce, 0.5, 20, allowedToDrive, moveForwards, lx, lz, refSpeed, 1);
else
dtpZ = dtpZ * 0.85;
AIVehicleUtil.driveToPoint(vehicle, dt, directionForce, allowedToDrive, moveForwards, dtpX, dtpZ, refSpeed);
end;
courseplay:setTrafficCollision(vehicle, lx, lz, true);
end;

Expand Down

0 comments on commit b2f7841

Please sign in to comment.