-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into corrupt_job_fix
- Loading branch information
Showing
7 changed files
with
95 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 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 | ||
|
||
print(('Created %s tomb(s).'):format(tomb_count)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters