建筑修改

Eyesedge讨论 | 贡献2023年2月26日 (日) 13:04的版本

建筑是维多利亚3中提供生产、行政、军事单位等的主体,不同的建筑有着不同的产出与消耗,本页面旨在为各模组制作者提供指引。

结构组成

首先,我们要了解一个建筑由哪些部分组成,不同的建筑其实内部的结构都是一样,只是相关的代码不同其消耗与产出也不同。Documents/Paradox Interactive/Victoria 3/mods/mod名称/common/

  1. 建筑组(building groups),这是一个建筑的基础,建筑没有对应的建筑组便不会在游戏中正确的出现。建筑组的文件路径为common/building_groups,此为建筑组文件所在的文件夹,不同类型的建筑有其所属的建筑组,不同的建筑组对应着制造业、农业、基础设施等,而不同的建筑组其所拥有的效果也不同,在官方的建筑组文件里也有相关代码的说明。
  2. 建筑(building),这是建筑的本体,文件路径为common/building

建筑组

我们以一个简单的建筑组来示例,首先,我们要在common-building_groups里创建一个带BOM的UTF-8格式的txt文件,名称为new_building_groups(new_bg等也可以)

bg_new = {   #这是建筑组的名称,格式必须为bg_xxxxxx
	category = urban    #这是建筑组所属的类别,urban(城市)、rural(乡村)、development(开发)
	always_possible = yes    #这是建筑组所属建筑是否能无限制修建,no即为有限制的修建(资源、等级限制等)
	economy_of_scale = yes    #这是建筑每级是否能获得吞吐量修正(自给建筑除外)
	cash_reserves_max = 25000    #建筑最高的储备金
	should_auto_expand = { 
		default_auto_expand_rule = yes    #自动扩建的条件
	}
	economy_of_scale_ai_factor = 2.0    #这是ai考虑吞吐量影响的因素数值
}

此为主组的示例,建筑组分为拥有完整条件的主建筑组与附属主建筑组的子建筑组,以下为次组的示例:

bg_new_industry = {
	parent_group = bg_new    #附属于哪一个主建筑组,如果只是修改可直接套游戏原有的建筑组
	lens = light_industry    #该建筑组内的建筑分属什么类型的建筑,此外还有重工业(heavy_industry)、农业(agriculture)等,如写在主建筑里则为一个大类(比如农业就包括了所有的农田)
	urbanization = 20    #每级城市化率
	infrastructure_usage_per_level = 2    #建筑每级所使用的基础设施值
}

一个主建筑组及其子建筑组,合起来就是一个完整的建筑组,虽然建筑可以分属在主建筑组内,但是多个子建筑组能分开对应不同的建筑类型,如轻工业与重工业分属在制造业内,制造业建筑组所属类别等条件属性均可应用轻重工业,如果只是新建一个子建筑组,那就可以直接附属在游戏原主建筑组内。

官方建筑组效果代码一览

以下说明基于百度翻译与个人校对

  • parent_group = parent_group_key 如果设置了主组,则该建筑组则会被视为指定建筑组的子组,默认无。
  • always_possible = yes/no 如果为是,则该建筑组内的建筑始终能无视所在省份的资源限制,默认否。
  • economy_of_scale = yes/no 如果为是,则任何非自给建筑或该组的子组的建筑将会获得每级大于1的规模经济吞吐量修正。默认否。
  • is_subsistence = yes/no If yes, buildings of types in this group are considered subsistence buildings that follow special rules. Default no.
  • default_building = building_type_key Specifies the default building type that will be built unless the state specifies a different one. No default.
  • lens = lens_key If specified, determines the lens buildings in this group will be sorted under. No default.
  • auto_place_buildings = yes/no
  • capped_by_resources = yes/no
  • discoverable_resource = yes/no
  • depletable_resource = yes/no
  • can_use_slaves = yes/no Default no, setting yes enables slavery for all contained buildings and groups
  • land_usage = urban/rural Which type of state resource the building uses. urban = Urbanization, rural = Arable Land. Default no state resource usage. If unspecified, will return first non-default land usage type found in parent building group tree.
  • cash_reserves_max = number Maximum amount of £ (per level) that buildings in this group can store into their cash reserves. If unspecified or set to 0, it will use the value from the parent group. Default 0
  • inheritable_construction =  yes/no If yes, a construction of this building group will survive a state changing hands or a split state merging
  • stateregion_max_level = yes/no If yes, any building types in this group with the has_max_level property will consider its level restrictions on state-region rather than state level
  • urbanization = number The amount of urbanization buildings in this group provides per level
  • should_auto_expand = trigger Under which condition buildings in this group should auto-expand if auto-expand is toggled on (trigger on more specific group or building type overrides) If this trigger has any contents at all, the game will think the building is potentially auto-expandable, so do not write triggers that can never evaluate to true here
  • hiring_rate = X How much of the building's max staffing level can be hired in a single week (default NDefines::NEconomy::HIRING_RATE)
  • proportionality_limit = X How high is the building's tolerance for pop types being out of proportion? default NDefines::NEconomy::EMPLOYMENT_PROPORTIONALITY_LIMIT)
  • hires_unemployed_only = yes If yes, buildings in this group may only hire from the unemployment pool. Default no.

模组制作指引