mirror of
https://github.com/fedddddd/iw5-gsc-utils.git
synced 2025-04-21 05:15:44 +00:00
Update gsc.cpp
This commit is contained in:
parent
c49ca5a8cd
commit
bdfd37de35
@ -305,15 +305,8 @@ namespace gsc
|
|||||||
function::add("addcommand", [](const function_args& args) -> scripting::script_value
|
function::add("addcommand", [](const function_args& args) -> scripting::script_value
|
||||||
{
|
{
|
||||||
const auto name = args[0].as<std::string>();
|
const auto name = args[0].as<std::string>();
|
||||||
const auto function = args[1].get_raw();
|
const auto function = args[1].as<scripting::function>();
|
||||||
|
command::add_script_command(name, [function](const command::params& params)
|
||||||
if (function.type != game::SCRIPT_FUNCTION)
|
|
||||||
{
|
|
||||||
throw std::runtime_error("Invalid type");
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto pos = function.u.codePosValue;
|
|
||||||
command::add_script_command(name, [pos](const command::params& params)
|
|
||||||
{
|
{
|
||||||
scripting::array array;
|
scripting::array array;
|
||||||
for (auto i = 0; i < params.size(); i++)
|
for (auto i = 0; i < params.size(); i++)
|
||||||
@ -321,7 +314,7 @@ namespace gsc
|
|||||||
array.push(params[i]);
|
array.push(params[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
scripting::exec_ent_thread(*game::levelEntityId, pos, {array.get_raw()});
|
function({array.get_raw()});
|
||||||
});
|
});
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user