IWeaponBehaviour interface
public interface IWeaponBehaviour What a weapon does while it’s held, registered with IWeapons.Register. The server makes one for each carried item of the weapon and runs it on the server only. A behaviour whose Deploy or Think throws, or whose factory throws making it, is switched off for that item with a note, as a brain that throws is: the weapon stays in hand doing nothing, keeping what it last set, until a new one is given. A Holster that throws is noted and the switch goes on. Each kind of throw is noted once.
public sealed class Torch : IWeaponBehaviour
{
public void Think(IWeaponHolder holder)
{
holder.Beam = holder.Held.HasFlag(WeaponButtons.Attack)
? WeaponBeam.At(holder.Trace(holder.Eye, Far(holder)).End)
: null;
}
public void Holster(IWeaponHolder holder)
{
holder.Beam = null;
}
}
- Assembly
- EvilEngine.Api
- Commit
- 4ff877b1