pub enum WeaponError {
Show 16 variants
Attribute(AttributeError),
CreationFailed,
CreationFailedNative(ItemGenerationError),
DifferentOwner,
Interface(InterfaceError),
InvalidClip {
clip: c_int,
max: c_int,
},
MarkedForDeletion,
MissingOrigin,
NetProp(NetPropError),
NoClip,
NotTfPlayer,
NotWeapon,
Rejected,
SlotOccupied,
UnsupportedLayout,
WrongSlot,
}tf2 only.Expand description
Why a weapon or inventory operation failed.
Variants§
Attribute(AttributeError)
Reading the weapon’s attributes failed, or
PlayerWeapons::give_item_with could not apply its attributes.
CreationFailed
GiveNamedItem returned no entity (for example, because the player
already has that weapon type), or a classname override produced an
entity of another classname.
CreationFailedNative(ItemGenerationError)
Native item generation, used by give_item and its variants, failed,
as the ItemGenerationError tells.
DifferentOwner
The weapon’s combat owner is not this player: another entity owns it,
or PlayerWeapons::detach was given an unowned weapon.
Interface(InterfaceError)
A required engine interface is unavailable.
InvalidClip
Weapon::set_clip was given a count outside 0 to the weapon’s max.
MarkedForDeletion
The player or weapon is already marked for deletion.
MissingOrigin
The player’s position, needed to spawn an economy item, is unavailable.
NetProp(NetPropError)
The player’s weapons, which PlayerWeapons::active and
PlayerWeapons::all read from its networked variables, could not
be read.
NoClip
The weapon has no clip, as melee weapons and miniguns, or counts its shots in energy.
NotTfPlayer
The entity is not a TF2 player, or the server does not run TF2.
NotWeapon
The entity is not a TF2 weapon (for example, it is a cosmetic), or the server does not run TF2.
Rejected
The game did not complete a detach or equip: RemovePlayerItem refused
the weapon, or it did not end up in its slot with this player as its
combat owner. A refused equip may still have set the weapon’s owner.
SlotOccupied
The weapon’s native slot already holds another weapon.
UnsupportedLayout
The weapon’s datamap lacks a usable m_hOwner field, or, for
Weapon::clip and Weapon::set_clip, a usable m_iClip1 field,
or, for Weapon::definition, its networked variables do not place its
item definition index where the SDK’s layout does.
WrongSlot
A replacement’s native slot is not the requested slot, or a new weapon’s slot number is outside 0..=255, the range creation tracks.
Trait Implementations§
Source§impl Debug for WeaponError
impl Debug for WeaponError
Source§impl Display for WeaponError
impl Display for WeaponError
Source§impl Error for WeaponError
impl Error for WeaponError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()