Lua Scripting (#1334)

Closes #83
Fixes #1309
Fixes #1287
Fixes #1129 (actually fixed now)
This commit is contained in:
maybegreat48
2023-06-06 07:40:40 +00:00
committed by GitHub
parent a8750a30fb
commit 70efa40afe
202 changed files with 156693 additions and 839 deletions

View File

@ -1,3 +1,4 @@
#include "core/data/weathers.hpp"
#include "fiber_pool.hpp"
#include "util/session.hpp"
#include "views/view.hpp"
@ -6,36 +7,36 @@ namespace big
{
void view::time_and_weather()
{
if (ImGui::TreeNode("LOCAL_TIME"_T.data()))
components::command_checkbox<"timeoverride">();
if (g.world.custom_time.override_time)
{
ImGui::Checkbox("OVERRIDE_TIME"_T.data(), &g.session.override_time);
if (g.session.override_time)
{
ImGui::SliderInt("HOUR"_T.data(), &g.session.custom_time.hour, 0, 23);
ImGui::SliderInt("MINUTE"_T.data(), &g.session.custom_time.minute, 0, 59);
ImGui::SliderInt("SECOND"_T.data(), &g.session.custom_time.second, 0, 59);
}
ImGui::TreePop();
ImGui::SliderInt("HOUR"_T.data(), &g.world.custom_time.hour, 0, 23);
ImGui::SliderInt("MINUTE"_T.data(), &g.world.custom_time.minute, 0, 59);
ImGui::SliderInt("SECOND"_T.data(), &g.world.custom_time.second, 0, 59);
}
if (ImGui::TreeNode("LOCAL_WEATHER"_T.data()))
components::command_checkbox<"weatheroverride">();
if (g.world.override_weather)
{
components::button("CLEAR_OVERRIDE"_T, [] {
MISC::CLEAR_OVERRIDE_WEATHER();
});
if (ImGui::ListBox("##weather-listbox", &g.session.local_weather, session::weathers, 15))
if (ImGui::BeginCombo("Weather", weathers[g.world.local_weather]))
{
g_fiber_pool->queue_job([] {
session::local_weather();
});
for (int i = 0; i < weathers.size(); i++)
{
if (ImGui::Selectable(weathers[i], g.world.local_weather == i))
{
g.world.local_weather = i;
}
ImGui::ListBoxFooter();
if (g.world.local_weather == i)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::TreePop();
}
}
}