Table of Contents

Town buildings

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.

Overview

Town buildings are stored as .con files in the folder res\construction\building.

Each era has its own subfolder:

make_buildings function

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)

Function parameters

Complete code example

local 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

grp and ids

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.

Example

{
	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:

For more detailed information about the categories, please refer to the townbuildingutil.assets list in the townbuildingutil.lua script.