Fixing bugs, change dialogue translations
This commit is contained in:
1 parent
ca73148f4b
commit
9f17d51fc8
12 files changed
+50
-809
No files matched your search
@@ -776,8 +776,6 @@ namespace ZL
|
||||
void Game::createLocationsStep5()
|
||||
{
|
||||
|
||||
|
||||
|
||||
rearmDormOneShotCallbacks();
|
||||
|
||||
menuManager.callTaxiFunc = [this]()
|
||||
|
||||
@@ -95,10 +95,12 @@ void GameState::load(const nlohmann::json& in)
|
||||
money = in.value("money", money);
|
||||
|
||||
// --- Script globals ---
|
||||
globalInts.clear();
|
||||
if (in.contains("globalInts") && in["globalInts"].is_object()) {
|
||||
for (const auto& [k, v] : in["globalInts"].items())
|
||||
globalInts[k] = v.get<int>();
|
||||
}
|
||||
globalFloats.clear();
|
||||
if (in.contains("globalFloats") && in["globalFloats"].is_object()) {
|
||||
for (const auto& [k, v] : in["globalFloats"].items())
|
||||
globalFloats[k] = v.get<float>();
|
||||
|
||||
@@ -2071,6 +2071,15 @@ namespace ZL
|
||||
{
|
||||
state.taxiCar.waypoints = state.taxiCarWaypoints;
|
||||
state.taxiCar.mode = NpcCar::Mode::FOLLOW_WAYPOINTS;
|
||||
|
||||
// For the dorm - disable trigger zone because the player already ordered taxi
|
||||
for (auto& tz : triggerZones) {
|
||||
if (tz.id == "taxi_zone001") {
|
||||
tz.enabled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ---- Save / Load ----
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include "Location.h"
|
||||
#include "items/ItemRegistry.h"
|
||||
#include "utils/Utils.h"
|
||||
|
||||
#define SOL_ALL_SAFETIES_ON 1
|
||||
#include <sol/sol.hpp>
|
||||
@@ -87,6 +88,26 @@ namespace ZL {
|
||||
|
||||
lua.open_libraries(sol::lib::base, sol::lib::math, sol::lib::string, sol::lib::table);
|
||||
|
||||
|
||||
// --- Переопределение функции print ---
|
||||
lua.set_function("print", [](sol::this_state ts, sol::variadic_args va) {
|
||||
sol::state_view lua_view(ts);
|
||||
sol::function tostring = lua_view["tostring"];
|
||||
|
||||
auto& log = logger();
|
||||
log << "[script] ";
|
||||
|
||||
bool first = true;
|
||||
for (auto arg : va) {
|
||||
if (!first) log << "\t"; // Разделяем аргументы табуляцией, как в стандартном Lua print
|
||||
std::string str = tostring(arg);
|
||||
log << str;
|
||||
first = false;
|
||||
}
|
||||
log << std::endl;
|
||||
});
|
||||
// -------------------------------------
|
||||
|
||||
auto api = lua.create_named_table("game_api");
|
||||
|
||||
// npc_walk_to(index, x, y, z [, on_arrived])
|
||||
|
||||
+4
-1
@@ -262,7 +262,10 @@ int main(int argc, char* argv[]) {
|
||||
try
|
||||
{
|
||||
readSettings();
|
||||
ZL::initLogger();
|
||||
if (ZL::Environment::enableLogging)
|
||||
{
|
||||
ZL::initLogger();
|
||||
}
|
||||
|
||||
ZL::logger() << "Log started!" << std::endl;
|
||||
|
||||
|
||||
+6
-6
@@ -364,21 +364,21 @@ namespace ZL
|
||||
|
||||
// --- Инфраструктура для дублирования вывода (Tee-поток) ---
|
||||
class TeeBuffer : public std::streambuf {
|
||||
std::streambuf* out1;
|
||||
std::streambuf* out2;
|
||||
std::streambuf* out1; // Буфер cout
|
||||
std::streambuf* out2; // Буфер файла
|
||||
protected:
|
||||
int overflow(int c) override {
|
||||
if (c != EOF) {
|
||||
int r1 = out1->sputc(c);
|
||||
out1->sputc(c); // Игнорируем потенциальный EOF от отключенной консоли
|
||||
int r2 = out2->sputc(c);
|
||||
if (r1 == EOF || r2 == EOF) return EOF;
|
||||
if (r2 == EOF) return EOF; // Возвращаем ошибку только если сломалась запись в файл
|
||||
}
|
||||
return c;
|
||||
}
|
||||
int sync() override {
|
||||
int r1 = out1->pubsync();
|
||||
out1->pubsync(); // Игнорируем ошибку сброса консоли
|
||||
int r2 = out2->pubsync();
|
||||
return (r1 == -1 || r2 == -1) ? -1 : 0;
|
||||
return (r2 == -1) ? -1 : 0; // Сообщаем об ошибке потоку только если не удалось сбросить в файл
|
||||
}
|
||||
public:
|
||||
TeeBuffer(std::streambuf* sb1, std::streambuf* sb2) : out1(sb1), out2(sb2) {}
|
||||
|
||||
Reference in new issue
Block a user