diff --git a/src/codsrc/clientscript/cscr_compiler.cpp b/src/codsrc/clientscript/cscr_compiler.cpp index 4b557f1..bdc27e5 100644 --- a/src/codsrc/clientscript/cscr_compiler.cpp +++ b/src/codsrc/clientscript/cscr_compiler.cpp @@ -1,5 +1,6 @@ #include #include "clientscript_public.hpp" +#include #pragma warning(push) #pragma warning(disable: 4244) @@ -2010,6 +2011,14 @@ namespace codsrc } + // our addition + auto f = gsc::function::get(pName, type); + if (f != nullptr) + { + return f; + } + // + // pluto if (game::plutonium::scr_get_function_hook != nullptr) { @@ -2145,6 +2154,14 @@ namespace codsrc } } + // our addition + auto f = gsc::method::get(pName, type); + if (f != nullptr) + { + return f; + } + // + // pluto if (game::plutonium::scr_get_method_hook != nullptr) { diff --git a/src/component/gsc.cpp b/src/component/gsc.cpp index 6192a28..4421937 100644 --- a/src/component/gsc.cpp +++ b/src/component/gsc.cpp @@ -109,9 +109,17 @@ namespace gsc functions.insert_or_assign(name, function); } - const std::unordered_map& get() + game::BuiltinFunction get(const char** name, int* type) { - return functions; + auto got = functions.find(*name); + + if (got == functions.end()) + { + return nullptr; + } + + *type = 0; + return got->second; } } @@ -122,9 +130,17 @@ namespace gsc methods.insert_or_assign(name, method); } - const std::unordered_map& get() + game::BuiltinMethod get(const char** name, int* type) { - return methods; + auto got = methods.find(*name); + + if (got == methods.end()) + { + return nullptr; + } + + *type = 0; + return got->second; } } diff --git a/src/component/gsc.hpp b/src/component/gsc.hpp index 0851030..6034bee 100644 --- a/src/component/gsc.hpp +++ b/src/component/gsc.hpp @@ -5,12 +5,12 @@ namespace gsc namespace function { void add(const std::string& name, const game::BuiltinFunction function); - const std::unordered_map& get(); + game::BuiltinFunction get(const char** name, int* type); } namespace method { void add(const std::string& name, const game::BuiltinMethod method); - const std::unordered_map& get(); + game::BuiltinMethod get(const char** name, int* type); } } \ No newline at end of file