Closed springjools closed 9 years ago
preGameCheck($force,$checkOnly,$automatic)
callback added in commit 433a596
"The return value must be the reason for preventing the game from starting" => Does it then say something like:
"Unable to start the game: the game will start in 5 seconds..."
If you add "the game will start in 5 seconds..." to the reason?
If the game is being launched manually (through !start or !forceStart), yes
Ok, I don't know if this is the right place to discuss plugins, but I now made a countdown plugin that looks like this: http://pastebin.com/BPtM34vs
The problem is that if the user wants to implement a countdown that doesn't output that cancel message, he has to implement the prespadscommand callin instead, and that bypasses also the rest of the startgame-checking, so you basically have to implement the start command from scratch.
Maybe I have overlooked something, but it would seem easier to use the pregame callin instead, but then it's a bit of an annoyance to output a reason for doing something that is always expected to happen.
Plugins can now return the special value "1" from the preGameCheck callback to prevent the game from starting without generating a message in the battle lobby: 8b4a39e
Great! Thanks.
beforeStart($automatic,$force)
This callback is called each time a before the SPADS launchgame command is going to be executed.
It must return 0 to prevent the command from being treated by other plugins and executed by SPADS core, or 1 to allow it.
Tested with this countdown http://pastebin.com/PMsMDzGP spads plugin or elderberry autohost, which adds a 5 second countdown before allowing the game to launch. Tested with returning both 0 and 1. The only issue is line 42 with :
$automatic = 0 if (!$automatic);
, which is a bit hacky, but without it the $automatic variable will not be initialised and there will be a warning in slog.