Example #1
0
 private static void Input_InWorldAction(EnumEntityAction action, bool on, ref EnumHandling handled)
 {
     if (PlayerControlUtils.disabledActions[(int)action])
     {
         handled = EnumHandling.PreventDefault;
     }
 }
        private void Input_InWorldAction(EnumEntityAction action, bool on, ref EnumHandling handled)
        {
            if (action == EnumEntityAction.RightMouseDown)
            {
                BlockSelection bs = capi.World.Player.CurrentBlockSelection;
                if (bs == null)
                {
                    return;
                }

                Block block = api.World.BlockAccessor.GetBlock(bs.Position);
                if (block.Code == null)
                {
                    return;
                }

                string[] parts = block.Code.Path.Split(new char[] { '-' }, 3);

                if ((parts[0] == "clayplanter" || parts[0] == "flowerpot") && parts.Length >= 3)
                {
                    capi.Network.GetChannel("upgradeTasks").SendPacket(new UpgradeHerePacket()
                    {
                        Pos = bs.Position
                    });
                }
            }
        }
Example #3
0
 private void OnEntityAction(EnumEntityAction action, bool @on, ref EnumHandling handled)
 {
     if (_isSprintToggled && action == EnumEntityAction.Sprint && !on)
     {
         handled = EnumHandling.PreventDefault;
     }
 }
Example #4
0
 private void onControls(EnumEntityAction action, bool on, ref EnumHandling handled)
 {
     if (action == EnumEntityAction.Sneak && on)
     {
         MountedBy?.TryUnmount();
         controls.StopAllMovement();
     }
 }
Example #5
0
 public bool this[EnumEntityAction action]
 {
     get
     {
         return(flags[(int)action]);
     }
     set
     {
         flags[(int)action] = value;
     }
 }
Example #6
0
 void AttemptToggleAction(EnumEntityAction action, bool on)
 {
     if (flags[(int)action] != on)
     {
         EnumHandling handling = EnumHandling.PassThrough;
         OnAction(action, on, ref handling);
         if (handling != EnumHandling.PassThrough)
         {
             return;
         }
         flags[(int)action] = on;
         Dirty = true;
     }
 }