-
Notifications
You must be signed in to change notification settings - Fork 209
make deathcause
an api for getting the cause of death
#1434
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
base: master
Are you sure you want to change the base?
make deathcause
an api for getting the cause of death
#1434
Conversation
make it more api-like
Remove the console formatting Signed-off-by: Squid Coder <[email protected]>
Format to keep old usage working Signed-off-by: Squid Coder <[email protected]>
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.
could you remove the leftover parens from the return
statements?
Also, needs a module declaration and standard side effects guard. See: https://docs.dfhack.org/en/latest/docs/dev/Lua%20API.html#importing-scripts
final fixes
localize some more functions and then rename the APIs and add comments
needs a changelog and documentation |
|
||
local DEATH_TYPES = reqscript('gui/unit-info-viewer').DEATH_TYPES | ||
|
||
-- Gets the first corpse item at the given location | ||
function getItemAtPosition(pos) | ||
local function getItemAtPosition(pos) | ||
for _, item in ipairs(df.global.world.items.other.ANY_CORPSE) do | ||
if item.pos.x == pos.x and item.pos.y == pos.y and item.pos.z == pos.z 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.
Not important, but this check can be if same_xyz(pos, item.pos) then
.
i have tested this PR locally and it doesn't cause any malfunction. i haven't confirmed that the added functionality works as expected, but at least it shouldn't introduce a regression. CI testing isn't working correctly for some reason i can't explain i will approve this once the API it introduces is documented |
Made this on my phone, might have errors so please dbl check