Skip to content

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

realSquidCoder
Copy link
Contributor

Made this on my phone, might have errors so please dbl check

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]>
@realSquidCoder realSquidCoder marked this pull request as ready for review April 12, 2025 15:24
@myk002 myk002 added this to 51.11-r2 Apr 12, 2025
@github-project-automation github-project-automation bot moved this to Todo in 51.11-r2 Apr 12, 2025
Copy link
Member

@myk002 myk002 left a 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

@myk002 myk002 moved this from Todo to Review In Progress in 51.11-r2 Apr 13, 2025
localize some more functions and then rename the APIs and add comments
@myk002 myk002 removed this from 51.11-r2 Apr 25, 2025
@ab9rf
Copy link
Member

ab9rf commented Jun 27, 2025

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
Copy link
Contributor

@Bumber64 Bumber64 Jun 27, 2025

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.

@ab9rf
Copy link
Member

ab9rf commented Jun 29, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants