Town buildings are a subcategory of construction files. Although town buildings can be configured in the same way as any other construction, they have certain restrictions and conditions.
Town buildings are stored as .con files in the folder res\construction\building.
Each era has its own subfolder:
res\construction\building\era_a: until 1900res\construction\building\era_b: 1900 to 1975res\construction\building\era_c: from 1975
To ensure town buildings fulfil all needed requirements, the function make_building is used to create town buildings.
The function is located in the script res\scripts\townbuildingutil.lua.
function townbuildingutil.make_building(constructionModelId, buildingModelId, buildingFace, transf, landUseType, era, size, parcelSize, assets)
constructionModelId: link to a model file to be placed during the constructionbuildingModelId: link to the building model filebuildingFace: list of 2D coordinates transf: transformation relative to parcel centerlandUseType: “RESIDENTIAL”, “COMMERCIAL”, or “INDUSTRIAL”era: “A”, “B”, or “C”size: building size (1 to 5)parcelSize: parcel size, from 1×1 to 4×5 (resp. { 1, 1 } to { 4, 5 })assets: list of model files to be placed around the buildinglocal townbuildingutil = require "townbuildingutil" local transf = require "transf" local vec3 = require "vec3" function data() return townbuildingutil.make_building( "asset/construction_1850.mdl", "building/era_a/res_1_1x1_01_02.mdl", { { -4.00, -1.25 }, { 4.00, -1.25 }, { 4.00, 8.00 }, { -4.00, 8.00 } }, transf.transl(vec3.new(.0, 1.5, .0)), "COMMERCIAL", "A", 1, { 1, 1 }, { -- list of grp and ids } ) end
A grp is a categorized collection of decorative model files. One (or none) of the models are chosen at random and placed at the specified position.
ids are model files, which are placed at the specified position.
{
grp = "era_a_com_1_wall_sign",
transf = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -0.8, 2.725, 2.5, 1 }
},
{
ids = { "building/era_a/com_1_asset_wall_awning_03_start.mdl" },
transf = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1.5, 2.725, 1.5, 1 }
},
Available grp files:
benchera_a_ind_random_decorationera_b_ind_random_decorationera_c_ind_random_decorationera_a_res_random_decorationera_b_res_random_decorationera_c_res_random_decorationrandom_roof_decoration_smallrandom_roof_decoration_largesolar_panel_on_offera_c_pavillion_on_offera_a_com_random_decorationera_b_com_random_decorationera_b_com_1_ground_boxera_b_com_1_ground_food_boothera_b_com_1_ground_signera_b_com_1_wall_sign_bigera_b_com_1_wall_sign_smallera_b_com_1_wall_store_sign_bigera_b_com_1_wall_store_sign_smallera_b_com_2_to_3_wall_sign_bigera_b_com_2_to_3_wall_sign_smallera_b_com_2_to_3_wall_store_signera_b_com_2_to_3_wall_store_sign_smallera_c_com_random_decorationera_a_com_1_food_boothera_a_com_1_wall_signera_a_com_1_wall_sign_bigera_a_com_1_ground_signera_a_com_1_wall_store_signera_a_com_2_wall_signera_a_com_2_roof_signera_a_com_2_wall_store_signera_a_com_2_wall_store_sign_bigera_a_com_2_wall_awning_04era_c_com_2_to_4_wall_sign_smallera_c_com_2_to_4_wall_sign_largeera_c_com_2_to_4_wall_store_signsilo_horizontalsilo_verticalsilo_specialgarden_sunshade_large_01garden_sunshade_large_02garden_sunshade_smallrandom_medium_treerandom_large_treerandom_small_treerandom_shrub_europerandom_shrub_usa
For more detailed information about the categories, please refer to the townbuildingutil.assets list in the townbuildingutil.lua script.