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

Function loadFrames

plugins/building-hacks.cpp:322–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320 hacked_workshops.clear();
321}
322static void loadFrames(lua_State* L,workshop_hack_data& def,int stack_pos)
323{
324 luaL_checktype(L,stack_pos,LUA_TTABLE);
325 lua_pushvalue(L,stack_pos);
326 lua_pushnil(L);
327 while (lua_next(L, -2) != 0) {
328 luaL_checktype(L,-1,LUA_TTABLE);
329 lua_pushnil(L);
330 std::vector<graphic_tile> frame;
331 while (lua_next(L, -2) != 0) {
332 graphic_tile t;
333 lua_pushnumber(L,1);
334 lua_gettable(L,-2);
335 if(lua_isnil(L,-1))
336 {
337 t.tile=-1;
338 lua_pop(L,1);
339 }
340 else
341 {
342 t.tile=lua_tonumber(L,-1);
343 lua_pop(L,1);
344
345 lua_pushnumber(L,2);
346 lua_gettable(L,-2);
347 t.fore=lua_tonumber(L,-1);
348 lua_pop(L,1);
349
350 lua_pushnumber(L,3);
351 lua_gettable(L,-2);
352 t.back=lua_tonumber(L,-1);
353 lua_pop(L,1);
354
355 lua_pushnumber(L,4);
356 lua_gettable(L,-2);
357 t.bright=lua_tonumber(L,-1);
358 lua_pop(L,1);
359
360 }
361 frame.push_back(t);
362 lua_pop(L,1);
363 }
364 lua_pop(L,1);
365 def.frames.push_back(frame);
366 }
367 lua_pop(L,1);
368 return ;
369}
370//arguments: custom type,impassible fix (bool), consumed power, produced power, list of connection points, update skip(0/nil to disable)
371// table of frames,frame to tick ratio (-1 for machine control)
372static int addBuilding(lua_State* L)

Callers 1

addBuildingFunction · 0.85

Calls 6

luaL_checktypeFunction · 0.85
lua_pushvalueFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
lua_pushnumberFunction · 0.85
lua_gettableFunction · 0.85

Tested by

no test coverage detected