Battle-Brothers-Legends / Legends-Bugs

Public bug tracker for Legends mod
37 stars 2 forks source link

[BUG] "Glutton/Fat" events do not compile, breaking event manager #181

Open hamzah-hayat opened 5 months ago

hamzah-hayat commented 5 months ago

Versions

Describe the bug The following files "scripts/events/events/glutton_gets_fat_event.cnut" "scripts/events/events/good_food_variety_event.cnut" "scripts/events/events/legends/legend_reserve_gets_fat_event.cnut" each have a (copy-pasted) statement that looks like so:

if (this.bro.getFlags().get("IsSpecial") || this.bro.getFlags().get("IsPlayerCharacter") || this.bro.getBackground().getID() == "background.legend_puppet" || this.bro.getBackground().getID() == "background.legend_donkey")
{
  return;
}

This has been placed in the wrong part of the file (the "bro" variable does not exist). This causes the event to fail, which also causes the event manager to fail, breaking all events from running. To fix this, I would move the check statement into each events for loop eg (for the reserve brother gets fat event)

foreach( bro in brothers )
{
    if (bro.getFlags().get("IsSpecial") || bro.getFlags().get("IsPlayerCharacter") || bro.getBackground().getID() == "background.legend_puppet" || bro.getBackground().getID() == "background.legend_donkey")
    {
        continue;
    }
    if (bro.isInReserves())
    {
        if (!bro.getSkills().hasSkill("trait.gluttonous"))
        {
            candidates.push(bro);
        }
    }
}

To Reproduce Steps to reproduce the behavior:

  1. Start a Battle brothers campaign
  2. Wait a few days
  3. Check BB error log
  4. Have no events fire.

Screenshots Error log image

Further errors are generated like so: image

Additional context The last release notes mention the following "Player characters, special characters, puppets and donkeys can no longer get 'fat' or 'gluttonous' traits from events related to eating too much (in some cases, these instances may generate with these traits still)." I believe that this directly relates to the error, this was coded incorrectly.