You could make it slow down the same way spaceships slow down in the first place: by applying a force in the opposite direction, proportional to the speed at which the ship goes, the same way you did to make it accelerate.
state.apply_central_force(-state.linear_velocity * some_factor)
I'm not sure how to make that last exactly 2 seconds though, it would need to be tweaked until it approaches that duration. That first approach is the most realistic one.
Another approach might be to get the linear velocity from within
_integrate_forces, reduce it manually and set it back to the
Something like this:
var speed = state.linear_velocity.length()
speed -= deceleration * delta
if speed < 0.0:
speed = 0.0
state.linear_velocity = state.linear_velocity.normalized() * speed
It's less realistic (not necessarily a problem tho), but you still need to tweak
deceleration so that it slows down to a halt in about 2 seconds. That may depend on the speed at which your ship was going before you decelerate.