Openplanet lib for ManiaScript game modes

A file by Dommy

Downloads 280
Created 7 years ago
Updated 3 years ago

A simple framework library automating the process of detecting Openplanet in game modes and game mode manialinks.

Usage

To use the library, you're required to load both the server-side lib in your game mode and the client-side lib within the playground ManiaApp.

In a ModeBase2 game mode:

#Include "Libs/domino54/Openplanet_Server.Script.txt" as Openplanet

***Match_LogVersions***
***
Log::RegisterScript(Openplanet::GetScriptName(), Openplanet::GetScriptVersion());
***

***Match_InitServer***
***
Openplanet::Load();
***

***Match_Yield***
***
Openplanet::Loop();
***

// Usage example:
Void UsageExample() {
    declare NbOpenplanetUsers = 0;

    foreach (Player in AllPlayers) {
        if (Openplanet::HasOpenplanet(Player)) {
            NbOpenplanetUsers += 1;
        }
    }

    // Shortcut of the above:
    NbOpenplanetUsers = Openplanet::NbOpenplanetUsers();

    log(NbOpenplanetUsers^" out of "^AllPlayers.count^" connected players have Openplanet installed.");
}

In an AppBase client ManiaApp:

#Include "ManiaApps/domino54/Openplanet_Client.Script.txt" as Openplanet

***LogVersions***
***
Log::RegisterScript(Openplanet::GetScriptName(), Openplanet::GetScriptVersion());
***

***LoadLibraries***
***
Openplanet::Load();

// Usage example:
if (Openplanet::IsOutdated()) {
    ClientUI.StatusMessage = "Your Openplanet build is outdated, please upgrade!";
}
***