ClanGenOfficial / clangen

Warrior Cats fan game
https://clangen.io
Other
230 stars 404 forks source link

[BUG] Lost Cats Returning with Faded Kits #2344

Closed jaysoleson closed 2 weeks ago

jaysoleson commented 1 month ago

Type: Code

Describe the bug This is a bug found by kitty051336 in the Lifegen server that occurs when lost/outside cats with faded kits attempt to return to the Clan. The code that brings their kits along with them gives a keyerror for the faded kit's ID and crashes the game.

Grade: Non-vital (? WILL cause a crash, but it's rare to occur)

Reproduce Steps to reproduce the behavior (with default fading time):

  1. Have a cat under 15-ish moons with a 1-2 moon old kit in the Clan
  2. Have this parent cat become lost, and their kit dies shortly after.
  3. Have the parent stay alive outside until the kit fully fades.
  4. Now, when the cat attempts to return to the Clan, the faded kit will cause a crash.

Commit # or Game Version Number: This was actually found in Lifegen, so I'm not actually sure (we double checked it wasn't our issue lol). The last Clangen commit we have merge looks to be 2fc4d52 i think ?

Additional context Zabe found that the fix is just a simple addition to add_to_clan in cats.py! it checks for child.exiled and child.outside, but not if theyre dead.

Screenshots fadedkit_crash

ZtheCorgi commented 1 month ago

to be clear the parent cat would likely need to become lost while pregnant, or them and their kits would need to become lost in the same event (which is only possible with mass extinction turned on at the moment)

ReenieKitty commented 1 month ago

to be clear the parent cat would likely need to become lost while pregnant, or them and their kits would need to become lost in the same event (which is only possible with mass extinction turned on at the moment)

I'm the one who reported this, I created this account for any bugs in the future and just happened to see this right afterwards.

For the sake of clarity, the returning cat, ID 311, was male. He joined the clan with two newborn kits at a young age, then was lost in the mass extinction where people come and take a bunch of cats. As far as I know, neither of his kits were lost at that time. The kit in question, ID 313, died at 5 moons old, and faded. 311 was lost for over 200 moons before dying outside the clan at 240 moons old.

It is entirely possible 313 was also lost, I just remember 311 specifically because he was the only medicine cat in the clan at that time and losing him meant I had none. Regardless, 311 was just pretty young when he joined the clan with a couple newborns, then promptly got kidnapped and one of his kits died and faded along the way.

The other kit, ID 312, was lost at a later date (he was practically an elder when he was lost) and did return eventually. 311 and 312 were both outside the clan at the same time at one point, but 312 was only lost as an adult. 312 actually rejoined the clan immediately after I restarted the game post crash, the very next moonskip.

Overall this is probably a very rare occurrence, but given outside cats seem to have a tendency to live to well over 200 moons, it may be slightly more common than you would think.

j-gynn commented 2 weeks ago

this seems to have been closed by #2348 but this ticket remained open - can someone close?