MCPcopy Create free account
hub / github.com/DFHack/dfhack / projPathMetrics

Function projPathMetrics

plugins/siege-engine.cpp:1058–1076  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1056}
1057
1058static int projPathMetrics(lua_State *L)
1059{
1060 auto engine = find_engine(L, 1);
1061 auto path = decode_path(L, 2, engine->center);
1062
1063 PathMetrics info(path);
1064
1065 lua_createtable(L, 0, 7);
1066 Lua::SetField(L, hit_type_names[info.hit_type], -1, "hit_type");
1067 Lua::SetField(L, info.collision_step, -1, "collision_step");
1068 Lua::SetField(L, info.collision_z_step, -1, "collision_z_step");
1069 Lua::SetField(L, info.goal_distance, -1, "goal_distance");
1070 if (info.goal_step < info.collision_step)
1071 Lua::SetField(L, info.goal_step, -1, "goal_step");
1072 if (info.goal_z_step < info.collision_step)
1073 Lua::SetField(L, info.goal_z_step, -1, "goal_z_step");
1074 Lua::SetField(L, target_tile_type_names[calcTileStatus(engine, info)], -1, "status");
1075 return 1;
1076}
1077
1078static TargetTileStatus calcTileStatus(EngineInfo *engine, df::coord target, float zdelta)
1079{

Callers

nothing calls this directly

Calls 5

find_engineFunction · 0.85
decode_pathFunction · 0.85
lua_createtableFunction · 0.85
SetFieldFunction · 0.85
calcTileStatusFunction · 0.85

Tested by

no test coverage detected