Added 3 new helper classes for the entity spell system. ESSEntityWorldSpawner3D, ESSEntityWorldSpawner3DSingle, ESSEntityWorldSpawner2D.

This commit is contained in:
Relintai 2025-04-13 18:54:12 +02:00
parent 570bcaee0f
commit 26c53fd16d
12 changed files with 429 additions and 1 deletions

View File

@ -116,7 +116,11 @@ sources = [
"props/prop_data_entity.cpp",
"material_cache/ess_material_cache.cpp"
"material_cache/ess_material_cache.cpp",
"world_spawners/ess_entity_world_spawner_2d.cpp",
"world_spawners/ess_entity_world_spawner_3d_single.cpp",
"world_spawners/ess_entity_world_spawner_3d.cpp",
]
if env["module_texture_packer_enabled"]:

View File

@ -105,6 +105,10 @@ def get_doc_classes():
"ESSMaterialCache",
"ESSMaterialCachePCM",
"ESSEntityWorldSpawner3D",
"ESSEntityWorldSpawner3DSingle",
"ESSEntityWorldSpawner2D",
]
def get_doc_path():

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ESSEntityWorldSpawner2D" inherits="Node2D">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_spawn" qualifiers="virtual">
<return type="void" />
<description>
</description>
</method>
<method name="emit_on_entity_spawned">
<return type="void" />
<argument index="0" name="info" type="EntityCreateInfo" />
<description>
</description>
</method>
<method name="spawn">
<return type="void" />
<description>
</description>
</method>
</methods>
<signals>
<signal name="emit_on_entity_spawned">
<argument index="0" name="info" type="EntityCreateInfo" />
<description>
</description>
</signal>
</signals>
<constants>
</constants>
</class>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ESSEntityWorldSpawner3D" inherits="Spatial">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_spawn" qualifiers="virtual">
<return type="void" />
<description>
</description>
</method>
<method name="emit_on_entity_spawned">
<return type="void" />
<argument index="0" name="info" type="EntityCreateInfo" />
<description>
</description>
</method>
<method name="spawn">
<return type="void" />
<description>
</description>
</method>
</methods>
<signals>
<signal name="emit_on_entity_spawned">
<argument index="0" name="info" type="EntityCreateInfo" />
<description>
</description>
</signal>
</signals>
<constants>
</constants>
</class>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ESSEntityWorldSpawner3DSingle" inherits="ESSEntityWorldSpawner3D">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<constants>
</constants>
</class>

View File

@ -153,6 +153,10 @@
#include "props/prop_data_entity.h"
#endif
#include "world_spawners/ess_entity_world_spawner_2d.cpp"
#include "world_spawners/ess_entity_world_spawner_3d_single.cpp"
#include "world_spawners/ess_entity_world_spawner_3d.cpp"
static ESS *entity_data_manager = NULL;
static ProfileManager *profile_manager = NULL;
@ -296,6 +300,11 @@ void register_entity_spell_system_types(ModuleRegistrationLevel p_level) {
#ifdef MODULE_TEXTURE_PACKER_ENABLED
ClassDB::register_class<ESSMaterialCachePCM>();
#endif
// World Spawners
ClassDB::register_class<ESSEntityWorldSpawner3D>();
ClassDB::register_class<ESSEntityWorldSpawner3DSingle>();
ClassDB::register_class<ESSEntityWorldSpawner2D>();
}
#ifdef TOOLS_ENABLED

View File

@ -0,0 +1,59 @@
/*************************************************************************/
/* ess_entity_world_spawner_2d.cpp */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ess_entity_world_spawner_2d.h"
#include "../utility/entity_create_info.h"
void ESSEntityWorldSpawner2D::spawn() {
call("_spawn");
}
void ESSEntityWorldSpawner2D::_spawn() {
}
void ESSEntityWorldSpawner2D::emit_on_entity_spawned(const Ref<EntityCreateInfo> &p_info) {
emit_signal("on_entity_spawned", p_info);
}
ESSEntityWorldSpawner2D::ESSEntityWorldSpawner2D() {
}
ESSEntityWorldSpawner2D::~ESSEntityWorldSpawner2D() {
}
void ESSEntityWorldSpawner2D::_bind_methods() {
BIND_VMETHOD(MethodInfo("_spawn"));
ADD_SIGNAL(MethodInfo("emit_on_entity_spawned", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
ClassDB::bind_method(D_METHOD("spawn"), &ESSEntityWorldSpawner2D::spawn);
ClassDB::bind_method(D_METHOD("_spawn"), &ESSEntityWorldSpawner2D::_spawn);
ClassDB::bind_method(D_METHOD("emit_on_entity_spawned", "info"), &ESSEntityWorldSpawner2D::emit_on_entity_spawned);
}

View File

@ -0,0 +1,55 @@
#ifndef ESS_ENTITY_WORLD_SPAWNER_2D_H
#define ESS_ENTITY_WORLD_SPAWNER_2D_H
/*************************************************************************/
/* ess_entity_world_spawner_2d.h */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "scene/main/node_2d.h"
class EntityCreateInfo;
class ESSEntityWorldSpawner2D : public Node2D {
GDCLASS(ESSEntityWorldSpawner2D, Node2D);
public:
void spawn();
virtual void _spawn();
void emit_on_entity_spawned(const Ref<EntityCreateInfo> &p_info);
ESSEntityWorldSpawner2D();
~ESSEntityWorldSpawner2D();
protected:
static void _bind_methods();
};
#endif

View File

@ -0,0 +1,59 @@
/*************************************************************************/
/* ess_entity_world_spawner_3d.cpp */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ess_entity_world_spawner_3d.h"
#include "../utility/entity_create_info.h"
void ESSEntityWorldSpawner3D::spawn() {
call("_spawn");
}
void ESSEntityWorldSpawner3D::_spawn() {
}
void ESSEntityWorldSpawner3D::emit_on_entity_spawned(const Ref<EntityCreateInfo> &p_info) {
emit_signal("on_entity_spawned", p_info);
}
ESSEntityWorldSpawner3D::ESSEntityWorldSpawner3D() {
}
ESSEntityWorldSpawner3D::~ESSEntityWorldSpawner3D() {
}
void ESSEntityWorldSpawner3D::_bind_methods() {
BIND_VMETHOD(MethodInfo("_spawn"));
ADD_SIGNAL(MethodInfo("emit_on_entity_spawned", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
ClassDB::bind_method(D_METHOD("spawn"), &ESSEntityWorldSpawner3D::spawn);
ClassDB::bind_method(D_METHOD("_spawn"), &ESSEntityWorldSpawner3D::_spawn);
ClassDB::bind_method(D_METHOD("emit_on_entity_spawned", "info"), &ESSEntityWorldSpawner3D::emit_on_entity_spawned);
}

View File

@ -0,0 +1,55 @@
#ifndef ESS_ENTITY_WORLD_SPAWNER_3D_H
#define ESS_ENTITY_WORLD_SPAWNER_3D_H
/*************************************************************************/
/* ess_entity_world_spawner_3d.h */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "scene/main/spatial.h"
class EntityCreateInfo;
class ESSEntityWorldSpawner3D : public Spatial {
GDCLASS(ESSEntityWorldSpawner3D, Spatial);
public:
void spawn();
virtual void _spawn();
void emit_on_entity_spawned(const Ref<EntityCreateInfo> &p_info);
ESSEntityWorldSpawner3D();
~ESSEntityWorldSpawner3D();
protected:
static void _bind_methods();
};
#endif

View File

@ -0,0 +1,46 @@
/*************************************************************************/
/* ess_entity_world_spawner_3d_single.cpp */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ess_entity_world_spawner_3d_single.h"
#include "../utility/entity_create_info.h"
void ESSEntityWorldSpawner3DSingle::_spawn() {
}
ESSEntityWorldSpawner3DSingle::ESSEntityWorldSpawner3DSingle() {
}
ESSEntityWorldSpawner3DSingle::~ESSEntityWorldSpawner3DSingle() {
}
void ESSEntityWorldSpawner3DSingle::_bind_methods() {
}

View File

@ -0,0 +1,52 @@
#ifndef ESS_ENTITY_WORLD_SPAWNER_3D_SINGLE_H
#define ESS_ENTITY_WORLD_SPAWNER_3D_SINGLE_H
/*************************************************************************/
/* ess_entity_world_spawner_3d_single.h */
/*************************************************************************/
/* This file is part of: */
/* PANDEMONIUM ENGINE */
/* https://github.com/Relintai/pandemonium_engine */
/*************************************************************************/
/* Copyright (c) 2022-present Péter Magyar. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "ess_entity_world_spawner_3d.h"
class EntityCreateInfo;
class ESSEntityWorldSpawner3DSingle : public ESSEntityWorldSpawner3D {
GDCLASS(ESSEntityWorldSpawner3DSingle, ESSEntityWorldSpawner3D);
public:
virtual void _spawn();
ESSEntityWorldSpawner3DSingle();
~ESSEntityWorldSpawner3DSingle();
protected:
static void _bind_methods();
};
#endif