These files both read and write flags:

entities/animals/boss_alchemist/death.lua           |   checks if should spawn hp refill
entities/animals/boss_limbs/boss_limbs_death.lua    |   checks if should spawn hp refill
entities/animals/boss_pit/boss_pit_death.lua        |   checks if should spawn hp refill
scripts/animals/boss_dragon_death.lua               |   affects first drop
scripts/buildings/chest_dark.lua                    |   no unlock :(
scripts/buildings/chest_light.lua                   |   no unlock :(
scripts/buildings/huussi.lua                        |   no unlock :(
scripts/magic/amulet.lua                            |   gives extra unlocks
scripts/magic/dark_moon_altar.lua                   |   idk, but seems to run in some specific case so probably fine
scripts/magic/moon_altar.lua                        |   see scripts/magic/dark_moon_altar.lua
scripts/perks/perk.lua                              |   tracks perk progress
