Wayward
Wayward Mods
Make a new creature! Make a new item! Make a troposphere! Your imagination is the only limit with Wayward Mods on Steam Workshop.
了解更多
LetterShapedGlyphs 2019 年 5 月 22 日 下午 12:26
Changing item recipes
While registering new items with a mod is very straightforward, I'm struggling to figure out how to change the recipe for a base game item.

BaseMod has a commented line which says:
All `@Register.thing` decorators that take arguments can reference other registrations via `Registry<Mod, Thing>().get("name")

As far as I can tell this would allow me to reference and thereby change the recipe for an item created by another mod, but it's not clear how one would hook that into a part of the base game.

Am I on the right track here? Or is there a much simpler method that I can't figure out?
< >
正在显示第 1 - 3 条,共 3 条留言
ChiriVulpes  [开发者] 3 2019 年 5 月 22 日 下午 4:39 
Hey Karthas,

The commented line you're referring to is documentation on registration of new things, not tweaking existing things.

There is currently no convenient decorator-style way to tweak base-game things, so instead, you have to do it manually — this means, you'll have to do your modification in onInitialize, and undo your modification in onUninitialize:

Example:
public onInitialize() { this.oldRecipe = itemDescriptions[ItemType.BarkLeggings].recipe; // this is the default recipe for bark leggings, but you'd want to write your own itemDescriptions[ItemType.BarkLeggings].recipe = { components: [ RecipeComponent(ItemType.TreeBark, 4, 4, 4), RecipeComponent(ItemType.String, 2, 2, 2), ], skill: SkillType.Woodworking, level: RecipeLevel.Intermediate, reputation: -75, }; } public onUnitialize() { itemDescriptions[ItemType.BarkLeggings].recipe = this.oldRecipe; }

All modification of base game content currently works the same way.

For more details on acceptable values for item descriptions or recipes, see:

IItemDescription[waywardgame.github.io]
IRecipe[waywardgame.github.io]

Or view the interfaces by Ctrl+Clicking on tokens in VSCode.
最后由 ChiriVulpes 编辑于; 2019 年 5 月 22 日 下午 4:40
LetterShapedGlyphs 2019 年 5 月 23 日 上午 3:10 
Thank you so much for the quick response. Exactly what I needed :)
LetterShapedGlyphs 2019 年 5 月 23 日 上午 9:18 
Apologies for double posting but quick follow up question:
I've managed to modify a few recipes using those guidelines, but am not seeing a way to require a minimum tier when using ItemTypeGroup? Is that something that is possible with the current code?

If not, it looks like I can use a workaround that involves registering a new ItemTypeGroup that only consists of acceptable tiers, but I was hoping to avoid that.

Edit:
One other thing - Is there a way of tying new terrain types into the default generation instead of overriding it like in the Troposphere example?
For example, I'd like to add a new metal that will show up in veins instead of relying on a method hook to replace the generated terrain via RNG.
最后由 LetterShapedGlyphs 编辑于; 2019 年 5 月 23 日 上午 9:48
< >
正在显示第 1 - 3 条,共 3 条留言
每页显示数: 1530 50