MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / Register

Function Register

TombEngine/Scripting/Internal/TEN/Util/Util.cpp:252–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250 }
251
252 void Register(sol::state* state, sol::table& parent)
253 {
254 auto tableUtil = sol::table(state->lua_state(), sol::create);
255 parent.set(ScriptReserved_Util, tableUtil);
256
257 tableUtil.set_function(ScriptReserved_HasLineOfSight, &HasLineOfSight);
258 tableUtil.set_function(ScriptReserved_CalculateHorizontalDistance, &CalculateHorizontalDistance);
259 tableUtil.set_function(ScriptReserved_GetDisplayPosition, &GetDisplayPosition);
260 tableUtil.set_function(ScriptReserved_PickMoveable, &PickMoveable);
261 tableUtil.set_function(ScriptReserved_PickStatic, &PickStatic);
262 tableUtil.set_function(ScriptReserved_PercentToScreen,
263 sol::overload(
264 static_cast<std::tuple<int, int>(*)(float, float)>(&PercentToScreen),
265 static_cast<Vec2(*)(const Vec2&)>(&PercentToScreen)
266 )
267 );
268 tableUtil.set_function(ScriptReserved_ScreenToPercent,
269 sol::overload(
270 static_cast<std::tuple<float, float>(*)(int, int)>(&ScreenToPercent),
271 static_cast<Vec2(*)(const Vec2&)>(&ScreenToPercent)
272 )
273 );
274 tableUtil.set_function(ScriptReserved_PrintLog, &PrintLog);
275
276 // COMPATIBILITY
277 tableUtil.set_function("CalculateDistance", &CalculateDistance);
278
279 auto handler = LuaHandler(state);
280 handler.MakeReadOnlyTable(tableUtil, ScriptReserved_LogLevel, LOG_LEVEL_IDS);
281 }
282}

Callers 5

InitMethod · 0.50
LogicHandlerMethod · 0.50
FlowHandlerMethod · 0.50
RegisterMethod · 0.50
ObjectsHandlerMethod · 0.50

Calls 5

overloadFunction · 0.85
LuaHandlerClass · 0.85
MakeReadOnlyTableMethod · 0.80
lua_stateMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected