weapons.entity module

Provides simplified weapon functionality.

class weapons.entity.Weapon(index, caching=True)[source]

Bases: _weapons._entity.WeaponMixin, entities._base.Entity

Allows easy usage of the weapon’s attributes.

__init__(index, caching=True)[source]

Initialize the object.

Parameters:
  • index (int) – A valid weapon index.
  • caching (bool) – Whether to lookup the cache for an existing instance or not.
Raises:

ValueError – Raised if the index is invalid.

get_ammo()[source]

Return the amount of ammo the player has for the weapon.

get_clip()[source]

Return the amount of ammo in the weapon’s clip.

get_secondary_fire_ammo()[source]

Return the secondary fire ammo the player has for the weapon.

get_secondary_fire_clip()[source]

Return the amount of ammo in the weapon’s secondary fire clip.

remove()[source]

Remove the weapon.

set_ammo(value)[source]

Set the player’s ammo property for the weapon.

set_clip(value)[source]

Set the amount of ammo in the weapon’s clip.

set_secondary_fire_ammo(value)[source]

Set the player’s secondary fire ammo property for the weapon.

set_secondary_fire_clip(value)[source]

Set the amount of ammo in the weapon’s secondary fire clip.

ammo

Property to get/set the weapon’s ammo.

clip

Property to get/set the weapon’s clip.

secondary_fire_ammo

Property to get/set the weapon’s secondary fire ammo.

secondary_fire_clip

Property to get/set the weapon’s secondary fire clip.

weapon_name

Return the full class name of the weapon.