Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions internal/gm-unit/editor_body.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ function Editor_Body_Modifier:setPartModifier(indexList, value)
-- Update the world texture
self.target_unit.flags4.any_texture_must_be_refreshed = true

-- Manually recalculate body size
local new_size = self.target_unit.body.size_info.size_base
local caste = df.creature_raw.find(self.target_unit.race).caste[self.target_unit.caste]
for idx, mod_entry in ipairs(caste.body_appearance_modifiers) do
local t = mod_entry.modifier.type
if t >= 0 and t <= 2 then -- 0=HEIGHT, 1=BROADNESS, 2=LENGTH
local mod_val = self.target_unit.appearance.body_modifiers[idx]
new_size = math.floor((new_size * mod_val) / 100)
end
end
self.target_unit.body.size_info.size_cur = new_size

self:updateChoices()
end

Expand All @@ -45,6 +57,18 @@ function Editor_Body_Modifier:setBodyModifier(modifierIndex, value)
-- Update the world texture
self.target_unit.flags4.any_texture_must_be_refreshed = true

-- Manually recalculate body size
local new_size = self.target_unit.body.size_info.size_base
local caste = df.creature_raw.find(self.target_unit.race).caste[self.target_unit.caste]
for idx, mod_entry in ipairs(caste.body_appearance_modifiers) do
local t = mod_entry.modifier.type
if t >= 0 and t <= 2 then -- 0=HEIGHT, 1=BROADNESS, 2=LENGTH
local mod_val = self.target_unit.appearance.body_modifiers[idx]
new_size = math.floor((new_size * mod_val) / 100)
end
end
self.target_unit.body.size_info.size_cur = new_size

self:updateChoices()
end

Expand Down