Export ITempEntsSystem

Discuss API design here.
InvisibleSoldiers
Senior Member
Posts: 114
Joined: Fri Mar 15, 2019 6:08 am

Export ITempEntsSystem

Postby InvisibleSoldiers » Fri Jun 05, 2020 5:12 am

ITempEntsSystem is more convenient way to send temp entities. It uses internal cache for them and just reassign the base properties.

Syntax: Select all

ITempEntsSystem : public IPredictionSystem
{
public:
virtual void ArmorRicochet( IRecipientFilter& filer, float delay,
const Vector* pos, const Vector* dir ) = 0;
virtual void BeamEntPoint( IRecipientFilter& filer, float delay,
int nStartEntity, const Vector *start, int nEndEntity, const Vector* end,
int modelindex, int haloindex, int startframe, int framerate,
float life, float width, float endWidth, int fadeLength, float amplitude,
int r, int g, int b, int a, int speed ) = 0;
virtual void BeamEnts( IRecipientFilter& filer, float delay,
int start, int end, int modelindex, int haloindex, int startframe, int framerate,
float life, float width, float endWidth, int fadeLength, float amplitude,
int r, int g, int b, int a, int speed ) = 0;
virtual void BeamFollow( IRecipientFilter& filter, float delay,
int iEntIndex, int modelIndex, int haloIndex, float life, float width, float endWidth,
float fadeLength, float r, float g, float b, float a ) = 0;
virtual void BeamPoints( IRecipientFilter& filer, float delay,
const Vector* start, const Vector* end, int modelindex, int haloindex, int startframe, int framerate,
float life, float width, float endWidth, int fadeLength, float amplitude,
int r, int g, int b, int a, int speed ) = 0;
...


So, we can simply call:

Syntax: Select all

te_system.beam_points(filter, delay, start, end ...)
User avatar
Ayuto
Project Leader
Posts: 2197
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Export ITempEntsSystem

Postby Ayuto » Tue Jun 09, 2020 8:12 am

A few years ago we already had exposed that class:
https://github.com/Source-Python-Dev-Te ... dL132-L171

I'm not fully sure anymore why we replaced it with the new system, but IIRC ITempEntsSystem doesn't set all effect properties. Thus, some effects were not working correctly in some games. With the new system we have access to all properties and effect hooks. I think some wrapper functions in Python with default values would be a good addition to the current system. Then, you are able to create effects with minimal effort:

Syntax: Select all

from effects import beam_points

# Create a simple red (?) beam for all users?
beam_points(<start>, <end>)

# Create a simple blue beam for all users?
beam_points(<start>, <end>, red=0, blue=255)

# Create a simple red beam for specific users?
beam_points(<start>, <end>, filter=<RecipientFilter>)

# Question:
# Should we accept a color parameter (from colors import Color) instead of red, green, blue, alpha?
User avatar
L'In20Cible
Project Leader
Posts: 1534
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Export ITempEntsSystem

Postby L'In20Cible » Thu Jun 11, 2020 11:56 am

Ayuto wrote:I'm not fully sure anymore why we replaced it with the new system, but IIRC ITempEntsSystem doesn't set all effect properties.

Yes, some wrappers are not accepting all parameters (such as models, that are hard-coded and globalized in the engine) but also that interface, its prototypes along with the other structures it requires (CEffectData, etc.) are outdated and not maintained. Keeping it would have required us to patch the SDKs in order to have limited and incomplete wrappers that requires extra signatures to keep up-to-date; wasn't worth the effort at the time and still doesn't today.

Ayuto wrote:I think some wrapper functions in Python with default values would be a good addition to the current system.
I would rather prefer TempEntity's subclasses with default values over wrapper functions. The later would requires us to either re-assign all the properties or instantiate new instances every calls which goes against their current isolated design.

Return to “API Design”

Who is online

Users browsing this forum: No registered users and 1 guest