copying entities

Please post any questions about developing your plugin here. Please use the search function before posting!
Speed0x
Member
Posts: 84
Joined: Sun Feb 05, 2017 4:55 pm

copying entities

Postby Speed0x » Wed Nov 22, 2017 12:32 am

is there a fast way for copying entities/tempentities? (creating multiple entities with same properties at once)
or is the normal initiation as multiple python vars via Entitiy()/Tempentity() the fastest way?

example code :

Syntax: Select all

entity_dict = {}
for i in range(1,25):
entity_dict[i] = Entitiy("prop_dynamic")

(can it be done faster? im thinking of some memory trick, although the server probably needs to initiate each object anyway..so a quick confirmation, that is isnt possible, would be enough to help.)

thanks!
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: copying entities

Postby Ayuto » Wed Nov 22, 2017 6:53 am

BaseEntity is much faster than Entity, but doesn't provide all the convenience methods. TempEntity instance can be created with all the shared properties and then before sending/creating it, you set all the specific properties. That way you only need to create a few instances.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 39 guests