Skip to content

Conversation

@roflmuffin
Copy link
Owner

@roflmuffin roflmuffin commented Dec 14, 2025

Example from the tests:

var light = Utilities.CreateEntityByName<CBarnLight>("light_barn")!;
using var kv = new CEntityKeyValues();

kv.SetColor("color", Color.BlanchedAlmond);
kv.SetFloat("brightness", 750.0f);
kv.SetBool("enabled", true);
kv.SetVector("size_params", new Vector(60.0f, 120.0f, 0.05f));
kv.SetInt("directlight", 3);
light.DispatchSpawn(kv);

Assert.Equal(750.0f, light.Brightness);
Assert.Equal(Color.BlanchedAlmond.ToArgb(), light.Color.ToArgb());
Assert.True(light.Enabled);
Assert.Equal(60.0f, light.SizeParams.X);
Assert.Equal(120.0f, light.SizeParams.Y);
Assert.Equal(0.05f, light.SizeParams.Z);
Assert.Equal(3, light.DirectLight);

light.Remove();

This will no doubt lead to more memory leaks if you are creating Vector3, Quaternion etc. to pass into key values; but this will be resolved in the v2 branch once I bring these changes forward (and everything becomes struct based).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants