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,图片可以是任意大小.


测试:


下载:


结论:


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值