Page 1 of 1

entity condition hook for multiple names ?

Posted: Wed Jul 01, 2020 8:48 pm
by Speed0x
can i use EntityPreHook with EntityCondition wihin a single decorater but with multiple classnames ?

like

Code: Select all

listofnames = ["name1","name2"]
@EntityPreHook(EntityCondition.equals_entity_classname(listofnames), 'detonate')


but when i use:

Code: Select all

@EntityPreHook(EntityCondition.equals_entity_classname(*listofnames), 'detonate')


to try and achieve that, it will construct the hook only for the first paramter it compares and receives for the hook? is this intended or a bug ? all other values in listofnames will be ignored in the prehook

Re: entity condition hook for multiple names ?

Posted: Wed Jul 01, 2020 9:25 pm
by L'In20Cible
Intended behaviour. Once the condition evaluated to True once, the hook is registered on that entity and the searches are done. If you want to have multiple hooks for the same callback, then you have to decorate it multiple times. For example: https://github.com/Source-Python-Dev-Te ... #L381-L389