rehlds / ReAPI

AMXModX module providing APIs for ReHLDS, ReGameDLL, and Metamod plugins (e.g., ReUnion, ReVoice).
GNU General Public License v3.0
160 stars 105 forks source link

[Request] Set entity rendering native. #34

Closed lespaul64 closed 7 years ago

lespaul64 commented 7 years ago

This function is used on most servers, it would be good if it include in reapi too.

From engine module: https://github.com/alliedmodders/amxmodx/blob/master/modules/engine/entity.cpp#L1531

theAsmodai commented 7 years ago

You can use set_entvar for work with rendering.

lespaul64 commented 7 years ago

@theAsmodai That would need to call amxx native set_entvar 4x.

with this, we can call 1 amxx native only:

static cell AMX_NATIVE_CALL set_ent_rendering(AMX *amx, cell *params) // set_ent_rendering(index, fx = kRenderFxNone, r = 0, g = 0, b = 0, render = kRenderNormal, amount = 0); = 7 arguments
{
    // params[1] = index
    // params[2] = fx
    // params[3] = r
    // params[4] = g
    // params[5] = b
    // params[6] = render
    // params[7] = amount

    CHECK_ENTITY_SIMPLE(params[1]);

    edict_t *pEntity = TypeConversion.id_to_edict(params[1]);

    pEntity->v.renderfx = params[2];
    pEntity->v.rendercolor = Vector(float(params[3]), float(params[4]), float(params[5]));
    pEntity->v.rendermode = params[6];
    pEntity->v.renderamt = float(params[7]);

    return 1;
}

It's okay if don't want add in reApi, but not all server use engine module.

theAsmodai commented 7 years ago

I think it's a rarely used native.

lespaul64 commented 7 years ago

Well it's okay then. I have to create a stock for this.