William758 / ZetArtifacts

2 stars 2 forks source link

Two tweaks to Artifact of Tossing that'd be nice. #5

Closed ghost closed 2 years ago

ghost commented 2 years ago

Artifact Keys can be scrapped. Could easily lead to infinite yellow scrap and scrappers don't spawn in the Artifact World for that reason. Probably can be prevented by doing a check for the item name or itemdef when you decide whether or not it would be a valid scrap option. Something like this:

case ItemTier.Boss:
    if (itemDef.name != "ArtifactKey")
    {
        return true;
    }
    else 
    {
        return false;
    }

Also since Scrappers are useless it'd be neat if Scrappers could be removed. This method should probably work with anything that doesn't entirely change the way the game makes it's interactable DCCS idk how clean my code because i'm not a coder but it seems to work fine in testing.

(where ever you add the tossing stuff)

RoR2.SceneDirector.onGenerateInteractableCardSelection += SceneDirector_onGenerateInteractableCardSelection;

private void SceneDirector_onGenerateInteractableCardSelection(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
        {
            if (RunArtifactManager.instance && RunArtifactManager.instance.IsArtifactEnabled(ZetDropifact))
            {
                dccs.RemoveCardsThatFailFilter(new Predicate<DirectorCard>(NoMoreScrapper));
            }
        }

private static bool NoMoreScrapper(DirectorCard card)
        {
            GameObject prefab = card.spawnCard.prefab;
            return !prefab.GetComponent<RoR2.ScrapperController>();
        }

Thanks for the cool mods and cheers.

William758 commented 2 years ago

Yeah I've gone ahead and prevented Artifact Keys from being scrapped. I also added a config to remove scrappers that's disabled by default because I've noticed that some people don't even use the scrap feature and look for a scrapper instead.