Skip to content

Fix gm-unit: dynamically update size_cur when modifying body appearance#1582

Closed
sizzlins wants to merge 3 commits into
DFHack:masterfrom
sizzlins:fix/gm-unit-body-size
Closed

Fix gm-unit: dynamically update size_cur when modifying body appearance#1582
sizzlins wants to merge 3 commits into
DFHack:masterfrom
sizzlins:fix/gm-unit-body-size

Conversation

@sizzlins

Copy link
Copy Markdown

Fixes #5793.

This pull request implements the math to dynamically update size_cur when modifying body appearance values (Height, Broadness, Length) in gm-unit. Previously, modifying these values left size_cur untouched (fulfilling the 3-year-old TODO in editor_body.lua). It uses standard DF scaling integer math to perfectly match the engine's volume calculations.

Fixes #5793. Manually calculates size_cur from size_base and body modifiers to emulate native DF scaling logic, fulfilling the 3-year-old TODO.
Comment thread internal/gm-unit/editor_body.lua Outdated
-- Update the world texture
self.target_unit.flags4.any_texture_must_be_refreshed = true

-- Manually recalculate body size

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is an exact duplicate of the code above. write a function and call it in both places. Don't Repeat Yourself.

@sizzlins sizzlins requested a review from ab9rf June 24, 2026 00:52
@sizzlins

Copy link
Copy Markdown
Author

superseded by #1594

@sizzlins sizzlins closed this Jun 24, 2026
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.

2 participants