Changes

Jump to navigation Jump to search
→‎Tools: fix broken links from migration, minor text updates to complete merge
Line 792: Line 792:     
===Data format===
 
===Data format===
The object data in <samp>Data/Objects</samp> consists of a string→ObjectData dictionary (where ObjectData is defined in the game code in <samp>GameData.Objects.ObjectData</samp>). It has entries like this<ref>See <samp>Data/Objects.xnb</ref>:
+
The object data in <samp>Data/Objects</samp> consists of a string → model lookup, where...
<syntaxhighlight lang="json">
+
* The key is the unqualified [[Modding:Common_data_field_types#Item_ID|item ID]].
"201": {
+
* The value is a model with the fields listed below.
  "Name": "Complete Breakfast",
  −
  "DisplayName": "[LocalizedText Strings\\Objects:CompleteBreakfast_Name]",
  −
  "Description": "[LocalizedText Strings\\Objects:CompleteBreakfast_Description]",
  −
  "Type": "Cooking",
  −
  "Category": -7,
  −
  "Price": 350,
  −
  "Texture": null,
  −
  "SpriteIndex": 201,
  −
  "Edibility": 80,
  −
  "IsDrink": false,
  −
  "Buffs": [
  −
    {
  −
      "Id": "Food",
  −
      "BuffId": null,
  −
      "IconTexture": null,
  −
      "IconSpriteIndex": 0,
  −
      "Duration": 600,
  −
      "IsDebuff": false,
  −
      "GlowColor": null,
  −
      "CustomAttributes": {
  −
        "FarmingLevel": 2.0,
  −
        "FishingLevel": 0.0,
  −
        "MiningLevel": 0.0,
  −
        "LuckLevel": 0.0,
  −
        "ForagingLevel": 0.0,
  −
        "MaxStamina": 50.0,
  −
        "MagneticRadius": 0.0,
  −
        "Speed": 0.0,
  −
        "Defense": 0.0,
  −
        "Attack": 0.0
  −
      },
  −
      "CustomFields": null
  −
    }
  −
  ],
  −
  "GeodeDropsDefaultItems": false,
  −
  "GeodeDrops": null,
  −
  "ArtifactSpotChances": null,
  −
  "ExcludeFromFishingCollection": false,
  −
  "ExcludeFromShippingCollection": false,
  −
  "ExcludeFromRandomSale": false,
  −
  "ContextTags": [
  −
    "color_yellow",
  −
    "food_breakfast"
  −
  ],
  −
  "CustomFields": null
  −
  }
  −
</syntaxhighlight>
  −
 
  −
For each entry in the data asset:
  −
* The key (before the colon) is the unqualified item ID and its sprite index within the [[Modding:Items/Object sprites|object spritesheet]] (saved as <samp>ParentSheetIndex</samp> in-code).
  −
* The value (after the colon) is the data pertaining to that object, with the fields listed below. The objects with keys 516–534 (<samp>Ring.ringLowerIndexRange</samp> through <samp>Ring.ringUpperIndexRange</samp>) and 801 (wedding ring) are hardcoded as rings.
  −
 
  −
Field values are described below (Copied from [[Modding:Migrate to Stardew Valley 1.6]]):
      
====Basic info====
 
====Basic info====
Line 862: Line 809:  
|-
 
|-
 
| <samp>Type</samp>
 
| <samp>Type</samp>
| The item's general type, like <samp>Arch</samp> (artifact) or <samp>Minerals</samp>. The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive
+
| The item's general type, like Arch (artifact) or Minerals. The vanilla types are: Litter, Basic, Minerals, Quest, asdf, Crafting, Arch, fish, Cooking, Seeds, Ring, interactive  
 
|-
 
|-
 
| <samp>Category</samp>
 
| <samp>Category</samp>
Line 912: Line 859:  
|-
 
|-
 
| <samp>BuffId</samp>
 
| <samp>BuffId</samp>
| ''(Optional)'' The unique ID of a buff from [[#Custom buffs|<samp>Data/Buffs</samp>]] to apply, or <samp>null</samp> to ignore <samp>Data/Buffs</samp> and set the ID to <samp>food</samp> or <samp>drink</samp> depending on the item's <samp>IsDrink</samp> field.
+
| ''(Optional)'' The unique ID of a buff from <samp>Data/Buffs</samp> to apply, or <samp>null</samp> to ignore <samp>Data/Buffs</samp> and set the ID to <samp>food</samp> or <samp>drink</samp> depending on the item's <samp>IsDrink</samp> field.
    
If a buff from <samp>Data/Buffs</samp> is applied and you also specify other fields, here's how the buff data is combined:
 
If a buff from <samp>Data/Buffs</samp> is applied and you also specify other fields, here's how the buff data is combined:
Line 940: Line 887:  
|-
 
|-
 
| <samp>GlowColor</samp>
 
| <samp>GlowColor</samp>
| ''(Optional)'' The glow color to apply to the player. See [[#Color fields|color format]]. Default none.
+
| ''(Optional)'' The glow color to apply to the player. See [[Modding:Common_data_field_types#Color|color format]]. Default none.
 
|-
 
|-
 
| <samp>CustomAttributes</samp>
 
| <samp>CustomAttributes</samp>
Line 959: Line 906:  
|-
 
|-
 
| <samp>CustomFields</samp>
 
| <samp>CustomFields</samp>
| ''(Optional)'' The [[#Custom data fields|custom fields]] for this entry.  
+
| ''(Optional)'' The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.  
 
|}
 
|}
 
|}
 
|}
    +
====Geodes & artifact spots====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>GeodeDrops</samp><br /><samp><samp>GeodeDropsDefaultItems</samp>
 +
| ''(Optional)'' The items that can be dropped when breaking open this item as a [[Minerals#Geodes|geode]]. Specifying either or both fields automatically enables geode behavior for this item.
 +
 +
You can specify one or both fields:
 +
<ul>
 +
<li><samp>GeodeDrops</samp> can be set to the specific items to drop. Default none. This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
|-
 +
| ''common fields''
 +
| See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported by geode drops.
 +
 +
If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random.
 +
|-
 +
| <samp>Chance</samp>
 +
| ''(Optional)'' The probability that the item will be dropped if the other fields match, as a decimal value between 0 (never) and 1 (always). Default 1.
 +
|-
 +
| <samp>SetFlagOnPickup</samp>
 +
| ''(Optional)'' The mail flag to set for the current player when this drop is picked up.
 +
|-
 +
| <samp>Precedence</samp>
 +
| ''(Optional)'' The order in which this entry should be checked, where lower values are checked first. This can be a negative value. Geode drops with the same precedence are checked in the order listed. Default 0.
 +
 +
For consistency, vanilla drops mostly use these values:
 +
* <samp>-1000</samp>: special overrides like the [[Golden Helmet]];
 +
* <samp>0</samp>: normal items.
 +
|}</li>
 +
<li><samp>GeodeDropsDefaultItems</samp> chooses a predefined list of possible geode drops like [[clay]], [[coal]], [[Copper Ore|copper]], [[Iridium Ore|iridium]], etc. Default false.</li>
 +
</ul>
 +
 +
If both fields are specified, each geode will choose between them with an equal 50% chance. If <samp>GeodeDrops</samp> is specified but no entries match, the geode will use the <samp>GeodeDropsDefaultItems</samp> regardless of whether it's true.
 +
|-
 +
| <samp>ArtifactSpotChances</samp>
 +
| ''(Optional)'' If this is an artifact (i.e. the <samp>Type</samp> field is <samp>Arch</samp>), the chance that it can be found by digging [[Artifact Spot|artifact spots]] in each location.
 +
 +
This consists of a string → model lookup, where:
 +
* the key is the internal location name;
 +
* the value is the probability the item will spawn if checked, as a decimal value between 0 (never) and 1 (always).
 +
|}
 +
 +
====Context tags & exclusions====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>ContextTags</samp>
 +
| ''(Optional)'' The custom [[Modding:Items#Context tags|context tags]] to add for this item (in addition to the tags added automatically based on the other object data). This is formatted as a list; for example:
 +
<syntaxhighlight lang="json">
 +
"ContextTags": [ "color_yellow", "fish_ocean", "fish_upright", "season_summer" ]
 +
</syntaxhighlight>
 +
|-
 +
| <samp>ExcludeFromRandomSale</samp>
 +
| ''(Optional)'' Whether to exclude this item from shops when selecting random items to sell. Default false.
 +
|-
 +
| <samp>ExcludeFromFishingCollection</samp><br /><samp>ExcludeFromShippingCollection</samp>
 +
| ''(Optional)'' Whether to exclude this item from the fishing/shipping collection and their respective effect on the [[perfection|perfection score]]. Default false, in which case the normal requirements apply (e.g. artifacts are always excluded from the shipping collection).
 +
|}
 +
 +
====Advanced====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>CustomFields</samp>
 +
| ''(Optional)'' The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.
 +
|}
    
===Notes===
 
===Notes===
Line 1,350: Line 1,374:  
[[Tools]] are items that can be swung or used by the player to perform some effect (e.g. dig dirt, chop trees, etc).
 
[[Tools]] are items that can be swung or used by the player to perform some effect (e.g. dig dirt, chop trees, etc).
   −
They have their in-game sprites in <samp>TileSheets/Tools</samp>, and their code in <samp>StardewValley.Tool</samp> and various subclasses like <samp>StardewValley.Tools.Axe</samp>.
+
They have their data in <samp>Data/Tools</samp>, their in-game sprites in <samp>TileSheets/Tools</samp>, and their code in <samp>StardewValley.Tool</samp> and various subclasses like <samp>StardewValley.Tools.Axe</samp>.
    
===Data format===
 
===Data format===
Tools are currently hardcoded and can't be edited by content packs.
+
 
 +
You can create/edit [[tools]] by editing the<samp>Data/Tools</samp> asset. This consists of a string → model lookup, where...
 +
* The key is the unqualified [[Modding:Common_data_field_types#Item_ID|item ID]].
 +
* The value is a model with the fields listed below.
 +
 
 +
====Basic tool data====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>ClassName</samp>
 +
| The name of the C# class to construct within the <code>StardewValley.Tools</code> namespace. The class must be a subclass of <samp>StardewValley.Tool</samp>, and have a constructor with no arguments. For example, given a value of <samp>Axe</samp>, the game will create <code>StardewValley.Tools.Axe</code> instances.
 +
 
 +
The main values are:
 +
* main tools (<samp>Axe</samp>, <samp>FishingRod</samp>, <samp>Hoe</samp>, <samp>MeleeWeapon</samp>, <samp>MilkPail</samp>, <samp>Pan</samp>, <samp>Pickaxe</samp>, <samp>Shears</samp>, <samp>Wand</samp>, and <samp>WateringCan</samp>);
 +
* a special <samp>GenericTool</samp> type which applies the <samp>Data/Tools</samp> data and only has generic logic, so C# mods can patch in their own logic;
 +
* and two tools cut from the game which may not work correctly (<samp>Lantern</samp> and <samp>Raft</samp>).
 +
|-
 +
| <samp>Name</samp>
 +
| The internal name to set for the tool item.
 +
|-
 +
| <samp>DisplayName</samp><br /><samp>Description</samp>
 +
| A [[Modding:Tokenizable strings|tokenizable string]] for the tool's in-game display name and description.
 +
|-
 +
| <samp>AttachmentSlots</samp>
 +
| ''(Optional)'' The number of attachment slots to enable on the tool. Note that only <samp>FishingRod</samp> tools have the code to render and use attachment slots. Default <samp>-1</samp>, which keeps the default value set by the tool class.
 +
|-
 +
| <samp>SalePrice</samp>
 +
| ''(Optional)'' The default price when the item is sold to the player in a shop. Defaults to <samp>-1</samp>, in which case you should set the price manually in shops.
 +
|-
 +
| <samp>CustomFields</samp>
 +
| The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.
 +
|}
 +
 
 +
====Appearance====
 +
Note that drawing the tool correctly in the world (ie, while the player is trying to use it) will likely require custom code.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>Texture</samp>
 +
| The asset name for the texture containing the tool's sprite.
 +
|-
 +
| <samp>SpriteIndex</samp>
 +
| The tool's sprite index within the <samp>Texture</samp>, where 0 is the top row.
 +
|-
 +
| <samp>MenuSpriteIndex</samp>
 +
| ''(Optional)'' The sprite index within the <samp>Texture</samp> for the item icon. Defaults to <samp>SpriteIndex</samp>.
 +
|}
 +
 
 +
====Upgrades====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>UpgradeLevel</samp>
 +
| ''(Optional)'' The tool upgrade level. Default <samp>-1</samp>, which keeps the default value set by the tool class.
 +
|-
 +
| <samp>ApplyUpgradeLevelToDisplayName</samp>
 +
| ''(Optional)'' Whether to adjust the <samp>DisplayName</samp> for the usual upgrade levels. For example, the display name for a level one Axe changes to 'Copper Axe'. Default false.
 +
 
 +
The display name format in English is:
 +
{| class="wikitable"
 +
|-
 +
! upgrade level
 +
! display name format
 +
|-
 +
| 1
 +
| Copper {{t|display name}}
 +
|-
 +
| 2
 +
| Steel {{t|display name}}
 +
|-
 +
| 3
 +
| Gold {{t|display name}}
 +
|-
 +
| 4
 +
| Iridium {{t|display name}}
 +
|}
 +
|-
 +
| <samp>ConventionalUpgradeFrom</samp>
 +
| ''(Optional)'' If set, prepends an upgrade for the given tool ID to the <samp>UpgradeFrom</samp> field. This applies these rules (based on the <samp>UpgradeLevel</samp> field, not the upgrade level of the specified tool ID):
 +
 
 +
{| class="wikitable"
 +
|-
 +
! upgrade level
 +
! price
 +
! items needed
 +
|-
 +
| 1
 +
| {{price|2000}}
 +
| {{name|Copper Bar|5}}
 +
|-
 +
| 2
 +
| {{price|5000}}
 +
| {{name|Iron Bar|5}}
 +
|-
 +
| 3
 +
| {{price|10000}}
 +
| {{name|Gold Bar|5}}
 +
|-
 +
| 4
 +
| {{price|25000}}
 +
| {{name|Iridium Bar|5}}
 +
|}
 +
 
 +
For example, Iridium Axe specifies this value:
 +
<syntaxhighlight lang="js">
 +
"ConventionalUpgradeFrom": "(T)GoldAxe"
 +
</syntaxhighlight>
 +
|-
 +
| <samp>UpgradeFrom</samp>
 +
| ''(Optional)'' The requirements to buy this tool from Clint's [[Blacksmith#Upgrade Tools|blacksmith tool upgrade shop]]. If you specify multiple entries, the first one which matches will be applied.
 +
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>Price</samp>
 +
| ''(Optional)'' The gold price to buy the upgrade. Defaults to 0.
 +
|-
 +
| <samp>RequireToolId</samp>
 +
| ''(Optional)'' If set, the [[Modding:Common_data_field_types#Item_ID|qualified or unqualified item ID]] for the tool that must be in the player's inventory for the upgrade to appear. The tool will be destroyed when the upgrade is purchased.
 +
|-
 +
| <samp>TradeItemId</samp>
 +
| ''(Optional)'' If set, the [[Modding:Common_data_field_types#Item_ID|qualified or unqualified item ID]] for an extra item that must be traded to upgrade the tool. (For example, many vanilla tools need metal bars.)
 +
|-
 +
| <samp>TradeItemAmount</samp>
 +
| ''(Optional)'' The number of <samp>TradeItemId</samp> required. Defaults to 1.
 +
|-
 +
| <samp>Condition</samp>
 +
| ''(Optional)'' A [[Modding:Game state queries|game state query]] which indicates whether this upgrade is available. Defaults to always true.
 +
|}
 +
 
 +
For example, these are equivalent to the Steel Axe's upgrade settings:
 +
<syntaxhighlight lang="js">
 +
"UpgradeFrom": [
 +
    {
 +
        "RequireToolId": "(T)CopperAxe",
 +
        "Price": 5000,
 +
        "TradeItemId": "(O)335", // Iron Bar
 +
        "TradeItemAmount": 5
 +
    }
 +
]
 +
</syntaxhighlight>
 +
 
 +
If you want the tool to always be available, you can just omit the conditions. For example:
 +
<syntaxhighlight lang="js">
 +
"UpgradeFrom": [
 +
    {
 +
        "Price": 5000
 +
    }
 +
]
 +
</syntaxhighlight>
 +
 
 +
Note that Clint needs a few days to smith the new tool. If you want to sell the tool directly, [[Modding:Shops|add it to a regular shop]] instead.
 +
|}
 +
 
 +
====Game logic====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>CanBeLostOnDeath</samp>
 +
| Whether the player can [[Adventurer's Guild#Item Recovery Service|lose this tool when they die]]. Default false.
 +
|}
 +
 
 +
====Extensibility====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! purpose
 +
|-
 +
| <samp>ModData</samp>
 +
| ''(Optional)'' The mod data values to set when the tool is created, accessible in C# code via the <samp>tool.modData</samp> dictionary. For example:
 +
<syntaxhighlight lang="js">
 +
"ModData": {
 +
    "PowerLevel": 9000
 +
}
 +
</syntaxhighlight>
 +
|-
 +
| <samp>SetProperties</samp>
 +
| ''(Optional)'' Set the value of arbitrary properties on the tool class. For example, this would disable the tool animation and require no stamina:
 +
<syntaxhighlight lang="js">
 +
"SetProperties": {
 +
    "InstantUse": true,
 +
    "IsEfficient": true
 +
}
 +
</syntaxhighlight>
 +
|}
    
==Weapons==
 
==Weapons==
Line 1,361: Line 1,581:     
===Data format===
 
===Data format===
The weapon data in <samp>Data/Weapons</samp> consists of an integer→string dictionary with entries like this:
+
The weapon data in <samp>Data/Weapons</samp> consists of a string → model lookup, where...
 +
* The key is the unqualified [[Modding:Common_data_field_types#Item_ID|item ID]] for the weapon.
 +
* The value is model with the fields listed below.
   −
<syntaxhighlight lang="json">
+
====Basic weapon info====
  "12": "Wooden Blade/Not bad for a piece of carved wood./3/7/1/0/0/0/0/3/-1/0/.02/3"
+
{| class="wikitable"
</syntaxhighlight>
+
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Name</samp>
 +
| The internal weapon name.
 +
|-
 +
| <samp>DisplayName</samp><br /><samp>Description</samp>
 +
| A [[Modding:Tokenizable strings|tokenizable string]] for the translated display name & description.
 +
|-
 +
| <samp>Type</samp>
 +
| The weapon type. One of <samp>0</samp> (stabbing sword), <samp>1</samp> (dagger), <samp>2</samp> (club or hammer), or <samp>3</samp> (slashing sword).
 +
|}
   −
For each entry in the data asset, the key is the item's <samp>ParentSheetIndex</samp> and the value is a slash-delimited string with these fields:
+
====Appearance====
 +
{| class="wikitable"
 +
|-
 +
! field
 +
! effect
 +
|-
 +
| <samp>Texture</samp>
 +
| The asset name for the spritesheet containing the weapon's sprite.
 +
|-
 +
| <samp>SpriteIndex</samp>
 +
| The index within the <samp>Texture</samp> for the weapon sprite, where 0 is the top-left sprite.
 +
|}
   −
; Melee weapons
+
====Stats====
: {| class="wikitable"
+
{| class="wikitable"
 
|-
 
|-
! index
   
! field
 
! field
 
! effect
 
! effect
 
|-
 
|-
| 0
+
| <samp>MinDamage</samp><br /><samp>MaxDamage</samp>
| name
+
| The minimum and maximum based damage caused when hitting a monster with this weapon.
| The internal weapon name (and display name in English).
   
|-
 
|-
| 1
+
| <samp>Knockback</samp>
| description
+
| ''(Optional)'' How far the target is pushed when hit, as a multiplier relative to a base weapon like the [[Rusty Sword]] (e.g. <samp>1.5</samp> for 150% of Rusty Sword's weight). Default 1.
| The translated item description shown in-game.
   
|-
 
|-
| 2<br />3
+
| <samp>Speed</samp>
| min damage<br />max damage
+
| ''(Optional)'' How fast the player can swing the weapon. Each point of speed is worth 40ms of swing time relative to 0. This stacks with the [[speed|player's weapon speed]]. Default 0.
| The minimum and maximum damage caused when hitting a monster with this weapon.
   
|-
 
|-
| 4
+
| <samp>Precision</samp>
| knockback
+
| ''(Optional)'' Reduces the chance that a strike will miss. Default 0.
| How far the target is pushed when hit, as a multiplier relative to a base weapon like the [[Rusty Sword]] (e.g. <samp>1.5</samp> for 150% of Rusty Sword's weight).
   
|-
 
|-
| 5
+
| <samp>Defense</samp>
| speed
+
| ''(Optional)'' Reduces damage received by the player. Default 0.
| How fast the player can swing the weapon. Each point of speed is worth 40ms of swing time relative to 0. This stacks with the [[speed|player's weapon speed]].
   
|-
 
|-
| 6
+
| <samp>AreaOfEffect</samp>
| added precision
+
| ''(Optional)'' Slightly increases the area of effect. Default 0.
| Reduces the chance that a strike will miss.
   
|-
 
|-
| 7
+
| <samp>CritChance</samp>
| added defence
+
| ''(Optional)'' The chance of a critical hit, as a decimal value between 0 (never) and 1 (always). Default 0.02.
| Reduces damage received by the player.
   
|-
 
|-
| 8
+
| <samp>CritMultiplier</samp>
| type
+
| ''(Optional)'' A multiplier applied to the base damage for a critical hit. This can be a decimal value. Default 3.
| The weapon type. One of <samp>0</samp> (stabbing sword), <samp>1</samp> (dagger), <samp>2</samp> (club or hammer), or <samp>3</samp> (slashing sword).
+
|}
 +
 
 +
====Game logic====
 +
{| class="wikitable"
 
|-
 
|-
| 9<br />10
+
! field
| base mine level<br />min mine level
+
! effect
| The base and minimum mine level, which affect [[#Mine container drops|mine container drops]].
   
|-
 
|-
| 11
+
| <samp>CanBeLostOnDeath</samp>
| added area of effect
+
| Whether the player can [[Adventurer's Guild#Item Recovery Service|lose this tool when they die]]. Default true.
| Slightly increases the area of effect.
   
|-
 
|-
| 12
+
| <samp>MineBaseLevel</samp><br /><samp>MineMinLevel</samp>
| critical chance
+
| ''(Optional)'' The base and minimum mine level, which affect [[#Mine container drops|mine container drops]]. Both default to -1, which disables automatic mine drops.
| The chance of a critical hit, as a decimal value between 0 and 1.
+
|}
 +
 
 +
====Advanced====
 +
{| class="wikitable"
 
|-
 
|-
| 13
+
! field
| critical damage
+
! effect
| A multiplier applied to the damage for critical hit.
   
|-
 
|-
| 14
+
| <samp>Projectiles</samp>
| display name
+
| ''(Optional)'' The projectiles fired when the weapon is used, which continue along their path until they hit a monster and cause damage. A separate projectile is fired for each entry in this list.
| The translated item name (in non-English assets only).
  −
|}
     −
; Slingshots
+
This consists of a list of models with these fields (one projectile will fire for each entry in the list):
: {| class="wikitable"
+
{| class="wikitable"
 
|-
 
|-
! index
   
! field
 
! field
 
! effect
 
! effect
 
|-
 
|-
| 0
+
| <samp>Id</samp>
| name
+
| The [[Modding:Common data field types#Unique string ID|unique string ID]] for the projectile within the current weapon's data.
| The internal weapon name (and display name in English).
+
|-
 +
| <samp>Damage</samp>
 +
| ''(Optional)'' The amount of damage caused when the projectile hits a monster. Default 10.
 +
|-
 +
| <samp>Explodes</samp>
 +
| ''(Optional)'' Whether the projectile explodes when it collides with something. Default false.
 +
|-
 +
| <samp>Bounces</samp>
 +
| ''(Optional)'' The number of times the projectile can bounce off walls before being destroyed. Default 0.
 +
|-
 +
| <samp>MaxDistance</samp>
 +
| ''(Optional)'' The maximum tile distance the projectile can travel. Default 4.
 +
|-
 +
| <samp>Velocity</samp>
 +
| ''(Optional)'' The speed at which the projectile moves. Default 10.
 +
|-
 +
| <samp>RotationVelocity</samp>
 +
| ''(Optional)'' The rotation velocity. Default 32.
 +
|-
 +
| <samp>TailLength</samp>
 +
| ''(Optional)'' The length of the tail which trails behind the main projectile. Default 1.
 +
|-
 +
| <samp>FireSound</samp><br /><samp>BounceSound</samp><br /><samp>CollisionSound</samp>
 +
| ''(Optional)'' The sound played when the projectile is fired, bounces off a wall, or collides with something. All three default to none.
 
|-
 
|-
| 1
+
| <samp>MinAngleOffset</samp><br /><samp>MaxAngleOffset</samp>
| description
+
| ''(Optional)'' A random offset applied to the direction of the project each time it's fired. Both fields default to 0, in which case it's always shot at the 90° angle matching the player's facing direction.
| The translated item description shown in-game (for non-English assets only).
   
|-
 
|-
| 2&ndash;8
+
| <samp>SpriteIndex</samp>
| ''unused''
+
| ''(Optional)'' The sprite index in the <samp>TileSheets/Projectiles</samp> asset to draw for this projectile. Defaults to 11 (a glowing-yellow-ball sprite).
|
   
|-
 
|-
| 9<br />10
+
| <samp>Item</samp>
| base mine level<br />min mine level
+
| ''(Optional)'' The item to shoot. If set, this overrides <samp>SpriteIndex</samp>.
| The base and minimum mine level, which affect [[#Mine container drops|mine container drops]].
+
 
 +
This consists of a list of models with these fields:
 +
{| class="wikitable"
 
|-
 
|-
| 11&ndash;13
+
! field
| ''unused''
+
! effect
|
   
|-
 
|-
| 14
+
| ''common fields''
| display name
+
| See [[Modding:Item queries#Item spawn fields|item spawn fields]] for the generic item fields supported for ammo items.
| The translated item description shown in-game (for non-English assets only).
+
 
 +
If set to an [[Modding:Item queries|item query]] which returns multiple items, one of them will be selected at random.
 +
|}
 
|}
 
|}
    +
Note that these are magic projectiles fired when the weapon is used, they're not aimed directly like [[slingshot]] projectiles.
 +
|-
 +
| <samp>CustomFields</samp>
 +
| The [[Modding:Common_data_field_types#Custom_fields|custom fields]] for this entry.
 +
|}
 
Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>).
 
Weapons have a hardcoded category of -98 (<samp>Object.weaponCategory</samp>).
   Line 1,471: Line 1,737:     
<ol>
 
<ol>
<li>Match weapons whose minimum mine level ([[#Format|field 10]]) is less than the current mine level.</li>
+
<li>Match weapons whose [[#Game logic|minimum mine level]] is less than the current mine level.</li>
<li>From that list, match weapons with a probability check based on the gap between the base mine level ([[#Format|field 9]]) and current mine level. The probability is a bell curve centered on the base mine level:
+
<li>From that list, match weapons with a probability check based on the gap between the [[#Game logic|base mine level]] and current mine level. The probability is a bell curve centered on the base mine level:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
138

edits

Navigation menu