Bug - Won't Fix Ginormous pumpkin ambiguity in get_campground()

adeyke

Member
As noted in this thread, ginormous pumpkins are unique in that they can exist both as a harvestable garden crop and as housing. In either case, get_campground() will return "ginormous pumpkin => 1", so any script checking for that can potentially have false positives and will need to instead use alternative methods (either checking the amount for "packet of pumpkin seeds => 11" or using get_dwelling()).

That alone isn't technically a bug, since it's just an ambiguity in KoL itself, and get_campground() is just accurately reporting that there's a ginormous pumpkin in the campground.

However, if there's both a harvestable ginormous pumpkin and a housing ginormous pumpkin, get_campground() will still report "ginormous pumpkin => 1" instead of "ginormous pumpkin => 2", which is inaccurate. Debug of such a campground attached.
 

Attachments

  • DEBUG_20230517.txt
    13.9 KB · Views: 1
Last edited by a moderator:

Veracity

Developer
Staff member
Thanks for the DEBUG log. That, along with a log I made myself with a character with a pumpkin house and no garden, has allowed me to understand how this works.

Internally, the list of items in KoLConstants.campground does not include the dwelling.
For gardens, it includes both SEED_PACKET (X) (where X is the days of growth that produce the current crop) and the actual current crop.

pumpkin house + ginormous pumpkin in garden?
dwelling = ginormous pumpkin
campground = packet of pumpkin seeds (11) + ginormous pumpkin
getCrop() returns ginormous pumpkin

pumpkin house + no garden?
dwelling = ginormous pumpkin
campground = (no seeds) + (no crop)
getCrop() returns null

So, there is no ambiguity internally regarding dwelling/garden.

The ambiguity you point out is in the ASH get_campground() function.

That has all of the items in KoLConstants.campground - and also adds in the dwelling.
If the script sees ginormous pumpkin, does that mean the dwelling is a pumpkin house? (If so, get_dwelling will say so).
Or does it mean the garden contains a ginormous pumpkin? (If so, it will also contain "packet of pumpkin seeds" => 11)

Since get_campground returns a set of items - map from item => count - as coded, we do, in fact, simply enter ginormous pumpkin -> 1 twice. We could, in fact, make the count be 2, if it is both your crop and dwelling. That'd be easy enough, but a garden script would still have to check that ginormous pumpkin => 1 is not the dwelling. Probably simpler for a garden script to recognize what kind of garden you have via the seed packet, and progress via the "count" of that item.

I have not decided what do do about this, yet. Perhaps a change to how get_campground adds the dwelling to the returned campground.

In any case, I have several tests using your (and my) DEBUG logs, so, thanks again.
 

Veracity

Developer
Staff member
I no longer think this needs the fix as proposed.

If we see a pumpkin house, we will do the following:

1) set your current dwelling - get_dwelling() - to ginormous pumpkin.
2) add ginormous pumpkin to get_campground()

If we see a ginormous pumpkin in your garden, we will do the following:

1) add pumpkin seeds (11) to get_campground()
2) add ginormous pumpkin to get_campground()

If a script wants to see if your dwelling is a pumpkin house, check that get_dwelling() is ginormous pumpkin
If a script wants to see if your garden has a ginormous pumpkin, check that get_campground() has pumpkin seeds (11)

Yes, if we added ginormous pumpkin (2) in get_campground(), you'd know you had both the dwelling and the garden, but if there is only one, you'd still have to check using the other method - get_dwelling() or pumpkin seeds.

My script - Garden Harvester - now handles this case correctly, either way, by looking for pumpkin seeds (11) and not ginormous pumpkin.
Other garden scripts can do the same thing.
A script that cares about your pumpkin house SHOULD be using get_dwelling() anyway.

ginormous pumpkin (2) will not help.

So, I am not going to do anything more to get_campground().
 
Top