File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed
addons/source-python/packages/source-python/entities
src/core/modules/entities Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ def get_model(self):
289
289
def set_model (self , model ):
290
290
"""Set the entity's model to the given model."""
291
291
self .model_index = model .index
292
- self .set_key_value_string ( 'model' , model .path )
292
+ self .model_name = model .path
293
293
294
294
model = property (
295
295
get_model , set_model ,
Original file line number Diff line number Diff line change 43
43
#include " entities_entity.h"
44
44
45
45
46
+ // -----------------------------------------------------------------------------
47
+ // IServerEntity extension class.
48
+ // -----------------------------------------------------------------------------
49
+ class ServerEntityExt
50
+ {
51
+ public:
52
+ static void SetModelName (IServerEntity *pServerEntity, const char *szModelName)
53
+ {
54
+ CBaseEntity *pBaseEntity = pServerEntity->GetBaseEntity ();
55
+ if (!pBaseEntity)
56
+ BOOST_RAISE_EXCEPTION (PyExc_ValueError, " BaseEntity is NULL." );
57
+
58
+ ((CBaseEntityWrapper *)pBaseEntity)->SetKeyValue (" model" , szModelName);
59
+ }
60
+ };
61
+
62
+
46
63
// -----------------------------------------------------------------------------
47
64
// CTakeDamageInfo wrapper class.
48
65
// -----------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -206,6 +206,7 @@ void export_server_entity(scope _entities)
206
206
207
207
.add_property (" model_name" ,
208
208
&IServerEntity::GetModelName,
209
+ &ServerEntityExt::SetModelName,
209
210
" Returns the name of the model this entity is using."
210
211
)
211
212
You can’t perform that action at this time.
0 commit comments