Author Topic: [PC] TM PC Modding API  (Read 15111 times)

0 Members and 1 Guest are viewing this topic.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
[PC] TM PC Modding API
« on: November 08, 2015, 08:35:53 PM »
Modding API Overview:

You can browse all my test mod projects here: https://github.com/cmartin99/TotalMinerMods

In the game save folder there is a subfolder named Mods. Each mod will have it's own subfolder in the Mods folder. All files associated with the mod will be in that folder. The folder name will be the name of the mod.

e.g.

C:\Games\TotalMiner\Mods\Garys Mod\ItemData.xml
C:\Games\TotalMiner\Mods\Garys Mod\SkillData.xml
C:\Games\TotalMiner\Mods\Garys Mod\BlockTextures16.xml
C:\Games\TotalMiner\Mods\Garys Mod\ItemTextures32.xml
C:\Games\TotalMiner\Mods\Garys Mod\tp_16.png
C:\Games\TotalMiner\Mods\Garys Mod\tpi_32.png


Adding New Items or Changing Existing Items:
Adding new items into the game requires the modder to supply certain XML files which define properties for the items, and PNG files to define their textures. Each mod can add multiple items. No programming is required. Changing existing items is the same as adding new items except you specify an existing ItemID rather than a new one.


Changing Existing Blocks:
Adding new blocks is not yet supported, but you can change existing blocks. Changing blocks requires the modder to supply certain XML files which redefine the blocks properties, and PNG files to redefine their textures. Each mod can change multiple blocks. No programming is required.


Adding New NPCs:
Adding new NPCs to the game works in a similar manner to adding new items, but the XML files that need to be supplied will pertain to NPC data instead. Modders will also need to create an avatar if they are adding a new NPC, by making a component in the game, then saving and copying the component to the folder the mod is in. Each mod can add multiple NPCs. Custom NPC behaviours and dialog can also be provided in a mod. No programming is required.


Adding Particle Emitter Templates:
Adding particle emitter templates only requires the modder to supply a ParticleEmitterData.xml file with the necessary fields filled in and the game will add it to the custom particle template list for use. Note that these will act in the same manner as system templates, meaning you will not be able to save these templates in game unless you save it as a copy with a different name. No programming is required.


Adding Texture Packs:
If all you want to do is add a new texture pack to the game then that is simply a matter of supplying the required PNG files. No programming is required.


We may also develop a tool to make custom object creation easier for those that are not comfortable working with XML files directly.

Feel free to ask any questions you may have regarding the API, but please keep all modding discussions within this topic instead of making separate ones.
« Last Edit: December 27, 2016, 08:33:48 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #1 on: November 08, 2015, 08:36:52 PM »
Adding Items

The XML files that define an item are:

ItemData.xml
ItemTypeData.xml
ItemTypeClassData.xml
ItemCombatData.xml
ItemSwingTimeData.xml
ItemSwingData.xml
ItemModelData.xml
ItemSoundData.xml
SkillData.xml
BlueprintData.xml

  • Changing existing items is exactly the same as adding a new item, except that you specify the name of an existing item in the xml file(s), and any data that you omit will be taken from the items current data.
  • All files are optional. If a file is not supplied, or individual fields in a file are omitted, then default values are used.
  • If you want the item to be craftable, you must supply BlueprintData.xml.
  • If you want to define the skill level requirements for the item, you must supply SkillData.xml.

For the purposes of explaining the data files, we've taken the entries used by the Steel Sword. Over time we will provide a description of each field in each file and what values they can specify.

--------------------------------------------------------------------------------------------------------------------------------------------

ItemData.xml

Defines general properties for Blocks and Items.

Sample File:
Spoiler for Hidden Content:
Simple Example: Name and Description change

<?xml version="1.0"?>
<ArrayOfModItemDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemDataXML>
    <ItemID>WoodSword</ItemID>
    <Name>Club Of Pain</Name>
    <Desc>Hand out maximum pain to your enemies.</Desc>
  </ModItemDataXML>
  <ModItemDataXML>
    <ItemID>SteelSword</ItemID>
    <Name>The Vanquisher</Name>
    <Desc>Vanquish enemies at will.</Desc>
  </ModItemDataXML>
</ArrayOfModItemDataXML>

Full Example:

<?xml version="1.0"?>
<ArrayOfModItemDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemDataXML>
    <ItemID>SteelSword</ItemID>
    <Name>Steel Sword</Name>
    <Desc>This sword will last 2 - 3 times longer than an iron sword.</Desc>
    <IsValid>true</IsValid>
    <IsEnabled>true</IsEnabled>
    <LockedDD>true</LockedDD>
    <LockedCR>false</LockedCR>
    <LockedSU>false</LockedSU>
    <MinCSPrice>633</MinCSPrice>
    <StackSize>100</StackSize>
    <Durability>1200</Durability>
    <StrikeDamage>20</StrikeDamage>
    <StrikeReach>3.6</StrikeReach>
    <HealPower>0</HealPower>
    <BurnTime>0</BurnTime>
    <SmeltTime>0</SmeltTime>
    <ParticleLight>0</ParticleLight>
    <CanDropIfLocked>false</CanDropIfLocked>
    <Plural>S</Plural>
  </ModItemDataXML>
</ArrayOfModItemDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: The Item identifier. No spaces. If modding an existing item, put the existing ItemID here. If adding a new item, put the new ItemID here.

Name: The name of the item as displayed on the screen. Should include spaces between words.

Desc: The full description text of the item as shown on the Interact/Prospect screen.

IsValid: True or False. The item will not be usable and cannot be enabled if False.

IsEnabled: True or False. The item will not be initially usable if False. The player will have to enable the item via the Item Options screen to use.

LockedDD: True or False. If True, the item will be initially locked in Dig Deep until the items blueprint is found or the item is equipped in inventory.

LockedCR: True or False. If True, the item will be initially locked in Creative until the item is equipped in inventory.

LockedSU: True or False. If True, the item will be initially locked in Survival until the item is equipped in inventory.

MinCSPrice: Base price for shop. 0 = free. -1 means the item will not be available to buy/sell in shops.

StackSize: Maximum stack size for the item. If the item has durability, this field is ignore (stack size is 1).

Durability: The durability of the item. Items with Durability > 0 are not stackable.

StrikeDamage: The base damage points the item will inflict when it strikes an opponent.

StrikeReach: The base reach distance for the item in metres. If an opponent is within this distance, it can be struck.

HealPower: The amount of health points gained when the item is used.

BurnTime: The amount of time in seconds it takes the item to burn in a furnace. A value of 0 means the item cannot burn.

SmeltTime: The amount of time in seconds it takes for the item to be smelted. Ignored if the item does not have a furnace blueprint.

ParticleLight: TBA

CanDropIfLocked: True or False. If false, the item cannot be dropped by mobs if the item is locked.

Plural: Instructs the game what text to add to the item name to describe the item in plural. Valid values are None, S and ES.

--------------------------------------------------------------------------------------------------------------------------------------------

ItemTypeData.xml

Defines types and categories for Blocks and Items.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemTypeDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemTypeDataXML>
    <ItemID>SteelSword</ItemID>
    <Use>Item</Use>
    <Type>Weapon</Type>
    <SubType>None</SubType>
    <Class>Steel</Class>
    <Inv>Weapon</Inv>
    <Combat>None</Combat>
    <Model>Weapon</Model>
    <Swing>Weapon</Swing>
    <Equip>RightHand</Equip>
  </ModItemTypeDataXML>
</ArrayOfModItemTypeDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: The item identifier.

Use: Valid values - Block or Item.

Type: Valid values -  Block, Item, Tool, Weapon, Armor, Power, Food, Decor, Jewelry.

SubType: Sub types can be combined by separating multiple values with spaces. Valid values -  Bow, Arrow, Shield, Edible, TillTool, HarvestTool, Grenade, GrenadeLauncher, Key, Door, RangedWeapon, BlockCanBeOpened, Leaves,  Gun, RapidSwing, Potion.

Class: Valid values - None, CantMine, Hand, Wood, Bronze, Iron, Steel, GreenstoneGold, Platinum, Diamond, Ruby, Titanium, SledgeHammer.

Inv: Specifies which shop tab the item will be listed. Valid values for Blocks - Natural, Stone, Ore, Flora, Utility, Building, Color. Valid values for Items - Tool, Weapon, Armor, Food, Jewelry, Key, Other.

Combat: TBA

Model: Valid values - Block, IconBlock, BigIconBlock, Item, MediumItem, MediumItemFront, ItemTLBR, Tool, Hatchet, Weapon, WeaponTLBR, WeaponTRBL, BigWeapon, SteelScimitar, SteelClaymore, Bow, Arrow, Armor, Shield, Key, Jewelry, Door, Torch, GunHand, GunRifle, Clipboard, Staff.

Swing: Valid values - Block, Item, IconBlock, Ramp, Weapon, WeaponTRBL, Spear, Bow, Shield, Eating, Arrow, SwitchArrow, GunHand, GunRifle, Key, Staff.

Equip: Valid values - Head, Neck, Body, Legs, Feet, LeftSide, RightSide, LeftHand, RightHand.

--------------------------------------------------------------------------------------------------------------------------------------------

ItemTypeClassData.xml

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemTypeClassDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemTypeClassDataXML>
    <ItemClass>Steel</ItemClass>
    <Power>450</Power>
    <MaxResistance>3150</MaxResistance>
  </ModItemTypeClassDataXML>
</ArrayOfModItemTypeClassDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemClass: TBD
Power: TBD
MaxResistance: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ItemCombatData.xml

Defines Combat bonus buffs for Combat Items.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemCombatDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemCombatDataXML>
    <CombatID>SteelSword</CombatID>
    <Health>0</Health>
    <Attack>40</Attack>
    <Strength>30</Strength>
    <Defence>30</Defence>
    <Ranged>0</Ranged>
    <Looting>0</Looting>
  </ModItemCombatDataXML>
</ArrayOfModItemCombatDataXML>
Field Documentation:
Spoiler for Hidden Content:
CombatID: The Combat identifier as specified in the <Combat> field in ItemTypeData.xml

Each of the following fields can have a value of -32767 to 32767.
Every 100 points is equivalent to 1 skill level.

Health:
Attack:
Strength:
Defence:
Ranged:
Looting:

--------------------------------------------------------------------------------------------------------------------------------------------

ItemSwingTimeData.xml

Defines timing data for the item swing.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemSwingTimeDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemSwingTimeDataXML>
    <ItemID>SteelSword</ItemID>
    <Time>0.42</Time>
    <Pause>0</Pause>
    <ExtendedPause>0</ExtendedPause>
    <RetractTime>-1</RetractTime>
    <RetractSmooth>false</RetractSmooth>
  </ModItemSwingTimeDataXML>
  <ModItemSwingTimeDataXML>
    <ItemID>Pizza</ItemID>
    <Time>1.2</Time>
    <Pause>0.1</Pause>
    <ExtendedPause>0.85</ExtendedPause>
    <RetractTime>-1</RetractTime>
    <RetractSmooth>false</RetractSmooth>
  </ModItemSwingTimeDataXML>
</ArrayOfModItemSwingTimeDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: TBD
Time: TBD
Pause: TBD
ExtendedPause: TBD
RetractTime: TBD
RetractSmooth: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ItemSwingData.xml

Defines animation data for the item swing.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemSwingDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemSwingDataXML>
    <SwingType>Weapon</SwingType>
    <IsSwingable>true</IsSwingable>
    <SwingTime>0</SwingTime>
    <RestPosition>
      <X>0.23462156</X>
      <Y>-0.165112343</Y>
      <Z>-0.4669441</Z>
    </RestPosition>
    <RestRotation>
      <X>0.13984846</X>
      <Y>0.41943686</Y>
      <Z>0</Z>
    </RestRotation>
    <ExtendedPosition>
      <X>0.2004708</X>
      <Y>0.25</Y>
      <Z>-0.45</Z>
    </ExtendedPosition>
    <ExtendedPositionFPV>
      <X>0.2004708</X>
      <Y>-0.08133192</Y>
      <Z>-0.45</Z>
    </ExtendedPositionFPV>
    <ExtendedRotation>
      <X>0.02</X>
      <Y>-0.2</Y>
      <Z>0.2</Z>
    </ExtendedRotation>
    <ExtendedRotationFPV>
      <X>-0.0619444</X>
      <Y>-0.4385138</Y>
      <Z>0.7777606</Z>
    </ExtendedRotationFPV>
    <CircularY>0.38</CircularY>
    <CircularZ>0.41</CircularZ>
    <CircularYFPV>0.11</CircularYFPV>
  </ModItemSwingDataXML>
  <ModItemSwingDataXML>
    <SwingType>Eating</SwingType>
    <IsSwingable>true</IsSwingable>
    <SwingTime>0</SwingTime>
    <RestPosition>
      <X>0.25</X>
      <Y>-0.17</Y>
      <Z>-0.45</Z>
    </RestPosition>
    <RestRotation>
      <X>0.2</X>
      <Y>0.4</Y>
      <Z>0</Z>
    </RestRotation>
    <ExtendedPosition>
      <X>0.04</X>
      <Y>0.17</Y>
      <Z>-0.63</Z>
    </ExtendedPosition>
    <ExtendedPositionFPV>
      <X>0.04</X>
      <Y>-0.17</Y>
      <Z>-0.55</Z>
    </ExtendedPositionFPV>
    <ExtendedRotation>
      <X>0.95</X>
      <Y>0</Y>
      <Z>0.2</Z>
    </ExtendedRotation>
    <ExtendedRotationFPV>
      <X>1.4</X>
      <Y>0</Y>
      <Z>0.3</Z>
    </ExtendedRotationFPV>
    <CircularY>0</CircularY>
    <CircularZ>0</CircularZ>
    <CircularYFPV>0</CircularYFPV>
  </ModItemSwingDataXML>
</ArrayOfModItemSwingDataXML>
Field Documentation:
Spoiler for Hidden Content:
SwingType: TBD
IsSwingable: TBD
SwingTime: TBD
RestPosition: TBD
RestRotation: TBD
ExtendedPosition: TBD
ExtendedPositionFPV: TBD
ExtendedRotation: TBD
ExtendedRotationFPV: TBD
CircularY: TBD
CircularZ: TBD
CircularYFPV: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ItemModelData.xml

Defines model orientation data for the item.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemModelDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemModelDataXML>
    <ItemModelType>Weapon</ItemModelType>
    <Scale>2.2</Scale>
    <HandOffset>
      <X>0</X>
      <Y>0.03331069</Y>
      <Z>-0.04895301</Z>
    </HandOffset>
    <HandYPR>
      <X>0</X>
      <Y>-1.35</Y>
      <Z>0</Z>
    </HandYPR>
    <HUDScale>1</HUDScale>
    <HUDOffset>
      <X>0</X>
      <Y>-0.06391386</Y>
      <Z>-0.0002981975</Z>
    </HUDOffset>
  </ModItemModelDataXML>
</ArrayOfModItemModelDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemModelType: TBD
Scale: TBD
HandOffset: TBD
HandYPR: TBD
HUDScale: TBD
HUDOffset: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ItemSoundData.xml

Defines sounds / audio used by the item.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModItemSoundDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModItemSoundDataXML>
    <ItemID>SteelSword</ItemID>
    <Group>ItemSteelTool</Group>
    <Sounds />
  </ModItemSoundDataXML>
</ArrayOfModItemSoundDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: TBD
Group: TBD
Sounds: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

SkillData.xml

Defines Skill properties for Blocks and Items.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModSkillDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModSkillDataXML>
    <ItemID>SteelSword</ItemID>
    <MineReq>0</MineReq>
    <UseReq>20</UseReq>
    <UseSkill>Attack</UseSkill>
    <CraftReq>24</CraftReq>
    <CraftSkill>Smithing</CraftSkill>
  </ModSkillDataXML>
</ArrayOfModSkillDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: The item identifier.

MineReq: The mining skill level required to mine the block.

UseReq: The [UseSkill] level required to use the item.

UseSkill: All XP associated with using the item will be applied to this skill. Valid values - Health, Strength, Attack, Defence, Ranged, Mining, Digging, Chopping, Building, Crafting, Smelting, Smithing, Farming, Cooking, Looting.

CraftReq: The [CraftSkill] level required to craft the item.

CraftSkill: All XP associated with crafting the item will be applied to this skill. Valid values - Health, Strength, Attack, Defence, Ranged, Mining, Digging, Chopping, Building, Crafting, Smelting, Smithing, Farming, Cooking, Looting.

--------------------------------------------------------------------------------------------------------------------------------------------

BlueprintData.xml

Defines how Blocks and Items are crafted.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModBlueprintDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModBlueprintDataXML>
    <ItemID>SteelSword</ItemID>
    <CraftType>Crafting</CraftType>
    <IsDefault>false</IsDefault>
    <Depth>
      <X>0.274452627</X>
      <Y>0.4744526</Y>
    </Depth>
    <Result>
      <ItemID>SteelSword</ItemID>
      <Count>1</Count>
    </Result>
    <Material11>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material11>
    <Material12>
      <ItemID>Stick</ItemID>
      <Durability>0</Durability>
      <Count>1</Count>
    </Material12>
    <Material13>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material13>
    <Material21>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material21>
    <Material22>
      <ItemID>SteelIngot</ItemID>
      <Durability>0</Durability>
      <Count>1</Count>
    </Material22>
    <Material23>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material23>
    <Material31>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material31>
    <Material32>
      <ItemID>SteelIngot</ItemID>
      <Durability>0</Durability>
      <Count>1</Count>
    </Material32>
    <Material33>
      <ItemID>None</ItemID>
      <Durability>0</Durability>
      <Count>0</Count>
    </Material33>
  </ModBlueprintDataXML>
</ArrayOfModBlueprintDataXML>
Field Documentation:
Spoiler for Hidden Content:
ItemID: TBD
CraftType: TBD
IsDefault: TBD
Depth: TBD
Result: TBD
Material11: TBD
Material12: TBD
Material13: TBD
Material21: TBD
Material22: TBD
Material23: TBD
Material31: TBD
Material32: TBD
Material33: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ItemTextures16.xml and ItemTextures32.xml

These two files list the items whose textures are in the PNG files.
The items defined in ItemTextures16.xml will be loaded from TPI_16.PNG and placed into SD texture packs (when they are loaded).
The items defined in ItemTextures32.xml will be loaded from TPI_32.PNG and placed into HD texture packs (when they are loaded).
These files are not necessary if you are not supplying PNG files.
You can optionally supply textures for SD packs, HD packs, or both.
You can supply textures for different items for SD and HD packs, they don't have to match.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfItemXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ItemXML>
    <ItemID>Revolver</ItemID>
  </ItemXML>
  <ItemXML>
    <ItemID>Bullet</ItemID>
  </ItemXML>
  <ItemXML>
    <ItemID>SniperRifle</ItemID>
  </ItemXML>
  <ItemXML>
    <ItemID>AssaultRifle</ItemID>
  </ItemXML>
</ArrayOfItemXML>

--------------------------------------------------------------------------------------------------------------------------------------------
« Last Edit: December 29, 2016, 10:22:56 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #2 on: November 08, 2015, 08:36:58 PM »
Changing Blocks

Currently it is not possible to add new Blocks to the game but you can change the definitions of existing blocks.

The XML files that define a Block are:

BlockData.xml
BlockMaterialData.xml
and all the Item*.xml files listed in the previous topic.

--------------------------------------------------------------------------------------------------------------------------------------------

BlockData.xml

Defines general properties for Blocks.

Sample File:
Spoiler for Hidden Content:
Simple Example: Name and Description change

<?xml version="1.0"?>
<ArrayOfModBlockDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModBlockDataXML>
    <BlockID>Retro</BlockID>
    <Opacity>1</Opacity>
    <Buffer>4</Buffer>
    <IsRotated>true</IsRotated>
  </ModBlockDataXML>
  <ModBlockDataXML>
    <BlockID>CherryMetal</BlockID>
    <Opacity>1</Opacity>
    <Buffer>4</Buffer>
    <IsRotated>true</IsRotated>
  </ModBlockDataXML>
</ArrayOfModBlockDataXML>

Full Example:

<?xml version="1.0"?>
<ArrayOfModBlockDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModBlockDataXML>
    <BlockID>Grass</BlockID>
    <Material>Earth</Material>
    <ClassType>None</ClassType>
    <Opacity>255</Opacity>
    <Luminance>0</Luminance>
    <Friction>0.35</Friction>
    <Dampen>0.1</Dampen>
    <Buffer>0</Buffer>
    <IsIcon>false</IsIcon>
    <IsAttached>false</IsAttached>
    <IsPassable>false</IsPassable>
    <IsRotated>false</IsRotated>
    <IsOrientated>false</IsOrientated>
    <IsOreDeposit>false</IsOreDeposit>
    <IsPowerEmitter>false</IsPowerEmitter>
    <IsPoweredMechanism>false</IsPoweredMechanism>
    <IsVertSunlightUnhindered>false</IsVertSunlightUnhindered>
    <BlastResistance>0</BlastResistance>
    <WindAffect>0</WindAffect>
    <TextureID>0</TextureID>
  </ModBlockDataXML>
</ArrayOfModBlockDataXML>
Field Documentation:
Spoiler for Hidden Content:
BlockID: The Block identifier. No spaces. This must identify an existing block. New BlockID's are not yet supported.
Material: TBD
ClassType: TBD
Opacity: TBD
Luminance: TBD
Friction: TBD
Dampen: TBD
Buffer: TBD
IsIcon: TBD
IsAttached: TBD
IsPassable: TBD
IsRotated: TBD
IsOrientated: TBD
IsOreDeposit: TBD
IsPowerEmitter: TBD
IsPoweredMechanism: TBD
IsVertSunlightUnhindered: TBD
BlastResistance: TBD
WindAffect: TBD
TextureID: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

BlockMaterialData.xml

Defines a Blocks material.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModBlockMaterialDataXMLXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModBlockMaterialDataXML>
    <Material>Earth</Material>
    <Resistance>1600</Resistance>
    <BaseEfficiency>100</BaseEfficiency>
    <PickEfficiency>75</PickEfficiency>
    <ShovelEfficiency>100</ShovelEfficiency>
    <HatchetEfficiency>50</HatchetEfficiency>
    <WeaponEfficiency>30</WeaponEfficiency>
    <XPAdjust>0</XPAdjust>
    <Flags />
  </ModBlockMaterialDataXML>
</ArrayOfModBlockMaterialDataXML>
Field Documentation:
Spoiler for Hidden Content:
Material: TBD
Resistance: TBD
BaseEfficiency: TBD
PickEfficiency: TBD
ShovelEfficiency: TBD
HatchetEfficiency: TBD
WeaponEfficiency: TBD
XPAdjust: TBD
Flags: TBD


--------------------------------------------------------------------------------------------------------------------------------------------

BlockTextures16.xml and BlockTextures64.xml

These two files list the blocks whose textures are in the PNG files.
The blocks defined in BlockTextures16.xml will be loaded from TP_16.PNG and placed into SD texture packs (when they are loaded).
The blocks defined in BlockTextures64.xml will be loaded from TP_64.PNG and placed into HD texture packs (when they are loaded).
These files are not necessary if you are not supplying PNG files.
You can optionally supply textures for SD packs, HD packs, or both.
You can supply textures for different blocks for SD and HD packs, they don't have to match.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfItemXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ItemXML>
    <ItemID>Grass</ItemID>
  </ItemXML>
  <ItemXML>
    <ItemID>Retro</ItemID>
  </ItemXML>
</ArrayOfItemXML>

--------------------------------------------------------------------------------------------------------------------------------------------
« Last Edit: December 29, 2016, 10:11:19 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #3 on: November 08, 2015, 08:37:10 PM »
Adding NPCs

The XML files that define an NPC are:

ActorTypeData.xml
ActorAIData.xml
ActorAudioData.xml
ActorLevelData.xml
ActorPhysicsData.xml

  • Changing existing NPCs is exactly the same as adding a new NPC, except that you specify the name of an existing NPC in the xml file(s), and any data that you omit will be taken from the NPCs current data.
  • All files are optional. If a file is not supplied, or individual fields in a file are omitted, then default values will be used.
  • If you want to define the ranges at which the NPC will hear and attack players, you must supply ActorAIData.xml
  • If you want to define the skill levels of the NPC, you must supply ActorLevelData.xml
  • If you want to provide NPC behaviours, you must supply Behaviour.db
  • If you want to provide NPC dialog, you must supply Dialog.db

A model for the NPC can also be supplied, either to create a new NPC or to replace the model of an existing NPC. If no model is supplied then the default one supplied with the game will be used. Models can be created in the game and saved as components, then copied into the same directory as the mod. When creating a component for an NPC model, ensure the 'model' is facing south in the world before you copy it to the clipboard so that the NPC will be facing the right direction when in game.

--------------------------------------------------------------------------------------------------------------------------------------------

ActorTypeData.xml

Defines general properties for NPCs.

Sample File:
Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModActorTypeDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModActorTypeDataXML>
    <ActorType>Spider</ActorType>
    <LevelType>Spider</LevelType>
    <PhysicsType>Spider</PhysicsType>
    <AIType>Spider</AIType>
    <ComName>Spider</ComName>
    <ModelHeight>1.5</ModelHeight>
    <ModelYRotation>0</ModelYRotation>
    <IsValid>true</IsValid>
    <IsFemale>false</IsFemale>
    <IsPassive>false</IsPassive>
    <IsImmuneToFire>false</IsImmuneToFire>
    <HasNameplate>true</HasNameplate>
    <HandMaxHit>3</HandMaxHit>
    <NaturalSpawnFreq>10</NaturalSpawnFreq>
    <NaturalBehaviour>NPCs\Spider</NaturalBehaviour>
    <LootTable>
      <LootItem>
        <Chance>10</Chance>
        <DamageType>Combat</DamageType>
        <Item>DiamondSword</Item>
        <Count1>1</Count1>
        <Count2>2</Count2>
      </LootItem>
      <LootItem>
        <Chance>20</Chance>
        <DamageType>Combat</DamageType>
        <Item>SteelSpear</Item>
        <Count1>1</Count1>
        <Count2>2</Count2>
      </LootItem>
    </LootTable>
  </ModActorTypeDataXML>
</ArrayOfModActorTypeDataXML>
Field Documentation:
Spoiler for Hidden Content:
ActorType: TBD
LevelType: TBD
PhysicsType: TBD
AIType: TBD
ComName: TBD
ModelHeight: TBD
ModelYRotation: TBD
IsValid: TBD
IsFemale: TBD
IsPassive: TBD
IsImmuneToFire: TBD
HasNameplate: TBD
HandMaxHit: TBD
NaturalSpawnFreq: TBD
NaturalBehaviour: TBD
LootTable: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ActorAIData.xml

Defines properties used by the NPC AI.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModActorAIDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModActorAIDataXML>
    <ActorAIType>Spider</ActorAIType>
    <StrikeDelay>1</StrikeDelay>
    <StrikeRange>3.5</StrikeRange>
    <RegardRange>40</RegardRange>
    <HearingRange>20</HearingRange>
    <AttackRange>35</AttackRange>
    <InactiveRange>60</InactiveRange>
  </ModActorAIDataXML>
</ArrayOfModActorAIDataXML>
Field Documentation:
Spoiler for Hidden Content:
ActorAIType: TBD
StrikeDelay: TBD
StrikeRange: TBD
RegardRange: TBD
HearingRange: TBD
AttackRange: TBD
InactiveRange: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ActorAudioData.xml

Defines Audio / Sounds for NPCs.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModActorAudioDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModActorAudioDataXML>
    <ActorType>Spider</ActorType>
    <AudioPain>SpiderPain</AudioPain>
    <AudioStrike>SpiderStrike</AudioStrike>
    <AudioWarning>SpiderWarning</AudioWarning>
    <AudioDeath>SpiderDeath</AudioDeath>
  </ModActorAudioDataXML>
</ArrayOfModActorAudioDataXML>
Field Documentation:
Spoiler for Hidden Content:
ActorType: TBD
AudioPain: TBD
AudioStrike: TBD
AudioWarning: TBD
AudioDeath: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ActorLevelData.xml

Defines Combat Skill Levels for NPCs.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModActorLevelDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModActorLevelDataXML>
    <ActorLevelType>Spider</ActorLevelType>
    <HealthLevel>14</HealthLevel>
    <AttackLevel>10</AttackLevel>
    <StrengthLevel>5</StrengthLevel>
    <DefenceLevel>1</DefenceLevel>
    <RangedLevel>1</RangedLevel>
  </ModActorLevelDataXML>
</ArrayOfModActorLevelDataXML>
Field Documentation:
Spoiler for Hidden Content:
ActorLevelType: TBD
HealthLevel: TBD
AttackLevel: TBD
StrengthLevel: TBD
DefenceLevel: TBD
RangedLevel: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

ActorPhysicsData.xml

Defines physics properties for the NPC.

Spoiler for Hidden Content:
<?xml version="1.0"?>
<ArrayOfModActorPhysicsDataXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ModActorPhysicsDataXML>
    <ActorPhysicsType>Spider</ActorPhysicsType>
    <Acceleration>0.13</Acceleration>
    <MoveSpeed>0.13</MoveSpeed>
    <JumpSpeed>0.35</JumpSpeed>
    <RotateSpeed>0.03</RotateSpeed>
  </ModActorPhysicsDataXML>
</ArrayOfModActorPhysicsDataXML>
Field Documentation:
Spoiler for Hidden Content:
ActorPhysicsType: TBD
Acceleration: TBD
MoveSpeed: TBD
JumpSpeed: TBD
RotateSpeed: TBD

--------------------------------------------------------------------------------------------------------------------------------------------

Behaviour.db and Dialog.db

These files enable provision of NPC Behaviour and Dialog trees.

To create these files, use the Export button on the Behaviours tab in the world where you have created the behaviours or dialog for the mod, and export the files to your Mod folder.

--------------------------------------------------------------------------------------------------------------------------------------------
« Last Edit: February 03, 2017, 04:34:25 AM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #4 on: November 08, 2015, 08:37:16 PM »
Adding Particle Emitter Templates

The XML files that define a Particle Emitter Templates are:

ParticleData.xml

ParticleData.xml
Spoiler for Hidden Content:
<ArrayOfParticleData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ParticleData>
    <Name>Garys Mod\Default</Name>
    <EmitFreq>1000</EmitFreq>
    <Duration>1500</Duration>
    <Rotation>0.1</Rotation>
    <Velocity>
      <X>0</X>
      <Y>1</Y>
      <Z>0</Z>
    </Velocity>
    <VelocityVariance>
      <X>0</X>
      <Y>0</Y>
      <Z>0</Z>
    </VelocityVariance>
    <EmitPosOffset>
      <X>0</X>
      <Y>0</Y>
      <Z>0</Z>
    </EmitPosOffset>
    <EmitPosVariance>
      <X>0</X>
      <Y>0</Y>
      <Z>0</Z>
    </EmitPosVariance>
    <Size>
      <X>0.1</X>
      <Y>0.1</Y>
      <Z>0.1</Z>
      <W>2</W>
    </Size>
    <WindFactor>0</WindFactor>
    <Gravity>0</Gravity>
    <StartColor>
      <R>255</R>
      <G>255</G>
      <B>255</B>
      <A>255</A>
    </StartColor>
    <EndColor>
      <R>0</R>
      <G>0</G>
      <B>255</B>
      <A>255</A>
    </EndColor>
  </ParticleData>
</ArrayOfParticleData>
« Last Edit: December 27, 2016, 08:08:52 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #5 on: November 08, 2015, 08:37:26 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #6 on: November 08, 2015, 08:37:31 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #7 on: November 08, 2015, 08:37:41 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #8 on: November 08, 2015, 08:37:47 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #9 on: November 08, 2015, 08:37:52 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #10 on: November 08, 2015, 08:37:57 PM »
Reserved.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #11 on: November 12, 2015, 07:59:40 PM »
bump.

Feel free to discus, although I'd recommend not asking questions like - what does this field do, as we will fill that information in as time goes on.

This is not the place to learn about XML or ask questions about XML, and if I see posts of that nature, they'll likely disappear with no trace (along with anything else I consider to be spam).

The topic is intended as a discussion point for modders on the API itself.

If you don't know XML and would like to learn, there are literally thousands of resources on the internet to do that, so please do that over there..
« Last Edit: November 12, 2015, 08:45:38 PM by Craig »

MrMarooca

  • Modder
  • Sr. Member
  • *****
  • Posts: 373
  • C# 4 lyfe
  • Awards Awarded to exemplary forum members 2 years on site+300 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • YouTube - MrMarooca
    • Awards
  • Xbox: MrMarooca
  • Steam: TheWhitestBoyYouKnow
Re: TM PC Modding API
« Reply #12 on: November 12, 2015, 08:07:44 PM »
Interesting. I never really imagined the API would use XML (I just assumed we'd use some dll's supplied by dev's or whatever). Do you guys think this could make the API somewhat limited compared to using supplied libraries or something similar? I do like the XML idea though, it offers the ability for everyone to make mods - even those not familiar with .NET.
« Last Edit: November 15, 2015, 09:14:37 PM by MrMarooca »
You want me to give a timeframe? haha I'd have more luck predicting the end of the world.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6544
  • Dig Deep
  • Awards Developer 4 years on site+1000 posts 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site+100 posts Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: TM PC Modding API
« Reply #13 on: November 12, 2015, 08:45:10 PM »
Do you guys think this could make the API somewhat limited compared to using supplied libraries or something similar?
No, the XML part of the API is just the start. We will start simple and build from that. For starters we'll try to expose as much as possible that can be modified via data only, then we'll add support for modification via programming.

Cooldude8

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • Awards
  • Xbox: Sharpbraineagl1
  • Steam: wesley51471
Re: TM PC Modding API
« Reply #14 on: November 13, 2015, 12:42:17 PM »
              
         You should make a side tool in the PC port for the people dont know what XML is or how to program in XML        You should make a side tool in the PC port for the people dont know what XML is or how to program in XML

You should make a side tool in the PC port for the people dont know what XML is or how to program in XML

You should make a side tool in the PC port for the people dont know what XML is or how to program in XML