fixes#1649 . ai.synced_command could easily be used to implement all types of
undeteced cheats so it was removed. As a replacement this commit adds a
[custom_command] synced command that just calls
wesnoth.game_events.on_synced_command which calls a lua handler that
must first be set.
This removes the Lua deprecation_message function in favour of exposing the C++ variant to Lua instead.
It also moves all deprecation messages to a separate logdomain, making them easily enabled en masse.
This reverts commit 1d84d83c6c.
I had introduced use of the hidden= key in b2df837d8e, but
apparently didn't add them to the valid list of non-aspect keys.
The previous version caused errors under some circumstances when an
event removed units other than the attacker during or immediately after
an AI attack.
When the AI moves a unit out of the way for another unit’s move, it is
occasionally possible for the former unit to use up all its movement
points (e.g. if it has few MP or on narrow crowded maps). If that unit
is on the list to be moved later during the same sequence, this caused
ai_helper.robust_move_and_attack() to return nil, which then made the
Fast Micro AI produce an error message.
It was left there in cfb2aa8050 for backward compatibility. However,
this causes a “duplicate AI” error at start-up in debug mode.
Furthermore, the file is not included in any current 1.12 or 1.13
add-on, so it should be safe to remove it. Using
[ai]ai_algorithm=idle_ai is the preferred option to include the Idle AI.
As indicated in the comment of the idle_ai config file, an AI needs to
contain at least one stage, otherwise the default AI will be injected
under certain circumstances. Unlike indicated in the comment, this now
also applies to loading a mid-scenario save. (I will add that to the
comment in the next commit.)
As this AI was in data/ai/dev/, it was previously only loaded when
Wesnoth was started in debug mode. The config was thus not available
when playing in no-debug mode, causing the default AI to be injected on
reload. This caused issue #1955.
While not strictly necessary, we keep a redirect in data/ai/dev for
backward compatibility, in case the file is included in add-ons.
The WFL min() function was changed from returning zero to returning an
error when an empty list is passed as argument (commits eccd3d8e and
fd9f1153). This adapts the Poisoner FAI code to deal with that
correctly.
(as proposed by @DeFender1031)
All existing deprecation messages in the Lua code have been changed to
use the new deprecation system.
The goal is to eventually use an equivalent system for ALL areas of the API.
This covers all the main higher-order functions included in WFL, except zip.
The two already implemented in ai_helper have been replaced with redirection stubs.
This is done by ignoring shroud for path finding (while still taking
hidden units into account correctly), consistent with default Wesnoth
AI behavior.
Otherwise it is too easy to exploit this by baiting the AI leader to
run into a trap, and it is too difficult for what it's worth to make
sure the attack location is safe. If only the side leader is left to do
such an attack, it's more often than not not a good idea to do so
anyway.
This is not necessary for most other Micro AIs, but this AI moves many
units per execution for speed reasons. If an ambush or failed teleport
or similar happens, it is better to reconsider rather than pull through
with the rest of the moves.
This function is supposed to be able to deal with all kinds of rare and
weird events without throwing errors, but it should still return a
status table describing what happened. The vast majority of situations
will simply return the move_result tables. For all the strange stuff
that could also happen due to WML events etc., we set up dummy tables
with the same structure and (somewhat) descriptive error messages
instead.
ai_helper.get_attacks() now excludes hidden enemies by default -> they
need to be specifically included if they are to be attacked, as opposed
to having to be excluded when not.
This is not necessary for most other Micro AIs, but this AI moves
several units per execution. If an ambush or failed teleport or similar
happens, it is better to reconsider rather than pull through with the
previously planned moves.
This is not necessary for most other Micro AIs, but this AI moves
several units per execution. If an ambush or failed teleport or similar
happens, it is better to reconsider rather than pull through with the
previously planned moves.