SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

Thrifty Smithing

FBy Foxcapades

Minimize smithing waste!

Description

<section>

Gives back scrap metal split off of items being crafted on an anvil.

Once a smithing work is completed, the player who completed it will be given the amount of whole bits that could be formed from the material removed from the work while it was being crafted.

If a smithing work is completed by a helve hammer, the scrap bits will be dropped to the floor at the base of the anvil.

</section> <section>

Configuration

The following configuration options are provided in the thrifty-smithing.json file, with default values based on the base VintageStory experience. Most of these should not be changed unless necessitated by changes from other mods.

<pre>{ <span style="color: #606;"><span style="color: #404;">"</span>voxelsPerIngot<span style="color: #404;">"</span></span>: <span style="color: #00d;">42</span>, <span style="color: #606;"><span style="color: #404;">"</span>voxelsPerPlate<span style="color: #404;">"</span></span>: <span style="color: #00d;">81</span>, <span style="color: #606;"><span style="color: #404;">"</span>materialUnitsPerIngot<span style="color: #404;">"</span></span>: <span style="color: #00d;">100</span>, <span style="color: #606;"><span style="color: #404;">"</span>materialUnitsPerBit<span style="color: #404;">"</span></span>: <span style="color: #00d;">5</span>, <span style="color: #606;"><span style="color: #404;">"</span>materialUnitsRecoveredModifier<span style="color: #404;">"</span></span>: <span style="color: #60e;">1.0</span>, <span style="color: #606;"><span style="color: #404;">"</span>disallowedRecipes<span style="color: #404;">"</span></span>: [] }</pre> <table> <thead> <tr> <th style="border-right: 1px black solid; padding: 5px;">Option</th> <th style="border-right: 1px black solid; padding: 5px;">Type</th> <th style="padding: 5px;">Description</th> </tr> </thead> <tbody> <tr> <td style="border-right: 1px black solid; padding: 5px;">

voxelsPerIngot

</td> <td style="border-right: 1px black solid; padding: 5px;">

int

</td> <td style="padding: 5px;">

The number of voxels a single ingot should be worth.

Valid value range: [1..255]

</td> </tr> <tr> <td style="border-right: 1px black solid; padding: 5px;">

voxelsPerPlate

</td> <td style="border-right: 1px black solid; padding: 5px;">

int

</td> <td style="padding: 5px;">

The number of voxels a single metal plate should be worth.

Valid value range: [1..255]

</td> </tr> <tr> <td style="border-right: 1px black solid; padding: 5px;">

materialUnitsPerIngot

</td> <td style="border-right: 1px black solid; padding: 5px;">

int

</td> <td style="padding: 5px;">

The amount of material required to craft an ingot.

Valid value range: [1..65535]

</td> </tr> <tr> <td style="border-right: 1px black solid; padding: 5px;">

materialUnitsPerBit

</td> <td style="border-right: 1px black solid; padding: 5px;">

int

</td> <td style="padding: 5px;">

The amount of material represented by a single metal bit.

Valid value range: [1..255]

</td> </tr> <tr> <td style="border-right: 1px black solid; padding: 5px;">

materialUnitsRecoveredModifier

</td> <td style="border-right: 1px black solid; padding: 5px;">

float

</td> <td style="padding: 5px;">

Percentage multiplier used to modify the amount of scrap material returned on completion of a smithing work.

The default value of 1.0 represents 100%, a value of 0.75 would represent 75%, 0.5 for 50% and so on.

Valid value range: [0.0..1.0] (max precision of ~4 digits)

</td> </tr> <tr> <td style="border-right: 1px black solid; padding: 5px;">

disallowedRecipes

</td> <td style="border-right: 1px black solid; padding: 5px;">

array of string

</td> <td style="padding: 5px;">

Asset locations for recipes that should not reward any scrap on completion.

For example setting this to ["game:knifeblade-copper"] would mean that players are not given any scrap metal back when crafting a copper knife blade.

</td> </tr> </tbody> </table> </section> <section>

Programmatic Extensibility

ThriftySmithing currently offers a limited mechanism through which other mods may alter the inputs used by ThriftySmithing to calculate metal bits returned as scrap after smithing an item.

ThriftySmithing looks for ITreeAttribute instances in an anvil's work item (BlockEntityAnvil.WorkItemStack) attributes whose names are prefixed with the string ef:ts:workData:. These ITreeAttribute instances may contain sub-attribute integer values under the keys voxels, ingots, and/or plates which may contain positive or negative values that will be applied to the scrap bit calculation.

Scrap Calculation

ThriftySmithing calculates the amount of scrap metal to give back to a player based on the number of voxels removed from a smithing work.&nbsp; By default this is determined by subtracting the number of voxels required by a recipe from the voxels granted based on the number of ingots or metal plates placed onto the anvil.

Example Extension

<pre><span style="color: #708090;">// Add a bunch of extra voxels to the scrap bit calculation</span> <span style="color: #07a;">void</span> <span style="color: #dd4a68;">SetThriftySmithingVoxels</span><span style="color: #999;">(</span>BlockEntityAnvil anvil<span style="color: #999;">)</span> <span style="color: #999;">{</span>

Read the full description on Vintage Story ModDB →

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.