soma0sd

코딩 & 과학 & 교육

C#/tModLoader: 모드 목록 불러오기

반응형

소스코드를 공개하지 않은 모드라고해도 모드에 접근해서 값을 변경하거나 값을 가져올 수 있습니다. 이런 방식을 활용하는 모드로는 치트시트(Cheat Sheet)나 보스 체크리스트(Boss Checklist)가 대표적입니다.

using Terraria.ModLoader;
using Terraria;
using System.IO;
using System.Reflection;
using System.Collections.Generic;

namespace TransKor
{
    public class TransKor : Mod
    {
        public TransKor(){}
        public override void Load()
        {
            for (int i = 0; i < ModLoader.Mods.Length; i++)
            {
                Mod mod = ModLoader.GetMod(i);
                // 현재 모듈과 ModLoader를 포함한 모든 모드를 나열
            }
        }
    }
}
  • ModLoader.Mods.Length: 모드의 갯수를 나타냅니다.

  • ModLoader.GetMod(int): 번호에 해당하는 모드를 가져옵니다.

ModLoader.GetMod(string) 도 가능합니다. 보이는 이름이 아닌 파일이름을 기반으로 찾는다는 점을 주의해서 사용하시면 됩니다.

반응형
태그:

댓글

End of content

No more pages to load