Skip to content

Commit 3c3e7a4

Browse files
PeridexisErrantlethosor
authored andcommitted
Improved script documentation
Cherry-picked changes in DFHack/dfhack#945
1 parent af0ba6a commit 3c3e7a4

File tree

131 files changed

+1035
-1171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+1035
-1171
lines changed

add-thought.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
-- Adds emotions to creatures.
22
--@ module = true
33

4-
--[[=begin
4+
--[====[
55
66
add-thought
77
===========
88
Adds a thought or emotion to the selected unit. Can be used by other scripts,
99
or the gui invoked by running ``add-thought gui`` with a unit selected.
1010
11-
=end]]
11+
]====]
1212

1313
local utils=require('utils')
1414

armoks-blessing.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Adjust all attributes of all dwarves to an ideal
22
-- by vjek
3-
--[[=begin
3+
--[====[
44
55
armoks-blessing
66
===============
@@ -12,7 +12,7 @@ easy-to-satisfy preferences.
1212
Without arguments, all attributes, age & personalities are adjusted.
1313
Arguments allow for skills to be adjusted as well.
1414
15-
=end]]
15+
]====]
1616
function rejuvenate(unit)
1717
if unit==nil then
1818
print ("No unit available! Aborting with extreme prejudice.")

autolabor-artisans.lua

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- Run an autolabor command for skill-affected labors.
22

3-
--[[=begin
3+
local help = [====[
44
55
autolabor-artisans
66
==================
@@ -10,7 +10,7 @@ influences output quality. Examples::
1010
autolabor-artisans 0 2 3
1111
autolabor-artisans disable
1212
13-
=end]]
13+
]====]
1414
local artisan_labors = {
1515
"CARPENTER",
1616
"DETAIL",
@@ -51,11 +51,7 @@ end
5151

5252
function run()
5353
if #args == 0 or args[1] == "help" then
54-
print('Applies an autolabor command to all labors with quality-based output.')
55-
print('')
56-
print('Examples:')
57-
print(' autolabor-artisans 0 2 3')
58-
print(' autolabor-artisans disable')
54+
print(help)
5955
return false
6056
end
6157

binpatch.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- Apply or remove binary patches at runtime.
2-
--[[=begin
2+
--[====[
33
44
binpatch
55
========
66
Implements functions for in-memory binpatches. See `binpatches`.
77
8-
=end]]
8+
]====]
99

1010
local bp = require('binpatch')
1111

brainwash.lua

+40-35
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
-- Brainwash a dwarf, modifying their personality
22
-- usage is: target a unit in DF, and execute this script in dfhack
3-
-- by vjek
4-
--[[=begin
3+
-- by vjek, edited by PeridexisErrant
4+
local help = [====[
55
66
brainwash
77
=========
8-
Modify the personality traits of the selected dwarf to match an 'ideal'
9-
personality - as stable and reliable as possible. This makes dwarves very
10-
stable, preventing tantrums even after months of misery.
8+
Modify the personality traits of the selected dwarf to match an idealised
9+
personality - for example, as stable and reliable as possible to prevent
10+
tantrums even after months of misery.
1111
12-
=end]]
12+
Usage: ``brainwash <type>``, with one of the following types:
13+
14+
:ideal: reliable, with generally positive personality traits
15+
:baseline: reset all personality traits to the average
16+
:stepford: amplifies all good qualities to an excessive degree
17+
:wrecked: amplifies all bad qualities to an excessive degree
18+
19+
]====]
1320

1421
function brainwash_unit(profile)
1522
local i,unit_name
1623

1724
unit=dfhack.gui.getSelectedUnit()
1825
if unit==nil then
19-
print ("No unit under cursor! Aborting with extreme prejudice.")
26+
print ("No unit under cursor! Aborting.")
2027
return
2128
end
2229

@@ -37,34 +44,32 @@ end
3744

3845
-- main script starts here
3946
-- profiles are listed here and passed to the brainwash function
40-
--
41-
local baseline={50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50}
42-
local ideal={75,25,25,75,25,25,25,99,25,25,25,50,75,50,25,75,75,50,75,75,25,75,75,50,75,25,50,25,75,75,75,25,75,75,25,75,25,25,75,75,25,75,75,75,25,75,75,25,25,50}
43-
local stepford={99,1,1,99,1,1,1,99,1,1,1,1,50,50,1,99,99,50,50,50,1,1,99,50,50,50,50,50,50,99,50,1,1,99,1,99,1,1,99,99,1,99,99,99,1,50,50,1,1,1}
44-
local wrecked={1,99,99,1,99,99,99,1,99,99,99,1,1,99,99,1,1,1,1,1,99,1,1,99,1,99,99,99,1,1,1,99,1,1,99,1,99,99,1,1,99,1,1,1,99,1,1,99,99,99}
45-
local opt = ...
47+
local baseline={
48+
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
49+
50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,
50+
50,50,50,50,50,50,50,50,50,50}
51+
local ideal={
52+
75,25,25,75,25,25,25,99,25,25,25,50,75,50,25,75,75,50,75,75,
53+
25,75,75,50,75,25,50,25,75,75,75,25,75,75,25,75,25,25,75,75,
54+
25,75,75,75,25,75,75,25,25,50}
55+
local stepford={
56+
99,1,1,99,1,1,1,99,1,1,1,1,50,50,1,99,99,50,50,50,
57+
1,1,99,50,50,50,50,50,50,99,50,1,1,99,1,99,1,1,99,99,
58+
1,99,99,99,1,50,50,1,1,1}
59+
local wrecked={
60+
1,99,99,1,99,99,99,1,99,99,99,1,1,99,99,1,1,1,1,1,
61+
99,1,1,99,1,99,99,99,1,1,1,99,1,1,99,1,99,99,1,1,
62+
99,1,1,1,99,1,1,99,99,99}
4663

47-
if opt then
48-
if opt=="ideal" then
49-
brainwash_unit(ideal)
50-
return
51-
end
52-
if opt=="baseline" then
53-
brainwash_unit(baseline)
54-
return
55-
end
56-
if opt=="stepford" then
57-
brainwash_unit(stepford)
58-
return
59-
end
60-
if opt=="wrecked" then
61-
brainwash_unit(wrecked)
62-
return
63-
end
64+
local opt = ...
65+
if opt=="ideal" then
66+
brainwash_unit(ideal)
67+
elseif opt=="baseline" then
68+
brainwash_unit(baseline)
69+
elseif opt=="stepford" then
70+
brainwash_unit(stepford)
71+
elseif opt=="wrecked" then
72+
brainwash_unit(wrecked)
6473
else
65-
print ("Invalid or missing personality argument.\nValid choices are ideal , baseline , stepford, and wrecked.")
66-
print ("ideal will create a reliable dwarf with generally positive personality traits.")
67-
print ("baseline will reset all personality traits to a default / the average.")
68-
print ("stepford amplifies all good qualities to an excessive degree.")
69-
print ("wrecked amplifies all bad qualities to an excessive degree.")
74+
print(help)
7075
end

burial.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
-- allows burial in unowned coffins
22
-- by Putnam https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda
3-
--[[=begin
3+
--[====[
44
55
burial
66
======
77
Sets all unowned coffins to allow burial. ``burial -pets`` also allows burial
88
of pets.
99
10-
=end]]
10+
]====]
1111

1212
local utils=require('utils')
1313

catsplosion.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Make cats just /multiply/.
2-
--[[=begin
2+
--[====[
33
44
catsplosion
55
===========
@@ -14,7 +14,7 @@ Usage:
1414
1515
Animals will give birth within two in-game hours (100 ticks or fewer).
1616
17-
=end]]
17+
]====]
1818

1919
world = df.global.world
2020

colonies.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- List, create, or change wild colonies (eg honey bees)
22
-- By PeridexisErrant and Warmist
33

4-
local help = [[=begin
4+
local help = [====[
55
66
colonies
77
========
@@ -18,7 +18,7 @@ However both accept an optional flag to use a different vermin
1818
type, for example ``colonies place ANT`` creates an ant colony
1919
and ``colonies convert TERMITE`` ends your beekeeping industry.
2020
21-
=end]]
21+
]====]
2222

2323
function findVermin(target_verm)
2424
for k,v in pairs(df.global.world.raws.creatures.all) do

devel/all-bob.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
-- Changes the first name of all units to "Bob"
22
--author expwnent
33
--
4-
--[[=begin
4+
--[====[
55
66
devel/all-bob
77
=============
88
Changes the first name of all units to "Bob".
99
Useful for testing `modtools/interaction-trigger` events.
1010
11-
=end]]
11+
]====]
1212

1313
for _,v in ipairs(df.global.world.units.all) do
1414
v.name.first_name = "Bob"

devel/check-release.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-- basic check for release readiness
2-
--[[=begin
2+
--[====[
33
devel/check-release
44
===================
55
Basic checks for release readiness
6-
=end]]
6+
]====]
77

88
ok = true
99
function err(s)

devel/clear-script-env.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- Clear script environment
2-
--[[=begin
2+
--[====[
33
44
devel/clear-script-env
55
======================
66
Clears the environment of the specified lua script(s).
77
8-
=end]]
8+
]====]
99
args = {...}
1010
if #args < 1 then qerror("script name(s) required") end
1111
for _, name in pairs(args) do

devel/cmptiles.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
-- Lists and/or compares two tiletype material groups.
2-
--[[=begin
2+
--[====[
33
44
devel/cmptiles
55
==============
66
Lists and/or compares two tiletype material groups.
77
88
Usage: ``devel/cmptiles material1 [material2]``
99
10-
=end]]
10+
]====]
1111

1212
local nmat1,nmat2=...
1313
local mat1 = df.tiletype_material[nmat1]

devel/export-dt-ini.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-- Exports an ini file for Dwarf Therapist.
2-
--[[=begin
2+
--[====[
33
devel/export-dt-ini
44
===================
55
Exports an ini file containing memory addresses for Dwarf Therapist.
6-
=end]]
6+
]====]
77

88
local utils = require 'utils'
99
local ms = require 'memscan'

devel/find-offsets.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Find some offsets for linux.
2-
--[[=begin
2+
--[====[
33
44
devel/find-offsets
55
==================
@@ -29,7 +29,7 @@ Arguments:
2929
* ``nofeed`` to block automated fake input searches
3030
* ``nozoom`` to disable neighboring object heuristics
3131
32-
=end]]
32+
]====]
3333

3434
local utils = require 'utils'
3535
local ms = require 'memscan'

devel/inject-raws.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Inject new raw definitions into the world
2-
--[[=begin
2+
--[====[
33
44
devel/inject-raws
55
=================
@@ -22,7 +22,7 @@ Usage example::
2222
2323
devel/inject-raws trapcomp ITEM_TRAPCOMP_STEAM_PISTON workshop STEAM_ENGINE MAGMA_STEAM_ENGINE reaction STOKE_BOILER
2424
25-
=end]]
25+
]====]
2626

2727
local utils = require 'utils'
2828

devel/inspect-screen.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- Read from the screen and display info about the tiles
2-
--[[=begin
2+
--[====[
33
44
devel/inspect-screen
55
====================
66
Read the tiles from the screen and display info about them.
77
8-
=end]]
8+
]====]
99

1010
local utils = require 'utils'
1111
local gui = require 'gui'

devel/light.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- an experimental lighting engine
2-
--[[=begin
2+
--[====[
33
44
devel/light
55
===========
@@ -8,7 +8,7 @@ An experimental lighting engine for DF, using the `rendermax` plugin.
88
Call ``devel/light static`` to not recalculate lighting when in game.
99
Press :kbd:`~` to recalculate lighting. Press :kbd:`\`` to exit.
1010
11-
=end]]
11+
]====]
1212

1313
local gui = require 'gui'
1414
local guidm = require 'gui.dwarfmode'

devel/list-filters.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
-- List input items for the building being built.
2-
--[[=begin
2+
--[====[
33
44
devel/list-filters
55
==================
66
List input items for the building currently being built.
77
This is where the filters in lua/dfhack/buildings.lua come from.
88
9-
=end]]
9+
]====]
1010

1111
local dumper = require 'dumper'
1212
local utils = require 'utils'

devel/lsmem.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-- Prints memory ranges of the process.
2-
--[[=begin
2+
--[====[
33
44
devel/lsmem
55
===========
66
Prints memory ranges of the process.
77
8-
=end]]
8+
]====]
99

1010
for _,v in ipairs(dfhack.internal.getMemRanges()) do
1111
local access = { '-', '-', '-', 'p' }

0 commit comments

Comments
 (0)