entity condition hook for multiple names ?

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

entity condition hook for multiple names ?

Postby Speed0x » Wed Jul 01, 2020 8:48 pm

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
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: entity condition hook for multiple names ?

Postby L'In20Cible » Wed Jul 01, 2020 9:25 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 25 guests