Add: [Script] Framework for cloning selected ScriptObject

This commit is contained in:
glx22
2025-05-26 18:47:50 +02:00
committed by Loïc Guilloux
parent 7dcc932d44
commit 7200e7f509
3 changed files with 41 additions and 16 deletions
+16
View File
@@ -105,6 +105,12 @@ protected:
*/
virtual bool LoadObject(HSQUIRRELVM) { return false; }
/**
* Clone an object.
* @return The clone if cloning this type is supported, nullptr otherwise.
*/
virtual ScriptObject *CloneObject() { return nullptr; }
public:
/**
* Store the latest result of a DoCommand per company.
@@ -136,6 +142,16 @@ public:
*/
static void InitializeRandomizers();
/**
* Used when trying to instanciate ScriptObject from squirrel.
*/
static SQInteger Constructor(HSQUIRRELVM);
/**
* Used for 'clone' from squirrel.
*/
static SQInteger _cloned(HSQUIRRELVM);
protected:
template <Commands TCmd, typename T> struct ScriptDoCommandHelper;