-
Notifications
You must be signed in to change notification settings - Fork 197
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
Bodyswap Improvements and Additions #1164
base: master
Are you sure you want to change the base?
Conversation
Crystalwarrior
commented
Jun 9, 2024
- If bodyswap is ran with no arguments, bring up a list of units on the map to bodyswap to
- Bodyswapping adjusts the extra members list, not core party - consistent with vanilla behavior for retiring/unretiring with core party.
- Reveal tiles near the bodyswapped unit
- When bodyswapping to someone with no name, forcibly give them a name
… map to bodyswap to Bodyswapping adjusts the extra members list, not core party - consistent with vanilla behavior for retiring/unretiring with core party. Reveal tiles near the bodyswapped unit
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
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.
remember to update the bodyswap.rst docs with the new behavior
Co-authored-by: Myk <[email protected]>
Merge linger into bodyswap
I agree with subsuming |
docs/bodyswap.rst
Outdated
@@ -14,15 +14,27 @@ Usage | |||
:: | |||
|
|||
bodyswap [--unit <id>] | |||
bodyswap [--linger] |
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.
I prefer the form you wrote in the docs below (and in the tombstone entry): bodyswap linger
, not bodyswap --linger
in that case, you should write the usage as bodyswap linger
, not bodyswap [linger]
, since the zero option case is already covered by the first usage line
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.
Oh crap yah I prefer bodyswap linger too, I'm just dumb about the arguments and dunno how to handle it properly
Co-authored-by: Myk <[email protected]>
docs/bodyswap.rst
Outdated
bodyswap unit <id> | ||
bodyswap linger |
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.
This usage block should be:
bodyswap [--unit <id>]
bodyswap linger
--unit
is an option go bodyswap
when it is run without a subcommand. linger
is a subcommand.
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.
oh the -- part is no longer around cuz I dismantled the arg parse
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.
you still need argparse for the --unit
option
bodyswap.lua
Outdated
local args = { ... } | ||
local options = { | ||
help = false, | ||
unit = -1, | ||
} | ||
|
||
local positionals = argparse.processArgsGetopt(args, { |
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.
all arg processing should be done after the module check; it shouldn't be run when this script is loaded as a module
@@ -99,6 +99,7 @@ Template for new versions: | |||
- `max-wave`: merged into `pop-control` | |||
- `devel/find-offsets`, `devel/find-twbt`, `devel/prepare-save`: remove development scripts that are no longer useful | |||
- `fix/item-occupancy`, `fix/tile-occupancy`: merged into `fix/occupancy` | |||
- `linger`: merged into `bodyswap` as ``bodyswap linger`` |
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.
needs to be moved into changelog for current version
If said unit has no name, a new name is randomly generated for it, based on the unit's race. | ||
If no valid language is found for that race, it will use the DIVINE language. | ||
|
||
If you run bodyswap linger, the killer is identified by examining the historical event generated |
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.
I think you need to mention that bodyswap linger
must be run immediately after you have died, and that it will put you into the body of your killer.
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 also remove docs/linger.rst
Takes control of the selected unit. | ||
``bodyswap --unit 42`` | ||
Takes control of the selected unit, or brings up a list of swappable units if no unit is selected. | ||
``bodyswap unit 42`` |
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.
``bodyswap unit 42`` | |
``bodyswap --unit 42`` |
end | ||
|
||
function lingerAdvUnit(unit) | ||
if not unit.flags2.killed 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.
use dfhack.units.isKilled(unit)
instead of accessing the flag directly
end | ||
if not slayer then | ||
qerror("Slayer not found!") | ||
elseif slayer.flags2.killed 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.
use dfhack.units.isKilled
local slayerName = "" | ||
if slayer.name.has_name then | ||
slayerName = ", " .. dfhack.TranslateName(slayer.name) .. "," | ||
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.
use dfhack.units.getReadableName(slayer)
to get the name of the histfig