舰船:船体、区段与部件
ship_sizes、section_templates、component_templates 三层结构,武器数值表,全局舰船设计与模型命名规则
三层结构
原版 common/HOW_TO_MAKE_NEW_SHIPS.txt 开宗明义:一艘船由三样东西组成。
| 层 | 位置 | 作用 |
|---|---|---|
| 船体尺寸(ship_size) | common/ship_sizes/ | 船的基本属性,以及有哪些区段槽 |
| 区段模板(section_template) | common/section_templates/ | 装在区段槽上的区段,提供部件槽 |
| 部件模板(component_template) | common/component_templates/ | 武器、护盾、反应堆等,装进部件槽 |
舰船设计(玩家在设计器里做的、或 common/global_ship_designs/ 里预制的)把三者组合起来。
辅助文件夹:
common/component_slot_templates/:部件槽模板,规定槽的尺寸、类型和每种武器的模型;common/component_sets/:部件组,设计器里同一组的部件放在一起,船体可以要求“必须装某一组”。
船体尺寸
原版护卫舰(common/ship_sizes/00_ship_sizes.txt,删减):
corvette = {
max_speed = @speed_very_fast
acceleration = 0.35
rotation_speed = 0.1
max_hitpoints = @corvette_hp
modifier = {
ship_evasion_add = @corvette_evasion
}
size_multiplier = @corvette_size_multiplier
fleet_slot_size = 1
section_slots = { "mid" = { locator = "part1" } }
base_buildtime = @corvette_build_time
enable_default_design = yes
prerequisites = { "tech_corvettes" }
class = shipclass_military
construction_type = starbase_shipyard
required_component_set = "power_core"
required_component_set = "ftl_components"
required_component_set = "thruster_components"
required_component_set = "sensor_components"
required_component_set = "combat_computers"
resources = {
category = ships
upkeep = {
energy = @corvette_upkeep_energy
alloys = @corvette_upkeep_alloys
}
}
}要点:
section_slots给每个区段槽命名,并指定它挂在模型的哪个定位点(locator)上;class决定船的大类(军舰、建造船、科研船……),很多部件按它限制;required_component_set要求设计必须包含某一组部件;prerequisites是前置科技;- 非设计器使用的特殊船(太空生物、事件船)设
is_designable = no。
HOW_TO_MAKE_NEW_SHIPS.txt 还提醒:新增船体尺寸后,要把它加到每个适用部件的限制里,否则这些部件装不上去。
区段模板
原版 common/section_templates/corvette.txt 中的一个护卫舰区段(删减):
ship_section_template = {
key = "CORVETTE_MID_S3"
ship_size = corvette
fits_on_slot = mid
should_draw_components = yes
entity = "corvette_S3_entity"
icon = "GFX_ship_part_core_mid"
component_slot = {
name = "SMALL_GUN_01"
template = "small_turret"
locatorname = "small_gun_01"
}
# ……SMALL_GUN_02、SMALL_GUN_03 同理
small_utility_slots = 3
aux_utility_slots = 1
resources = {
category = ship_sections
cost = {
alloys = @section_cost
}
}
}- 每个区段都写成
ship_section_template = { key = ... },key是它的名字; ship_size和fits_on_slot可以重复写多次,表示兼容多个船体、多个槽;component_slot是武器类槽位,template引用component_slot_templates里的模板(例如small_turret规定尺寸small、类型weapon,并为动能、能量、爆炸武器分别指定模型);- 辅助槽位直接写数量:
small_utility_slots、medium_utility_slots、large_utility_slots、aux_utility_slots。
部件模板
部件分三种块:weapon_component_template、utility_component_template、strike_craft_component_template。common/component_templates/000_documentation.txt 列出了全部字段。原版小型质量加速炮(00_weapons_projectile.txt,删减):
weapon_component_template = {
type = instant
key = "SMALL_MASS_DRIVER_1"
size = small
icon = "GFX_ship_part_mass_driver_1"
icon_frame = 1
prerequisites = { "tech_mass_drivers_1" }
component_set = "MASS_DRIVER_1"
projectile_gfx = "mass_driver_s"
tags = {
weapon_type_kinetic
s_slot
}
upgrades_to = "SMALL_MASS_DRIVER_2"
resources = {
category = ship_components
cost = {
alloys = @s_t1_cost
}
upkeep = {
energy = @s_t1_upkeep_energy
alloys = @s_t1_upkeep_alloys
}
}
}通用字段:
| 字段 | 说明 |
|---|---|
key | 部件名,也是本地化键 |
size | point_defence、small、medium、large、extra_large、titanic、torpedo、planet_killer、aux |
power | 消耗(负)或提供(正)的电力 |
modifier | 显示在设计器里的数值,如 ship_armor_add |
ship_modifier | 大部分船只修正写在这里,不在设计器显示 |
triggered_ship_modifier / triggered_ship_design_modifier | 触发式版本 |
potential | 部件是否出现在可选列表;this 是设计,from 是国家 |
possible | 用来禁止与其他部件同时装备 |
component_set / upgrades_to | 所属部件组、自动升级目标 |
friendly_aura / hostile_aura | 光环 |
ai_weight / ai_tags / should_ai_use | AI 用法 |
文档把 class_restriction、size_restriction、ship_limit、blocked_by 标为已弃用,新写的部件请改用 potential 和 possible。
武器数值在 CSV 里
文档说明:大部分武器数值(伤害、射程、精度、穿透、冷却、导弹属性等)不写在脚本模板里,而是在 common/component_templates/weapon_components.csv,按 key 对应。原版这一行:
SMALL_MASS_DRIVER_1;10.00;-5.00;5.00;16.00;1.00;1.50;0.00;0.50;0.00;4.00;14.00;20.00;50.00;0.75;0.50;0.00;1.00;0.00;0.00;0.00;0.00;0.00;0.00;列的顺序见 CSV 表头:key;cost;power;min_damage;max_damage;hull_damage;shield_damage;shield_penetration;armor_damage;armor_penetration;……。
99_README_WEAPON_COMPONENTS_STAT_DOCS.txt说明:编辑配套的.ods表格,另存为 CSV,字段分隔符用;,文本分隔符留空。- CSV 开头的注释说这个文件可以用控制台命令
reload stats重新加载。 - 新武器要在 CSV 里加一行;整文件覆盖原版 CSV 会和其他改武器的模组冲突,见加载顺序与覆盖规则。
全局舰船设计
common/global_ship_designs/ 放事件和开局用的预制设计(字段说明见同目录 000_documentation.txt)。原版 ai_ship_designs.txt 开头的结构:
ship_design = {
name = "NAME_Euthanizer"
ship_size = large_ship_ai
section = {
template = "ai_large_warship_key"
slot = "mid"
component = {
slot = "PD_01"
template = "POINT_DEFENCE_2"
}
# ……
}
}每个 section 指定区段模板和所在的区段槽,component 再指定部件槽和部件。事件里用 create_ship 生成船时可以引用设计名,参数见 effects.log。
模型命名规则
HOW_TO_MAKE_NEW_SHIPS.txt 的“Graphics”一节:
- 船体的核心模型按
<图形文化>_<船体尺寸>_entity查找,例如mammalian_01_corvette_entity;找不到时回退到不带文化前缀的corvette_entity; - 区段模型按区段模板里的
entity加上图形文化前缀查找; - 核心模型必须有
section_slots引用的定位点(part1等); - 武器模型需要名为
turret_muzzle_01的定位点,作为弹道发射位置。
想做一艘不随图形文化变化的特殊船,就把实体名的文化前缀去掉。
本地化
- 船体尺寸:
<键>与<键>_plural(原版corvette、corvette_plural); - 区段、部件:
key的值,例如CORVETTE_MID_S3、SMALL_MASS_DRIVER_1。