Add property tax calculation

master
rubenwardy 2019-07-23 19:29:27 +01:00
parent c577db0481
commit 004604d036
2 changed files with 24 additions and 1 deletions

View File

@ -7,7 +7,6 @@ graph LR
CementChunk[Cement chunk]
ConcreteBlock[Concrete block]
Sand -- Furnace --> Glass
Sand -- Furnace --> Silicon

View File

@ -306,6 +306,30 @@ function land.calc_value(area)
end
--- Gets plot value, calcs it if needed.
--
-- @tparam table area
-- @treturn number value
function land.get_value(area)
if area.land_value then
return area.land_value
else
return land.calc_value()
end
end
--- Work out the amount of tax that should be paid monthly
--
-- @tparam table area
-- @treturn number value
function land.get_tax(area)
local value = land.get_value(area)
local zone = land.get_zone(area)
return value * (zone.property_tax_rate or 0.1)
end
--- Whether a user can buy a plot
--
-- @tparam table area