From 26c53fd16de1340a4724f0382eb5a14e4e58e931 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 13 Apr 2025 18:54:12 +0200 Subject: [PATCH] Added 3 new helper classes for the entity spell system. ESSEntityWorldSpawner3D, ESSEntityWorldSpawner3DSingle, ESSEntityWorldSpawner2D. --- modules/entity_spell_system/SCsub | 6 +- modules/entity_spell_system/config.py | 4 ++ .../doc_classes/ESSEntityWorldSpawner2D.xml | 36 +++++++++++ .../doc_classes/ESSEntityWorldSpawner3D.xml | 36 +++++++++++ .../ESSEntityWorldSpawner3DSingle.xml | 13 ++++ .../entity_spell_system/register_types.cpp | 9 +++ .../ess_entity_world_spawner_2d.cpp | 59 +++++++++++++++++++ .../ess_entity_world_spawner_2d.h | 55 +++++++++++++++++ .../ess_entity_world_spawner_3d.cpp | 59 +++++++++++++++++++ .../ess_entity_world_spawner_3d.h | 55 +++++++++++++++++ .../ess_entity_world_spawner_3d_single.cpp | 46 +++++++++++++++ .../ess_entity_world_spawner_3d_single.h | 52 ++++++++++++++++ 12 files changed, 429 insertions(+), 1 deletion(-) create mode 100644 modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner2D.xml create mode 100644 modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3D.xml create mode 100644 modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3DSingle.xml create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.cpp create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.h create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.cpp create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.h create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.cpp create mode 100644 modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.h diff --git a/modules/entity_spell_system/SCsub b/modules/entity_spell_system/SCsub index c2c09abda..57cdd8e0b 100644 --- a/modules/entity_spell_system/SCsub +++ b/modules/entity_spell_system/SCsub @@ -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"]: diff --git a/modules/entity_spell_system/config.py b/modules/entity_spell_system/config.py index 7d8303109..b06268857 100644 --- a/modules/entity_spell_system/config.py +++ b/modules/entity_spell_system/config.py @@ -105,6 +105,10 @@ def get_doc_classes(): "ESSMaterialCache", "ESSMaterialCachePCM", + + "ESSEntityWorldSpawner3D", + "ESSEntityWorldSpawner3DSingle", + "ESSEntityWorldSpawner2D", ] def get_doc_path(): diff --git a/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner2D.xml b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner2D.xml new file mode 100644 index 000000000..3351fc78d --- /dev/null +++ b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner2D.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3D.xml b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3D.xml new file mode 100644 index 000000000..d1c1a1560 --- /dev/null +++ b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3D.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3DSingle.xml b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3DSingle.xml new file mode 100644 index 000000000..4541eda09 --- /dev/null +++ b/modules/entity_spell_system/doc_classes/ESSEntityWorldSpawner3DSingle.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/modules/entity_spell_system/register_types.cpp b/modules/entity_spell_system/register_types.cpp index 23487faac..e556b46b5 100644 --- a/modules/entity_spell_system/register_types.cpp +++ b/modules/entity_spell_system/register_types.cpp @@ -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(); #endif + + // World Spawners + ClassDB::register_class(); + ClassDB::register_class(); + ClassDB::register_class(); } #ifdef TOOLS_ENABLED diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.cpp b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.cpp new file mode 100644 index 000000000..e0aa48987 --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.cpp @@ -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 &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); +} diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.h b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.h new file mode 100644 index 000000000..1dab0dd23 --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_2d.h @@ -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 &p_info); + + ESSEntityWorldSpawner2D(); + ~ESSEntityWorldSpawner2D(); + +protected: + static void _bind_methods(); +}; + +#endif diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.cpp b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.cpp new file mode 100644 index 000000000..908c770c7 --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.cpp @@ -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 &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); +} diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.h b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.h new file mode 100644 index 000000000..3bddd9911 --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d.h @@ -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 &p_info); + + ESSEntityWorldSpawner3D(); + ~ESSEntityWorldSpawner3D(); + +protected: + static void _bind_methods(); +}; + +#endif diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.cpp b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.cpp new file mode 100644 index 000000000..0be8c5d9d --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.cpp @@ -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() { +} diff --git a/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.h b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.h new file mode 100644 index 000000000..a42ed6d3e --- /dev/null +++ b/modules/entity_spell_system/world_spawners/ess_entity_world_spawner_3d_single.h @@ -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