diff --git a/internal/gm-unit/editor_body.lua b/internal/gm-unit/editor_body.lua index ab135976b..3a4d8443b 100644 --- a/internal/gm-unit/editor_body.lua +++ b/internal/gm-unit/editor_body.lua @@ -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 @@ -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