Пример #1
0
 public override WorldInteraction[] GetPlacedBlockInteractionHelp(IWorldAccessor world, BlockSelection selection, IPlayer forPlayer)
 {
     if (selection.SelectionBoxIndex == 0)
     {
         return(new WorldInteraction[] {
             new WorldInteraction()
             {
                 ActionLangCode = "blockhelp-quern-addremoveitems",
                 MouseButton = EnumMouseButton.Right
             }
         }.Append(base.GetPlacedBlockInteractionHelp(world, selection, forPlayer)));
     }
     else
     {
         return(new WorldInteraction[] {
             new WorldInteraction()
             {
                 ActionLangCode = "blockhelp-quern-grind",
                 MouseButton = EnumMouseButton.Right,
                 ShouldApply = (wi, bs, es) => {
                     BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(bs.Position) as BlockEntityQuern;
                     return beQuern != null && beQuern.CanGrind();
                 }
             }
         }.Append(base.GetPlacedBlockInteractionHelp(world, selection, forPlayer)));
     }
 }
Пример #2
0
        public override void OnBlockInteractStop(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;

            if (beQuern != null)
            {
                beQuern.SetPlayerGrinding(byPlayer, false);
            }
        }
Пример #3
0
        public override bool OnBlockInteractStep(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;

            if (beQuern != null)
            {
                return(beQuern.CanGrind());
            }

            return(false);
        }
Пример #4
0
        public override bool OnBlockInteractCancel(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel, EnumItemUseCancelReason cancelReason)
        {
            BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;

            if (beQuern != null)
            {
                beQuern.SetPlayerGrinding(byPlayer, false);
            }


            return(true);
        }
Пример #5
0
        public override bool OnBlockInteractStep(float secondsUsed, IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;

            if (beQuern != null && (blockSel.SelectionBoxIndex == 1 || beQuern.Inventory.openedByPlayerGUIds.Contains(byPlayer.PlayerUID)))
            {
                beQuern.IsGrinding(byPlayer);
                return(beQuern.CanGrind());
            }

            return(false);
        }
Пример #6
0
        public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;

            if (beQuern != null && beQuern.CanGrind() && (blockSel.SelectionBoxIndex == 1 || beQuern.Inventory.openedByPlayerGUIds.Contains(byPlayer.PlayerUID)))
            {
                beQuern.SetPlayerGrinding(byPlayer, true);
                return(true);
            }

            return(base.OnBlockInteractStart(world, byPlayer, blockSel));
        }
Пример #7
0
        public override bool OnBlockInteractStart(IWorldAccessor world, IPlayer byPlayer, BlockSelection blockSel)
        {
            if (blockSel.SelectionBoxIndex == 1)
            {
                BlockEntityQuern beQuern = world.BlockAccessor.GetBlockEntity(blockSel.Position) as BlockEntityQuern;
                if (beQuern != null && beQuern.CanGrind())
                {
                    beQuern.SetPlayerGrinding(byPlayer, true);
                    return(true);
                }
            }

            return(base.OnBlockInteractStart(world, byPlayer, blockSel));
        }