A little es help
Posted: Thu Oct 11, 2018 1:48 pm
Kami wrote this script in es and for the most part is works (crashes the server on maps with many entitys) could someone look at at
and remove the collision vector and maybe tweak anything else they may think will help , I don't mind the func_breakable (windows) having two layers
it is the func_doors (lifts) func_door_rotating (doors) and the prop_physics (all) thanks
and remove the collision vector and maybe tweak anything else they may think will help , I don't mind the func_breakable (windows) having two layers
it is the func_doors (lifts) func_door_rotating (doors) and the prop_physics (all) thanks
Code: Select all
import es
import corelib
import gamethread
ent_dict = {}
remove_list = {}
def es_map_start(ev):
gamethread.delayed(1.0,do_it)
def do_it():
#Put all entities in a dictionary and assign the location to its index. Structure: Classname -> Index -> Location
remove_list = {}
ents = es.createentitylist()
for ent in ents:
class_name = ents[ent]['classname']
if class_name not in ent_dict:
ent_dict[class_name] = {}
loc = es.getindexprop(ent, 'CBaseEntity.m_vecOrigin')
if str(loc) == "0.000000,0.000000,0.000000":
loc = es.getindexprop(ent, 'CBaseEntity.m_Collision.m_vecMins')
ent_dict[class_name][ent] = loc
#Put entities in the remove_list only if the location is not used yet.
for class_name in ent_dict:
#ent_dict[class_name] = entity index
#Check if the class_name was assigned to the remove_list before
if class_name not in remove_list:
#If not, assign it an empty dictionary to keep all entities with the same name but with different location
remove_list[class_name] = []
#Loop through all the locations for that given classname
for loc in ent_dict[class_name]:
#If the location is not in the remove_dict already add it, if it is, remove the entity
if ent_dict[class_name][loc] not in remove_list[class_name]:
remove_list[class_name].append(ent_dict[class_name][loc])
else:
if str(ent_dict[class_name][loc]) != "0.000000,0.000000,0.000000":
es.remove(loc)