Skip to content

Weapon Middleware

Infinitum edited this page Oct 18, 2021 · 9 revisions

Weapon Middleware

Location: server/components/Weapon

Hit

Middleware<[Weapon, Instance, Map<Instance, boolean>]>

  • Weapon - the weapon that did the hit
  • Instance - if a player was hit the instance will be the player, else it will be the part that was hit
  • Map<Instance, boolean> - a debounce tracker that tricks which instances have already been hit by the sword (the instance can be a player)

The Hit middleware is called after the weapon adds the instance to the debounce map. It happens before the weapon does damage to the instance.

Swing

Middleware<[Weapon]>

  • Weapon - the weapon that was swung

This middleware is fired after the weapon begins the swing animation.

Draw

Middleware<[Weapon]>

  • Weapon - the weapon is being drawn

This middleware is fired after the weapon has already begun to draw.

Damage Middleware

Middleware<[Weapon, Player]>

  • Weapon - the weapon that will damage the player
  • Player - the Player that will be damaged

This midddleware is fired when the weapon has found a hit that is a player and is about to damage them (has not yet damaged the player).

Clone this wiki locally