That is indeed a cool idea, well done!
L'In20Cible wrote:That said, you know me... here are some points:
I would expect nothing less.
: That method isn't static, so this should rather be:
Syntax: Select all
player.view_angle.get_angle_vectors(None, right, None)
Oh that's nice.
: Since your PlayerCF
class makes use of the internal caching, you don't really need that dictionary. It is rather redundant, since the instances are already stored into PlayerCF.cache
so you could simply do the following to retrieve cached instances:
Syntax: Select all
player = PlayerCF(index)
player = PlayerCF.from_inthandle(index)
It's like a bad habit. Whenever I start working on a new project, the first thing I do is create dictionaries for players/entities/weapons. I completely forgot about internal caching.
: Should not the start be the flash position towards where it is going? Actually, the flash does an S instead of a C as illustrated in the following picture:
You can see it first does a curve to reach the player's view vector which looks quite weird to me.
I wouldn't say the trajectory is an S, more like a wider/stretched C. I did this
to give the player an easier way to get their pop flash right - by aiming at the corner itself and not away from it. It also gives the flashbang more breathing room when the player is really close or even touching the wall, as can be seen here:
It is used when the player inspects
their weapon, to check if they're holding a flashbang. But now that I've been reminded about internal caching, I guess I could use the Weapon class. Or even better - player.active_weapon
: Instead of looking that every think, wouldn't it be better to just externally listen for the bounce event patiently waiting for the engine to let you know? This sure sound more optimized to me.
I was trying to avoid using an EntityHook, as the bounce event doesn't provide the index of the projectile. Seeing as _think() will get called a maximum of 5 times per flashbang, I didn't think there would be much of an impact on performance. Although I might hook CFlashbangProjectile::BounceSound()
and use that instead.
Another bad habit of mine.
: Should rather use an entity delay. Otherwise, if a plugin does Entity.create('weapon_flashbang').remove()
your callbacks will be working with an invalid index.
I'm checking if the flashbang has an owner
before notifying the OnFlashbangCreated listener. If a plugin does the quick create().remove() thing, the flashbang will have an invalid owner inthandle (-1).
Awesome! I haven't played around with translations yet - guess it's time to do some learning.
: I don't thin hard-coding the animation index is a good idea. While this is true for the default model, it can be different for custom ones. You should rather look into the studio
package to extract it from its name.
Haven't used that package at all, I'll check it out.
: That is certainly a property we could add to the Player
class (though, as an Entity
, rather than BaseEntity
). Feel free to make a PR.
Seeing as I'm beyond rusty with C++, I could add it to the Player class. Although I think it'd be better if someone added it to PlayerMixin instead.
Thank you for the pointers, L'In20Cible.