Added additional build time arguments ess_entity_base_class and ess_entity_base_class_include. It does not work too well, it is going to be reverted, but I want to save the code in case it's needed later.

This commit is contained in:
Relintai 2022-02-21 01:36:34 +01:00
parent fd8c1af154
commit c26a47273b
3 changed files with 30 additions and 5 deletions

4
SCsub
View File

@ -4,6 +4,10 @@ Import('env')
module_env = env.Clone()
if "ess_entity_base_class" in module_env:
module_env.Append(CPPDEFINES=[('ESS_ENTITY_BASE_CLASS', module_env["ess_entity_base_class"])])
module_env.Append(CPPDEFINES=[('ESS_ENTITY_BASE_CLASS_INCLUDE', module_env["ess_entity_base_class_include"])])
if os.path.isdir('../mesh_data_resource'):
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])

View File

@ -5,7 +5,14 @@ def can_build(env, platform):
def configure(env):
pass
from SCons.Script import Variables, Help
envvars = Variables()
envvars.Add("ess_entity_base_class", "What class Entity should inherit from. Default is Node.")
envvars.Add("ess_entity_base_class_include", "What The include for that class. Default is scene/main/node.h")
envvars.Update(env)
Help(envvars.GenerateHelpText(env))
def get_doc_classes():

View File

@ -37,8 +37,6 @@ SOFTWARE.
#include "core/io/networked_multiplayer_peer.h"
#include "scene/main/node.h"
#include "../data/items/craft_recipe.h"
#include "../data/items/item_instance.h"
#include "../data/spells/spell.h"
@ -69,6 +67,22 @@ SOFTWARE.
#include spatial_h_path
#ifndef ESS_ENTITY_BASE_CLASS
// By default Entity inherits from Node
#define ENTITY_BASE_CLASS Node
#include "scene/main/node.h"
#else
// We turn the ESS_ENTITY_BASE_CLASS define into a text replace macro
#define ENTITY_BASE_CLASS ESS_ENTITY_BASE_CLASS
// Abuse pre-processor macros to quote what's inside the ESS_ENTITY_BASE_CLASS_INCLUDE define
#define _ENTITY_BASE_CLASS_QUOTE(x) #x
#define _ENTITY_BASE_CLASS_QUOTE_H(x) _ENTITY_BASE_CLASS_QUOTE(x)
#include _ENTITY_BASE_CLASS_QUOTE_H(ESS_ENTITY_BASE_CLASS_INCLUDE)
#endif
class EntityData;
class AuraData;
class Spell;
@ -236,8 +250,8 @@ struct EntityStat {
} \
variable = value;
class Entity : public Node {
GDCLASS(Entity, Node);
class Entity : public ENTITY_BASE_CLASS {
GDCLASS(Entity, ENTITY_BASE_CLASS);
public:
//// Base ////