liplum / MultiCrafterLib

A Mindustry mod library provides a multiple-recipe crafter to produce items, fluids, power or even heat for Json and JavaScript mods.
https://liplum.github.io/MultiCrafterLib/
GNU General Public License v3.0
47 stars 10 forks source link

Rotator always rotates #45

Open Curlychump opened 3 months ago

Curlychump commented 3 months ago

If a rotator (spinner) drawer is added it will always spin, regardless of status.

Code attached

 acidmixer = new MultiCrafter("Acid Mixer"){{
        hasPower = solid = hasLiquids = hasItems = true;
        isConsumePower = true;
        description = ("A Mixer made of materials capable of holding strong acids, making it suitable to mix acids.");
        rotate = false;
        size = 3;
        consumePower(2f);
        envEnabled = Env.any;
        drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawLiquidTile(Liquids.water), new DrawLiquidTile(clabLiquids.sAcid), new DrawRegion("-base"), new DrawRegion("-rotator"){{
            spinSprite = true;
            rotateSpeed = 4f;
        }});
        requirements(Category.crafting, with(clabItems.weldedframe, 100, clabItems.steel, 50, Items.silicon, 25, Items.titanium, 50));
        resolvedRecipes = Seq.with(
            new Recipe(
                //IOEntry input: this recipe's input goes here
                new IOEntry(
                    //input items go here (can be empty if you wish to use fluids only)
                    Seq.with(ItemStack.with(clabItems.sulfur, 5)),
                    //input fluids go here (there are no fluids required so this is empty)
                    Seq.with(LiquidStack.with(Liquids.water, 100f)),
                    5f
                ),
                //IOEntry output: this recipe's output goes here
                new IOEntry(
                    //output items
                    Seq.with(),
                    //output fluids, again, it can be empty
                    Seq.with(LiquidStack.with(clabLiquids.sAcid, 100f))
                ),
                //float craftTime: self-explanatory. measured in ticks
                60f
            ),
            new Recipe(
                //IOEntry input: this recipe's input goes here
                new IOEntry(
                    //input items go here (can be empty if you wish to use fluids only)
                    Seq.with(ItemStack.with()),
                    //input fluids go here (there are no fluids required so this is empty)
                    Seq.with(LiquidStack.with(clabLiquids.nitrogen, 10f, clabLiquids.oxygen, 20f)),
                    5f
                ),
                //IOEntry output: this recipe's output goes here
                new IOEntry(
                    //output items
                    Seq.with(),
                    //output fluids, again, it can be empty
                    Seq.with(LiquidStack.with(clabLiquids.nAcid, 100f/20f))
                ),
                //float craftTime: self-explanatory. measured in ticks
                60f
            ));
    }};