From 30100bec8fb1650d62af11e48b9757af5ed9f3e3 Mon Sep 17 00:00:00 2001 From: Tachytaenius Date: Thu, 22 Sep 2022 20:23:56 +0100 Subject: [PATCH] Add link to Tachy Guns and show more code configurations in guide --- docs/guides/modding-guide.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/guides/modding-guide.rst b/docs/guides/modding-guide.rst index fa0510290..cc7d507d5 100644 --- a/docs/guides/modding-guide.rst +++ b/docs/guides/modding-guide.rst @@ -348,6 +348,9 @@ timer:: The structure of a full mod --------------------------- +For reference, `Tachy Guns `__ is a +full mod that conforms to this guide. + Create a folder for mod projects somewhere outside your Dwarf Fortress installation directory (e.g. ``/path/to/mymods/``) and use your mod IDs as the names for the mod folders within it. In the example below, we'll use a mod ID of @@ -425,13 +428,18 @@ Ok, you're all set up! Now, let's take a look at an example moduleA.onLoad() moduleB.onLoad() - -- register your callbacks - repeatUtil.scheduleEvery(modId .. ' every tick', 1, 'ticks', - moduleA.every1Tick) + -- multiple functions in the same repeat callback + repeatUtil.scheduleEvery(modId .. ' every tick', 1, 'ticks', function() + moduleA.every1Tick() + moduleB.every1Tick() + end) + + -- one function per repeat callback (you can put them in the + -- above format if you prefer) repeatUtil.scheduleEvery(modId .. ' 100 frames', 1, 'frames', moduleD.every100Frames) - -- multiple functions in the same callback + -- multiple functions in the same eventful callback eventful.onReactionComplete[modId] = function(reaction, reaction_product, unit, input_items, input_reagents, output_items) @@ -442,7 +450,7 @@ Ok, you're all set up! Now, let's take a look at an example unit, input_items, input_reagents, output_items) end - -- one function per callback (you can put them in the + -- one function per eventful callback (you can put them in the -- above format if you prefer) eventful.onProjItemCheckMovement[modId] = moduleD.onProjItemCheckMovement eventful.onProjUnitCheckMovement[modId] = moduleD.onProjUnitCheckMovement