| 1056 | } |
| 1057 | |
| 1058 | static 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 | |
| 1078 | static TargetTileStatus calcTileStatus(EngineInfo *engine, df::coord target, float zdelta) |
| 1079 | { |
nothing calls this directly
no test coverage detected