@@ -6574,7 +6574,7 @@ Functions
6574
6574
Each frame tile is table of with following optional members: ``ch ``, ``fg ``,
6575
6575
``bg ``, ``bold ``, ``tile ``, ``tile_overlay ``, ``tile_signpost ``, ``tile_item ``.
6576
6576
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.
6578
6578
6579
6579
:frame_skip: How many ticks to display one frame. If set to negative number, zero or skipped, frames
6580
6580
are synchronized with machine animation.
@@ -6588,8 +6588,9 @@ Functions
6588
6588
:make_graphics_too: replace same tiles in graphics mode with tiles from vanilla df mechanism
6589
6589
:frame_length: How many ticks to display one frame. If set to negative number, zero or skipped, frames
6590
6590
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.
6593
6594
6594
6595
* ``setOnUpdate(workshop_type, interval, callback) ``
6595
6596
@@ -6638,20 +6639,35 @@ Examples
6638
6639
Simple mechanical workshop::
6639
6640
6640
6641
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)
6649
6658
6650
6659
Or with auto_gears::
6651
6660
6652
6661
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})
6655
6671
6656
6672
buildingplan
6657
6673
============
0 commit comments