Jump to content

Steeringwheeluser component assumption failure

  • Fixed
function SteeringWheelUser:SteerInDir(dir_x, dir_z)
	-- if you are on a boat and the target heading is close enough to the current heading, don't do a steer.
	local dontsteer = false
	local rx, rz
	if self.boat ~= nil then
		self.boat.components.boatphysics:SetTargetRudderDirection(dir_x, dir_z)

		local tx,tz = self.boat.components.boatphysics:GetTargetRudderDirection()

		rx, rz = self.boat.components.boatphysics:GetRudderDirection()
		local TOLERANCE = 0.1

		if math.abs(tx - rx)<TOLERANCE and math.abs(tz - rz)<TOLERANCE then
			dontsteer = true
	if not dontsteer then
		self.should_play_left_turn_anim = (rz * dir_x - rx * dir_z) > 0

Variables rx and rz aren't initialized if the player isn't on a boat when this function calls, which it can via RPC, resulting in a server crash.

To fix I'd just initialize them both to zero:

local rx, rz = 0.0, 0.0


Steps to Reproduce

Send a steer boat RPC while not on a boat as a client.

  • Thanks 1

User Feedback

A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...