From c743b2f8143c94a50e455efb6647c346a7513a7e Mon Sep 17 00:00:00 2001 From: Diavolo Date: Sun, 3 Dec 2023 21:31:46 +0100 Subject: [PATCH] feat: add options to load map specific GSC scripts --- src/client/component/script.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/client/component/script.cpp b/src/client/component/script.cpp index f0cea7ea..f4163527 100644 --- a/src/client/component/script.cpp +++ b/src/client/component/script.cpp @@ -1,6 +1,7 @@ #include #include "loader/component_loader.hpp" #include "game/game.hpp" +#include "game/utils.hpp" #include "game_event.hpp" @@ -151,14 +152,19 @@ namespace script { load("custom_scripts" / game_type.value(), true); } + + const std::filesystem::path mapname = game::get_dvar_string("mapname"); + if (!mapname.empty()) + { + load("custom_scripts" / mapname, true); + } } game::RawFile* db_find_x_asset_header_stub(const game::XAssetType type, const char* name, const bool error_if_missing, const int wait_time) { - auto* asset_header = db_find_x_asset_header_hook.invoke( - type, name, error_if_missing, wait_time); + auto* asset_header = db_find_x_asset_header_hook.invoke(type, name, error_if_missing, wait_time); if (type != game::ASSET_TYPE_SCRIPTPARSETREE) {