DillyzThe1 / DillyzRoleApi-Rewritten

A full rewrite for DillyzRoleApi, made for v2022.12.14 & up!
https://discord.gg/49NFTwcYgZ
Apache License 2.0
0 stars 5 forks source link

Issue with Api #5

Open TechDevOfficial opened 1 year ago

TechDevOfficial commented 1 year ago

i have a problem using multiple roles. I have a lot of roles in my mods folder. All work but one only work if there isn't any mod. Here's my code but how to make work all? using BepInEx; using BepInEx.IL2CPP; using DillyzRoleApi_Rewritten; using HarmonyLib; using UnityEngine; using UnityEngine.UI;

namespace HackerBuonoVSHackerCattivo { //Custom Url | Mod name | Version [BepInPlugin("com.github.TechDevOfficial.HackerBuonoRole", "Hacker", "1.0")] [BepInDependency(DillyzRoleApiMain.MOD_ID)] public class HackerBuonoVSHackerCattivoMain : BasePlugin {

    public Harmony harmony = new Harmony("com.github.TechDevOfficial.Hacker");
    public override void Load()
    {
        harmony.PatchAll();
        Log.LogInfo("The mod as loaded");

        //string.name | Role name | Discription of the mod | if i can see color | if color is public | Mod RGB color | Can see team color | What side the CustomRole is on | If able to vent | If it as the original kill button | If its show was the role name and not impster                
        CustomRole phaserole = DillyzUtil.createRole("Hacker Buono", "Phase through wall and kill the crew.", false, false, new Color32(150, 125, 125, 255), false, CustomRoleSide.Crewmate, VentPrivilege.None, false, false);
        //how the role is intruduced
        phaserole.a_or_an = "an";

        CustomRole hackercattivo = DillyzUtil.createRole("HACKER CATTIVO", "ATTRAVERSA I MURI E UCCIDI I CREWMATE", true, false, new Color32(150, 125, 125, 255), false, CustomRoleSide.Impostor, VentPrivilege.Impostor, true, true);
        //how the role is intruduced
        hackercattivo.a_or_an = "an";

        CustomButton hackerabutton = DillyzUtil.addButton(System.Reflection.Assembly.GetExecutingAssembly(), "hackera", "HackerBuonoVSHackerCattivo.Buttons.hackerabuono.png", 10f, false, new string[] { "Hacker Buono" }, new string[] { }, delegate (KillButtonCustomData button, bool success)
        {
            // succes is if the ocoldown is over and they can use it yet
            if (!success)
                return;
            //DillyzUtil.RpcCommitAssassination(PlayerControl.LocalPlayer, PlayerControl.LocalPlayer);
            PlayerControl.LocalPlayer.gameObject.GetComponent<CircleCollider2D>().enabled = false;
        });

        //Mod RGB Color
        hackerabutton.textOutlineColor = new Color32(150, 125, 125, 255);

        hackerabutton.SetUseTimeButton(5f, delegate (KillButtonCustomData button, bool interrupted)
        {
            // interrupted is if the use time was stopped by something other than it being manually called as running out (such as meetings or death)
            PlayerControl.LocalPlayer.gameObject.GetComponent<CircleCollider2D>().enabled = true;
        });

        CustomButton hacker = DillyzUtil.addButton(System.Reflection.Assembly.GetExecutingAssembly(), "hackera", "HackerBuonoVSHackerCattivo.Buttons.hackera.png", 10f, false, new string[] { "HACKER CATTIVO" }, new string[] { }, delegate (KillButtonCustomData button, bool success)
        {
            // succes is if the ocoldown is over and they can use it yet
            if (!success)
                return;
            //DillyzUtil.RpcCommitAssassination(PlayerControl.LocalPlayer, PlayerControl.LocalPlayer);
            PlayerControl.LocalPlayer.gameObject.GetComponent<CircleCollider2D>().enabled = false;
        });
        //Mod RGB Color
        hacker.textOutlineColor = new Color32(150, 125, 125, 255);

        hacker.SetUseTimeButton(5f, delegate (KillButtonCustomData button, bool interrupted)
        {
            // interrupted is if the use time was stopped by something other than it being manually called as running out (such as meetings or death)
            PlayerControl.LocalPlayer.gameObject.GetComponent<CircleCollider2D>().enabled = true;
        });
    }
}

}

DillyzThe1 commented 1 year ago

Hi, please consider using Github formatting when submitting code.

Example:

// prints to unity console (not for mods)
Debug.Log("debug");

Also, I don't understand the exact problem because the code is fine.

Please detail your Among Us installation's version name, which version of DillyzRoleApi you're using, where the problem lies (ie. loading or functionality), and verify your mod's new versions are in game.

TechDevOfficial commented 1 year ago

okay. then i have many roles in two different dlls and they all work except 1. I use among us 2022.12.14i build and my problem is in a role. i can select the role but the game don't show abilities

TechDevOfficial commented 1 year ago

and i use the latest version of your api

TechDevOfficial commented 1 year ago

I would like to create a mod bundle, but I can't get the one in my bundle to work