Fix rare script error on Score.User
null
Downloads | 77,724 |
---|---|
Updated | 9 days ago |
Released | 3 years ago |
Created | 3 years ago |
Numeric ID | 255 |
Min. Openplanet | 1.26.0 |
This plugin provides other plugins with data about the current race. You might need to install it to make other plugins work.
Requires MLHook (you need to install that plugin too)
Please report performance issues! See bottom of page for who/where.
Currently exposed data:
TimeAttack
: sort by best timeRace
: sorted by race leaderRace_Respawns
: sorted by race leader, but updates ranking immediately when a player respawns to account for time-lossAdditional data exposure available upon request.
Some plugins already using MLFeed:
Include this in your info.toml
file:
[script]
dependencies = ["MLHook", "MLFeedRaceData"] # need both
see also: https://openplanet.dev/docs/reference/info-toml
Note: it is recommended that you use the Openplanet VSCode extension which will provide autocompletion and documentation for you when using MLFeed.
Several feeds are available that provide different information. The functions that provide the feeds are:
auto RaceData = MLFeed::GetRaceData_V4()
auto KoData = MLFeed::GetKoData()
-- for knockout mode (including COTD KO)auto GhostData = MLFeed::GetGhostData()
-- info about loaded ghostsauto MMData = MLFeed::GetTeamsMMData_V1()
-- info about matchmakingauto MapListUids = MLFeed::Get_MapListUids_Receiver()
-- info about the server map listThe main info for players can be accessed via the sorted RaceData
lists, getting via name, or getting via login:
auto player = RaceData.GetPlayer_V4(name)
auto player = RaceData.GetPlayer_V4_ByLogin(login)
auto leadInRace = cast<MLFeed::PlayerCpInfo_V4>(RaceData.SortedPlayers_Race[0])
auto leadInRace = cast<MLFeed::PlayerCpInfo_V4>(RaceData.SortedPlayers_RaceRespawns[0])
auto leadInTA = cast<MLFeed::PlayerCpInfo_V4>(RaceData.SortedPlayers_TimeAttack[0])
Note: all player classes can be cast to MLFeed::PlayerCpInfo_V4
-- the sorted arrays contain MLFeed::PlayerCpInfo_V2
for historical reasons.
PlayerCpInfo contains checkpoint and race data, respawn info, and a bunch of other useful info.
Full docs can be found in the export files:
Main type: HookRaceStatsEventsBase_V4
Example usage: doing something on player respawn.
uint lastRespawnCount = 0;
void Update(float dt) {
if (GetApp().CurrentPlayground is null) return;
// Get race data and the local player
auto RaceData = MLFeed::GetRaceData_V4();
auto player = RaceData.GetPlayer_V4(MLFeed::LocalPlayersName);
if (player is null) return;
// check for respawns
if (player.NbRespawnsRequested != lastRespawnCount) {
lastRespawnCount = player.NbRespawnsRequested;
if (lastRespawnCount != 0) {
startnew(OnPlayerRespawn);
}
}
}
void OnPlayerRespawn() {
// do stuff
}
Docs at end
The Demo UIs available in (openplanet's) developer mode (via Scripts
menu) & associated source code in the repo.
Example Usage - COTD Buffer Time
Example Optional Usage - List Players' PBs
Still curious about how to use something? Read the examples and use github search to find usages! Still not sure? Ask @XertroV on the Openplanet Discord
License: Public Domain
Authors: XertroV
Suggestions/feedback: @XertroV on Openplanet discord
Code/issues: https://github.com/XertroV/tm-mlfeed-race-data
GL HF
Fix rare script error on Score.User
null
PlayersLeftThisBatch
and friends