Jump to content

Creating new blocks


jhast07

Recommended Posts

I was taking a peek through the files of the game and I was just curious how I would be able to make new blocks that didn't crash my game. Mostly extensions of current blocks. Iron bars being able to be upgraded to steel bars with 10,000 hit points for example. I attempted throwing a mod together, but naturally it didn't work since this is my first try doing something like this. I tried using the bases of other blocks and kind of frankenstening them together, but the server won't load after lol If I could get some insight as to how the game thinks or what it is looking for it would make it easier to wrap my head around how to start adding in new blocks to play around with modding. Thank you guys. Here is what I came up with for my mod.

 

<block id="1990" name="Steelbars">

<property name="CustomIcon" value="ironBars"/>

<property name="Material" value="Mmetal_hard"/>

<property name="Shape" value="New"/>

<property name="LightOpacity" value="0"/>

<property name="Model" value="iron_bars_"/>

<property name="Texture" value="571"/>

<property name="ImposterExclude" value="true"/>

<property name="UseGlobalUV" value="Local"/>

<property name="Place" value="TowardsPlacer"/>

<property name="Collide" value="movement,melee,rocket"/> <!-- -rocket -->

<property class="RepairItems"> <property name="forgedSteel" value="10"/> </property>

<drop event="Harvest" name="scrapIron" count="32"/>

<drop event="Destroy" count="0"/>

<drop event="Fall" name="scrapMetalPile" count="1" prob="0.75" stick_chance="1"/>

<property name="Group" value="Building"/>

<property name="EconomicValue" value="10"/>

<property name="DescriptionKey" value="ironBarsDesc"/>

<property name="DowngradeBlock" value="Ironbars"/>

</block>

Link to comment
Share on other sites

Also, I'd suggest naming your new item steelBars. You don't -have- to, you can name it however you like. But there are naming conventions for a reason. So you don't have to go look up every name every time to see how it got spelled this time. With multiWordNames, the first word is all lowercase, all further words have the first letter capitalized.

Link to comment
Share on other sites

Note also that various different kinds of word groups have different naming conventions. Properties capitalize every word(CustomIcon), materials use an odd capital M prefix(for material) and the have the words all lowercase divided by a '_'. Once you get used to using them, they will slowly start to become second nature, and having distinct naming conventions for different kinds of names can help one tell at a glance what something is. It has other uses in proper coding, as well, but those are less essential here.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...