m 3c09055d21 very early gsc not working
TODO:
- add script_extension.cpp for scripting.cpp
2023-12-28 01:59:00 -06:00

45 lines
911 B
C++

#include <std_include.hpp>
#include "game/scripting/function.hpp"
#include "game/scripting/execution.hpp"
#include "component/scripting.hpp"
namespace scripting
{
function::function(const char* pos)
: pos_(pos)
{
}
script_value function::get_raw() const
{
game::VariableValue value;
value.type = game::VAR_FUNCTION;
value.u.codePosValue = this->pos_;
return value;
}
const char* function::get_pos() const
{
return this->pos_;
}
std::string function::get_name() const
{
if (scripting::script_function_table_rev.contains(this->pos_))
{
const auto& func = scripting::script_function_table_rev[this->pos_];
return utils::string::va("%s::%s", func.first.data(), func.second.data());
}
return "unknown function";
}
script_value function::call(const entity& self, std::vector<script_value> arguments) const
{
return exec_ent_thread(self, this->pos_, arguments);
}
}