游侠技术

士不分心终有志,工能用力必成功!

RimWorld模组教程之入门

源始链接: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,图片可以是任意大小.


测试:


下载:


结论:


阅读更多
想对作者说点什么? 我来说一句

鹏哥特色教程之c#(1)

2009年03月31日 1.8MB 下载

鹏哥特色教程之c#(10)

2010年03月12日 2.06MB 下载

清华大学计算机教程之-数据结构

2009年06月23日 4.84MB 下载

JSP教程之与数据库通信

2010年04月19日 988KB 下载

没有更多推荐了,返回首页

不良信息举报

RimWorld模组教程之入门

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭