mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Removed WorldSpell. Added a few properties into Spell that will replace it.
This commit is contained in:
parent
dc0c6d224b
commit
bfd7bdcf42
3
SCsub
3
SCsub
@ -69,9 +69,6 @@ sources = [
|
||||
"entities/stats/simple_level_stat_data.cpp",
|
||||
"entities/stats/complex_level_stat_data.cpp",
|
||||
|
||||
"world_spells/world_spell_data.cpp",
|
||||
"world_spells/world_spell.cpp",
|
||||
|
||||
"inventory/bag.cpp",
|
||||
#"inventory/inventory.cpp",
|
||||
|
||||
|
@ -116,13 +116,6 @@ void Aura::set_visual_spell_effects(const Ref<SpellEffectVisual> &value) {
|
||||
_visual_spell_effects = value;
|
||||
}
|
||||
|
||||
Ref<WorldSpellData> Aura::get_world_spell_data() {
|
||||
return _world_spell_data;
|
||||
}
|
||||
void Aura::set_world_spell_data(const Ref<WorldSpellData> &value) {
|
||||
_world_spell_data = value;
|
||||
}
|
||||
|
||||
int Aura::get_ability_scale_data_id() const {
|
||||
return ability_scale_data_id;
|
||||
}
|
||||
@ -379,8 +372,6 @@ Aura::~Aura() {
|
||||
|
||||
_visual_spell_effects.unref();
|
||||
|
||||
_world_spell_data.unref();
|
||||
|
||||
_damage_scaling_curve.unref();
|
||||
_absorb_scaling_curve.unref();
|
||||
_heal_scaling_curve.unref();
|
||||
@ -1661,10 +1652,6 @@ void Aura::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_visual_spell_effects", "value"), &Aura::set_visual_spell_effects);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "visual_spell_effects", PROPERTY_HINT_RESOURCE_TYPE, "SpellEffectVisual"), "set_visual_spell_effects", "get_visual_spell_effects");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell_data"), &Aura::get_world_spell_data);
|
||||
ClassDB::bind_method(D_METHOD("set_world_spell_data", "value"), &Aura::set_world_spell_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_spell_data", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), "set_world_spell_data", "get_world_spell_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_teaches_spell"), &Aura::get_teaches_spell);
|
||||
ClassDB::bind_method(D_METHOD("set_teaches_spell", "next_rank"), &Aura::set_teaches_spell);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "teaches_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_teaches_spell", "get_teaches_spell");
|
||||
|
@ -49,8 +49,6 @@ SOFTWARE.
|
||||
|
||||
#include "../spells/spell_effect_visual.h"
|
||||
|
||||
#include "../../world_spells/world_spell_data.h"
|
||||
|
||||
class AuraApplyInfo;
|
||||
class AuraScript;
|
||||
class Entity;
|
||||
@ -100,9 +98,6 @@ public:
|
||||
Ref<SpellEffectVisual> get_visual_spell_effects();
|
||||
void set_visual_spell_effects(const Ref<SpellEffectVisual> &value);
|
||||
|
||||
Ref<WorldSpellData> get_world_spell_data();
|
||||
void set_world_spell_data(const Ref<WorldSpellData> &value);
|
||||
|
||||
int get_ability_scale_data_id() const;
|
||||
void set_ability_scale_data_id(const int value);
|
||||
|
||||
@ -417,8 +412,6 @@ private:
|
||||
|
||||
Ref<SpellEffectVisual> _visual_spell_effects;
|
||||
|
||||
Ref<WorldSpellData> _world_spell_data;
|
||||
|
||||
bool _damage_enabled;
|
||||
int _damage_type;
|
||||
int _damage_min;
|
||||
|
@ -24,7 +24,6 @@ SOFTWARE.
|
||||
|
||||
#include "../../entities/resources/entity_resource_cost_data.h"
|
||||
#include "../../entities/skills/entity_skill_data.h"
|
||||
#include "../../world_spells/world_spell.h"
|
||||
#include "../auras/aura.h"
|
||||
#include "../items/craft_recipe.h"
|
||||
|
||||
@ -35,7 +34,6 @@ SOFTWARE.
|
||||
#include "../../pipelines/spell_damage_info.h"
|
||||
#include "../../pipelines/spell_heal_info.h"
|
||||
|
||||
|
||||
int Spell::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
@ -176,13 +174,6 @@ void Spell::set_visual_spell_effects(const Ref<SpellEffectVisual> &value) {
|
||||
_visual_spell_effects = value;
|
||||
}
|
||||
|
||||
Ref<WorldSpellData> Spell::get_projectile() {
|
||||
return _projectile;
|
||||
}
|
||||
void Spell::set_projectile(const Ref<WorldSpellData> &value) {
|
||||
_projectile = value;
|
||||
}
|
||||
|
||||
Ref<CraftRecipe> Spell::get_teaches_craft_recipe() {
|
||||
return _teaches_craft_recipe;
|
||||
}
|
||||
@ -328,6 +319,41 @@ void Spell::set_cast_time(const float value) {
|
||||
_cast_time = value;
|
||||
}
|
||||
|
||||
bool Spell::delay_get_use_time() const {
|
||||
return _delay_use_time;
|
||||
}
|
||||
void Spell::delay_set_use_time(const bool value) {
|
||||
_delay_use_time = value;
|
||||
}
|
||||
|
||||
float Spell::delay_get_time() const {
|
||||
return _delay_time;
|
||||
}
|
||||
void Spell::delay_set_time(const float value) {
|
||||
_delay_time = value;
|
||||
}
|
||||
|
||||
bool Spell::delay_get_use_speed() const {
|
||||
return _delay_use_speed;
|
||||
}
|
||||
void Spell::delay_set_use_speed(const bool value) {
|
||||
_delay_use_speed = value;
|
||||
}
|
||||
|
||||
float Spell::delay_get_speed() const {
|
||||
return _delay_speed;
|
||||
}
|
||||
void Spell::delay_set_speed(const float value) {
|
||||
_delay_speed = value;
|
||||
}
|
||||
|
||||
Ref<PackedScene> Spell::delay_get_scene() const {
|
||||
return _delay_scene;
|
||||
}
|
||||
void Spell::delay_set_scene(const Ref<PackedScene> &value) {
|
||||
_delay_scene = value;
|
||||
}
|
||||
|
||||
bool Spell::get_damage_enabled() const {
|
||||
return _damage_enabled;
|
||||
}
|
||||
@ -856,6 +882,11 @@ Spell::Spell() {
|
||||
|
||||
_training_cost = 0;
|
||||
_training_required_skill_level = 0;
|
||||
|
||||
_delay_use_time = false;
|
||||
_delay_time = 0;
|
||||
_delay_use_speed = false;
|
||||
_delay_speed = 0;
|
||||
}
|
||||
|
||||
Spell::~Spell() {
|
||||
@ -873,12 +904,11 @@ Spell::~Spell() {
|
||||
|
||||
_visual_spell_effects.unref();
|
||||
|
||||
_world_spell_data.unref();
|
||||
|
||||
_teaches_craft_recipe.unref();
|
||||
_projectile.unref();
|
||||
_training_required_spell.unref();
|
||||
_training_required_skill.unref();
|
||||
|
||||
_delay_scene.unref();
|
||||
}
|
||||
|
||||
void Spell::_sstart_casting(Ref<SpellCastInfo> info) {
|
||||
@ -905,11 +935,11 @@ void Spell::_sstart_casting(Ref<SpellCastInfo> info) {
|
||||
|
||||
info->get_target()->son_cast_finished_target(info);
|
||||
|
||||
if (get_projectile().is_valid()) {
|
||||
handle_projectile(info);
|
||||
} else {
|
||||
handle_effect(info);
|
||||
}
|
||||
//if (get_projectile().is_valid()) {
|
||||
// handle_projectile(info);
|
||||
//} else {
|
||||
// handle_effect(info);
|
||||
//}
|
||||
|
||||
handle_cooldown(info);
|
||||
|
||||
@ -924,11 +954,11 @@ void Spell::_sfinish_cast(Ref<SpellCastInfo> info) {
|
||||
info->get_target()->son_cast_finished_target(info);
|
||||
}
|
||||
|
||||
if (get_projectile().is_valid()) {
|
||||
handle_projectile(info);
|
||||
} else {
|
||||
handle_effect(info);
|
||||
}
|
||||
//if (get_projectile().is_valid()) {
|
||||
// handle_projectile(info);
|
||||
//} else {
|
||||
// handle_effect(info);
|
||||
//}
|
||||
|
||||
handle_cooldown(info);
|
||||
}
|
||||
@ -968,6 +998,7 @@ void Spell::_handle_spell_heal(Ref<SpellHealInfo> data) {
|
||||
}
|
||||
|
||||
void Spell::_handle_projectile(Ref<SpellCastInfo> info) {
|
||||
/*
|
||||
if (_world_spell_data.is_valid()) {
|
||||
WorldSpell *ws = memnew(WorldSpell);
|
||||
|
||||
@ -978,6 +1009,7 @@ void Spell::_handle_projectile(Ref<SpellCastInfo> info) {
|
||||
p->add_child(ws);
|
||||
ws->send(_world_spell_data, info);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Spell::_handle_effect(Ref<SpellCastInfo> info) {
|
||||
@ -1186,10 +1218,6 @@ void Spell::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_visual_spell_effects", "value"), &Spell::set_visual_spell_effects);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "visual_spell_effects", PROPERTY_HINT_RESOURCE_TYPE, "SpellEffectVisual"), "set_visual_spell_effects", "get_visual_spell_effects");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_projectile"), &Spell::get_projectile);
|
||||
ClassDB::bind_method(D_METHOD("set_projectile", "value"), &Spell::set_projectile);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "projectile", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), "set_projectile", "get_projectile");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_teaches_craft_recipe"), &Spell::get_teaches_craft_recipe);
|
||||
ClassDB::bind_method(D_METHOD("set_teaches_craft_recipe", "value"), &Spell::set_teaches_craft_recipe);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "teaches_craft_recipe", PROPERTY_HINT_RESOURCE_TYPE, "CraftRecipe"), "set_teaches_craft_recipe", "get_teaches_craft_recipe");
|
||||
@ -1275,6 +1303,27 @@ void Spell::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_can_move_while_casting", "value"), &Spell::set_can_move_while_casting);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cast_can_move_while_casting"), "set_can_move_while_casting", "get_can_move_while_casting");
|
||||
|
||||
ADD_GROUP("Delay", "delay");
|
||||
ClassDB::bind_method(D_METHOD("delay_get_use_time"), &Spell::delay_get_use_time);
|
||||
ClassDB::bind_method(D_METHOD("delay_set_use_time", "value"), &Spell::delay_set_use_time);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "delay_use_time"), "delay_set_use_time", "delay_get_use_time");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delay_get_time"), &Spell::delay_get_time);
|
||||
ClassDB::bind_method(D_METHOD("delay_set_time", "value"), &Spell::delay_set_time);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "delay_time"), "delay_set_time", "delay_get_time");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delay_get_use_speed"), &Spell::delay_get_use_speed);
|
||||
ClassDB::bind_method(D_METHOD("delay_set_use_speed", "value"), &Spell::delay_set_use_speed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "delay_use_speed"), "delay_set_use_speed", "delay_get_use_speed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delay_get_speed"), &Spell::delay_get_speed);
|
||||
ClassDB::bind_method(D_METHOD("delay_set_speed", "value"), &Spell::delay_set_speed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "delay_speed"), "delay_set_speed", "delay_get_speed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("delay_get_scene"), &Spell::delay_get_scene);
|
||||
ClassDB::bind_method(D_METHOD("delay_set_scene", "value"), &Spell::delay_set_scene);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "delay_scene", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "delay_set_scene", "delay_get_scene");
|
||||
|
||||
ADD_GROUP("Damage", "damage");
|
||||
ClassDB::bind_method(D_METHOD("get_damage_enabled"), &Spell::get_damage_enabled);
|
||||
ClassDB::bind_method(D_METHOD("set_damage_enabled", "value"), &Spell::set_damage_enabled);
|
||||
|
@ -38,8 +38,6 @@ SOFTWARE.
|
||||
|
||||
#include "spell_effect_visual.h"
|
||||
|
||||
#include "../../world_spells/world_spell_data.h"
|
||||
|
||||
class Entity;
|
||||
class Aura;
|
||||
class SpellCastInfo;
|
||||
@ -141,9 +139,6 @@ public:
|
||||
Ref<SpellEffectVisual> get_visual_spell_effects();
|
||||
void set_visual_spell_effects(const Ref<SpellEffectVisual> &value);
|
||||
|
||||
Ref<WorldSpellData> get_projectile();
|
||||
void set_projectile(const Ref<WorldSpellData> &value);
|
||||
|
||||
Ref<CraftRecipe> get_teaches_craft_recipe();
|
||||
void set_teaches_craft_recipe(const Ref<CraftRecipe> &value);
|
||||
|
||||
@ -190,6 +185,23 @@ public:
|
||||
float get_cast_time() const;
|
||||
void set_cast_time(const float value);
|
||||
|
||||
//Delay
|
||||
bool delay_get_use_time() const;
|
||||
void delay_set_use_time(const bool value);
|
||||
|
||||
float delay_get_time() const;
|
||||
void delay_set_time(const float value);
|
||||
|
||||
bool delay_get_use_speed() const;
|
||||
void delay_set_use_speed(const bool value);
|
||||
|
||||
float delay_get_speed() const;
|
||||
void delay_set_speed(const float value);
|
||||
|
||||
Ref<PackedScene> delay_get_scene() const;
|
||||
void delay_set_scene(const Ref<PackedScene> &value);
|
||||
|
||||
//Damage
|
||||
bool get_damage_enabled() const;
|
||||
void set_damage_enabled(const bool value);
|
||||
|
||||
@ -380,12 +392,18 @@ private:
|
||||
|
||||
Ref<SpellEffectVisual> _visual_spell_effects;
|
||||
|
||||
Ref<WorldSpellData> _world_spell_data;
|
||||
Ref<CraftRecipe> _teaches_craft_recipe;
|
||||
|
||||
bool _range_enabled;
|
||||
float _range;
|
||||
|
||||
//Delay
|
||||
bool _delay_use_time;
|
||||
float _delay_time;
|
||||
bool _delay_use_speed;
|
||||
float _delay_speed;
|
||||
Ref<PackedScene> _delay_scene;
|
||||
|
||||
bool _damage_enabled;
|
||||
int _damage_type;
|
||||
int _damage_min;
|
||||
@ -419,8 +437,6 @@ private:
|
||||
float _aoe_radius;
|
||||
Vector3 _aoe_box_extents;
|
||||
|
||||
Ref<WorldSpellData> _projectile;
|
||||
|
||||
int _spell_cooldown_mainpulation_data_count;
|
||||
|
||||
int _training_cost;
|
||||
|
@ -27,7 +27,6 @@ SOFTWARE.
|
||||
#include "../data/spells/spell.h"
|
||||
#include "../entities/entity.h"
|
||||
#include "../singletons/entity_data_manager.h"
|
||||
#include "../world_spells/world_spell.h"
|
||||
|
||||
//// SpellCastInfo ////
|
||||
|
||||
@ -79,30 +78,6 @@ void SpellCastInfo::set_target_bind(Node *target) {
|
||||
_target = e;
|
||||
}
|
||||
|
||||
WorldSpell *SpellCastInfo::get_world_spell() {
|
||||
if (_world_spell && !ObjectDB::instance_validate(_world_spell)) {
|
||||
_world_spell = NULL;
|
||||
}
|
||||
|
||||
return _world_spell;
|
||||
}
|
||||
void SpellCastInfo::set_world_spell(WorldSpell *world_spell) {
|
||||
_world_spell = world_spell;
|
||||
}
|
||||
void SpellCastInfo::set_world_spell_bind(Node *world_spell) {
|
||||
if (!world_spell) {
|
||||
return;
|
||||
}
|
||||
|
||||
WorldSpell *w = cast_to<WorldSpell>(world_spell);
|
||||
|
||||
if (!ObjectDB::instance_validate(w)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_world_spell = w;
|
||||
}
|
||||
|
||||
bool SpellCastInfo::get_has_cast_time() const {
|
||||
return _has_cast_time;
|
||||
}
|
||||
@ -241,7 +216,6 @@ void SpellCastInfo::from_dict(const Dictionary &dict) {
|
||||
SpellCastInfo::SpellCastInfo() {
|
||||
_caster = NULL;
|
||||
_target = NULL;
|
||||
_world_spell = NULL;
|
||||
|
||||
_has_cast_time = false;
|
||||
_cast_time = 0;
|
||||
@ -273,10 +247,6 @@ void SpellCastInfo::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_target", "caster"), &SpellCastInfo::set_target_bind);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "target", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), "set_target", "get_target");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell"), &SpellCastInfo::get_world_spell);
|
||||
ClassDB::bind_method(D_METHOD("set_world_spell", "world_spell"), &SpellCastInfo::set_world_spell_bind);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "world_spell", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpell"), "set_world_spell", "get_world_spell");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_has_cast_time"), &SpellCastInfo::get_has_cast_time);
|
||||
ClassDB::bind_method(D_METHOD("set_has_cast_time", "value"), &SpellCastInfo::set_has_cast_time);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "has_cast_time"), "set_has_cast_time", "get_has_cast_time");
|
||||
|
@ -27,7 +27,6 @@ SOFTWARE.
|
||||
|
||||
class Spell;
|
||||
class Entity;
|
||||
class WorldSpell;
|
||||
class ItemInstance;
|
||||
class ItemTemplate;
|
||||
|
||||
@ -43,10 +42,6 @@ public:
|
||||
void set_target(Entity *caster);
|
||||
void set_target_bind(Node *caster);
|
||||
|
||||
WorldSpell *get_world_spell();
|
||||
void set_world_spell(WorldSpell *world_spell);
|
||||
void set_world_spell_bind(Node *world_spell);
|
||||
|
||||
bool get_has_cast_time() const;
|
||||
void set_has_cast_time(bool value);
|
||||
|
||||
@ -91,7 +86,6 @@ protected:
|
||||
private:
|
||||
Entity *_caster;
|
||||
Entity *_target;
|
||||
WorldSpell *_world_spell;
|
||||
bool _has_cast_time;
|
||||
float _cast_time;
|
||||
float _spell_scale;
|
||||
|
@ -114,9 +114,6 @@ SOFTWARE.
|
||||
#include "data/spells/spell_effect_visual.h"
|
||||
#include "data/spells/spell_effect_visual_simple.h"
|
||||
|
||||
#include "world_spells/world_spell.h"
|
||||
#include "world_spells/world_spell_data.h"
|
||||
|
||||
#include "entities/ai/entity_ai.h"
|
||||
|
||||
#include "formations/ai_formation.h"
|
||||
@ -238,9 +235,6 @@ void register_entity_spell_system_types() {
|
||||
ClassDB::register_class<SpellEffectVisual>();
|
||||
ClassDB::register_class<SpellEffectVisualSimple>();
|
||||
|
||||
ClassDB::register_class<WorldSpellData>();
|
||||
ClassDB::register_class<WorldSpell>();
|
||||
|
||||
//AI
|
||||
ClassDB::register_class<EntityAI>();
|
||||
|
||||
|
@ -270,36 +270,6 @@ int EntityDataManager::get_aura_count() {
|
||||
return _auras.size();
|
||||
}
|
||||
|
||||
//WorldSpellsDatas
|
||||
String EntityDataManager::get_world_spell_datas_folder() {
|
||||
return _world_spell_datas_folder;
|
||||
}
|
||||
void EntityDataManager::set_world_spell_datas_folder(String folder) {
|
||||
_world_spell_datas_folder = folder;
|
||||
}
|
||||
Vector<Ref<WorldSpellData> > *EntityDataManager::get_world_spell_datas() {
|
||||
return &_world_spell_datas;
|
||||
}
|
||||
Ref<WorldSpellData> EntityDataManager::get_world_spell_data(int class_id) {
|
||||
ERR_FAIL_COND_V_MSG(!_world_spell_data_map.has(class_id), Ref<WorldSpellData>(), "Could not find WorldSpellData! Id:" + String::num(class_id));
|
||||
|
||||
return _world_spell_data_map.get(class_id);
|
||||
}
|
||||
Ref<WorldSpellData> EntityDataManager::get_world_spell_data_index(int index) {
|
||||
ERR_FAIL_INDEX_V(index, _world_spell_datas.size(), Ref<WorldSpellData>());
|
||||
|
||||
return _world_spell_datas.get(index);
|
||||
}
|
||||
int EntityDataManager::get_world_spell_data_count() {
|
||||
return _world_spell_datas.size();
|
||||
}
|
||||
void EntityDataManager::add_world_spell_data(const Ref<WorldSpellData> &cls) {
|
||||
ERR_FAIL_COND(!cls.is_valid());
|
||||
|
||||
_world_spell_datas.push_back(cls);
|
||||
_world_spell_data_map.set(cls->get_id(), cls);
|
||||
}
|
||||
|
||||
//Craft Data
|
||||
void EntityDataManager::add_craft_data(const Ref<CraftRecipe> &cda) {
|
||||
ERR_FAIL_COND(!cda.is_valid());
|
||||
@ -465,7 +435,6 @@ void EntityDataManager::load_all() {
|
||||
load_entity_skills();
|
||||
load_spells();
|
||||
load_auras();
|
||||
load_world_spell_datas();
|
||||
load_characters();
|
||||
load_craft_datas();
|
||||
load_item_templates();
|
||||
@ -674,50 +643,6 @@ void EntityDataManager::load_auras() {
|
||||
}
|
||||
}
|
||||
|
||||
void EntityDataManager::load_world_spell_datas() {
|
||||
_Directory dir;
|
||||
|
||||
ERR_FAIL_COND(_world_spell_datas_folder.ends_with("/"));
|
||||
|
||||
if (dir.open(_world_spell_datas_folder) == OK) {
|
||||
|
||||
dir.list_dir_begin();
|
||||
|
||||
String filename;
|
||||
|
||||
while (true) {
|
||||
filename = dir.get_next();
|
||||
|
||||
if (filename == "")
|
||||
break;
|
||||
|
||||
if (!dir.current_is_dir()) {
|
||||
String path = _world_spell_datas_folder + "/" + filename;
|
||||
|
||||
_ResourceLoader *rl = _ResourceLoader::get_singleton();
|
||||
|
||||
Ref<ResourceInteractiveLoader> resl = rl->load_interactive(path, "WorldSpellData");
|
||||
|
||||
ERR_CONTINUE(!resl.is_valid());
|
||||
|
||||
resl->wait();
|
||||
|
||||
Ref<Resource> s = resl->get_resource();
|
||||
|
||||
ERR_CONTINUE(!s.is_valid());
|
||||
|
||||
Ref<WorldSpellData> wsp = s;
|
||||
|
||||
ERR_CONTINUE(!wsp.is_valid());
|
||||
|
||||
add_world_spell_data(wsp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print_error("An error occurred when trying to access the path.");
|
||||
}
|
||||
}
|
||||
|
||||
void EntityDataManager::load_characters() {
|
||||
_Directory dir;
|
||||
|
||||
@ -988,12 +913,6 @@ void EntityDataManager::request_entity_spawn(const Ref<EntityCreateInfo> &info)
|
||||
void EntityDataManager::request_entity_spawn_deferred(const Ref<EntityCreateInfo> &info) {
|
||||
call_deferred("emit_signal", "on_entity_spawn_requested", info);
|
||||
}
|
||||
void EntityDataManager::request_world_spell_spawn(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info) {
|
||||
emit_signal("on_world_spell_spawn_requested", data, info);
|
||||
}
|
||||
void EntityDataManager::request_world_spell_spawn_deferred(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info) {
|
||||
call_deferred("emit_signal", "on_world_spell_spawn_requested", data, info);
|
||||
}
|
||||
|
||||
void EntityDataManager::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_use_spell_points"), &EntityDataManager::get_use_spell_points);
|
||||
@ -1092,16 +1011,6 @@ void EntityDataManager::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_aura_index", "index"), &EntityDataManager::get_aura_index);
|
||||
ClassDB::bind_method(D_METHOD("get_aura_count"), &EntityDataManager::get_aura_count);
|
||||
|
||||
//WorldSpellData
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell_datas_folder"), &EntityDataManager::get_world_spell_datas_folder);
|
||||
ClassDB::bind_method(D_METHOD("set_world_spell_datas_folder", "folder"), &EntityDataManager::set_world_spell_datas_folder);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "world_spell_datas_folder"), "set_world_spell_datas_folder", "get_world_spell_datas_folder");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("add_world_spell_data", "cls"), &EntityDataManager::add_world_spell_data);
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell_data", "class_id"), &EntityDataManager::get_world_spell_data);
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell_data_index", "index"), &EntityDataManager::get_world_spell_data_index);
|
||||
ClassDB::bind_method(D_METHOD("get_world_spell_data_count"), &EntityDataManager::get_world_spell_data_count);
|
||||
|
||||
//Craft Data
|
||||
ClassDB::bind_method(D_METHOD("get_craft_data_folder"), &EntityDataManager::get_craft_data_folder);
|
||||
ClassDB::bind_method(D_METHOD("set_craft_data_folder", "folder"), &EntityDataManager::set_craft_data_folder);
|
||||
@ -1159,7 +1068,6 @@ void EntityDataManager::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("load_xp_data"), &EntityDataManager::load_xp_data);
|
||||
ClassDB::bind_method(D_METHOD("load_spells"), &EntityDataManager::load_spells);
|
||||
ClassDB::bind_method(D_METHOD("load_auras"), &EntityDataManager::load_auras);
|
||||
ClassDB::bind_method(D_METHOD("load_world_spell_datas"), &EntityDataManager::load_world_spell_datas);
|
||||
ClassDB::bind_method(D_METHOD("load_characters"), &EntityDataManager::load_characters);
|
||||
ClassDB::bind_method(D_METHOD("load_craft_datas"), &EntityDataManager::load_craft_datas);
|
||||
ClassDB::bind_method(D_METHOD("load_item_templates"), &EntityDataManager::load_item_templates);
|
||||
@ -1168,12 +1076,9 @@ void EntityDataManager::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("load_entity_species_datas"), &EntityDataManager::load_entity_species_datas);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("on_entity_spawn_requested", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
|
||||
ADD_SIGNAL(MethodInfo("on_world_spell_spawn_requested", PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "SpellCastInfo")));
|
||||
|
||||
ClassDB::bind_method(D_METHOD("request_entity_spawn", "info"), &EntityDataManager::request_entity_spawn);
|
||||
ClassDB::bind_method(D_METHOD("request_entity_spawn_deferred", "info"), &EntityDataManager::request_entity_spawn_deferred);
|
||||
ClassDB::bind_method(D_METHOD("request_world_spell_spawn", "data", "info"), &EntityDataManager::request_world_spell_spawn);
|
||||
ClassDB::bind_method(D_METHOD("request_world_spell_spawn_deferred", "data", "info"), &EntityDataManager::request_world_spell_spawn_deferred);
|
||||
}
|
||||
|
||||
EntityDataManager::EntityDataManager() {
|
||||
@ -1196,7 +1101,6 @@ EntityDataManager::EntityDataManager() {
|
||||
_entity_datas_folder = GLOBAL_DEF("ess/data/entity_datas_folder", "");
|
||||
_spells_folder = GLOBAL_DEF("ess/data/spells_folder", "");
|
||||
_auras_folder = GLOBAL_DEF("ess/data/auras_folder", "");
|
||||
_world_spell_datas_folder = GLOBAL_DEF("ess/data/world_spell_datas_folder", "");
|
||||
_craft_data_folder = GLOBAL_DEF("ess/data/craft_data_folder", "");
|
||||
_item_template_folder = GLOBAL_DEF("ess/data/item_template_folder", "");
|
||||
_mob_data_folder = GLOBAL_DEF("ess/data/mob_data_folder", "");
|
||||
@ -1226,9 +1130,6 @@ EntityDataManager::~EntityDataManager() {
|
||||
_auras.clear();
|
||||
_aura_map.clear();
|
||||
|
||||
_world_spell_datas.clear();
|
||||
_world_spell_data_map.clear();
|
||||
|
||||
_craft_datas.clear();
|
||||
_craft_data_map.clear();
|
||||
|
||||
|
@ -42,8 +42,6 @@ SOFTWARE.
|
||||
|
||||
#include "../data/entities/xp_data.h"
|
||||
|
||||
#include "../world_spells/world_spell_data.h"
|
||||
|
||||
class Aura;
|
||||
class Spell;
|
||||
class EntityData;
|
||||
@ -52,7 +50,6 @@ class ItemTemplate;
|
||||
class EntityResourceData;
|
||||
class EntitySkillData;
|
||||
class EntityCreateInfo;
|
||||
class WorldSpellData;
|
||||
class SpellCastInfo;
|
||||
class EntitySpeciesData;
|
||||
|
||||
@ -133,14 +130,6 @@ public:
|
||||
int get_aura_count();
|
||||
void add_aura(const Ref<Aura> &aura);
|
||||
|
||||
String get_world_spell_datas_folder();
|
||||
void set_world_spell_datas_folder(String folder);
|
||||
Vector<Ref<WorldSpellData> > *get_world_spell_datas();
|
||||
Ref<WorldSpellData> get_world_spell_data(int class_id);
|
||||
Ref<WorldSpellData> get_world_spell_data_index(int index);
|
||||
int get_world_spell_data_count();
|
||||
void add_world_spell_data(const Ref<WorldSpellData> &cls);
|
||||
|
||||
String get_craft_data_folder();
|
||||
void set_craft_data_folder(String folder);
|
||||
Vector<Ref<CraftRecipe> > *get_craft_datas();
|
||||
@ -187,7 +176,6 @@ public:
|
||||
void load_xp_data();
|
||||
void load_spells();
|
||||
void load_auras();
|
||||
void load_world_spell_datas();
|
||||
void load_characters();
|
||||
void load_craft_datas();
|
||||
void load_item_templates();
|
||||
@ -197,8 +185,6 @@ public:
|
||||
|
||||
void request_entity_spawn(const Ref<EntityCreateInfo> &info);
|
||||
void request_entity_spawn_deferred(const Ref<EntityCreateInfo> &info);
|
||||
void request_world_spell_spawn(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info);
|
||||
void request_world_spell_spawn_deferred(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info);
|
||||
|
||||
EntityDataManager();
|
||||
~EntityDataManager();
|
||||
@ -230,10 +216,6 @@ private:
|
||||
Vector<Ref<Aura> > _auras;
|
||||
HashMap<int, Ref<Aura> > _aura_map;
|
||||
|
||||
String _world_spell_datas_folder;
|
||||
Vector<Ref<WorldSpellData> > _world_spell_datas;
|
||||
HashMap<int, Ref<WorldSpellData> > _world_spell_data_map;
|
||||
|
||||
String _craft_data_folder;
|
||||
Vector<Ref<CraftRecipe> > _craft_datas;
|
||||
HashMap<int, Ref<CraftRecipe> > _craft_data_map;
|
||||
|
@ -1,224 +0,0 @@
|
||||
/*
|
||||
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 "world_spell.h"
|
||||
|
||||
#include "../infos/spell_cast_info.h"
|
||||
#include "../entities/entity.h"
|
||||
|
||||
NodePath WorldSpell::get_body_path() {
|
||||
return _body_path;
|
||||
}
|
||||
void WorldSpell::set_body_path(NodePath value) {
|
||||
_body_path = value;
|
||||
|
||||
_body = get_node_or_null(_body_path);
|
||||
|
||||
if (ObjectDB::instance_validate(_body))
|
||||
_body->set_owner(this);
|
||||
}
|
||||
Node *WorldSpell::get_body() {
|
||||
return _body;
|
||||
}
|
||||
|
||||
int WorldSpell::get_data_id() {
|
||||
return _data_id;
|
||||
}
|
||||
void WorldSpell::set_data_id(int value) {
|
||||
_data_id = value;
|
||||
}
|
||||
|
||||
Ref<WorldSpellData> WorldSpell::get_data() {
|
||||
return _data;
|
||||
}
|
||||
void WorldSpell::set_data(Ref<WorldSpellData> value) {
|
||||
_data = value;
|
||||
}
|
||||
|
||||
SpellEnums::ColliderType WorldSpell::get_collider_type() {
|
||||
return _collider_type;
|
||||
}
|
||||
void WorldSpell::set_collider_type(SpellEnums::ColliderType value) {
|
||||
_collider_type = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpell::get_collider_box_extents() {
|
||||
return _collider_box_extents;
|
||||
}
|
||||
void WorldSpell::set_collider_box_extents(Vector3 value) {
|
||||
_collider_box_extents = value;
|
||||
}
|
||||
|
||||
float WorldSpell::get_collider_sphere_radius() {
|
||||
return _collider_sphere_radius;
|
||||
}
|
||||
void WorldSpell::set_collider_sphere_radius(float value) {
|
||||
_collider_sphere_radius = value;
|
||||
}
|
||||
|
||||
SpellEnums::TargetType WorldSpell::get_target_type() {
|
||||
return _target_type;
|
||||
}
|
||||
void WorldSpell::set_target_type(SpellEnums::TargetType value) {
|
||||
_target_type = value;
|
||||
}
|
||||
|
||||
int WorldSpell::get_target_bone_id() {
|
||||
return _target_bone_id;
|
||||
}
|
||||
void WorldSpell::set_target_bone_id(int value) {
|
||||
_target_bone_id = value;
|
||||
}
|
||||
|
||||
bool WorldSpell::get_move() {
|
||||
return _move;
|
||||
}
|
||||
void WorldSpell::set_move(bool value) {
|
||||
_move = value;
|
||||
}
|
||||
|
||||
float WorldSpell::get_movement_speed() {
|
||||
return _movement_speed;
|
||||
}
|
||||
void WorldSpell::set_movement_speed(float value) {
|
||||
_movement_speed = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpell::get_movement_dir() {
|
||||
return _movement_dir;
|
||||
}
|
||||
void WorldSpell::set_movement_dir(Vector3 value) {
|
||||
_movement_dir = value;
|
||||
}
|
||||
|
||||
float WorldSpell::get_max_dist() {
|
||||
return _max_dist;
|
||||
}
|
||||
void WorldSpell::set_max_dist(float value) {
|
||||
_max_dist = value;
|
||||
}
|
||||
|
||||
Ref<PackedScene> WorldSpell::get_effect() {
|
||||
return _effect;
|
||||
}
|
||||
void WorldSpell::set_effect(Ref<PackedScene> value) {
|
||||
_effect = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpell::get_effect_offset() {
|
||||
return _effect_offset;
|
||||
}
|
||||
void WorldSpell::set_effect_offset(Vector3 value) {
|
||||
_effect_offset = value;
|
||||
}
|
||||
|
||||
void WorldSpell::send(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info) {
|
||||
ERR_FAIL_COND(!data.is_valid());
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
_data = data;
|
||||
_spell_cast_info = info;
|
||||
|
||||
}
|
||||
|
||||
WorldSpell::WorldSpell() {
|
||||
_data_id = 0;
|
||||
|
||||
_collider_type = SpellEnums::COLLIDER_TYPE_NONE;
|
||||
|
||||
_collider_sphere_radius = 1;
|
||||
|
||||
_target_type = SpellEnums::TARGET_TYPE_NONE;
|
||||
_target_bone_id = 0;
|
||||
|
||||
_move = true;
|
||||
_movement_speed = 10;
|
||||
|
||||
_max_dist = 400;
|
||||
}
|
||||
|
||||
WorldSpell::~WorldSpell() {
|
||||
_data.unref();
|
||||
_effect.unref();
|
||||
}
|
||||
|
||||
void WorldSpell::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_body_path"), &WorldSpell::get_body_path);
|
||||
ClassDB::bind_method(D_METHOD("set_body_path", "value"), &WorldSpell::set_body_path);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "body_path"), "set_body_path", "get_body_path");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_body"), &WorldSpell::get_body);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data_id"), &WorldSpell::get_data_id);
|
||||
ClassDB::bind_method(D_METHOD("set_data_id", "value"), &WorldSpell::set_data_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "data_id"), "set_data_id", "get_data_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_data"), &WorldSpell::get_data);
|
||||
ClassDB::bind_method(D_METHOD("set_data", "value"), &WorldSpell::set_data);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "WorldSpellData"), "set_data", "get_data");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_type"), &WorldSpell::get_collider_type);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_type", "value"), &WorldSpell::set_collider_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_COLLIDER_TYPE), "set_collider_type", "get_collider_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_box_extents"), &WorldSpell::get_collider_box_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_box_extents", "value"), &WorldSpell::set_collider_box_extents);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collider_box_extents"), "set_collider_box_extents", "get_collider_box_extents");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_sphere_radius"), &WorldSpell::get_collider_sphere_radius);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_sphere_radius", "value"), &WorldSpell::set_collider_sphere_radius);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collider_sphere_radius"), "set_collider_sphere_radius", "get_collider_sphere_radius");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_type"), &WorldSpell::get_target_type);
|
||||
ClassDB::bind_method(D_METHOD("set_target_type", "value"), &WorldSpell::set_target_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TARGET_TYPE), "set_target_type", "get_target_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_bone_id"), &WorldSpell::get_target_bone_id);
|
||||
ClassDB::bind_method(D_METHOD("set_target_bone_id", "value"), &WorldSpell::set_target_bone_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_bone_id"), "set_target_bone_id", "get_target_bone_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_move"), &WorldSpell::get_move);
|
||||
ClassDB::bind_method(D_METHOD("set_move", "value"), &WorldSpell::set_move);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "move"), "set_move", "get_move");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_movement_speed"), &WorldSpell::get_movement_speed);
|
||||
ClassDB::bind_method(D_METHOD("set_movement_speed", "value"), &WorldSpell::set_movement_speed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "movement_speed"), "set_movement_speed", "get_movement_speed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_movement_dir"), &WorldSpell::get_movement_dir);
|
||||
ClassDB::bind_method(D_METHOD("set_movement_dir", "value"), &WorldSpell::set_movement_dir);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "movement_dir"), "set_movement_dir", "get_movement_dir");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_max_dist"), &WorldSpell::get_max_dist);
|
||||
ClassDB::bind_method(D_METHOD("set_max_dist", "value"), &WorldSpell::set_max_dist);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_dist"), "set_max_dist", "get_max_dist");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_effect"), &WorldSpell::get_effect);
|
||||
ClassDB::bind_method(D_METHOD("set_effect", "value"), &WorldSpell::set_effect);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect", "get_effect");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_effect_offset"), &WorldSpell::get_effect_offset);
|
||||
ClassDB::bind_method(D_METHOD("set_effect_offset", "value"), &WorldSpell::set_effect_offset);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "effect_offset"), "set_effect_offset", "get_effect_offset");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("send", "data", "info"), &WorldSpell::send);
|
||||
}
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
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 WORLD_SPELL_H
|
||||
#define WORLD_SPELL_H
|
||||
|
||||
#include "scene/main/node.h"
|
||||
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
#include "../spell_enums.h"
|
||||
|
||||
#include "world_spell_data.h"
|
||||
|
||||
class SpellCastInfo;
|
||||
|
||||
class WorldSpell : public Node {
|
||||
GDCLASS(WorldSpell, Node);
|
||||
|
||||
public:
|
||||
NodePath get_body_path();
|
||||
void set_body_path(NodePath value);
|
||||
Node *get_body();
|
||||
|
||||
int get_data_id();
|
||||
void set_data_id(int value);
|
||||
|
||||
Ref<WorldSpellData> get_data();
|
||||
void set_data(Ref<WorldSpellData> value);
|
||||
|
||||
SpellEnums::ColliderType get_collider_type();
|
||||
void set_collider_type(SpellEnums::ColliderType value);
|
||||
|
||||
Vector3 get_collider_box_extents();
|
||||
void set_collider_box_extents(Vector3 value);
|
||||
|
||||
float get_collider_sphere_radius();
|
||||
void set_collider_sphere_radius(float value);
|
||||
|
||||
SpellEnums::TargetType get_target_type();
|
||||
void set_target_type(SpellEnums::TargetType value);
|
||||
|
||||
int get_target_bone_id();
|
||||
void set_target_bone_id(int value);
|
||||
|
||||
bool get_move();
|
||||
void set_move(bool value);
|
||||
|
||||
float get_movement_speed();
|
||||
void set_movement_speed(float value);
|
||||
|
||||
Vector3 get_movement_dir();
|
||||
void set_movement_dir(Vector3 value);
|
||||
|
||||
float get_max_dist();
|
||||
void set_max_dist(float value);
|
||||
|
||||
Ref<PackedScene> get_effect();
|
||||
void set_effect(Ref<PackedScene> value);
|
||||
|
||||
Vector3 get_effect_offset();
|
||||
void set_effect_offset(Vector3 value);
|
||||
|
||||
void send(const Ref<WorldSpellData> &data, const Ref<SpellCastInfo> &info);
|
||||
|
||||
WorldSpell();
|
||||
~WorldSpell();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
NodePath _body_path;
|
||||
Node *_body;
|
||||
|
||||
int _data_id;
|
||||
Ref<WorldSpellData> _data;
|
||||
Ref<SpellCastInfo> _spell_cast_info;
|
||||
|
||||
SpellEnums::ColliderType _collider_type;
|
||||
Vector3 _collider_box_extents;
|
||||
float _collider_sphere_radius;
|
||||
|
||||
SpellEnums::TargetType _target_type;
|
||||
int _target_bone_id;
|
||||
|
||||
bool _move;
|
||||
float _movement_speed;
|
||||
Vector3 _movement_dir;
|
||||
|
||||
float _max_dist;
|
||||
|
||||
Ref<PackedScene> _effect;
|
||||
Vector3 _effect_offset;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,179 +0,0 @@
|
||||
/*
|
||||
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 "world_spell_data.h"
|
||||
|
||||
int WorldSpellData::get_id() const {
|
||||
return _id;
|
||||
}
|
||||
void WorldSpellData::set_id(const int value) {
|
||||
_id = value;
|
||||
}
|
||||
|
||||
SpellEnums::ColliderType WorldSpellData::get_collider_type() const {
|
||||
return _collider_type;
|
||||
}
|
||||
void WorldSpellData::set_collider_type(const SpellEnums::ColliderType value) {
|
||||
_collider_type = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpellData::get_collider_box_extents() const {
|
||||
return _collider_box_extents;
|
||||
}
|
||||
void WorldSpellData::set_collider_box_extents(const Vector3 &value) {
|
||||
_collider_box_extents = value;
|
||||
}
|
||||
|
||||
float WorldSpellData::get_collider_sphere_radius() const {
|
||||
return _collider_sphere_radius;
|
||||
}
|
||||
void WorldSpellData::set_collider_sphere_radius(const float value) {
|
||||
_collider_sphere_radius = value;
|
||||
}
|
||||
|
||||
SpellEnums::TargetType WorldSpellData::get_target_type() const {
|
||||
return _target_type;
|
||||
}
|
||||
void WorldSpellData::set_target_type(const SpellEnums::TargetType value) {
|
||||
_target_type = value;
|
||||
}
|
||||
|
||||
int WorldSpellData::get_target_bone_id() const {
|
||||
return _target_bone_id;
|
||||
}
|
||||
void WorldSpellData::set_target_bone_id(const int value) {
|
||||
_target_bone_id = value;
|
||||
}
|
||||
|
||||
bool WorldSpellData::get_move() const {
|
||||
return _move;
|
||||
}
|
||||
void WorldSpellData::set_move(const bool value) {
|
||||
_move = value;
|
||||
}
|
||||
|
||||
float WorldSpellData::get_movement_speed() const {
|
||||
return _movement_speed;
|
||||
}
|
||||
void WorldSpellData::set_movement_speed(const float value) {
|
||||
_movement_speed = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpellData::get_movement_dir() const {
|
||||
return _movement_dir;
|
||||
}
|
||||
void WorldSpellData::set_movement_dir(const Vector3 &value) {
|
||||
_movement_dir = value;
|
||||
}
|
||||
|
||||
float WorldSpellData::get_max_dist() const {
|
||||
return _max_dist;
|
||||
}
|
||||
void WorldSpellData::set_max_dist(const float value) {
|
||||
_max_dist = value;
|
||||
}
|
||||
|
||||
Ref<PackedScene> WorldSpellData::get_effect() {
|
||||
return _effect;
|
||||
}
|
||||
void WorldSpellData::set_effect(const Ref<PackedScene> &value) {
|
||||
_effect = value;
|
||||
}
|
||||
|
||||
Vector3 WorldSpellData::get_effect_offset() const {
|
||||
return _effect_offset;
|
||||
}
|
||||
void WorldSpellData::set_effect_offset(const Vector3 &value) {
|
||||
_effect_offset = value;
|
||||
}
|
||||
|
||||
WorldSpellData::WorldSpellData() {
|
||||
_id = 0;
|
||||
|
||||
_collider_type = SpellEnums::COLLIDER_TYPE_NONE;
|
||||
|
||||
_collider_sphere_radius = 1;
|
||||
|
||||
_target_type = SpellEnums::TARGET_TYPE_NONE;
|
||||
_target_bone_id = 0;
|
||||
|
||||
_move = true;
|
||||
_movement_speed = 10;
|
||||
|
||||
_max_dist = 400;
|
||||
}
|
||||
|
||||
WorldSpellData::~WorldSpellData() {
|
||||
_effect.unref();
|
||||
}
|
||||
|
||||
void WorldSpellData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_id"), &WorldSpellData::get_id);
|
||||
ClassDB::bind_method(D_METHOD("set_id", "value"), &WorldSpellData::set_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_type"), &WorldSpellData::get_collider_type);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_type", "value"), &WorldSpellData::set_collider_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_COLLIDER_TYPE), "set_collider_type", "get_collider_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_box_extents"), &WorldSpellData::get_collider_box_extents);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_box_extents", "value"), &WorldSpellData::set_collider_box_extents);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collider_box_extents"), "set_collider_box_extents", "get_collider_box_extents");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_collider_sphere_radius"), &WorldSpellData::get_collider_sphere_radius);
|
||||
ClassDB::bind_method(D_METHOD("set_collider_sphere_radius", "value"), &WorldSpellData::set_collider_sphere_radius);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "collider_sphere_radius"), "set_collider_sphere_radius", "get_collider_sphere_radius");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_type"), &WorldSpellData::get_target_type);
|
||||
ClassDB::bind_method(D_METHOD("set_target_type", "value"), &WorldSpellData::set_target_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_type", PROPERTY_HINT_ENUM, SpellEnums::BINDING_STRING_TARGET_TYPE), "set_target_type", "get_target_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_target_bone_id"), &WorldSpellData::get_target_bone_id);
|
||||
ClassDB::bind_method(D_METHOD("set_target_bone_id", "value"), &WorldSpellData::set_target_bone_id);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "target_bone_id"), "set_target_bone_id", "get_target_bone_id");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_move"), &WorldSpellData::get_move);
|
||||
ClassDB::bind_method(D_METHOD("set_move", "value"), &WorldSpellData::set_move);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "move"), "set_move", "get_move");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_movement_speed"), &WorldSpellData::get_movement_speed);
|
||||
ClassDB::bind_method(D_METHOD("set_movement_speed", "value"), &WorldSpellData::set_movement_speed);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "movement_speed"), "set_movement_speed", "get_movement_speed");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_movement_dir"), &WorldSpellData::get_movement_dir);
|
||||
ClassDB::bind_method(D_METHOD("set_movement_dir", "value"), &WorldSpellData::set_movement_dir);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "movement_dir"), "set_movement_dir", "get_movement_dir");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_max_dist"), &WorldSpellData::get_max_dist);
|
||||
ClassDB::bind_method(D_METHOD("set_max_dist", "value"), &WorldSpellData::set_max_dist);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::REAL, "max_dist"), "set_max_dist", "get_max_dist");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_effect"), &WorldSpellData::get_effect);
|
||||
ClassDB::bind_method(D_METHOD("set_effect", "value"), &WorldSpellData::set_effect);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "effect", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_effect", "get_effect");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_effect_offset"), &WorldSpellData::get_effect_offset);
|
||||
ClassDB::bind_method(D_METHOD("set_effect_offset", "value"), &WorldSpellData::set_effect_offset);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "effect_offset"), "set_effect_offset", "get_effect_offset");
|
||||
}
|
@ -1,99 +0,0 @@
|
||||
/*
|
||||
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 WORLD_SPELL_DATA_H
|
||||
#define WORLD_SPELL_DATA_H
|
||||
|
||||
#include "core/resource.h"
|
||||
|
||||
#include "core/vector.h"
|
||||
#include "scene/resources/packed_scene.h"
|
||||
|
||||
#include "../spell_enums.h"
|
||||
|
||||
class WorldSpellData : public Resource {
|
||||
GDCLASS(WorldSpellData, Resource);
|
||||
|
||||
public:
|
||||
int get_id() const;
|
||||
void set_id(const int value);
|
||||
|
||||
SpellEnums::ColliderType get_collider_type() const;
|
||||
void set_collider_type(const SpellEnums::ColliderType value);
|
||||
|
||||
Vector3 get_collider_box_extents() const;
|
||||
void set_collider_box_extents(const Vector3 &value);
|
||||
|
||||
float get_collider_sphere_radius() const;
|
||||
void set_collider_sphere_radius(const float value);
|
||||
|
||||
SpellEnums::TargetType get_target_type() const;
|
||||
void set_target_type(const SpellEnums::TargetType value);
|
||||
|
||||
int get_target_bone_id() const;
|
||||
void set_target_bone_id(const int value);
|
||||
|
||||
bool get_move() const;
|
||||
void set_move(const bool value);
|
||||
|
||||
float get_movement_speed() const;
|
||||
void set_movement_speed(const float value);
|
||||
|
||||
Vector3 get_movement_dir() const;
|
||||
void set_movement_dir(const Vector3 &value);
|
||||
|
||||
float get_max_dist() const;
|
||||
void set_max_dist(const float value);
|
||||
|
||||
Ref<PackedScene> get_effect();
|
||||
void set_effect(const Ref<PackedScene> &value);
|
||||
|
||||
Vector3 get_effect_offset() const;
|
||||
void set_effect_offset(const Vector3 &value);
|
||||
|
||||
WorldSpellData();
|
||||
~WorldSpellData();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int _id;
|
||||
|
||||
SpellEnums::ColliderType _collider_type;
|
||||
Vector3 _collider_box_extents;
|
||||
float _collider_sphere_radius;
|
||||
|
||||
SpellEnums::TargetType _target_type;
|
||||
int _target_bone_id;
|
||||
|
||||
bool _move;
|
||||
float _movement_speed;
|
||||
Vector3 _movement_dir;
|
||||
|
||||
float _max_dist;
|
||||
|
||||
Ref<PackedScene> _effect;
|
||||
Vector3 _effect_offset;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user