More bindings cleanup.

This commit is contained in:
Relintai 2019-10-19 12:47:30 +02:00
parent e463b32f87
commit 056f9e0358
7 changed files with 28 additions and 26 deletions

View File

@ -113,7 +113,7 @@ void DataManager::add_spell(Ref<Spell> spell) {
ERR_FAIL_COND(!spell.is_valid()); ERR_FAIL_COND(!spell.is_valid());
_spells.push_back(spell); _spells.push_back(spell);
_spell_map.set(spell->get_spell_id(), spell); _spell_map.set(spell->get_id(), spell);
} }
void DataManager::add_aura(Ref<Aura> aura) { void DataManager::add_aura(Ref<Aura> aura) {

View File

@ -3,11 +3,11 @@
#include "aura.h" #include "aura.h"
#include "craft_recipe.h" #include "craft_recipe.h"
int Spell::get_spell_id() { int Spell::get_id() {
return _spell_id; return _id;
} }
void Spell::set_spell_id(int value) { void Spell::set_id(int value) {
_spell_id = value; _id = value;
} }
int Spell::get_spell_type() { int Spell::get_spell_type() {
@ -750,7 +750,7 @@ String Spell::get_description(int level) {
Spell::Spell() { Spell::Spell() {
PLAYER_HIT_RADIUS = (float)0.5; PLAYER_HIT_RADIUS = (float)0.5;
_spell_id = 1; _id = 1;
_spell_type = SpellEnums::SPELL_TYPE_NONE; _spell_type = SpellEnums::SPELL_TYPE_NONE;
_spell_category = SpellEnums::SPELL_CATEGORY_NORMAL; _spell_category = SpellEnums::SPELL_CATEGORY_NORMAL;
@ -868,9 +868,10 @@ void Spell::_bind_methods() {
ClassDB::bind_method(D_METHOD("_handle_spell_damage", "info"), &Spell::_handle_spell_damage); ClassDB::bind_method(D_METHOD("_handle_spell_damage", "info"), &Spell::_handle_spell_damage);
//Properties //Properties
ClassDB::bind_method(D_METHOD("get_spell_id"), &Spell::get_spell_id); ClassDB::bind_method(D_METHOD("get_id"), &Spell::get_id);
ClassDB::bind_method(D_METHOD("set_spell_id", "value"), &Spell::set_spell_id); ClassDB::bind_method(D_METHOD("set_id", "value"), &Spell::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_id"), "set_spell_id", "get_spell_id"); ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ADD_PROPERTY(PropertyInfo(Variant::INT, "spell_id"), "set_id", "get_id");//REMOVE
ClassDB::bind_method(D_METHOD("get_spell_type"), &Spell::get_spell_type); ClassDB::bind_method(D_METHOD("get_spell_type"), &Spell::get_spell_type);
ClassDB::bind_method(D_METHOD("set_spell_type", "value"), &Spell::set_spell_type); ClassDB::bind_method(D_METHOD("set_spell_type", "value"), &Spell::set_spell_type);

View File

@ -83,8 +83,8 @@ class Spell : public Resource {
GDCLASS(Spell, Resource); GDCLASS(Spell, Resource);
public: public:
int get_spell_id(); int get_id();
void set_spell_id(int value); void set_id(int value);
int get_spell_type(); int get_spell_type();
void set_spell_type(int value); void set_spell_type(int value);
@ -342,7 +342,7 @@ protected:
static void _bind_methods(); static void _bind_methods();
private: private:
int _spell_id; int _id;
int _spell_type; int _spell_type;
SpellEnums::SpellCategory _spell_category; SpellEnums::SpellCategory _spell_category;

View File

@ -2,11 +2,11 @@
#include "../../data/aura.h" #include "../../data/aura.h"
int CharacterSpec::get_spec_id() { int CharacterSpec::get_id() {
return _spec_id; return _id;
} }
void CharacterSpec::set_spec_id(int value) { void CharacterSpec::set_id(int value) {
_spec_id = value; _id = value;
} }
String CharacterSpec::get_text_name() { String CharacterSpec::get_text_name() {
@ -62,7 +62,7 @@ Ref<Aura> CharacterSpec::get_talent(const int row_index, const int culomn, const
CharacterSpec::CharacterSpec() { CharacterSpec::CharacterSpec() {
_spec_id = 0; _id = 0;
} }
CharacterSpec::~CharacterSpec() { CharacterSpec::~CharacterSpec() {
@ -70,9 +70,10 @@ CharacterSpec::~CharacterSpec() {
} }
void CharacterSpec::_bind_methods() { void CharacterSpec::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_spec_id"), &CharacterSpec::get_spec_id); ClassDB::bind_method(D_METHOD("get_id"), &CharacterSpec::get_id);
ClassDB::bind_method(D_METHOD("set_spec_id", "value"), &CharacterSpec::set_spec_id); ClassDB::bind_method(D_METHOD("set_id", "value"), &CharacterSpec::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "spec_id"), "set_spec_id", "get_spec_id"); ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ADD_PROPERTY(PropertyInfo(Variant::INT, "spec_id"), "set_id", "get_id");//REMOVE
ClassDB::bind_method(D_METHOD("get_text_name"), &CharacterSpec::get_text_name); ClassDB::bind_method(D_METHOD("get_text_name"), &CharacterSpec::get_text_name);
ClassDB::bind_method(D_METHOD("set_text_name", "value"), &CharacterSpec::set_text_name); ClassDB::bind_method(D_METHOD("set_text_name", "value"), &CharacterSpec::set_text_name);

View File

@ -14,8 +14,8 @@ class CharacterSpec : public Resource {
GDCLASS(CharacterSpec, Resource); GDCLASS(CharacterSpec, Resource);
public: public:
int get_spec_id(); int get_id();
void set_spec_id(int value); void set_id(int value);
String get_text_name(); String get_text_name();
void set_text_name(String value); void set_text_name(String value);
@ -38,7 +38,7 @@ protected:
static void _bind_methods(); static void _bind_methods();
private: private:
int _spec_id; int _id;
String _text_name; String _text_name;
Vector<Ref<TalentRowData> > _rows; Vector<Ref<TalentRowData> > _rows;
}; };

View File

@ -316,7 +316,7 @@ void EntityClassData::start_casting(int spell_id, Entity *caster, float spellSca
return; return;
} }
if (s->get_spell_id() == spell_id) { if (s->get_id() == spell_id) {
s->sstart_casting_simple(caster, spellScale); s->sstart_casting_simple(caster, spellScale);
return; return;
} }

View File

@ -510,7 +510,7 @@ Dictionary Entity::_to_dict() {
Dictionary known_spells; Dictionary known_spells;
for (int i = 0; i < _s_spells.size(); ++i) { for (int i = 0; i < _s_spells.size(); ++i) {
known_spells[i] = _s_spells.get(i)->get_spell_id(); known_spells[i] = _s_spells.get(i)->get_id();
} }
dict["known_spells"] = known_spells; dict["known_spells"] = known_spells;
@ -3457,7 +3457,7 @@ void Entity::slearn_spell(int id) {
for (int i = 0; i < cd->get_num_spells(); ++i) { for (int i = 0; i < cd->get_num_spells(); ++i) {
Ref<Spell> sp = cd->get_spell(i); Ref<Spell> sp = cd->get_spell(i);
if (sp->get_spell_id() == id) { if (sp->get_id() == id) {
adds_spell(sp); adds_spell(sp);
sets_free_spell_points(_s_free_spell_points - 1); sets_free_spell_points(_s_free_spell_points - 1);
return; return;