- Fix const on
PlayersLeftThisBatch
and friends - Fix edge case sorting unspawned players with race ranking
- Fix spawn counter and spawn index so spawn indexes are the same for players spawning on the same frame
Downloads | 62,889 |
---|---|
Updated | 9 days ago |
Released | 2 years ago |
Created | 2 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
PlayersLeftThisBatch
and friendsA game restart may be required after updating
MapListUids_Receiver@ MLFeed::Get_MapListUids_Receiver()
bool MapList_Request()
- initiate a request, does nothing & returns false if a request is already in progress. Max 25* UIDs are returned.bool MapList_Request_Larger(int nbMaxUids)
- as above but increases the number of UIDs returned for the next request only.bool MapList_IsInProgress
- is a request in progressconst array<string>@ MapList_Names
- names of maps returned from the MapList request. Limited to 25* for performance reasons. const array<string>@ MapList_MapUids
- map UIDs returned from the MapList request. Limited to 25* for performance reasons, but it's the slice starting immediately after the current map.uint UpdateCount
- incremented whenever data is received from the Maniascript componentuint64 LastRequestStart
- Time::Now when the last request starteduint64 LastRequestEnd
- Time::Now when the last request finisheduint64 MsSinceLastReqStart
- millis since LastRequestStart
uint64 MsSinceLastReqEnd
- millis since LastRequestEnd
int Slice_StartIx
- Start index of the slice of map uids shown.int Slice_EndIx
- End index of the slice of map uids shown; can be greater than Slice_NbMaps
.int Slice_NbMaps
- The complete number of maps in the MapList response.int MapOrigIxInList
- The original index of the map in the UID list when the map loaded. (If you update the current map in the map list later, this is important information to know.)string MapOrigIxInListUid
- The UID of the map for which MapOrigIxInList applies.string[]@ GetUidSlice_Async(int startIx, int endIx)
- Read a slice from MapList_MapUids. Will yield for 1-3 frames in total.PlayerCpInfo_V4@ HookRaceStatsEventsBase_V2::GetPlayer_V4_ByLogin(const string &in login)
int HookRaceStatsEventsBase::get_Rules_MillisSinceStart()
int HookRaceStatsEventsBase::get_Rules_TimeElapsed()
int HookRaceStatsEventsBase::get_Rules_TimeRemaining()
bool HookRaceStatsEventsBase::IsRemainingRulesTimeLessThan(int durationMs)
uint HookRaceStatsEventsBase::PlayersLeft_BatchNumber
string[]@ HookRaceStatsEventsBase::PlayersLeftThisBatch
uint[]@ HookRaceStatsEventsBase::PlayersLeftThisBatch_LoginIdValues
int PlayerCpInfo_V2::get_FinishTime()
MwId PlayerCpInfo_V4::LoginMwId
MwId PlayerCpInfo_V4::NameMwId
const PlayerCpInfo_V4@ HookRaceStatsEventsBase_V4::get_LocalPlayer()
MLFeed::LocalPlayersLoginIdValue
MwId::Value
for the local player's login.PlayerCpInfo_V4::FindCSmPlayer()
not being const*: there's an off by 1 error with the number of uids returned, so the max is 1 more than specified.