Added a new class ESSEntitySpawner. It is a resource. This will make setting up entity spawning a lot less painful. Also the module will be able to contain a few built in solutions. An instance is available from the ESS singleton (can be set, or loaded/automatically loaded). Also fixed a few smaller issues with saving/loading.

This commit is contained in:
Relintai 2020-04-18 14:31:36 +02:00
parent 5b14bf40bd
commit 6c9bea09bc
17 changed files with 332 additions and 52 deletions

View File

@ -53,10 +53,12 @@ For example this way it is easy to make chests attack the player, or make spell
Since spawning (= creating) entities is entirely dependant on the type of game you are making, ESS cannot do
everything for you. It will set up stats, equipment etc, but there is no way to set up positions for example.
In lieu of this ESS has a signal that you should hook into from a class, and using that hook
you can set up your entities however you like.
You can implement your spawning logic by inheriting from ESSEntitySpawner, and implementing `_request_entity_spawn`.
ESS also contains the method to request the system to spawn an Entity.
You will need to register this spawner into the ESS singleton, either by using `setup(resource_db, entity_spawner)`, or
by using the provided property/setter `entity_spawner`/`set_entity_spawner()`.
The ESS singleton also contains convenience methods to request spawning an Entity.
#### EntityCreateInfo
@ -159,4 +161,5 @@ Add to readme:
Loot, Species, cds, categ cds, items (crafting etc), Xp,
levelling, Stats, drag and drop, talents, vendors, Skills,
Profiles, Projectiles, Singletons, Skeleton,
Global enums
Global enums
resourcedb

2
SCsub
View File

@ -115,6 +115,8 @@ sources = [
"profiles/player_profile.cpp",
"spawners/ess_entity_spawner.cpp",
"singletons/profile_manager.cpp",
"singletons/ess.cpp",

View File

@ -106,6 +106,8 @@ def get_doc_classes():
"EntityEnums",
"ItemEnums",
"SpellEnums",
"ESSEntitySpawner",
]
def get_doc_path():

View File

@ -48,6 +48,11 @@ void ESSResourceDB::set_xp_data(const Ref<XPData> &data) {
_xp_data = data;
}
void ESSResourceDB::initialize() {
if (has_method("_initialize"))
call("_initialize");
}
ESSResourceDB::ESSResourceDB() {
}
@ -131,4 +136,7 @@ void ESSResourceDB::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entity_species_data_count"), &ESSResourceDB::get_entity_species_data_count);
ClassDB::bind_method(D_METHOD("get_entity_species_datas"), &ESSResourceDB::get_entity_species_datas);
ClassDB::bind_method(D_METHOD("set_entity_species_datas", "recipe"), &ESSResourceDB::set_entity_species_datas);
BIND_VMETHOD(MethodInfo("_initialize"));
ClassDB::bind_method(D_METHOD("initialize"), &ESSResourceDB::initialize);
}

View File

@ -113,6 +113,8 @@ public:
virtual Vector<Variant> get_entity_species_datas() const = 0;
virtual void set_entity_species_datas(const Vector<Variant> &data) = 0;
void initialize();
ESSResourceDB();
~ESSResourceDB();

View File

@ -412,6 +412,10 @@ void ESSResourceDBFolders::set_entity_species_datas(const Vector<Variant> &data)
}
}
void ESSResourceDBFolders::_initialize() {
load_all();
}
void ESSResourceDBFolders::load_all() {
load_xp_data();
load_folders();
@ -563,6 +567,7 @@ void ESSResourceDBFolders::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "folders"), "set_folders", "get_folders");
//load
ClassDB::bind_method(D_METHOD("_initialize"), &ESSResourceDBFolders::_initialize);
ClassDB::bind_method(D_METHOD("load_all"), &ESSResourceDBFolders::load_all);
ClassDB::bind_method(D_METHOD("load_xp_data"), &ESSResourceDBFolders::load_xp_data);
ClassDB::bind_method(D_METHOD("load_folders"), &ESSResourceDBFolders::load_folders);

View File

@ -132,6 +132,7 @@ public:
Vector<Variant> get_entity_species_datas() const;
void set_entity_species_datas(const Vector<Variant> &data);
virtual void _initialize();
void load_all();
void load_xp_data();
void load_folders();
@ -151,29 +152,29 @@ private:
PoolStringArray _folders;
Vector<Ref<EntityResourceData>> _entity_resources;
HashMap<int, Ref<EntityResourceData>> _entity_resource_map;
Vector<Ref<EntityResourceData> > _entity_resources;
HashMap<int, Ref<EntityResourceData> > _entity_resource_map;
Vector<Ref<EntitySkillData>> _entity_skills;
HashMap<int, Ref<EntitySkillData>> _entity_skill_map;
Vector<Ref<EntitySkillData> > _entity_skills;
HashMap<int, Ref<EntitySkillData> > _entity_skill_map;
Vector<Ref<EntityData>> _entity_datas;
HashMap<int, Ref<EntityData>> _entity_data_map;
Vector<Ref<EntityData> > _entity_datas;
HashMap<int, Ref<EntityData> > _entity_data_map;
Vector<Ref<Spell>> _spells;
HashMap<int, Ref<Spell>> _spell_map;
Vector<Ref<Spell> > _spells;
HashMap<int, Ref<Spell> > _spell_map;
Vector<Ref<Aura>> _auras;
HashMap<int, Ref<Aura>> _aura_map;
Vector<Ref<Aura> > _auras;
HashMap<int, Ref<Aura> > _aura_map;
Vector<Ref<CraftRecipe>> _craft_recipes;
HashMap<int, Ref<CraftRecipe>> _craft_recipe_map;
Vector<Ref<CraftRecipe> > _craft_recipes;
HashMap<int, Ref<CraftRecipe> > _craft_recipe_map;
Vector<Ref<ItemTemplate>> _item_templates;
HashMap<int, Ref<ItemTemplate>> _item_template_map;
Vector<Ref<ItemTemplate> > _item_templates;
HashMap<int, Ref<ItemTemplate> > _item_template_map;
Vector<Ref<EntitySpeciesData>> _entity_species_datas;
HashMap<int, Ref<EntitySpeciesData>> _entity_species_data_map;
Vector<Ref<EntitySpeciesData> > _entity_species_datas;
HashMap<int, Ref<EntitySpeciesData> > _entity_species_data_map;
bool _automatic_load;
bool _load_folders;

View File

@ -12,8 +12,8 @@
<tutorials>
</tutorials>
<methods>
<method name="get_resource_db">
<return type="ESSResourceDB">
<method name="load_all">
<return type="void">
</return>
<description>
</description>
@ -50,6 +50,16 @@
<description>
</description>
</method>
<method name="setup">
<return type="void">
</return>
<argument index="0" name="resource_db" type="ESSResourceDB">
</argument>
<argument index="1" name="entity_spawner" type="ESSEntitySpawner">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="allow_class_recipe_learning" type="bool" setter="set_allow_class_recipe_learning" getter="get_allow_class_recipe_learning" default="false">
@ -60,6 +70,12 @@
</member>
<member name="automatic_load" type="bool" setter="set_automatic_load" getter="get_automatic_load" default="false">
</member>
<member name="entity_spawner" type="ESSEntitySpawner" setter="set_entity_spawner" getter="get_entity_spawner">
</member>
<member name="entity_spawner_path" type="String" setter="set_entity_spawner_path" getter="get_entity_spawner_path" default="&quot;&quot;">
</member>
<member name="resource_db" type="ESSResourceDB" setter="set_resource_db" getter="get_resource_db">
</member>
<member name="resource_db_path" type="String" setter="set_resource_db_path" getter="get_resource_db_path" default="&quot;&quot;">
</member>
<member name="scale_spells_by_default" type="bool" setter="set_scale_spells_by_default" getter="get_scale_spells_by_default" default="false">
@ -71,14 +87,6 @@
<member name="use_spell_points" type="bool" setter="set_use_spell_points" getter="get_use_spell_points" default="false">
</member>
</members>
<signals>
<signal name="on_entity_spawn_requested">
<argument index="0" name="info" type="EntityCreateInfo">
</argument>
<description>
</description>
</signal>
</signals>
<constants>
</constants>
</class>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="ESSEntitySpawner" inherits="Resource" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_request_entity_spawn" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="info" type="EntityCreateInfo">
</argument>
<description>
</description>
</method>
<method name="get_scene_tree" qualifiers="const">
<return type="SceneTree">
</return>
<description>
</description>
</method>
<method name="request_entity_spawn">
<return type="void">
</return>
<argument index="0" name="info" type="EntityCreateInfo">
</argument>
<description>
</description>
</method>
<method name="request_entity_spawn_deferred">
<return type="void">
</return>
<argument index="0" name="info" type="EntityCreateInfo">
</argument>
<description>
</description>
</method>
</methods>
<signals>
<signal name="on_entity_spawn">
<argument index="0" name="info" type="EntityCreateInfo">
</argument>
<description>
</description>
</signal>
</signals>
<constants>
</constants>
</class>

View File

@ -7,6 +7,12 @@
<tutorials>
</tutorials>
<methods>
<method name="_initialize" qualifiers="virtual">
<return type="void">
</return>
<description>
</description>
</method>
<method name="add_aura">
<return type="void">
</return>
@ -303,6 +309,12 @@
<description>
</description>
</method>
<method name="initialize">
<return type="void">
</return>
<description>
</description>
</method>
<method name="set_auras">
<return type="void">
</return>

View File

@ -36,13 +36,13 @@
<members>
<member name="aura_effect_visual" type="PackedScene" setter="set_aura_effect_visual" getter="get_aura_effect_visual">
</member>
<member name="aura_effect_visual_point" type="int" setter="set_aura_effect_visual_point" getter="get_aura_effect_visual_point" enum="EntityEnums.CharacterSkeletonPoints" default="80839040">
<member name="aura_effect_visual_point" type="int" setter="set_aura_effect_visual_point" getter="get_aura_effect_visual_point" enum="EntityEnums.CharacterSkeletonPoints" default="80892288">
</member>
<member name="effect_spell_cast_effect_id" type="PackedScene" setter="set_spell_cast_effect" getter="get_spell_cast_effect">
</member>
<member name="effect_spell_cast_finish_effect" type="PackedScene" setter="set_spell_cast_finish_effect" getter="get_spell_cast_finish_effect">
</member>
<member name="spell_cast_finish_effect_point" type="int" setter="set_spell_cast_finish_effect_point" getter="get_spell_cast_finish_effect_point" enum="EntityEnums.CharacterSkeletonPoints" default="80839040">
<member name="spell_cast_finish_effect_point" type="int" setter="set_spell_cast_finish_effect_point" getter="get_spell_cast_finish_effect_point" enum="EntityEnums.CharacterSkeletonPoints" default="80892288">
</member>
<member name="spell_effect_visual" type="PackedScene" setter="set_spell_effect_visual" getter="get_spell_effect_visual">
</member>

View File

@ -131,13 +131,15 @@ SOFTWARE.
#include "profiles/class_profile.h"
#include "profiles/player_profile.h"
#include "spawners/ess_entity_spawner.h"
#include "singletons/profile_manager.h"
#include "editor/ess_editor_plugin.h"
#include "database/ess_resource_db.cpp"
#include "database/ess_resource_db_static.h"
#include "database/ess_resource_db_folders.h"
#include "database/ess_resource_db_static.h"
static ESS *entity_data_manager = NULL;
static ProfileManager *profile_manager = NULL;
@ -271,6 +273,8 @@ void register_entity_spell_system_types() {
ClassDB::register_class<ProfileManager>();
ClassDB::register_class<ESSEntitySpawner>();
entity_data_manager = memnew(ESS);
ClassDB::register_class<ESS>();
Engine::get_singleton()->add_singleton(Engine::Singleton("ESS", ESS::get_instance()));

View File

@ -23,6 +23,7 @@ SOFTWARE.
#include "ess.h"
#include "../database/ess_resource_db.h"
#include "../spawners/ess_entity_spawner.h"
#include "../utility/entity_create_info.h"
ESS *ESS::instance;
@ -87,14 +88,41 @@ void ESS::set_allow_class_recipe_learning(const bool value) {
_allow_class_recipe_learning = value;
}
Ref<ESSResourceDB> ESS::get_resource_db() {
return _ess_resource_db;
}
void ESS::set_resource_db(const Ref<ESSResourceDB> &resource_db) {
_ess_resource_db = resource_db;
}
Ref<ESSEntitySpawner> ESS::get_entity_spawner() {
return _ess_entity_spawner;
}
void ESS::set_entity_spawner(const Ref<ESSEntitySpawner> &spawner) {
_ess_entity_spawner = spawner;
}
String ESS::get_resource_db_path() {
return _ess_resource_db_path;
}
void ESS::set_resource_db_path(String path) {
void ESS::set_resource_db_path(const String &path) {
_ess_resource_db_path = path;
}
Ref<ESSResourceDB> ESS::get_resource_db() {
return _ess_resource_db;
String ESS::get_entity_spawner_path() {
return _ess_entity_spawner_path;
}
void ESS::set_entity_spawner_path(const String &path) {
_ess_entity_spawner_path = path;
}
void ESS::request_entity_spawn(Ref<EntityCreateInfo> info) {
if (_ess_entity_spawner.is_valid())
_ess_entity_spawner->request_entity_spawn(info);
}
void ESS::request_entity_spawn_deferred(Ref<EntityCreateInfo> info) {
if (_ess_entity_spawner.is_valid())
_ess_entity_spawner->request_entity_spawn_deferred(info);
}
void ESS::load_resource_db() {
@ -109,6 +137,18 @@ void ESS::load_resource_db() {
_ess_resource_db = d;
}
void ESS::load_entity_spawner() {
_Directory dir;
ERR_FAIL_COND(_ess_entity_spawner_path == "");
Ref<ESSEntitySpawner> d = load_resource(_ess_entity_spawner_path, "ESSEntitySpawner");
ERR_FAIL_COND(!d.is_valid());
_ess_entity_spawner = d;
}
Ref<Resource> ESS::load_resource(const String &path, const String &type_hint) {
_ResourceLoader *rl = _ResourceLoader::get_singleton();
@ -125,11 +165,16 @@ Ref<Resource> ESS::load_resource(const String &path, const String &type_hint) {
#endif
}
void ESS::request_entity_spawn(const Ref<EntityCreateInfo> &info) {
emit_signal("on_entity_spawn_requested", info);
void ESS::load_all() {
load_resource_db();
load_entity_spawner();
_ess_resource_db->initialize();
}
void ESS::request_entity_spawn_deferred(const Ref<EntityCreateInfo> &info) {
call_deferred("emit_signal", "on_entity_spawn_requested", info);
void ESS::setup(const Ref<ESSResourceDB> &resource_db, const Ref<ESSEntitySpawner> &entity_spawner) {
_ess_resource_db = resource_db;
_ess_entity_spawner = entity_spawner;
}
void ESS::_bind_methods() {
@ -165,22 +210,33 @@ void ESS::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_allow_class_recipe_learning", "value"), &ESS::set_allow_class_recipe_learning);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "allow_class_recipe_learning"), "set_allow_class_recipe_learning", "get_allow_class_recipe_learning");
//XPData
ClassDB::bind_method(D_METHOD("get_resource_db"), &ESS::get_resource_db);
ClassDB::bind_method(D_METHOD("set_resource_db"), &ESS::set_resource_db);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "resource_db", PROPERTY_HINT_RESOURCE_TYPE, "ESSResourceDB"), "set_resource_db", "get_resource_db");
ClassDB::bind_method(D_METHOD("get_entity_spawner"), &ESS::get_entity_spawner);
ClassDB::bind_method(D_METHOD("set_entity_spawner"), &ESS::set_entity_spawner);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_spawner", PROPERTY_HINT_RESOURCE_TYPE, "ESSEntitySpawner"), "set_entity_spawner", "get_entity_spawner");
ClassDB::bind_method(D_METHOD("get_resource_db_path"), &ESS::get_resource_db_path);
ClassDB::bind_method(D_METHOD("set_resource_db_path", "path"), &ESS::set_resource_db_path);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_db_path"), "set_resource_db_path", "get_resource_db_path");
ClassDB::bind_method(D_METHOD("get_resource_db"), &ESS::get_resource_db);
ClassDB::bind_method(D_METHOD("get_entity_spawner_path"), &ESS::get_entity_spawner_path);
ClassDB::bind_method(D_METHOD("set_entity_spawner_path", "path"), &ESS::set_entity_spawner_path);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "entity_spawner_path"), "set_entity_spawner_path", "get_entity_spawner_path");
//load
ClassDB::bind_method(D_METHOD("load_resource_db"), &ESS::load_resource_db);
ClassDB::bind_method(D_METHOD("load_resource", "path", "type_hint"), &ESS::load_resource, DEFVAL(""));
ADD_SIGNAL(MethodInfo("on_entity_spawn_requested", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
ClassDB::bind_method(D_METHOD("request_entity_spawn", "info"), &ESS::request_entity_spawn);
ClassDB::bind_method(D_METHOD("request_entity_spawn_deferred", "info"), &ESS::request_entity_spawn_deferred);
ClassDB::bind_method(D_METHOD("load_all"), &ESS::load_all);
ClassDB::bind_method(D_METHOD("setup", "resource_db", "entity_spawner"), &ESS::setup);
}
ESS::ESS() {
@ -198,8 +254,9 @@ ESS::ESS() {
_automatic_load = GLOBAL_DEF("ess/data/automatic_load", false);
_ess_resource_db_path = GLOBAL_DEF("ess/data/ess_resource_db_path", "");
_ess_entity_spawner_path = GLOBAL_DEF("ess/data/ess_entity_spawner_path", "");
if (_automatic_load) {
if (!Engine::get_singleton()->is_editor_hint() && _automatic_load) {
call_deferred("load_all");
}
}
@ -208,4 +265,5 @@ ESS::~ESS() {
instance = NULL;
_ess_resource_db.unref();
_ess_entity_spawner.unref();
}

View File

@ -34,6 +34,7 @@ SOFTWARE.
#include "core/bind/core_bind.h"
class ESSResourceDB;
class ESSEntitySpawner;
class EntityCreateInfo;
class ESS : public Object {
@ -69,14 +70,28 @@ public:
bool get_allow_class_recipe_learning() const;
void set_allow_class_recipe_learning(const bool value);
String get_resource_db_path();
void set_resource_db_path(String path);
Ref<ESSResourceDB> get_resource_db();
void set_resource_db(const Ref<ESSResourceDB> &resource_db);
Ref<ESSEntitySpawner> get_entity_spawner();
void set_entity_spawner(const Ref<ESSEntitySpawner> &spawner);
String get_resource_db_path();
void set_resource_db_path(const String &path);
String get_entity_spawner_path();
void set_entity_spawner_path(const String &path);
void request_entity_spawn(Ref<EntityCreateInfo> info);
void request_entity_spawn_deferred(Ref<EntityCreateInfo> info);
void load_resource_db();
void load_entity_spawner();
Ref<Resource> load_resource(const String &path, const String &type_hint = "");
void request_entity_spawn(const Ref<EntityCreateInfo> &info);
void request_entity_spawn_deferred(const Ref<EntityCreateInfo> &info);
void load_all();
void setup(const Ref<ESSResourceDB> &resource_db, const Ref<ESSEntitySpawner> &entity_spawner);
ESS();
~ESS();
@ -86,8 +101,12 @@ protected:
private:
bool _automatic_load;
String _ess_resource_db_path;
Ref<ESSResourceDB> _ess_resource_db;
Ref<ESSEntitySpawner> _ess_entity_spawner;
String _ess_resource_db_path;
String _ess_entity_spawner_path;
static ESS *instance;

View File

@ -25,6 +25,8 @@ SOFTWARE.
#include "core/os/file_access.h"
#include "core/project_settings.h"
#include "core/engine.h"
#include "core/version.h"
ProfileManager *ProfileManager::_instance;
@ -209,7 +211,7 @@ ProfileManager::ProfileManager() {
_c_player_profile->connect("changed", callable_mp(this, &ProfileManager::_on_player_profile_changed));
#endif
if (_automatic_load)
if (!Engine::get_singleton()->is_editor_hint() && _automatic_load)
call_deferred("load");
}
@ -226,7 +228,7 @@ ProfileManager::~ProfileManager() {
}
void ProfileManager::_on_player_profile_changed(Ref<PlayerProfile> profile) {
if (_automatic_save)
if (!Engine::get_singleton()->is_editor_hint() && _automatic_save)
save();
}

View File

@ -0,0 +1,51 @@
/*
Copyright (c) 2019-2020 Péter Magyar
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_spawner.h"
#include "../utility/entity_create_info.h"
_FORCE_INLINE_ void ESSEntitySpawner::request_entity_spawn(Ref<EntityCreateInfo> info) {
if (has_method("_request_entity_spawn"))
call("_request_entity_spawn", info);
emit_signal("on_entity_spawn", info);
}
_FORCE_INLINE_ void ESSEntitySpawner::request_entity_spawn_deferred(Ref<EntityCreateInfo> info) {
call_deferred("request_entity_spawn", info);
}
ESSEntitySpawner::ESSEntitySpawner() {
}
ESSEntitySpawner::~ESSEntitySpawner() {
}
void ESSEntitySpawner::_bind_methods() {
BIND_VMETHOD(MethodInfo("_request_entity_spawn", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
ADD_SIGNAL(MethodInfo("on_entity_spawn", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
ClassDB::bind_method(D_METHOD("get_scene_tree"), &ESSEntitySpawner::get_scene_tree);
ClassDB::bind_method(D_METHOD("request_entity_spawn", "info"), &ESSEntitySpawner::request_entity_spawn);
ClassDB::bind_method(D_METHOD("request_entity_spawn_deferred", "info"), &ESSEntitySpawner::request_entity_spawn_deferred);
}

View File

@ -0,0 +1,52 @@
/*
Copyright (c) 2019-2020 Péter Magyar
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.
*/
#ifndef ESS_ENTITY_SPAWNER_H
#define ESS_ENTITY_SPAWNER_H
#include "core/resource.h"
#include "scene/main/scene_tree.h"
class EntityCreateInfo;
class ESSEntitySpawner : public Resource {
GDCLASS(ESSEntitySpawner, Resource);
public:
_FORCE_INLINE_ SceneTree *get_scene_tree() const {
return SceneTree::get_singleton();
}
void request_entity_spawn(Ref<EntityCreateInfo> info);
void request_entity_spawn_deferred(Ref<EntityCreateInfo> info);
ESSEntitySpawner();
~ESSEntitySpawner();
protected:
static void _bind_methods();
private:
};
#endif