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

Change items.all to items.other.IN_PLAY for forbid scripts #895

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions forbid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local argparse = require('argparse')
local function getForbiddenItems()
local items = {}

for _, item in pairs(df.global.world.items.all) do
for _, item in pairs(df.global.world.items.other.IN_PLAY) do
if item.flags.forbid then
local item_type = df.item_type[item:getType()]

Expand Down Expand Up @@ -59,7 +59,7 @@ if positionals[1] == "all" then
print("Forbidding all items on the map...")

local count = 0
for _, item in pairs(df.global.world.items.all) do
for _, item in pairs(df.global.world.items.other.IN_PLAY) do
item.flags.forbid = true
count = count + 1
end
Expand All @@ -73,7 +73,7 @@ if positionals[1] == "unreachable" then
local citizens = dfhack.units.getCitizens(true)
local count = 0

for _, item in pairs(df.global.world.items.all) do
for _, item in pairs(df.global.world.items.other.IN_PLAY) do
if item.flags.construction or item.flags.in_building or item.flags.artifact then
goto skipitem
end
Expand Down
2 changes: 1 addition & 1 deletion unforbid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ local function unforbid_all(include_unreachable, quiet, include_worn)

local citizens = dfhack.units.getCitizens(true)
local count = 0
for _, item in pairs(df.global.world.items.all) do
for _, item in pairs(df.global.world.items.other.IN_PLAY) do
if item.flags.forbid then
if not include_unreachable then
local reachable = false
Expand Down