mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
-Moved EntityCreateInfo into it's own file.
-Also registered it.
This commit is contained in:
parent
d06a6615a0
commit
b485b4d114
4
SCsub
4
SCsub
@ -62,3 +62,7 @@ module_env.add_source_files(env.modules_sources,"drag_and_drop/es_drag_and_drop.
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"skeleton/character_skeleton.cpp")
|
||||
|
||||
module_env.add_source_files(env.modules_sources,"utility/entity_create_info.cpp")
|
||||
|
||||
|
||||
|
||||
|
@ -24,85 +24,14 @@
|
||||
|
||||
#include "../skeleton/character_skeleton.h"
|
||||
|
||||
#include "../utility/entity_create_info.h"
|
||||
|
||||
class CharacterClass;
|
||||
class AuraData;
|
||||
class Spell;
|
||||
class SpellDamageInfo;
|
||||
class SpellCastInfo;
|
||||
|
||||
class EntityCreateInfo : public Object {
|
||||
GDCLASS(EntityCreateInfo, Object);
|
||||
|
||||
public:
|
||||
int get_guid() { return _guid; }
|
||||
void set_guid(int value) { _guid = value; }
|
||||
|
||||
EntityEnums::EntityType get_entity_type() { return _entity_type; }
|
||||
void set_entity_type(EntityEnums::EntityType value) { _entity_type = value; }
|
||||
|
||||
String get_player_name() { return _player_name; }
|
||||
void set_player_name(String value) { _player_name = value; }
|
||||
|
||||
int get_level() { return _level; }
|
||||
void set_level(int value) { _level = value; }
|
||||
|
||||
int get_xp() { return _xp; }
|
||||
void set_xp(int value) { _xp = value; }
|
||||
|
||||
Ref<CharacterClass> get_character_class() { return _character_class; }
|
||||
void set_character_class(Ref<CharacterClass> value) { _character_class = value; }
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_type"), &EntityCreateInfo::get_entity_type);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_type", "value"), &EntityCreateInfo::set_entity_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_type", PROPERTY_HINT_ENUM, "None, Player, AI, Mob"), "set_entity_type", "get_entity_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_player_name"), &EntityCreateInfo::get_player_name);
|
||||
ClassDB::bind_method(D_METHOD("set_player_name", "value"), &EntityCreateInfo::set_player_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "player_name"), "set_player_name", "get_player_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level"), &EntityCreateInfo::get_level);
|
||||
ClassDB::bind_method(D_METHOD("set_level", "value"), &EntityCreateInfo::set_level);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "level"), "set_level", "get_level");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_xp"), &EntityCreateInfo::get_xp);
|
||||
ClassDB::bind_method(D_METHOD("set_xp", "value"), &EntityCreateInfo::set_xp);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "xp"), "set_xp", "get_xp");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_character_class"), &EntityCreateInfo::get_character_class);
|
||||
ClassDB::bind_method(D_METHOD("set_character_class", "value"), &EntityCreateInfo::set_character_class);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "character_class", PROPERTY_HINT_RESOURCE_TYPE, "CharacterClass"), "set_character_class", "get_character_class");
|
||||
}
|
||||
|
||||
private:
|
||||
int _guid;
|
||||
EntityEnums::EntityType _entity_type;
|
||||
String _player_name;
|
||||
int _level;
|
||||
int _xp;
|
||||
|
||||
Ref<CharacterClass> _character_class;
|
||||
};
|
||||
|
||||
struct EntitySpellCastInfo {
|
||||
bool s_casting;
|
||||
int s_spellId;
|
||||
int s_spell_cast_game_object_guid;
|
||||
float s_current_cast_time;
|
||||
float s_cast_time;
|
||||
float s_spell_scale;
|
||||
bool c_casting;
|
||||
int c_spell_id;
|
||||
float c_current_cast_time;
|
||||
float c_cast_time;
|
||||
String c_spell_name;
|
||||
float anim_reduction;
|
||||
//Entity *s_target;
|
||||
//Entity *c_target;
|
||||
int s_target_guid;
|
||||
//Entity *owner;
|
||||
};
|
||||
class EntityCreateInfo;
|
||||
|
||||
enum SpellCastDataSignals {
|
||||
CastFailed,
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
#include "skeleton/character_skeleton.h"
|
||||
|
||||
#include "utility/entity_create_info.h"
|
||||
|
||||
void register_entity_spell_system_types() {
|
||||
|
||||
//data
|
||||
@ -95,6 +97,7 @@ void register_entity_spell_system_types() {
|
||||
ClassDB::register_class<AuraTriggerData>();
|
||||
|
||||
//entities
|
||||
ClassDB::register_class<EntityCreateInfo>();
|
||||
ClassDB::register_class<Entity>();
|
||||
ClassDB::register_class<Player>();
|
||||
ClassDB::register_class<Mob>();
|
||||
|
1
utility/entity_create_info.cpp
Normal file
1
utility/entity_create_info.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "entity_create_info.h"
|
63
utility/entity_create_info.h
Normal file
63
utility/entity_create_info.h
Normal file
@ -0,0 +1,63 @@
|
||||
#ifndef ENTITY_CREATE_INFO_H
|
||||
#define ENTITY_CREATE_INFO_H
|
||||
|
||||
#include "core/ustring.h"
|
||||
#include "../entity_enums.h"
|
||||
#include "../data/character.h"
|
||||
|
||||
class EntityCreateInfo : public Object {
|
||||
GDCLASS(EntityCreateInfo, Object);
|
||||
|
||||
public:
|
||||
int get_guid() { return _guid; }
|
||||
void set_guid(int value) { _guid = value; }
|
||||
|
||||
EntityEnums::EntityType get_entity_type() { return _entity_type; }
|
||||
void set_entity_type(EntityEnums::EntityType value) { _entity_type = value; }
|
||||
|
||||
String get_player_name() { return _player_name; }
|
||||
void set_player_name(String value) { _player_name = value; }
|
||||
|
||||
int get_level() { return _level; }
|
||||
void set_level(int value) { _level = value; }
|
||||
|
||||
int get_xp() { return _xp; }
|
||||
void set_xp(int value) { _xp = value; }
|
||||
|
||||
Ref<CharacterClass> get_character_class() { return _character_class; }
|
||||
void set_character_class(Ref<CharacterClass> value) { _character_class = value; }
|
||||
|
||||
protected:
|
||||
static void _bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("get_entity_type"), &EntityCreateInfo::get_entity_type);
|
||||
ClassDB::bind_method(D_METHOD("set_entity_type", "value"), &EntityCreateInfo::set_entity_type);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_type", PROPERTY_HINT_ENUM, "None, Player, AI, Mob"), "set_entity_type", "get_entity_type");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_player_name"), &EntityCreateInfo::get_player_name);
|
||||
ClassDB::bind_method(D_METHOD("set_player_name", "value"), &EntityCreateInfo::set_player_name);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "player_name"), "set_player_name", "get_player_name");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_level"), &EntityCreateInfo::get_level);
|
||||
ClassDB::bind_method(D_METHOD("set_level", "value"), &EntityCreateInfo::set_level);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "level"), "set_level", "get_level");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_xp"), &EntityCreateInfo::get_xp);
|
||||
ClassDB::bind_method(D_METHOD("set_xp", "value"), &EntityCreateInfo::set_xp);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "xp"), "set_xp", "get_xp");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_character_class"), &EntityCreateInfo::get_character_class);
|
||||
ClassDB::bind_method(D_METHOD("set_character_class", "value"), &EntityCreateInfo::set_character_class);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "character_class", PROPERTY_HINT_RESOURCE_TYPE, "CharacterClass"), "set_character_class", "get_character_class");
|
||||
}
|
||||
|
||||
private:
|
||||
int _guid;
|
||||
EntityEnums::EntityType _entity_type;
|
||||
String _player_name;
|
||||
int _level;
|
||||
int _xp;
|
||||
|
||||
Ref<CharacterClass> _character_class;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user