Skip to content

Commit

Permalink
only create tombs for coffins not in a zone
Browse files Browse the repository at this point in the history
that is, don't create tomb zones for coffins that are already in other
types of zones
  • Loading branch information
myk002 committed Oct 14, 2023
1 parent 9c77c52 commit 7f2c3e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 2 additions & 9 deletions burial.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- Allows burial in unowned coffins.
-- Based on Putnam's work (https://gist.github.com/Putnam3145/e7031588f4d9b24b9dda)

local argparse = require('argparse')
local quickfort = reqscript('quickfort')

Expand All @@ -18,20 +19,12 @@ local tomb_blueprint = {

local tomb_count = 0
for _, coffin in pairs(df.global.world.buildings.other.COFFIN) do

if cur_zlevel and coffin.z ~= df.global.window_z then
if #coffin.relations > 0 or cur_zlevel and coffin.z ~= df.global.window_z then
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

Expand Down
9 changes: 5 additions & 4 deletions docs/burial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ burial
: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.
Creates a 1x1 tomb zone for each built coffin that isn't already contained in a
zone.

Usage
-----
Expand All @@ -16,16 +17,16 @@ Examples
--------

``burial``
Create a tomb for every coffin on the map with automatic burial enabled.
Create a general use tomb for every unzoned coffin on the map.

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

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

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

``burial -cp``
Create tombs with automatic burial disabled for both citizens and pets,
Expand Down

0 comments on commit 7f2c3e5

Please sign in to comment.