Engine icon indicating copy to clipboard operation
Engine copied to clipboard

Feature: Object Cloning

Open HugoBDesigner opened this issue 2 months ago • 0 comments

Which component should be improved?

Scripting

Describe your feature suggestion in more detail

Source Objects (basically anything under CBaseEntity should have a ::Clone() function. This function would create a new entity, with a new handle and a new entity index, but whose every other property – from keyvalues to spawnflags to script scopes to I/O – is identical to the base entity.

It is currently somewhat possible to create new entities (such as with CreateEntityByName), but it is not possible to accurately apply all of the properties of the base object, both due to entity spawning limitations and due to entity data access (or lack thereof).

With the Clone method, you could potentially specify, just like in CreateEntityByName, specific keyvalues that would be changed from the source object. You could also set up its initial position, velocity, and other properties, either directly through the Clone function or after the fact through the returning handle.

HugoBDesigner avatar Oct 27 '25 01:10 HugoBDesigner