Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
301 stars 43 forks source link

Wish for empty containers & Make empty cans and empty bottles craftable #538

Closed jakwings closed 5 years ago

jakwings commented 5 years ago

Also add aliases for land mines and vials. Before this change it was impossible to wish for a bottle using text "potion" or "drink".

andrewtweber commented 5 years ago

I believe that before, if you specifically wished for a "bottle of ommel urine" for example, it would just give you a randomly-filled bottle, is that behavior changed?

ryfactor commented 5 years ago

Looks great! I think it just enables wishing of empty bottles etc. by the addition of the keyword 'empty', in addition to allowing empty cans and bottles to be crafted.

jakwings commented 5 years ago

Yes, still no way to wish for an item with arbitrary material, unless we allow keywords like "of ommel urine".

I found that Config FEATURE or some thing still invalidates some aliaes for matching (not my fault). You can search a broken lantern by "broken lantern" but not by "broken light". Not so practical but I haven't figured out why...

jakwings commented 5 years ago

Ah, found out the cause: itemdatabase::InitDefaults() automatically adds the adjective "broken" to every BROKEN item.

For convenience, I think the container should be empty by default for crafting cans and bottles.

andrewtweber commented 5 years ago

1 conflict appeared after merging the other PR. Feel free to merge after you resolve it @iology

AquariusPower commented 5 years ago

As I remember If I am not wrong (and I was), before cans where blocked by being filled with food (therefore preventing crafting'em empty too in the old code), ~~if we craft them using any other material than the default one (tin?), we can fill'em with liquids, but after using it's contents, it would spawn an empty can with the default material and not the original one,~~ The "issue" was related to mellis as I wrote on next post. I guess it may still be like that, it was one of the reasons not much time was spent on letting it work at that time, out of that inconsistency "issue" :>

jakwings commented 5 years ago

Just fix some logic there, does the problem still exist?

jakwings commented 5 years ago

@AquariusPower I rolled back to 93efe67 and removed the restriction, but could not reproduce the problem. So it probably had been fixed sometime.

AquariusPower commented 5 years ago

I just tested and the problem is not happening: I changed can's material to gold, consumed it's contents and the empty one was still gold.

To be sure, prayed to mellis and the golden emtpy can become a filled one but now made of default material, the god doesnt fills the existing can, but really trades it by a new one, as it is said there. I dont know if it could instead fill'em (to be more fun?), but is at least coherent with what is said :>

jakwings commented 5 years ago

To be sure, prayed to mellis and the golden emtpy can become a filled one but now made of default material, the god doesnt fills the existing can, but really trades it by a new one, as it is said there. I dont know if it could instead fill'em (to be more fun?), but is at least coherent with what is said :>

item::BetterVersion() is only used by Mellis. Maybe we should move it to gods.cpp. +1 for a new one.

AquariusPower commented 5 years ago

mmm.. nice spotting

at Main/Source/miscitem.cpp

item* can::BetterVersion() const
{
  if(!GetSecondaryMaterial())
    return can::Spawn();
  else
    return 0;
}

could instead use self main material config at this call, I think like this: return can::Spawn(GetConfig());
whenever explosions and ennerbeast be able to xplode the can (cant right?), crafting better quality ones will be interesting

potions/bottles seem to already work like that (dont understand why tho, gotta test it to confirm) return potion::Spawn(GetConfig());

jakwings commented 5 years ago

GetConfig() only consider the material config in item.dat, so special materials won't be kept.