Lua API: remove move unit side effects
They currently work in S3_1, don't they?
We are assumed to keep compatibility over at least one version, during which the author can migrate. So this could be targeted to 3.2 at the earliest.
So add a deprecation warning that the side effects will go away in 3.2?
Is there any documentation on the exact policy for Lua?
Do we have a policy against adding additional parameters to a Lua-function as long as the old call still works? (Missing parameters are nil)
I think I have an idea on how to make it easy to migrate to 3.2.
Once #41730 lands and we have a way of looking for the diplomatic relationship war and preferably also unit class flags from Lua the current Unit:move() and Unit:teleport() can be deprecated.
New attempt. This time after deprecation in 3.1.
Unit:move() and Unit:teleport() accumulated many exceptions to enabler defined rules as more and more parts of regular unit move can under action enabler control. They were able to conquer cities, embark into transports, conquer extras and pop huts. The
The reason for the exceptions was strict backwards compatibility. Freeciv can't know if a ruleset or scenario author intended a move as what now was an enabler controlled action. The action side effect of the move may have been intended by, irrelevant to or overlooked by the script author.
Keeping this stirct backwards compatibility made it difficult to move certain rules to the ruleset. The best that could be done for them was obligatory hard requirements.This is why much hasn't moved to the ruleset yet.
The exceptions can also make a ruleset author - assuming a call to unit_move() is a regular move - accidentally trigger behavior currently controlled by actions and end up breaking his own rules in a Lua script.
A unit can now be forced to perform an action - as long as it is legal - with Unit:perform_action().
Given the above I say that the time has come to purge some side effects. Remove the city conquest, extra conquest and hut popping side effects. Allow embarking to stay for now. Someone may use one of the functions to teleport into a transport or something like that.