Skip to content

Commit

Permalink
Autogen script links, table of contents, and demo!
Browse files Browse the repository at this point in the history
Automatically generating the link target for each script saves a lot of
time and potential for errors.

Each kind-of-script page now includes a link target for that page, and
also a table of contents.

In-script markers to delimit text for Sphinx extraction now use native
docstring markers from Ruby, which is a lot more elegant in .rb scripts
- and robust, as long as the fisrt docstring is valid .rst!
  • Loading branch information
PeridexisErrant committed Oct 23, 2015
1 parent 905cb1f commit 673fdbc
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 6 deletions.
9 changes: 9 additions & 0 deletions adaptation.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# View or set level of cavern adaptation for the selected unit or the whole fort
# based on removebadthoughts.rb
=begin
adaptation
==========
View or set level of cavern adaptation for the selected unit or the whole fort.
Usage: ``adaptation <show|set> <him|all> [value]``. The ``value`` must be
between 0 and 800,000 inclusive.
=end

# Color constants, values mapped to color_value enum in include/ColorText.h
COLOR_GREEN = 2
Expand Down
8 changes: 2 additions & 6 deletions add-thought.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
-- Adds emotions to creatures.
--@ module = true

--[[
BEGIN_DOCS
.. _add-thought:
--[[=begin
add-thought
===========
Adds a thought or emotion to the selected unit. Can be used by other scripts,
or the gui invoked by running ``add-thought gui`` with a unit selected.
END_DOCS
]]
=end]]

local utils=require('utils')

Expand Down
9 changes: 9 additions & 0 deletions armoks-blessing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
-- arguments allow for skills to be adjusted as well
-- WARNING: USING THIS SCRIPT WILL ADJUST ALL DWARVES IN PLAY!
-- by vjek
--[[=begin
armoks-blessing
===============
Runs the equivalent of `rejuvenate`, `elevate-physical`, `elevate-mental`, and
`brainwash` on all dwarves currently on the map. This is an extreme change,
which sets every stat to an ideal - legendary skills, great traits, and
easy-to-satisfy preferences.
=end]]
function rejuvenate(unit)
if unit==nil then
print ("No unit available! Aborting with extreme prejudice.")
Expand Down
16 changes: 16 additions & 0 deletions autofarm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@

=begin
autofarm
========
Automatically handle crop selection in farm plots based on current plant stocks.
Selects a crop for planting if current stock is below a threshold.
Selected crops are dispatched on all farmplots.
Usage::
autofarm start
autofarm default 30
autofarm threshold 150 helmet_plump tail_pig
=end
class AutoFarm

def initialize
Expand Down
7 changes: 7 additions & 0 deletions autolabor-artisans.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
-- Executes an autolabor command for each labor where skill level influences output quality.

--[[=begin
autolabor-artisans
==================
Runs `autolabor`, with settings tuned for small but highly skilled workforces.
=end]]
local artisan_labors = {
"CARPENTER",
"DETAIL",
Expand Down
8 changes: 8 additions & 0 deletions autounsuspend.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# un-suspend construction jobs, on a recurring basis
=begin
autounsuspend
=============
Automatically unsuspend jobs in workshops, on a recurring basis.
See `unsuspend` for one-off use, or `resume` ``all``.
=end

class AutoUnsuspend
attr_accessor :running
Expand Down

0 comments on commit 673fdbc

Please sign in to comment.