Right now of course no GS support that, and no AIs too, but with the libs any AIs can run and ask money to a GS that handle that.
The key is to implement this, the AIs just need to add the lib and the GS just need to add the GS version of the lib.
Done that because i get bore streetcars get out of money and collapse, while i could implement this into my gamescript (well, ok only awards as it's the only i have done), building libs will allow any GS to gave that feature, so you could have a nocargoal or transportgoal (Zuu if you read this) or your favorite GS to play with, but still have your little toy AI keep doing their work. Isn't that nice, having both of the two worlds?
So ToyLib is 4 parts : ToyLib for GS, ToyLib for AI, a simple test AI, and a test GS (that i will upload to bananas), as it do nothing, yes, nothing by itself, but use the lib so its only work is providing money. Some users may wish play with a "no GS" stock openttd but still allow the toys AI to not collapse.
Everything is under GPLv2 license, the repo is again host (thank you very much guys!!!) there : https://dev.openttdcoop.org/projects/gslibrary-toy/
The libs use SCP to communicate with the AIs and avoid anyone use it to cheat for money. So only AIs can ask money, and only ones using the libs. If i see AI that aren't for toys/eyes candy... purpose using it to cheat, i will add a blacklist in it, as right now, any AI using the lib is allow to ask money (yeah, i might be foul, but i trust AI authors). GS can use a function to enable/disable giving money, so if the GS author add the option, server admins should still keep their trust on your script.
The libs are made to handle SCP for you, so SCP usage is abstract to anyone not knowing SCP, i've done the implementation as easy and minimal as i could. (Look at the samples given to see how it's easy).
Here's howto adapt your script to use them :
For an AI:
Add needed libs
Code: Select all
import("Library.AIToyLib", "AIToyLib", 1); // importing the ToyLib
import("Library.SCPLib", "SCPLib", 45); // If your AI use SCP you have that already
Code: Select all
local dummy_init = AIToyLib(null); // for an AI not using SCP
local dummy_init = AIToyLib(your_scp_handle); // for an AI using SCP
Code: Select all
AIToyLib.Check(); // for an AI not using SCP only, AI using SCP don't need that
Code: Select all
AIToyLib.ToyAskMoney(amount_of_money);
Add needed libs
Code: Select all
import("Library.GSToyLib", "GSToyLib", 1); // importing the ToyLib
import("Library.SCPLib", "SCPLib", 45); // GS using SCP have that already
Code: Select all
local dummy_init = GSToyLib(null); // for a GS not using SCP
local dummy_init = GSToyLib(your_scp_handle); // for a GS using SCP
Code: Select all
GSToyLib.Check(); // For a GS not using SCP only, GS using SCP don't need it
I have add a function to output stats of companies that get money from your GS (see GSToyLib.LogStats), server admin might enjoy having the option to use that function.