铁锈战争模组和地图制作帮助文档

建筑和工厂

在铁锈战争中,建筑和工厂是玩家发展和扩张的基础。本章节将详细介绍如何创建自定义建筑和工厂,包括建筑属性、生产设置、特殊功能等。

建筑基本结构

建筑定义与单位定义类似,但有一些特殊属性。以下是建筑的基本结构:

[core] 建筑核心属性

建筑的核心属性与单位类似,但有一些特殊设置:

[core]
name:工厂
class:CustomUnitMetadata
price:1000
maxHp:1500
mass:20000
techLevel:1
buildSpeed:0.005
radius:25
displayRadius:30
fogOfWarSightRange:15
isBuilding:true
footprint:-1,-1,1,1
constructionFootprint:-2,-2,2,2
            

重要建筑核心属性说明

属性 说明 示例
isBuilding 标记为建筑 isBuilding:true
footprint 建筑碰撞范围 footprint:-1,-1,1,1
constructionFootprint 建筑覆盖范围 constructionFootprint:-2,-2,2,2

footprint 和 constructionFootprint

这两个属性定义了建筑在地图上的占用空间:

[graphics] 建筑图像设置

建筑的图像设置与单位类似,但有一些特殊考虑:

[graphics]
image:buildings/factory.png
	image_back:buildings/factory_base.png
	image_wreak:buildings/factory_wreak.png
	image_shadow:AUTO
	teamColorsUseHue:true
	teamColoringMode:hueAdd
            

建筑图像特殊属性

属性 说明 示例
image_back 建筑背景图像 image_back:buildings/factory_base.png

工厂设置

工厂是能够生产单位的建筑。以下是工厂设置的关键部分:

[canBuild_#] 生产设置

定义工厂可以生产的单位:

[canBuild_1]
name:基础坦克
pos:0.1

[canBuild_2]
name:侦察车
pos:0.2
            

生产设置属性说明

属性 说明 示例
name 可生产的单位名称 name:基础坦克
pos 在UI中的排序位置 pos:0.1

特殊建筑类型

资源建筑

资源建筑可以产生资源:

[core]
name:矿场
class:CustomUnitMetadata
price:800
maxHp:1000
generation_resources:credits:10
generation_delay:40
            

防御建筑

防御建筑通常具有攻击能力:

[core]
name:炮塔
class:CustomUnitMetadata
price:500
maxHp:800
isBuilding:true
footprint:0,0,0,0
constructionFootprint:-1,-1,1,1

[attack]
canAttack:true
canAttackFlyingUnits:false
canAttackLandUnits:true

[turret_1]
x:0
y:0
projectile:cannon_ball
turnSpeed:3
size:10
barrelX:0
barrelY:15
            

特殊功能建筑

一些建筑具有特殊功能:

[core]
name:科技中心
class:CustomUnitMetadata
price:3000
maxHp:2000
isBuilding:true

[action_upgrade]
text:升级单位
description:提升单位属性
price:500
buildSpeed:10s
displayType:upgrade
            

建筑放置规则

建筑可以设置放置规则,限制其建造位置:

[placementRule_#] 放置规则

[placementRule_1]
searchTags:resource_pool
searchTeam:own
searchDistance:50
minCount:1
blocksPlacement:true
cannotPlaceMessage:必须建造在资源池附近
            

放置规则属性说明

属性 说明 示例
searchTags 搜索具有特定标签的单位 searchTags:resource_pool
searchTeam 搜索的队伍 searchTeam:own
searchDistance 搜索距离 searchDistance:50
minCount 最小数量要求 minCount:1
blocksPlacement 是否阻止放置 blocksPlacement:true
cannotPlaceMessage 放置失败时的提示信息 cannotPlaceMessage:必须建造在资源池附近

完整建筑示例

工厂示例

[core]
name:高级工厂
class:CustomUnitMetadata
price:2000
maxHp:2500
mass:30000
techLevel:2
buildSpeed:0.006
radius:30
displayRadius:35
fogOfWarSightRange:15
isBuilding:true
footprint:-1,-1,1,1
constructionFootprint:-2,-2,2,2
selfBuildRate:0.002

[graphics]
image:buildings/advanced_factory.png
image_back:buildings/factory_base.png
image_wreak:buildings/advanced_factory_wreak.png
image_shadow:AUTO
teamColorsUseHue:true
teamColoringMode:hueAdd

[canBuild_1]
name:重型坦克
pos:0.1

[canBuild_2]
name:侦察车
pos:0.2

[canBuild_3]
name:工程师
pos:0.3
            

防御塔示例

[core]
name:防空炮塔
class:CustomUnitMetadata
price:600
maxHp:600
mass:5000
techLevel:1
buildSpeed:0.003
radius:20
displayRadius:25
fogOfWarSightRange:15
isBuilding:true
footprint:0,0,0,0
constructionFootprint:-1,-1,1,1
selfBuildRate:0.002

[graphics]
image:buildings/anti_air_turret.png
image_wreak:buildings/anti_air_turret_wreak.png
image_turret:buildings/anti_air_turret_gun.png
image_shadow:AUTO
teamColorsUseHue:true
teamColoringMode:hueAdd

[attack]
canAttack:true
canAttackFlyingUnits:true
canAttackLandUnits:false
canAttackUnderwaterUnits:false

[turret_1]
x:0
y:0
projectile:anti_air_missile
turnSpeed:5
size:10
barrelX:0
barrelY:15

[projectile_1]
directDamage:30
life:120
speed:6
targetGround:false
autoTargetingOnDeadTarget:true
image:projectiles/missile.png
drawType:2
color:#00FF00
            

注意事项

回到顶部