Adding new item template properties?

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Kab the Bird Ranger
Posts: 123
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: 7234
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: 2211
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

User avatar
Interkarma
Posts: 7234
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: 3014
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

User avatar
DunnyOfPenwick
Posts: 275
Joined: Wed Apr 14, 2021 1:58 am
Location: Southeast US

Re: Adding new item template properties?

Post by DunnyOfPenwick »

On the topic of item templates, shouldn't there be a way to override modded item behaviour when using the INFO button in inventory, as with the USE functionality? Or is there a way and I just didn't see it?

I don't need this now, but I suspect someone might need it in the future.

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

Re: Adding new item template properties?

Post by Ralzar »

Agreed, I have a couple of items in my mods where info would be very handy.

Post Reply