@@ -6574,7 +6574,7 @@ Functions
65746574 Each frame tile is table of with following optional members: ``ch ``, ``fg ``,
65756575 ``bg ``, ``bold ``, ``tile ``, ``tile_overlay ``, ``tile_signpost ``, ``tile_item ``.
65766576 First 4 are function same as ascii workshop definition. The latter 4 are graphics
6577- layers. ``tile_signpost `` is only valid in first row and it shows up above the workshop.
6577+ layers. ``tile_signpost `` is only valid in first row and it shows up above the workshop.
65786578
65796579 :frame_skip: How many ticks to display one frame. If set to negative number, zero or skipped, frames
65806580 are synchronized with machine animation.
@@ -6588,8 +6588,9 @@ Functions
65886588 :make_graphics_too: replace same tiles in graphics mode with tiles from vanilla df mechanism
65896589 :frame_length: How many ticks to display one frame. If set to negative number, zero or skipped, frames
65906590 are synchronized with machine animation.
6591- :gear_tiles: Optional table with of 2 or 4 indexes. First two define ascii tiles and next two graphics tiles.
6592- This overrides default gear tiles.
6591+ :gear_tiles: Optional table with ``ch ``, ``ch_alt ``, ``tile ``, ``tile_alt ``. First two are ascii
6592+ gear tiles and are used to find tiles in workshop raw and animate them. Second two are
6593+ used to animate graphical tiles.
65936594
65946595* ``setOnUpdate(workshop_type, interval, callback) ``
65956596
@@ -6638,20 +6639,35 @@ Examples
66386639Simple mechanical workshop::
66396640
66406641 local bhacks = require('plugins.building-hacks')
6641- --work only powered, consume 15 power and one connection point at 0,0
6642- bhacks.setMachineInfo("BONE_GRINDER",true,15,0,{{x=0,y=0}})
6643- --set animation to switch between gear tiles at 0,0
6644- bhacks.setAnimationInfo("BONE_GRINDER",{
6645- {[0]={42,7,0,0}}, --first frame, 1 changed tile
6646- {[0]={15,7,0,0}} -- second frame, same
6647- }
6648- )
6642+
6643+ --work only powered, consume 15 power and one connection point at 0, 0
6644+ bhacks.setMachineInfo("BONE_GRINDER", true, 15, 0, {{x=0, y=0}})
6645+
6646+ --load custom graphical tiles for use if graphics is enabled
6647+ local tile1=dfhack.screen.findGraphicsTile('DRAGON_ENGINE_TILES', 0, 0)
6648+ local tile2=dfhack.screen.findGraphicsTile('DRAGON_ENGINE_TILES', 1, 0)
6649+
6650+ local frames={}
6651+ --first frame - tile (1, 1) changed to character 42
6652+ ensure_key(frames, 1, 1)[1]={ch=42, fg=7, bg=0, bold=0, tile=tile1}
6653+ --second frame - tile (1,1) changed to character 15
6654+ ensure_key(frames, 2, 1)[1]={ch=15, fg=7, bg=0, bold=0, tile=tile2}
6655+
6656+ --set animation to switch between gear tiles at 1,1
6657+ bhacks.setAnimationInfo("BONE_GRINDER", frames)
66496658
66506659Or with auto_gears::
66516660
66526661 local bhacks = require('plugins.building-hacks')
6653- bhacks.setMachineInfoAuto("BONE_GRINDER",true,15)
6654- bhacks.setAnimationInfoAuto("BONE_GRINDER",true)
6662+
6663+ --load custom graphical tiles for use if graphics is enabled
6664+ local tile1=dfhack.screen.findGraphicsTile('DRAGON_ENGINE_TILES', 0, 0)
6665+ local tile2=dfhack.screen.findGraphicsTile('DRAGON_ENGINE_TILES', 1, 0)
6666+
6667+ --work only powered, consume 15 power and find connection point from building raws
6668+ bhacks.setMachineInfoAuto("BONE_GRINDER", true, 15)
6669+ --set animation to switch between default ascii gears and specific graphic tiles loaded above
6670+ bhacks.setAnimationInfoAuto("BONE_GRINDER", true, -1, {tile=tile1, tile_alt=tile2})
66556671
66566672buildingplan
66576673============
0 commit comments