Let the game compute other medals & add humain readable time

This commit is contained in:
Beu 2021-05-05 11:27:25 +02:00
parent c1024b39c0
commit 32cb4d75ef

View File

@ -1,6 +1,8 @@
#name "Map Validator"
#author "Beu"
#category "Map Editor"
#siteid 91
#version "1.2"
// Based on the Moski plugin which is also based on the Miss plugin :)
@ -24,9 +26,6 @@ void validate(int author_time) {
}
if (map !is null) {
map.TMObjective_AuthorTime = author_time;
map.TMObjective_BronzeTime = author_time * 4;
map.TMObjective_SilverTime = author_time * 3;
map.TMObjective_GoldTime = author_time * 2;
}
}
@ -40,10 +39,22 @@ void Render() {
UI::Begin("\\$cf9" + Icons::Flag + "\\$z Map Validator###MapValidator", menu_visibility, UI::WindowFlags::NoResize | UI::WindowFlags::AlwaysAutoResize | UI::WindowFlags::NoCollapse);
if (app.RootMap !is null) {
author_time = UI::InputInt("Author time in ms", author_time ,1);
if (author_time < 0) author_time = 0;
if (UI::Button("Validate")) {
validate(author_time);
menu_visibility = false;
}
// Convert time in ms to humain readable time
string display_time = Text::Format('%02d',(author_time / 1000 / 60) % 60) + ":" + Text::Format('%02d',(author_time / 1000) % 60) + "." + Text::Format('%03d',author_time % 1000);
if (Math::Floor(author_time / 1000 / 60 / 60) > 0) {
display_time = Text::Format('%d',author_time / 1000 / 60 / 60) + ":" + display_time;
}
UI::SameLine();
UI::Text("with " + display_time + " of author time");
} else {
UI::Text("Open this plugin in the map editor");
}