CounterStrikeSharp icon indicating copy to clipboard operation
CounterStrikeSharp copied to clipboard

Implementing EntityKeyValues

Open KillStr3aK opened this issue 1 year ago • 8 comments

Mostly based on #440 by @Yarukon

Implemented CEntityKeyValues, can be used like:

CDynamicProp? prop = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");

if (prop != null)
{
    CEntityKeyValues keyValues = new CEntityKeyValues();

    keyValues.SetBool("my_bool", true);
    keyValues.SetEHandle("player_handle", player.EntityHandle);
    keyValues.SetVector("vector", new Vector(15.0f, 250.0f, 300.0f));
        
    prop.DispatchSpawn(keyValues);
}

This is also possible:

CDynamicProp? prop = Utilities.CreateEntityByName<CDynamicProp>("prop_dynamic");

if (prop != null)
{
    CEntityKeyValues keyValues = new CEntityKeyValues();

    keyValues["my_bool", KeyValuesType.TYPE_BOOL] = true;
        
    prop.DispatchSpawn(keyValues);
}

Also implemented some of the math related classes minimally, however: we need #613 in order to prevent memory leaks related to them. (changes needed later on if this one gets merged earlier, or I can make the adjustments on this if 613 is merged.)

KillStr3aK avatar Oct 08 '24 05:10 KillStr3aK

Would be nice to have this released, otherwise prop_ragdoll bugs with velocity without setting pos before dispatchspawn

Prefix avatar Jan 08 '25 12:01 Prefix

I have tested this specific PR on Linux and it's working fine.

oylsister avatar Jan 27 '25 14:01 oylsister

Any update on this? :)

P250 avatar Apr 03 '25 21:04 P250

Is there any update on this? :) would love to have it merged if possible.

derkalle4 avatar Jun 15 '25 16:06 derkalle4

Any updates on this PR? Would be great to have this merged.

MarkKuiper-Infra avatar Jul 28 '25 10:07 MarkKuiper-Infra

Please, give any information about it @KillStr3aK

TomaszPobierski avatar Sep 02 '25 10:09 TomaszPobierski

Any update on this? :)

Is there any update on this? :) would love to have it merged if possible.

Please, give any information about it @KillStr3aK

other than the conflicts with the main branch the pr is ready, and it does not depend on #613 , but it would just bring even more leaks to the table. I did not look for a solution since that as I'm busy these days but the main implementation is here if someone finds a solution for the leak issues faster than I do

KillStr3aK avatar Sep 02 '25 10:09 KillStr3aK

https://github.com/roflmuffin/CounterStrikeSharp/pull/1090

oscar-wos avatar Oct 27 '25 17:10 oscar-wos

A variation of this has been merged in #1146 and released in v1.0.351

roflmuffin avatar Dec 15 '25 06:12 roflmuffin