Пример #1
0
 public override InteractResult OnActLeft(InteractionContext context)
 {
     if (context.HasBlock && context.Block.Is <Minable>())
     {
         Result result = this.PlayerDeleteBlock(context.BlockPosition.Value, context.Player, false, 1);
         if (result.Success)
         {
             if (RubbleObject.TrySpawnFromBlock(context.Block.GetType(), context.BlockPosition.Value))
             {
                 RubbleUtils.BreakBigRubble(context.BlockPosition.Value, 20 * SkillsUtil.GetSkillLevel(context.Player.User, typeof(StrongMiningSkill)));
                 context.Player.User.UserUI.OnCreateRubble.Invoke();
             }
         }
         return((InteractResult)result);
     }
     else if (context.Target is RubbleObject)
     {
         var rubble = (RubbleObject)context.Target;
         if (rubble.IsBreakable)
         {
             rubble.Breakup();
             BurnCalories(context.Player);
             return(InteractResult.Success);
         }
         else
         {
             return(InteractResult.NoOp);
         }
     }
     else
     {
         return(InteractResult.NoOp);
     }
 }
Пример #2
0
 private bool ContextOnInterraction(InteractionContext context)
 {
     if (context.Method == InteractionMethod.Right)
     {
         if (context.SelectedItem is PickaxeItem)
         {
             if (context.HasBlock == false || context.Player.User.Inventory.Carried.IsEmpty)
             {
                 if (SkillsUtil.HasSkillLevel(context.Player.User, typeof(MiningPickupAmountSkill), 1))
                 {
                     RubbleUtils.PickUpRubble(context.Player.User, 2 + (2 * SkillsUtil.GetSkillLevel(context.Player.User, typeof(MiningPickupRangeSkill))), (BetterMiningPlugin.ConfigStorage.GetInt("PickupRubbleBySkillLevel") * SkillsUtil.GetSkillLevel(context.Player.User, typeof(MiningPickupAmountSkill))));
                 }
             }
         }
     }
     else if (context.Method == InteractionMethod.Left)
     {
         if (context.SelectedItem is PickaxeItem && context.HasBlock && context.Block.Is <Minable>())
         {
             if (context.SelectedItem.OnActLeft(context).IsSuccess)
             {
                 RubbleUtils.BreakBigRubble(context.BlockPosition.Value, 20 * SkillsUtil.GetSkillLevel(context.Player.User, typeof(StrongMiningSkill)));
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #3
0
        public override InteractResult OnActRight(InteractionContext context)
        {
            User user = context.Player.User;

            if (context.HasBlock == false || user.Inventory.Carried.IsEmpty)
            {
                if (SkillsUtil.HasSkillLevel(user, typeof(MiningPickupAmountSkill), 1))
                {
                    RubbleUtils.PickUpRubble(user, 2 + (2 * SkillsUtil.GetSkillLevel(user, typeof(MiningPickupRangeSkill))), (4 * SkillsUtil.GetSkillLevel(user, typeof(MiningPickupAmountSkill))));
                    return(InteractResult.Success);
                }
            }
            return(InteractResult.NoOp);
        }