源始链接:http://rimworldwiki.com/wiki/Modding_Tutorials/Getting_Started
在本教程里,我们将创建一个往游戏里添加简单的,无用的区块的简单模组
先决条件:
略(懂得xml文件编写,译者注)
创建目录结构:
在RimWorld的Mods文件夹中创建如下目录结构
SimpleBlock/
About/
About.xml
Preview.png
Defs/
ThingDefs/
Building_Structure_SimpleBlock.xml
Textures/
Things/
Building/
SimpleBlock_Atlas.png
SimpleBlock_Blueprint.png
SimpleBlock_MenuIcon.png
MAC系统中右键点击RimWorld应用,选择
Show Package Contents
即可看到Mods文件夹.
定义Simple_block
往我们的Buildings_Structure_SimpleBlock.xml
中添加如下内容
骨架文件
<?xml version="1.0" encoding="utf-8"?>
<Buildings>
<ThingDef Name="BuildingBase" Abstract="True">
</ThingDef>
<ThingDef ParentName="BuildingBase">
</ThingDef>
</Buildings>
定义建筑基类
(描述删节)
<?xml version="1.0" encoding="utf-8"?>
<Buildings>
<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<soundImpactDefault>BulletImpactMetal</soundImpactDefault>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<repairEffect>Repair</repairEffect>
<filthLeaving>BuildingRubble</filthLeaving>
</ThingDef>
<ThingDef ParentName="BuildingBase">
</ThingDef>
</Buildings>
(描述删节)
创建简易对象
(描述删节)
<?xml version="1.0" encoding="utf-8"?>
<Buildings>
<ThingDef Name="BuildingBase" Abstract="True">
<category>Building</category>
<soundImpactDefault>BulletImpactMetal</soundImpactDefault>
<selectable>true</selectable>
<drawerType>MapMeshAndRealTime</drawerType>
<terrainAffordanceNeeded>Light</terrainAffordanceNeeded>
<repairEffect>Repair</repairEffect>
<filthLeaving>BuildingRubble</filthLeaving>
</ThingDef>
<ThingDef ParentName="BuildingBase">
<designationCategory>Structure</designationCategory>
<defName>SimpleBlock</defName>
<label>Simple block</label>
<description>An ugly thing.</description>
<graphicPath>Things/Building/SimpleBlock_Atlas</graphicPath>
<blueprintgraphicPath>Things/Building/SimpleBlock_BluePrint</blueprintgraphicPath>
<graphicClass>Graphic_Single</graphicClass>
<uiIconPath>Things/Building/SimpleBlock_MenuIcon</uiIconPath>
<statBases>
<MaxHealth>450</MaxHealth>
<Beauty>2</Beauty>
<WorkToMake>100</WorkToMake>
<Flammability>0</Flammability>
</statBases>
<size>(1,1)</size>
<costList>
<Steel>7</Steel>
</costList>
<filthLeaving>BuildingRubble</filthLeaving>
<eType>BuildingComplex</eType>
<thingClass>Building</thingClass>
<altitudeLayer>BuildingTall</altitudeLayer>
<passability>Impassable</passability>
<castEdgeShadows>true</castEdgeShadows>
<fillPercent>1</fillPercent>
<placingDraggableDimensions>0</placingDraggableDimensions>
<tickerType>Never</tickerType>
<rotatable>true</rotatable>
<neverMultiSelect>true</neverMultiSelect>
<holdsRoof>false</holdsRoof>
<staticSunShadowHeight>0.5</staticSunShadowHeight>
<blockLight>true</blockLight>
</ThingDef>
</Buildings>
收尾
要让RimWorld识别我们的模组,编辑About.xml
在里面放以下代码
<?xml version="1.0" encoding="utf-8"?>
<ModMetaData>
<name>Simple Block</name>
<author>Your name here!</author>
<url>about:blank</url>
<targetVersion>Alpha 9</targetVersion>
<description>A very simple block for a tutorial.</description>
</ModMetaData>
喜欢的话,您还可以添加一个图片,命名为
Preview
,图片可以是任意大小.
测试:
略
下载:
略
结论:
略