WeaponMechanics/MechanicsMain

Add option so that while holding a weapon to have it negate fall damage

Opened this issue · 2 comments

Description

As far as I can tell there is no such option in the config or docs even though you have the "Reset_Fall_Distance" option. Witch on its own is ok but I want the weapons to have the ability to flat out make it so that players don't take any fall damage at all while being held.

Configuration

info:
  Weapon_Equip_Mechanics:
    - "DisableFallDamage{}"

I don't really know where it should actually go but I think that would be the most rational location to have it.

Payment (optional)

  • I'm willing to pay for this feature

I should be able to code something in a plugin called commandhelper that will disable fall damage with certain checks. If need be and I am already coding it.(this function is/was in crackshot)

I made this and added support for it to work with mobs. All you have to do is ether equip or hold an item with "no fall damage"
anywhere in the lore. It will work with color codes and formatting but it wont if you add any formatting in the middle of the string.

throw the code into a file like "NoFallLore.ms" and put that file in plugins/commandhelper/LocalPackages

bind('entity_damage', null, array(cause: 'FALL'), @event) {
 # Code made by Dethkiller15
 if(array_contains_ic(@event, 'player')) {
   @PlayerEquipArray = array(pheld_slot(@event['player']), '-106', '100', '101', '102', '103')
   foreach(@InvSlot in @PlayerEquipArray) {
     if(!is_null(pinv(@event['player'],@InvSlot))) {
       foreach(@value in get_itemmeta(@event['player'],@InvSlot)['lore']) {
         if(string_contains_ic(@value, 'no fall damage')) {
           cancel(true)
           break()
         }
       }
     }
   }
 } else {
   @MobEquipArray = array('boots', 'chestplate', 'helmet', 'leggings', 'off_hand', 'weapon')
   @mobEquipmentArray = get_mob_equipment(@event['id'])
   foreach(@Slot in @MobEquipArray) {
     if(!is_null(@mobEquipmentArray[@Slot])) {
       if(!is_null(@mobEquipmentArray[@Slot]['meta'])) {
         if(!is_null(@mobEquipmentArray[@Slot]['meta']['lore'])) {
           foreach(@LoreLine in @mobEquipmentArray[@Slot]['meta']['lore']) {
             if(string_contains_ic(@LoreLine, 'no fall damage')) {
               cancel(true)
               break()
             }
           }
         }
       }
     }
   }
 }
}