![]() |
#1 |
Prophet
Join Date: Apr 2008
Posts: 2,672
![]() |
list-tvals.h
I was under the impression that we could add more object types in the game via object_base.txt, but it's not the case since tvals are hardcoded in list-tvals.h, so adding a new object type requires adding an entry to this file and recompile the source code.
This is bad, not anyone is a dev that can edit the source and recompile it. It would be nice if tvals were dynamically generated when parsing object_base.txt.
__________________
PWMAngband variant maintainer - check http://powerwyrm.monsite-orange.fr (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant! |
![]() |
![]() |
![]() |
#2 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
![]() |
List-tvals is necessary to make an enum used by the code. There isn't much point in adding a tval without also adding logic to handle it, so I see no benefit to changing this
|
![]() |
![]() |
![]() |
#3 |
Veteran
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,105
![]() |
You could break up the logic into actions perhaps? Stackable, Edible, Zapable, Chargable... etc.
|
![]() |
![]() |
![]() |
#4 |
Veteran
Join Date: May 2012
Location: Adelaide, Australia
Posts: 2,105
![]() |
So I may not have been exactly clear in the above post. The code has a bunch of this:
Code:
bool tval_is_edible(const struct object *obj) { switch (obj->tval) { case TV_FOOD: case TV_MUSHROOM: return true; default: return false; } } It's also got a bunch of this: Code:
else if (tval_is_edible(obj1) || tval_is_potion(obj1) || tval_is_scroll(obj1) || tval_is_rod(obj1)) { /* Food, potions, scrolls and rods all stack nicely, since the kinds are identical, either both will be aware or both will be unaware */ if stackable { Note I'm not particularly suggesting doing it that way. It just seems to me that list-tvals.h isn't the only thing that has to change to put types editable in the edit files. |
![]() |
![]() |
![]() |
#5 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
![]() |
Yeah, that is pretty much what I felt, but was less clear. If you plan to add a non-trivially different object type, SOME code will be needed. If the addition is trivial, what is the point?
There are a few more attributes that could go into the edit files without massive code changes, but NOT actual gameplay logic. We got rid of lua for a reason. Beyond the ones you mention, there is also shoot/throw break chance. |
![]() |
![]() |
![]() |
#6 | |
Veteran
Join Date: Apr 2007
Posts: 1,936
Donated: $40
![]() |
... which (for me at least) was because it was badly integrated. If it had been deeply integrated with more possibilities for extension then I wouldn't have removed it...
which isn't to take away from the overall point that there is a limit to the level of customisation you can get from the edit files. Quote:
__________________
takkaria whispers something about options. -more- |
|
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
"List visible monsters" and "List visible items" behavior | fruviad | Development | 1 | April 19, 2019 03:56 |
Variant list | caruso | Oook! | 13 | July 5, 2013 19:14 |
list experience value in Monster List view | fbas | Vanilla | 1 | November 24, 2010 20:51 |
My Unangband wish list (0.6.4a) | Hajo | Variants | 23 | October 24, 2010 07:37 |
Variant list | pav | Oook! | 19 | September 19, 2008 00:07 |