Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Burial update #859

Merged
merged 7 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions burial.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
-- allows burial in unowned coffins
-- by Putnam https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda
--[====[
-- Allows burial in unowned coffins.
-- Based on Putnam's work (https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda)
local argparse = require('argparse')
local quickfort = reqscript('quickfort')

burial
======
Sets all unowned coffins to allow burial. ``burial -pets`` also allows burial
of pets.

]====]

local utils=require('utils')

local validArgs = utils.invert({
'pets'
local cur_zlevel, citizens, pets = false, true, true
argparse.processArgsGetopt({...}, {
{'z', 'cur-zlevel', handler=function() cur_zlevel = true end},
{'c', 'citizens-only', handler=function() pets = false end},
{'p', 'pets-only', handler=function() citizens = false end},
})
local tomb_blueprint = {
mode = 'zone',
pos = nil,
-- Don't pass properties with default values to avoid 'unhandled property' warning
data = ('T{%s %s}'):format(citizens and '' or 'citizens=false', pets and 'pets=true' or ''),
}

local args = utils.processArgs({...}, validArgs)
local tomb_count = 0
for _, coffin in pairs(df.global.world.buildings.other.COFFIN) do

for k,v in ipairs(df.global.world.buildings.other.COFFIN) do --as:df.building_coffinst
if v.owner_id==-1 then
v.burial_mode.allow_burial=true
if not args.pets then
v.burial_mode.no_pets=true
if cur_zlevel and not (coffin.z == df.global.window_z) then
myk002 marked this conversation as resolved.
Show resolved Hide resolved
goto skip
end
for _, zone in pairs(coffin.relations) do
if zone.type == df.civzone_type.Tomb then
goto skip
end
end

tomb_blueprint.pos = xyz2pos(coffin.x1, coffin.y1, coffin.z)
quickfort.apply_blueprint(tomb_blueprint)
tomb_count = tomb_count + 1

::skip::
end

print(('Created %s tomb(s).'):format(tomb_count))
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ Template for new versions:

## New Tools
- `add-recipe`: (reinstated) add reactions to your civ (e.g. for high boots if your civ didn't start with the ability to make high boots)
- `burial`: (reinstated) create tomb zones for unzoned coffins

## New Features
- `burial`: new options to configure automatic burial and limit scope to the current z-level
- `drain-aquifer`: gained ability to drain just above or below a certain z-level
- `drain-aquifer`: new option to drain all layers except for the first N aquifer layers, in case you want some aquifer layers but not too many
- `gui/control-panel`: ``drain-aquifer --top 2`` added as an autostart option
Expand Down
41 changes: 32 additions & 9 deletions docs/burial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,43 @@ burial
======

.. dfhack-tool::
:summary: Configures all unowned coffins to allow burial.
:tags: unavailable fort productivity buildings
:summary: Create tomb zones for unzoned coffins.
:tags: fort productivity buildings

Creates a 1x1 tomb zone for each built coffin that isn't already in a tomb.

Usage
-----

::

burial [--pets]

if the ``--pets`` option is passed, coffins will also allow burial of pets.
``burial [<options>]``

Examples
--------

``burial --pets``
Configures all unowned coffins to allow burial, including pets.
``burial``
Create a tomb for every coffin on the map with automatic burial enabled.

``burial -z``
Create tombs only on the current zlevel.

``burial -c``
Create tombs designated for automatic burial of citizens only.

``burial -p``
Create tombs designated for automatic burial of pets only.

``burial -cp``
Create tombs with automatic burial disabled for both citizens and pets,
requiring manual assignment of deceased units to each tomb.
Comment on lines +30 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. I like that you documented this use case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Two options logically excluding each other probably isn't the most semantically straightforward way to access a feature, but it puts the docs to good use


Options
-------

``-z``, ``--cur-zlevel``
Only create tombs on the current zlevel.

``-c``, ``--citizens-only``
Only automatically bury citizens.

``-p``, ``--pets-only``
Only automatically bury pets.