Detecting Openplanet in ManiaScript
To detect Openplanet in ManiaScript, you check the value System.ExtraTool_Info
on the clientside. This will be a string containing the string "Openplanet" and a version. For example:
#Include "TextLib" as TL
// Returns true if the user has Openplanet installed
Boolean HasOpenplanet() {
return TL::RegexFind("^Openplanet ", System.ExtraTool_Info, "").count == 1;
}
// Returns the signature mode currently used in Openplanet
Text GetOpenplanetSignatureMode() {
declare Text[] SignatureMode = TL::RegexMatch(" \\[([A-Z]*)\\]$", System.ExtraTool_Info, "");
if (SignatureMode.count == 1) {
return SignatureMode[0];
}
return "REGULAR";
}
The signature modes available with Openplanet by default are:
OFFICIAL
- Only plugins shipped with Openplanet can run.REGULAR
- All signed plugins can run.DEVMODE
- All signed and unsigned plugins can run.
Certain custom signature modes can be returned here, too. For example, COMPETITION
is returned when the user has the TMGL signature mode enabled. If you wish to host your own competition with a custom set of approved plugins, please get in touch with us. However, we recommend using existing signature modes if possible.
The list of signature modes are "tiered", meaning that one signature mode allows its own set of plugins plus anything above. For example, REGULAR
also implies OFFICIAL
. In the case of TMGL, COMPETITION
sits above REGULAR
, which means that REGULAR
also implies COMPETITION
.
Note that this works only on the side where Openplanet is running, so if you want to check on the server if some client is running Openplanet, you'll have to send them a Manialink with the detection code and do a netwrite request and netread response. (We have some plans to make this easier to handle in the future.)