-
Notifications
You must be signed in to change notification settings - Fork 199
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
Update Exterminate #1187
Update Exterminate #1187
Conversation
Crystalwarrior
commented
Jun 15, 2024
- Fix it crashing adventure mode due to outdated item deletion method
- Add --x (--max) argument, letting you set an extermination cap
- Teleport disintegrated units to the top of the world so they are not seen dying
…te" option Swap to dfhack.items.remove(item) method of destroying an item Add a --maximum options to set maximum number of units to exterminate
…emove(item) anymore?
…to z-level 0 instead?) Add a "maximum" option letting you exterminate up to a cap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add documentation to docs/exterminate.rst
and changelog.txt
Don't teleport unit on DISINTEGRATE method Add documentation for new features
docs/exterminate.rst
Outdated
@@ -48,6 +48,8 @@ Options | |||
on the map. | |||
``-f``, ``--include-friendly`` | |||
Specifies the tool should also kill units friendly to the player. | |||
``-x``, ``--max <num>`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``-x``, ``--max <num>`` | |
``-l``, ``--limit <num>`` |
docs/exterminate.rst
Outdated
@@ -64,6 +66,7 @@ Methods | |||
:magma: Boil the unit in magma (not recommended for magma-safe creatures). | |||
:butcher: Will mark the units for butchering instead of killing them. This is | |||
more useful for pets than armed enemies. | |||
:knockout: Will put units into an unconscious state for 30k ticks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:knockout: Will put units into an unconscious state for 30k ticks. | |
:knockout: Will put units into an unconscious state for 30k ticks (about a month). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more testing needed for this one, I dunno if adventure mode ticks align with fortress mode ticks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they don't. the month estimate is for fort mode. you could define either define a time span that knockout
will last and adjust different ticks based on the mode, or else document the different time spans that knockout
will last in fort mode vs. adventure mode.
wiki article on time: https://dwarffortresswiki.org/index.php/Time#Basic_mechanics
exterminate.lua
Outdated
local isInAdvGroup = false | ||
local isAdvPet = false | ||
local adv = dfhack.world.getAdventurer() | ||
if adv then | ||
isInAdvGroup = unit.relationship_ids.GroupLeader == dfhack.world.getAdventurer().id | ||
isAdvPet = unit.relationship_ids.PetOwner == dfhack.world.getAdventurer().id | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local isInAdvGroup = false | |
local isAdvPet = false | |
local adv = dfhack.world.getAdventurer() | |
if adv then | |
isInAdvGroup = unit.relationship_ids.GroupLeader == dfhack.world.getAdventurer().id | |
isAdvPet = unit.relationship_ids.PetOwner == dfhack.world.getAdventurer().id | |
end | |
local adv = dfhack.world.getAdventurer() | |
if adv then | |
if adv == unit or | |
unit.relationship_ids.GroupLeader == adv.id or | |
unit.relationship_ids.PetOwner == adv.id | |
then | |
return true | |
end | |
end |
if adv then | ||
isInAdvGroup = unit.relationship_ids.GroupLeader == dfhack.world.getAdventurer().id | ||
isAdvPet = unit.relationship_ids.PetOwner == dfhack.world.getAdventurer().id | ||
end | ||
return dfhack.units.isOwnCiv(unit) or | ||
dfhack.units.isOwnGroup(unit) or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does isOwnGroup behave in adventure mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't. isOwnGroup only checks plotinfo which is irrelevant to adventure mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does that mean it always returns false, or that it returns garbage data?
exterminate.lua
Outdated
@@ -156,13 +161,15 @@ local options, args = { | |||
method = killMethod.INSTANT, | |||
only_visible = false, | |||
include_friendly = false, | |||
maximum = -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maximum = -1, | |
limit = -1, |
exterminate.lua
Outdated
@@ -217,7 +224,9 @@ elseif positionals[1]:split(':')[1] == "all" then | |||
local selected_caste = positionals[1]:split(':')[2] | |||
|
|||
for _, unit in ipairs(df.global.world.units.active) do | |||
|
|||
if options.maximum > 0 and count >= options.maximum then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if options.maximum > 0 and count >= options.maximum then | |
if options.limit > 0 and count >= options.limit then |
exterminate.lua
Outdated
@@ -269,6 +278,9 @@ else | |||
target = selected_race | |||
|
|||
for _, unit in pairs(df.global.world.units.active) do | |||
if options.maximum > 0 and count >= options.maximum then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if options.maximum > 0 and count >= options.maximum then | |
if options.limit > 0 and count >= options.limit then |
…tate with no pathfinding maximum -> limit Implement suggestions
note that you can add the code change suggestions to a batch and commit them directly instead of reimplementing the suggestions yourself. That also has the benefit of resolving the suggestion. |
I determined that |