advantages of !self?

EmNudge

L4: Comfortable Member
Sep 23, 2015
184
60
In the output of an entity, is there any advantages of using !self over selecting the entity you're using.

i.e. is
My Output Named: OnPressed
Target Entities Named: my_button
Via This Input: Disable
any worse than
My Output Named: OnPressed
Target Entities Named: !self
Via This Input: Disable
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
I use this for deathrun buttons.
All my buttons are named the same, so I can easily kill them all at once. But to disable just one I use !self.
You can also use this to disable an entity without giving it a name.
 

EmNudge

L4: Comfortable Member
Sep 23, 2015
184
60
I use this for deathrun buttons.
All my buttons are named the same, so I can easily kill them all at once. But to disable just one I use !self.
You can also use this to disable an entity without giving it a name.
oh I see, no advantages code or optimization wise, just better for unnamed or buttons with same names.

btw, I usually make each button let's say "button_deaththing_01" and then trigger all the buttons related to the death thing by calling on "button_deaththing_*" which, as you know, triggers all entities with button_deaththing_ at the start of their name
 

wiseguy149

Emperor of Entities and Amateur of Aesthetics
May 12, 2009
103
220
All of the advantages of using !self are purely for the convenience of the mapper and make no difference in terms of how stuff actually runs.


If you're going to rename your entity at any point, and you have an output that targets itself, you'd also have to rename that output. Or, if you use !self, you don't have to.

If you have multiple entities with the same name (because you don't feel like using wildcards to target multiple entities at once) but you still want one entity to have an output that targets only itself instead of everything with it's name, you can use !self.

If you don't want to name an entity at all, you can use !self.


As a personal rule, I always use !self instead of having an entity target its own name. It usually saves me time, since I wind up renaming and duplicating my entities a lot. It's just more convenient.
 

henke37

aa
Sep 23, 2011
2,075
515
!self should also be useful for templated setups.
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,258
999
!self is cleaner, as it helps keep your logic entities modular. You can safely change the names of entities, or remove some of them, and they will still work. Just like !activator works for whatever triggers your logic, you don't have to pre-name any entity that does so it saves some effort. And also if you duplicate an entity, its logic is self-contained.

It also helps to keep your entity data block down if you don't name entities.