Skip to content

Commit f9e63ff

Browse files
committed
Fixed issue #163
Updated documentation.
1 parent a086d1c commit f9e63ff

File tree

1 file changed

+35
-8
lines changed
  • addons/source-python/packages/source-python/weapons

1 file changed

+35
-8
lines changed

addons/source-python/packages/source-python/weapons/instance.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,38 @@ def __init__(self, name, basename, properties):
4848

4949
@property
5050
def name(self):
51-
"""Return the classname of the weapon."""
51+
"""Return the entity classname of the weapon (e.g. 'weapon_knife').
52+
53+
:rtype: str
54+
"""
5255
return self._name
5356

5457
@property
5558
def basename(self):
56-
"""Return the basename of the weapon."""
59+
"""Return the basename of the weapon (e.g. 'knife').
60+
61+
:rtype: str
62+
"""
5763
return self._basename
5864

5965
@property
6066
def slot(self):
61-
"""Return the slot of the weapon."""
67+
"""Return the slot of the weapon.
68+
69+
:rtype: int
70+
"""
6271
return self._slot
6372

6473
@property
6574
def maxammo(self):
66-
"""Return the maxammo amount for the weapon."""
75+
"""Return the maxammo amount for the weapon.
76+
77+
:return:
78+
None if the weapon doesn't have ammo.
79+
:rtype: int
80+
"""
6781
# Is the stored maxammo an integer?
68-
if isinstance(self._maxammo, int):
82+
if self._maxammo is None or isinstance(self._maxammo, int):
6983

7084
# Return the value
7185
return self._maxammo
@@ -75,15 +89,28 @@ def maxammo(self):
7589

7690
@property
7791
def ammoprop(self):
78-
"""Return the ammoprop of the weapon."""
92+
"""Return the ammoprop of the weapon.
93+
94+
:return:
95+
None if the weapon doesn't have ammo.
96+
:rtype: int
97+
"""
7998
return self._ammoprop
8099

81100
@property
82101
def clip(self):
83-
"""Return the clip value of the weapon."""
102+
"""Return the clip value of the weapon.
103+
104+
:return:
105+
None if the weapon doesn't have ammo.
106+
:rtype: int
107+
"""
84108
return self._clip
85109

86110
@property
87111
def tags(self):
88-
"""Return the tags of the weapon."""
112+
"""Return the tags of the weapon.
113+
114+
:rtype: list
115+
"""
89116
return self._tags

0 commit comments

Comments
 (0)