TeamSpen210 / HammerAddons

Useful tweaks and content for Source Engine Games
123 stars 36 forks source link

paint_sphere auto trigger keyvalue #259

Open vrad-exe opened 8 months ago

vrad-exe commented 8 months ago

Given that paint_sphere is most often used to apply paint at the start of a map, it'd be nice to have the ability to make it trigger automatically on map load instead of requiring a logic_auto input. This would be a bit tricky to implement though since it'd generally require giving the entities names to target them with I/O, but then that might conflict with user set names, etc...

One solution could be setting the entity's teamnum to a specific value in the postcompiler, then adding a VScript to the map which loops over all paint_spheres and activates ones with a matching team. That could still conflict with user specified team numbers but is a lot less likely because...why would users be setting team numbers on paint_spheres manually? Response contexts could work for this too, but there's no way to access those directly through VScript, so it'd require adding an extra filter entity and using I/O.

Alternatively, since features added by HammerAddons are more clearly labeled now, you could just make it based on targetnames and warn the user that if they have multiple paint_spheres with the same name, setting auto trigger on one of them will make all of them fire.

TeamSpen210 commented 8 months ago

It'd make most sense to do it by targetnames. Just include in the description that the targetname will be changed so it's not usable directly. Another solution would be to give them all entity scripts, which fire the output and then self-destruct. A third would be to just remove the entities entirely - have a single paint_sphere for each paint type, then store off the positions in a VScript, have it teleport itself to each spot before painting.

vrad-exe commented 8 months ago

Oh another thing to note for this, I remember once noticing that in multiplayer you can't apply gel before the first player has spawned in. You probably want to add a VScript think function which will check for a player entity existing before firing the inputs.