mwg API
    Preparing search index...

    Function sideVisionGroups

    • The sides a scenario's content says see together, as groups ready for FactionFog.share.

      Wesnoth groups sides into teams with [side] team_name, and share_vision says whether a side shares what it sees with its team. none does not; all and shroud are treated alike here because FactionFog shares sight and memory as one thing rather than keeping them apart, and a fog that separated them would be the place to tell the two apart. A side with no team_name shares with nobody, and a team of one is not returned, since sharing with nobody is what it already does.

      Parameters

      Returns readonly (readonly string[])[]

      import { sideVisionGroups, type MwlWorld } from '@datamoc/mw_games/mwl';

      declare const world: MwlWorld;

      // sides 1 and 2 both wrote team_name=north, and side 3 asked for share_vision=none
      console.log(sideVisionGroups(world)); // [['1', '2']]