@@ -96,7 +96,7 @@ def iterator():
96
96
# =============================================================================
97
97
# >> WEAPON TAG CLASSES
98
98
# =============================================================================
99
- class __WeaponTagsInstance (dict ):
99
+ class _WeaponTags (dict ):
100
100
'''Class used to store weapon tags for the current game'''
101
101
102
102
def __missing__ (self , item ):
@@ -108,8 +108,8 @@ def __missing__(self, item):
108
108
# Return the instance
109
109
return instance
110
110
111
- # Get the __WeaponTagsInstance instance
112
- _WeaponTagsInstance = __WeaponTagsInstance ()
111
+ # Get the _WeaponTags instance
112
+ _WeaponTagsInstance = _WeaponTags ()
113
113
114
114
115
115
class _Tag (object ):
@@ -147,13 +147,8 @@ def _class_weapon_contains_tag(self, weapon):
147
147
148
148
149
149
# =============================================================================
150
- # >> WEAPON EDICT RETURN TYPE FUNCTIONS
150
+ # >> WEAPON EDICT RETURN TYPES
151
151
# =============================================================================
152
- def _return_edict (edict ):
153
- '''Returns the weapon's edict'''
154
- return edict
155
-
156
-
157
152
def _return_instance (edict ):
158
153
'''Returns the weapon's BaseEntity instance'''
159
154
from entities .entity import BaseEntity
@@ -167,63 +162,29 @@ def _return_instance(edict):
167
162
'inthandle' , inthandle_from_edict )
168
163
_WeaponEdictIterManagerInstance .register_return_type (
169
164
'pointer' , pointer_from_edict )
170
- _WeaponEdictIterManagerInstance .register_return_type ('edict' , _return_edict )
165
+ _WeaponEdictIterManagerInstance .register_return_type (
166
+ 'edict' , lambda edict : edict )
171
167
_WeaponEdictIterManagerInstance .register_return_type (
172
168
'weapon' , _return_instance )
173
169
174
170
175
171
# =============================================================================
176
- # >> WEAPON CLASS RETURN TYPE FUNCTIONS
172
+ # >> WEAPON CLASS RETURN TYPES
177
173
# =============================================================================
178
- def _return_weapon (weapon ):
179
- '''Returns the weapon type's WeaponManager item'''
180
- return weapon
181
-
182
-
183
- def _return_classname (weapon ):
184
- '''Returns the weapon type's classname'''
185
- return weapon .name
186
-
187
-
188
- def _return_basename (weapon ):
189
- '''Returns the weapon type's basename'''
190
- return weapon .basename
191
-
192
-
193
- def _return_slot (weapon ):
194
- '''Returns the weapon type's slot'''
195
- return weapon .slot
196
-
197
-
198
- def _return_maxammo (weapon ):
199
- '''Returns the weapon type's maxammo'''
200
- return weapon .maxammo
201
-
202
-
203
- def _return_ammoprop (weapon ):
204
- '''Returns the weapon type's ammoprop'''
205
- return weapon .ammoprop
206
-
207
-
208
- def _return_clip (weapon ):
209
- '''Returns the weapon type's clip'''
210
- return weapon .clip
211
-
212
-
213
- def _return_tags (weapon ):
214
- '''Returns the weapon type's tags'''
215
- return weapon .tags
216
-
217
174
# Register the return type functions
218
- _WeaponClassIterManagerInstance .register_return_type ('weapon' , _return_weapon )
219
175
_WeaponClassIterManagerInstance .register_return_type (
220
- 'classname' , _return_classname )
176
+ 'weapon' , lambda weapon : weapon )
177
+ _WeaponClassIterManagerInstance .register_return_type (
178
+ 'classname' , lambda weapon : weapon .name )
179
+ _WeaponClassIterManagerInstance .register_return_type (
180
+ 'basename' , lambda weapon : weapon .basename )
181
+ _WeaponClassIterManagerInstance .register_return_type (
182
+ 'slot' , lambda weapon : weapon .slot )
183
+ _WeaponClassIterManagerInstance .register_return_type (
184
+ 'maxammo' , lambda weapon : weapon .maxammo )
221
185
_WeaponClassIterManagerInstance .register_return_type (
222
- 'basename' , _return_basename )
223
- _WeaponClassIterManagerInstance .register_return_type ('slot' , _return_slot )
186
+ 'ammoprop' , lambda weapon : weapon .ammoprop )
224
187
_WeaponClassIterManagerInstance .register_return_type (
225
- 'maxammo ' , _return_maxammo )
188
+ 'clip ' , lambda weapon : weapon . clip )
226
189
_WeaponClassIterManagerInstance .register_return_type (
227
- 'ammoprop' , _return_ammoprop )
228
- _WeaponClassIterManagerInstance .register_return_type ('clip' , _return_clip )
229
- _WeaponClassIterManagerInstance .register_return_type ('tags' , _return_tags )
190
+ 'tags' , lambda weapon : weapon .tags )
0 commit comments