diff --git a/classes/TerraFarmConfig.lua b/classes/TerraFarmConfig.lua index 6114c0b..d48beac 100644 --- a/classes/TerraFarmConfig.lua +++ b/classes/TerraFarmConfig.lua @@ -19,6 +19,10 @@ ---@field terraformFlattenRadius number ---@field terraformDisablePaint boolean ---@field dischargePaintLayer string +---@field raiseDisplacementVolumeRatio number +---@field lowerDisplacementVolumeRatio number +---@field flattenDisplacementVolumeRatio number +---@field flattenDischargeDisplacementVolumeRatio number TerraFarmConfig = {} local TerraFarmConfig_mt = Class(TerraFarmConfig) @@ -39,7 +43,12 @@ TerraFarmConfig.DEFAULT = { terraformFlattenStrength = 50.0, terraformFlattenRadius = 2.0, terraformDisablePaint = false, - dischargePaintLayer = 'dirt' + dischargePaintLayer = 'dirt', + + raiseDisplacementVolumeRatio = 1.0, + lowerDisplacementVolumeRatio = 1.618, + flattenDisplacementVolumeRatio = 1.0, + flattenDischargeDisplacementVolumeRatio = 0.5 } TerraFarmConfig.RADIUS_MIN = 0.1 @@ -139,6 +148,13 @@ function TerraFarmConfig.loadXML() self.terraformFlattenStrength = getConfigFloat(xmlFile, 'terraFarm.defaults', 'terraformFlattenStrength') self.terraformFlattenRadius = getConfigFloat(xmlFile, 'terraFarm.defaults', 'terraformFlattenRadius') + -- VOLUME DISPLACEMENT RATIOS + + self.raiseDisplacementVolumeRatio = getConfigFloat(xmlFile, 'terraFarm.settings', 'raiseDisplacementVolumeRatio') + self.lowerDisplacementVolumeRatio = getConfigFloat(xmlFile, 'terraFarm.settings', 'lowerDisplacementVolumeRatio') + self.flattenDisplacementVolumeRatio = getConfigFloat(xmlFile, 'terraFarm.settings', 'flattenDisplacementVolumeRatio') + self.flattenDischargeDisplacementVolumeRatio = getConfigFloat(xmlFile, 'terraFarm.settings', 'flattenDischargeDisplacementVolumeRatio') + delete(xmlFile) if g_terraFarm and g_terraFarm:updateFillTypeData() ~= true then @@ -184,6 +200,14 @@ function TerraFarmConfig:save() setXMLFloat(xmlFile, 'terraFarm.defaults.terraformFlattenStrength', self.terraformFlattenStrength) setXMLFloat(xmlFile, 'terraFarm.defaults.terraformFlattenRadius', self.terraformFlattenRadius) + + -- VOLUME DISPLACEMENT RATIOS + + setXMLFloat(xmlFile, 'terraFarm.settings.raiseDisplacementVolumeRatio', self.raiseDisplacementVolumeRatio) + setXMLFloat(xmlFile, 'terraFarm.settings.lowerDisplacementVolumeRatio', self.lowerDisplacementVolumeRatio) + setXMLFloat(xmlFile, 'terraFarm.settings.flattenDisplacementVolumeRatio', self.flattenDisplacementVolumeRatio) + setXMLFloat(xmlFile, 'terraFarm.settings.flattenDischargeDisplacementVolumeRatio', self.flattenDischargeDisplacementVolumeRatio) + saveXMLFile(xmlFile) delete(xmlFile) end \ No newline at end of file diff --git a/classes/TerraFarmLandscaping.lua b/classes/TerraFarmLandscaping.lua index a260ec0..4a272f2 100644 --- a/classes/TerraFarmLandscaping.lua +++ b/classes/TerraFarmLandscaping.lua @@ -243,14 +243,18 @@ function TerraFarmLandscaping:onSculptingApplied(errorCode, displacedVolumeOrAre if machine ~= nil and machine.onVolumeDisplacement ~= nil then if self.operation == TerraFarmLandscaping.OPERATION.RAISE then - machine:onVolumeDisplacement(-displacedVolumeOrArea) + -- machine:onVolumeDisplacement(-displacedVolumeOrArea) + machine:onVolumeDisplacement(-displacedVolumeOrArea * g_terraFarm.config.raiseDisplacementVolumeRatio) elseif self.operation == TerraFarmLandscaping.OPERATION.LOWER then - machine:onVolumeDisplacement(displacedVolumeOrArea * 1.618) + -- machine:onVolumeDisplacement(displacedVolumeOrArea * 1.618) + machine:onVolumeDisplacement(displacedVolumeOrArea * g_terraFarm.config.lowerDisplacementVolumeRatio) elseif self.operation == TerraFarmLandscaping.OPERATION.FLATTEN then if self.isDischarging then - machine:onVolumeDisplacement(displacedVolumeOrArea * -0.5) + -- machine:onVolumeDisplacement(displacedVolumeOrArea * -0.5) + machine:onVolumeDisplacement(displacedVolumeOrArea * g_terraFarm.config.flattenDischargeDisplacementVolumeRatio * -1.0) else - machine:onVolumeDisplacement(displacedVolumeOrArea) + -- machine:onVolumeDisplacement(displacedVolumeOrArea) + machine:onVolumeDisplacement(displacedVolumeOrArea * g_terraFarm.config.flattenDisplacementVolumeRatio) end end else