Skip to content

Commit cf1431e

Browse files
Apply suggestions from code review
Co-authored-by: Christian Doczkal <20443222+chdoc@users.noreply.github.com>
1 parent 067d182 commit cf1431e

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

autotraining.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ function addTraining(unit)
208208
for i=1,9,1 do
209209
if ( squad.positions[i].occupant == -1 ) then
210210
dfhack.military.addToSquad(unit.id,squad.id,i)
211-
-- squad.positions[i].occupant = unit.hist_figure_id
212-
-- unit.military.squad_id = squad.id
213-
-- unit.military.squad_position = i
214211
return true
215212
end
216213
end
@@ -224,9 +221,6 @@ function removeTraining(unit)
224221
for i=1,9,1 do
225222
if ( unit.hist_figure_id == squad.positions[i].occupant ) then
226223
dfhack.military.removeFromSquad(unit.id)
227-
-- unit.military.squad_id = -1
228-
-- unit.military.squad_position = -1
229-
-- squad.positions[i].occupant = -1
230224
return true
231225
end
232226
end
@@ -277,7 +271,7 @@ function start()
277271
if (args.t) then
278272
state.threshold = 0-tonumber(args.t)
279273
end
280-
repeatUtil.scheduleEvery(GLOBAL_KEY, 1, 'days', check) -- 997 is the closest prime to 1000
274+
repeatUtil.scheduleEvery(GLOBAL_KEY, 1, 'days', check)
281275
end
282276

283277
function stop()

docs/autotraining.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ autotraining
55
:summary: Assigns citizens to a military squad until they have fulfilled their need for Martial Training
66
:tags: fort auto bugfix units
77

8-
Automation script for citizens to hit the gym when they yearn for the gains. Also passively builds military skills and physical stats.
8+
This script automatically assigns citizens with the need for military training to designated training squads.
99

10-
You need to have at least one squad that is set up for training. This should be a new non-military-use squad. The uniform should be
11-
set to "No Uniform" and the squad should be set to "Constant Training" in the military screen. Edit the squad's schedule to full time training with around 8 units training.
12-
The squad doesn't need months off. The members leave the squad once they have gotten their gains.
10+
You need to have at least one squad that is set up for training. The squad should be set to "Constant Training" in the military screen. The squad doesn't need months off. The members leave the squad once they have satisfied their need for military training.
11+
12+
The configured uniform determines the skills that are acquired by the training dwarves. Providing "No Uniform" is a perfectly valid choice and will make your militarily inclined civilians become wrestlers over time. However, you can also provide weapons and armor to pre-train civilians for future drafts.
1313

1414
Once you have made squads for training use `gui/autotraining` to select the squads and ignored units, as well as the needs threshhold.
1515

internal/control-panel/registry.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ COMMANDS_BY_IDX = {
3535
params={'--time', '14', '--timeUnits', 'days', '--command', '[', 'workorder', 'ShearCreature', ']'}},
3636
{command='autoslab', group='automation', mode='enable'},
3737
{command='autotraining', group='automation', mode='enable',
38-
desc='Automation script for citizens to hit the gym when they yearn for the gains.'},
38+
desc='Automatically assign units with training needs to training squads. '},
3939
{command='ban-cooking all', group='automation', mode='run'},
4040
{command='buildingplan set boulders false', group='automation', mode='run',
4141
desc='Enable if you usually don\'t want to use boulders for construction.'},

0 commit comments

Comments
 (0)