Skip to content

Datatypes

Regonold edited this page Dec 21, 2024 · 11 revisions

Public Link for all current datatypes Link!

In one turret, there are three main data types. That being:

  • recipedata
  • bulletdata
  • typedata

recipedata

recipedata is what determines the crafting recipe for items. The first json key is the base item (e.g: wood), The second one is the converter (e.g: furnace), then the value of the second one is the final product (e.g: charcoal).

Here is an example with copper being refined into copper bullets "copper":{ "refiner":"copperbullet" }

recipedata for each item isn't limited to one converter, but instead can by any amount. "ironore":{ "furnace":"iron", "refiner":"cog" },

Constructor Building

The constructor building (that one that takes two inputs) handles recipes a bit differently. It first takes its two items (e.g: woodbullet and cog), both sorted alphabetically (e.g: cog and woodbullet), then with a "." in the middle (e.g: cog.woodbullet)

Here is an example with superscatter bullets "bronzebullet.reinforcedbullet":{ "constructor":"superscatter" }

bulletdata

Bulletdata is where item's combative traits are stored. bulletdata has only one required property, that being damage.

Heres an example with ironbullet "ironbullet":{ "damage":7 }

NOTE: The market gives 2 * damage currency of the item that is inputted, so keep that in mind when balancing items!

Effects

A bullet "effect" is a state that is applied onto an enemy by a bullet, for example things like a burn Here is each effect and what they achieve:

"burn"

This effect has 2 parameters [Duration of effect, Intensity of damage] and will apply a damage over time effect on the enemy for the specified time each second

A burn that damages 10 damage every second, for 2 seconds: {"burn": [2, 10]}

"freeze"

This effect has 2 parameters [Duration of effect, Slowness modifier] and will slow an enemy down for the specified time

A freeze that slows an enemy down by 20 for 5 seconds: {"freeze": [5, 20]}

Properties

A "property" in bullet data is a subset of attributes that modifies how a bullet looks or functions, for example how it spins etc. Here is each property and what they achieve:

"damage"

This property defines how many points of damage a bullet will do on enemy contact

A bullet that does 10 hit points of damage to enemies {"damage": 10}

"scatter"

This property makes it so when a bullet is fired, a specific number of them will fire instead of one

A scatter that fires 5 bullets instead of one: {"scatter": 5}

"spin"

This property makes it so a bullet visually rotates a certain number of degrees per second

A spin that rotates 45 a second{"spin": 45}

"pierce"

This property makes it define gow many enemies the bullet can pass through before being destroyed

A pierce that makes a bullet go through 2 enemies instead of one {"pierce": 2}

"shatter"

This property makes it so when the bullet hits an enemy it "shatters" into multiple different bullets

A shatter that makes it so if a bullet hits an enemy it splits into 3: {"shatter": 3}

"seeking"

This property makes it so the bullet will gravitate towards the nearest enemy depending on how high the value is, 1 for low, 10 for high

A bullet that will almost always hit an enemy: {"seeking": 100}

"orelevel"

This property defines how much of a corresponding ore tile will generate. The value has to be between -1 or 1, -1 being no ore, 0 being half amount, and 1 being maximum amount.

A orelevel that will barely cover a map with the corresponding ore: {"orelevel": -0.9}

"sellprice"

This property defines how much a bullet will sell for in the market (overwriting the damage * 2 base sell price)

A bullet that will sell for 99999: ```{"sellprice": 99999}

typedata

Here is each value in typedata:

"internalname"

This is the name you will use to reference your item in your mod

"displayname"

The visual name of your item in things like UI

"sizex" "sizey"

for the time being, both should have the same value. They should both be 1 or 2

"inputside":

a string of the name of the input side. (e.g: "east")

"outputside"

a string of the name of the output side. (e.g: "west")

"freeinput"

set to true or false depending if you want your tile to behave like conveyors (they take input from all sides)

"inputcount"

Recommended to set to 1, but is the amount of inputs the tile can have at once.

"outputcount": 1

Recommended to set to 1, but is the amount of outputs the tile can have at once.

"showprogress"

When set to true, it will cause progress bars to appear over the tile when its running

"worktime"

The amount of time it takes for the tile to do its action

"price"

Price of the item

"subtype"

The subtype isnt just a visual category, but entirely chooses the action the tile will do. There are three main subtypes, that being "transporters", "producers" and "converters".

"wavestart"

The wavestart defines at what wave a building can be unlocked, for example the makeket uses wavestart of 1 to unlock after wave one has been defeated

typedata for 2x2

The only thing that changes for 2x2 tiles is inputside and output side It is nice to imagine your 2 by 2 tile as this:

image

No matter the rotation of your tile it always stays like this. 0,0 is always in bottom left.

The new inputside and outputside are formatted like this: {"pos":"(0, -1)","side":"north"}

First, its the position (refer to the image above) then the side its on. This example has its inputside/outputside on the bottom-left's south face. {"pos":"(0, 0)","side":"south"}

typedata for producer subtype

Producers create resources from thin air, and thus gain a new value in their typedata called 'material'. This material is the item they create. It uses the same identifier syntax like every other item reference.

Heres an example: "material":"def:wood"

Clone this wiki locally