WeaponMechanics/MechanicsMain

When shooting a mob, <target_name> is returning the username of the player that is firing the weapon.

Opened this issue · 0 comments

Current/Expected Behavior

When shooting a mob with a mechanic containing <target_name>, I'm getting my own username returned.

I'm using MechanicsCore and WeaponMechanics version 3.3.3 on Paper 1.20.4-496

Weapon Config:

AK_47:
  Info:
    Weapon_Item:
      Type: "FEATHER"
      Name: "<gold>AK-47"
      Lore:
        - "<gray>Very reliable automatic assault rifle chambered in 7.62mm Soviet."
        - "<gray>Large caliber ammunition requires skill to control recoil."
        - ""
        - "<gray>Weapon Statistics <gold>-<gray> 66.5"
        - "<gold>➣<gray> 68 <gold>⟸ <gray>Accuracy"
        - "<gold>➣<gray> 76 <gold>⟸ <gray>Damage"
        - "<gold>➣<gray> 67 <gold>⟸ <gray>Range"
        - "<gold>➣<gray> 61 <gold>⟸ <gray>Fire Rate"
        - "<gold>➣<gray> 59 <gold>⟸ <gray>Mobility"
        - "<gold>➣<gray> 68 <gold>⟸ <gray>Control"
      Unbreakable: true
      Hide_Flags: true
      Attributes:
        - "GENERIC_MOVEMENT_SPEED -0.0181"
      Deny_Use_In_Crafting: true
      Recipe:
        Shape:
          - " a "
          - "sib"
          - " h "
        Ingredients:
          a: Adhesive  # found in MechanicsCore > Items > CraftingMaterials.yml
          i: iron_block
          b: Barrel  # found in MechanicsCore > Items > CraftingMaterials.yml
          h: Handle  # found in MechanicsCore > Items > CraftingMaterials.yml
          s:
            Type: wooden_shovel
            Name: "<yellow>Stock"
            Lore:
              - "<gray>Crafting material for weapons"
            Recipe:
              Shape:
                - "www"
                - "ww "
              Ingredients:
                w: oak_planks
    Weapon_Info_Display:
      Action_Bar:
        Message: "<gold>AK-47<firearm_state> <gray>«<gold><ammo_left><gray>»<gold><reload>"
    Weapon_Get_Mechanics:
      - "Sound{sound=ITEM_ARMOR_EQUIP_CHAIN, pitch=0.75, listeners=Source{}}"
    Weapon_Equip_Delay: 30
    Cancel:
      Drop_Item: true
      Arm_Swing_Animation: true
      Break_Blocks: true
  Skin:
    Default: 5
    Scope: ADD 1000
    Sprint: ADD 2000
    blue: ADD 10000 # blue and red will only work if you have purchased WMC
    red: ADD 20000
  Projectile: "assault_rifle.Projectile"
  Shoot:
    Trigger:
      Main_Hand: "RIGHT_CLICK"
      Off_Hand: "RIGHT_CLICK"
      Circumstance:
        Swimming: "DENY"
        Sprinting: "DENY"
        Dual_Wielding: "DENY"
    Projectile_Speed: 220
    Fully_Automatic_Shots_Per_Second: 10
    Spread:
      Base_Spread: 3.9
      Modify_Spread_When:
        Zooming: 50%
        Sneaking: 50%
        In_Midair: 150%
    Recoil:
      Push_Time: 200
      Horizontal:
        - 3.2
        - 0
      Vertical:
        - 3.2
      Modify_Recoil_When:
        Zooming: 50%
        Sneaking: 50%
        In_Midair: 150%
    Mechanics:
      - "CustomSound{sound=shoot.ak47.quiet, volume=6, noise=0.1}"
  Reload:
    Trigger:
      Main_Hand: "DROP_ITEM"
      Off_Hand: "DROP_ITEM"
    Magazine_Size: 30
    Reload_Duration: 57
    Start_Mechanics:
      - "CustomSound{sound=reload.start.normal, volume=0.5, noise=0.1}"
    Finish_Mechanics:
      - "CustomSound{sound=reload.end.normal, volume=0.5, noise=0.1}"
  Damage:
    Base_Damage: 5.0
    Armor_Damage: 3
    Dropoff:
      - "10 -1.66"
      - "25 -3.32"
      - "50 -4.98"
    Head:
      Mechanics:
        - "Command{command=broadcast the target is <target_name>}"
        - "Command{command=broadcast the source is <source_name>}"
    Body:
      Mechanics:
        - "Command{command=broadcast the target is <target_name>}"
        - "Command{command=broadcast the source is <source_name>}"
  Scope:
    Trigger:
      Main_Hand: "LEFT_CLICK"
      Off_Hand: "LEFT_CLICK"
    Zoom_Amount: 1.5
    Shoot_Delay_After_Scope: 15
    Mechanics:
      - "CustomSound{sound=scope.in, volume=0.5, noise=0.1, listeners=Source{}}"
    Zoom_Off:
      Mechanics:
        - "CustomSound{sound=scope.out, volume=0.5, noise=0.1, listeners=Source{}}"
  Firearm_Action:
    Type: "SLIDE"
    Open:
      Time: 8
      Mechanics:
        - "Sound{sound=BLOCK_NOTE_BLOCK_HAT, volume=0.5, noise=0.1, listeners=Source{}}"
        - "Sound{sound=BLOCK_PISTON_CONTRACT, volume=0.5, noise=0.1, listeners=Source{}, delayBeforePlay=2}"
    Close:
      Time: 8
      Mechanics:
        - "Sound{sound=BLOCK_PISTON_EXTEND, volume=0.5, noise=0.1, listeners=Source{}}"

  # The following options are added by WeaponMechanicsCosmetics, and you will
  # not see the changes take effect until you purchase it.

  Cosmetics:
    Muzzle_Flash: true
    Splash_Mechanics:
      - "Sound{sound=ENTITY_GENERIC_SPLASH, pitch=1.85, noise=0.15} @Target{}"
      - "Particle{particle=WATER_SPLASH, count=20, noise=0.2 0.2 0.2} @Target{}"
    Bullet_Zip:
      Maximum_Distance: 4.0
      Sounds:
        - "CustomSound{sound=fx.whiz, noise=0.02, listeners=Target{}} @Target{}"
    Crossbow:
      Only_When_Scoping: false

  Trail:
    Distance_Between_Particles: 0.3
    Particle_Chooser: LOOP
    Particles:
      - "Particle{particle=DUST_COLOR_TRANSITION, color=RED, fadeColor=YELLOW, size=0.4}"

  Show_Time:
    Reload:
      Item_Cooldown: true
      Exp: true
      Action_Bar: "<gray>Reloading <bar> <gray><time>s"
      Action_Bar_Cancelled: "<red>Reload Cancelled"
      Bar:
        Left_Color: "<gray>"
        Right_Color: "<red>"
        Left_Symbol: "|"
        Right_Symbol: "|"
        Symbol_Amount: 30
    Weapon_Equip_Delay:
      Item_Cooldown: true
    Shoot_Delay_After_Scope:
      Item_Cooldown: true

Steps To Reproduce

  1. Use the config. 2. Spawn the weapon. 3. Shoot a mob in the head or chest.

Log File

latest.log

Anything else?

2024-04-26_14 55 12