Adding new item template properties?

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Kab the Bird Ranger
Posts: 25
Joined: Tue Feb 23, 2021 12:30 am

Adding new item template properties?

Post by Kab the Bird Ranger »

Someone taught me that the Repair service can repair virtually all items, not just equipment. I took a look, and indeed, only arrows are filtered out.

https://github.com/Interkarma/daggerfal ... ow.cs#L803

For vanilla Daggerfall, this is not really an issue, since only equipment can have its condition reduced, and therefore everything else will always have full condition.

But with mods involved, I'm wondering if we shouldn't have a way to let mods disable the repair service.

At first, I thought of going into the ItemTemplate type and adding a new field, that mods could change in their ItemTemplates.json. However, I realized that the ItemTemplate fields are based strictly on the data in FALL.EXE. I wasn't sure adding new fields there would be the right approach.

Any ideas on how else you would do it? Maybe we could have extra fields in ItemHelper to go along with RegisterCustomItem and the rest, but I wouldn't want to add a new function there for every other item template property we might want to add in the future.

User avatar
Interkarma
Posts: 6337
Joined: Sun Mar 22, 2015 1:51 am

Re: Adding new item template properties?

Post by Interkarma »

Registering new properties to item templates is a reasonable idea. There should be a way to add this in a non-breaking manner.

I'd like this to be done in a way that doesn't break if a mod adding these properties is removed later and the item remains. I can see an outline in my mind of a way this could work, but would need to explore to see if it's viable before I comment further.

User avatar
Ralzar
Posts: 1843
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Adding new item template properties?

Post by Ralzar »

This is why the food items in Climates & Calories does not use the condition data and instead renames the items as they deteriorate.

When I used condition data I discovered that you could give a rotten apple to the blacksmith and he could pound it back into a fresh apple :D
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

User avatar
Interkarma
Posts: 6337
Joined: Sun Mar 22, 2015 1:51 am

Re: Adding new item template properties?

Post by Interkarma »

That's one gifted blacksmith!

User avatar
Hazelnut
Posts: 2791
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Adding new item template properties?

Post by Hazelnut »

Yeah it was amusing when we realised this. Changing the name worked better anyway because the condition strings are fixed and a broken apple is just as nonsensical.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply