Ported a few of Entity's virtual methods from BrokenSeals. Started reworking spawning, and Entity initialization. Moved the singletons into a new singletons folder, and renamed the profile_manager folder to profiles.

This commit is contained in:
Relintai 2020-02-03 11:56:52 +01:00
parent 1704caafc8
commit 5ea00de13e
35 changed files with 469 additions and 166 deletions

18
SCsub
View File

@ -109,18 +109,18 @@ sources = [
"formations/ai_formation.cpp",
"profile_manager/input/input_profile_modifier.cpp",
"profile_manager/input/input_profile_modifier_entry.cpp",
"profile_manager/input/input_profile.cpp",
"profiles/input/input_profile_modifier.cpp",
"profiles/input/input_profile_modifier_entry.cpp",
"profiles/input/input_profile.cpp",
"profile_manager/actionbar/action_bar_button_entry.cpp",
"profile_manager/actionbar/action_bar_entry.cpp",
"profile_manager/actionbar/action_bar_profile.cpp",
"profiles/actionbar/action_bar_button_entry.cpp",
"profiles/actionbar/action_bar_entry.cpp",
"profiles/actionbar/action_bar_profile.cpp",
"profile_manager/class_profile.cpp",
"profile_manager/profile_manager.cpp",
"profiles/class_profile.cpp",
"autoloads/entity_data_manager.cpp",
"singletons/profile_manager.cpp",
"singletons/entity_data_manager.cpp",
]
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':

View File

@ -1061,7 +1061,6 @@ void Aura::_sdeapply(Ref<AuraData> data) {
stat->remove_modifier(_id);
}
if (_add_states != 0) {
for (int i = 0; i < EntityEnums::ENTITY_STATE_TYPE_INDEX_MAX; ++i) {
int t = 1 << i;

View File

@ -24,6 +24,8 @@ SOFTWARE.
#include "item_template.h"
#include "../singletons/entity_data_manager.h"
Ref<ItemTemplate> ItemInstance::get_item_template() const {
return _item_template;
}

View File

@ -30,8 +30,6 @@ SOFTWARE.
#include "../item_enums.h"
#include "item_stat_modifier.h"
#include "../autoloads/entity_data_manager.h"
class ItemTemplate;
class ItemInstance : public Reference {

View File

@ -23,6 +23,7 @@ SOFTWARE.
#include "aura_data.h"
#include "../../data/aura.h"
#include "../../singletons/entity_data_manager.h"
#include "../entity.h"
float AuraData::get_damage_count() {
@ -306,12 +307,10 @@ void AuraData::_from_dict(const Dictionary &dict) {
_aura_group = dict.get("aura_group", 0);
int aura_id = dict.get("aura_id", 0);
if (EntityDataManager::get_instance() != NULL) {
Ref<Aura> aura = EntityDataManager::get_instance()->get_aura(aura_id);
Ref<Aura> aura = EntityDataManager::get_instance()->get_aura(aura_id);
if (aura.is_valid()) {
_aura = aura;
}
if (aura.is_valid()) {
_aura = aura;
}
_is_timed = dict.get("is_timed", true);

View File

@ -22,6 +22,9 @@ SOFTWARE.
#include "entity.h"
#include "../singletons/entity_data_manager.h"
#include "../singletons/profile_manager.h"
#include "../data/aura.h"
#include "../data/spell.h"
#include "../entities/auras/aura_data.h"
@ -60,6 +63,43 @@ Node *Entity::get_character_skeleton() {
return _character_skeleton;
}
//GUID
int Entity::gets_guid() {
return _s_guid;
}
void Entity::sets_guid(int value) {
_s_guid = value;
VRPC(setc_guid, value);
}
int Entity::getc_guid() {
return _c_guid;
}
void Entity::setc_guid(int value) {
_c_guid = value;
set_name(String::num(_c_guid));
}
//EntityPlayerType
int Entity::gets_entity_player_type() {
return _s_entity_player_type;
}
void Entity::sets_entity_player_type(int value) {
_s_entity_player_type = value;
VRPC(setc_entity_player_type, value);
}
int Entity::getc_entity_player_type() {
return _c_entity_player_type;
}
void Entity::setc_entity_player_type(int value) {
_c_entity_player_type = value;
}
//EntityType
EntityEnums::EntityType Entity::gets_entity_type() {
return _s_entity_type;
}
@ -247,7 +287,7 @@ void Entity::sets_entity_data(Ref<EntityData> value) {
_s_entity_data = value;
setup();
//setup();
emit_signal("sentity_data_changed", value);
@ -294,13 +334,35 @@ void Entity::setc_seed(int value) {
_c_seed = value;
}
void Entity::setup() {
void Entity::setup(Ref<EntityCreateInfo> info) {
ERR_FAIL_COND(!info.is_valid());
sets_guid(info->get_guid());
sets_entity_player_type(info->get_entity_player_type());
if (info->get_network_owner() != 0 && get_tree()->is_network_server())
set_network_master(info->get_network_owner());
sets_original_entity_controller(info->get_entity_controller());
sets_entity_controller(info->get_entity_controller());
sets_entity_name(info->get_entity_name());
sets_entity_data(info->get_entity_data());
sets_entity_data(info->get_entity_data());
if (!info->get_serialized_data().empty()) {
from_dict(info->get_serialized_data());
}
if (has_method("_setup")) {
call_multilevel("_setup");
call_multilevel("_setup", info);
}
}
void Entity::_setup() {
void Entity::_setup(Ref<EntityCreateInfo> info) {
if (!_s_entity_data.is_valid())
return;
@ -337,6 +399,14 @@ void Entity::_setup() {
//SEND
}
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY) {
setup_actionbars();
}
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_AI) {
sets_entity_name(_s_entity_data->get_name());
}
return;
}
@ -419,6 +489,17 @@ void Entity::_setup() {
if (!Engine::get_singleton()->is_editor_hint())
set_process(_s_entity_data.is_valid());
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY) {
setup_actionbars();
}
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_AI) {
sets_entity_name(_s_entity_data->get_name());
}
slevelup(info->get_level() - 1);
sets_xp(info->get_xp());
}
void Entity::setup_actionbars() {
@ -1104,25 +1185,6 @@ void Entity::_from_dict(const Dictionary &dict) {
sets_entity_data_id(edi);
}
void Entity::initialize(Ref<EntityCreateInfo> info) {
ERR_FAIL_COND(!info.is_valid());
_s_entity_name = info->get_entity_name();
_c_entity_name = info->get_entity_name();
sets_original_entity_controller(info->get_entity_controller());
sets_entity_controller(info->get_entity_controller());
//setc_entity_controller(info->get_entity_type());
sets_level(info->get_level());
setc_level(info->get_level());
sets_xp(info->get_xp());
setc_xp(info->get_xp());
sets_entity_data(info->get_entity_data());
}
////// Stat System //////
bool Entity::gets_is_dead() {
@ -2129,6 +2191,9 @@ void Entity::addc_xp(int value) {
}
void Entity::slevelup(int value) {
if (value <= 0)
return;
if (_s_level == EntityEnums::MAX_LEVEL)
return;
@ -5277,6 +5342,9 @@ Entity::Entity() {
_s_type = 0;
_c_type = 0;
_s_entity_player_type = 0;
_c_entity_player_type = 0;
_s_gender = EntityEnums::GENDER_MALE;
_c_gender = EntityEnums::GENDER_MALE;
@ -5606,6 +5674,146 @@ Entity::~Entity() {
_physics_process_scis.clear();
}
void Entity::_scraft(int id) {
if (!hass_craft_recipe_id(id))
return;
Ref<CraftRecipe> recipe = gets_craft_recipe_id(id);
if (!recipe.is_valid())
return;
for (int i = 0; i < recipe->get_required_tools_count(); ++i) {
Ref<CraftRecipeHelper> mat = recipe->get_required_tool(i);
if (!mat.is_valid())
continue;
if (!gets_bag()->has_item(mat->get_item(), mat->get_count()))
return;
}
for (int i = 0; i < recipe->get_required_materials_count(); ++i) {
Ref<CraftRecipeHelper> mat = recipe->get_required_material(i);
if (!mat.is_valid())
continue;
if (!gets_bag()->has_item(mat->get_item(), mat->get_count()))
return;
}
//ok, player has everything
for (int i = 0; i < recipe->get_required_materials_count(); ++i) {
Ref<CraftRecipeHelper> mat = recipe->get_required_material(i);
if (!mat.is_valid())
continue;
gets_bag()->remove_items(mat->get_item(), mat->get_count());
}
Ref<ItemInstance> item = recipe->get_item()->get_item()->create_item_instance();
gets_bag()->add_item(item);
}
void Entity::_son_xp_gained(int value) {
if (EntityDataManager::get_instance()->get_xp_data()->can_level_up(gets_level())) {
return;
}
int xpr = EntityDataManager::get_instance()->get_xp_data()->get_xp(gets_level());
if (xpr <= gets_xp()) {
slevelup(1);
sets_xp(0);
}
}
void Entity::_son_level_up(int level) {
if (!gets_entity_data().is_valid())
return;
Ref<EntityClassData> ecd = gets_entity_data()->get_entity_class_data();
if (!ecd.is_valid())
return;
sets_free_spell_points(gets_free_spell_points() + ecd->get_spell_points_per_level() * level);
sets_free_talent_points(gets_free_talent_points() + level);
for (int i = 0; i < Stat::MAIN_STAT_ID_COUNT; ++i) {
int st = gets_entity_data()->get_entity_class_data()->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_level() - level, gets_level());
int statid = i + Stat::MAIN_STAT_ID_START;
Ref<Stat> stat = get_stat_int(statid);
Ref<StatModifier> sm = stat->get_modifier(0);
sm->set_base_mod(sm->get_base_mod() + st);
}
}
void Entity::_moved() {
if (sis_casting())
sfail_cast();
}
void Entity::_con_target_changed(Entity *entity, Entity *old_target) {
if (ObjectDB::instance_validate(old_target))
old_target->onc_untargeted();
if (ObjectDB::instance_validate(getc_target())) {
getc_target()->onc_targeted();
if (canc_interact())
crequest_interact();
}
}
void Entity::_son_death() {
//only if mob
/*
if dead:
return
if starget == null:
queue_free()
return
#warning-ignore:unused_variable
for i in range(sget_aura_count()):
sremove_aura(sget_aura(0))
dead = true
var ldiff : float = slevel - starget.slevel + 10.0
if ldiff < 0:
ldiff = 0
if ldiff > 15:
ldiff = 15
ldiff /= 10.0
starget.adds_xp(int(5.0 * slevel * ldiff))
starget = null
sentity_interaction_type = EntityEnums.ENITIY_INTERACTION_TYPE_LOOT
ai_state = EntityEnums.AI_STATE_OFF
anim_node_state_machine.travel("dead")
# set_process(false)
set_physics_process(false)
*/
}
void Entity::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_INSTANCED: {
@ -5728,15 +5936,15 @@ void Entity::_bind_methods() {
ADD_SIGNAL(MethodInfo("cskill_changed", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::OBJECT, "skill", PROPERTY_HINT_RESOURCE_TYPE, "EntitySkill")));
//setup
BIND_VMETHOD(MethodInfo("_setup"));
BIND_VMETHOD(MethodInfo("_setup", PropertyInfo(Variant::OBJECT, "info", PROPERTY_HINT_RESOURCE_TYPE, "EntityCreateInfo")));
//Windows
ADD_SIGNAL(MethodInfo("onc_open_loot_winow_request"));
ADD_SIGNAL(MethodInfo("onc_open_container_winow_request"));
ADD_SIGNAL(MethodInfo("onc_open_vendor_winow_request"));
ClassDB::bind_method(D_METHOD("setup"), &Entity::setup);
ClassDB::bind_method(D_METHOD("_setup"), &Entity::_setup);
ClassDB::bind_method(D_METHOD("setup", "info"), &Entity::setup);
ClassDB::bind_method(D_METHOD("_setup", "info"), &Entity::_setup);
ClassDB::bind_method(D_METHOD("setup_actionbars"), &Entity::setup_actionbars);
//binds
@ -6051,6 +6259,22 @@ void Entity::_bind_methods() {
ClassDB::bind_method(D_METHOD("setc_entity_data_id", "value"), &Entity::setc_entity_data_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_data_id"), "setc_entity_data_id", "getc_entity_data_id");
ClassDB::bind_method(D_METHOD("gets_entity_player_type"), &Entity::gets_entity_player_type);
ClassDB::bind_method(D_METHOD("sets_entity_player_type", "value"), &Entity::sets_entity_player_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "sentity_player_type"), "sets_entity_player_type", "gets_entity_player_type");
ClassDB::bind_method(D_METHOD("getc_entity_player_type"), &Entity::getc_entity_player_type);
ClassDB::bind_method(D_METHOD("setc_entity_player_type", "value"), &Entity::setc_entity_player_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "centity_player_type"), "setc_entity_player_type", "getc_entity_player_type");
ClassDB::bind_method(D_METHOD("gets_guid"), &Entity::gets_guid);
ClassDB::bind_method(D_METHOD("sets_guid", "value"), &Entity::sets_guid);
ADD_PROPERTY(PropertyInfo(Variant::INT, "sguid"), "sets_guid", "gets_guid");
ClassDB::bind_method(D_METHOD("getc_guid"), &Entity::getc_guid);
ClassDB::bind_method(D_METHOD("setc_guid", "value"), &Entity::setc_guid);
ADD_PROPERTY(PropertyInfo(Variant::INT, "cguid"), "setc_guid", "getc_guid");
ClassDB::bind_method(D_METHOD("gets_entity_type"), &Entity::gets_entity_type);
ClassDB::bind_method(D_METHOD("sets_entity_type", "value"), &Entity::sets_entity_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "sentity_type", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_TYPES), "sets_entity_type", "gets_entity_type");
@ -6140,8 +6364,6 @@ void Entity::_bind_methods() {
ClassDB::bind_method(D_METHOD("setc_entity_data", "value"), &Entity::setc_entity_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "centity_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityData"), "setc_entity_data", "getc_entity_data");
ClassDB::bind_method(D_METHOD("initialize", "entity_create_info"), &Entity::initialize);
ClassDB::bind_method(D_METHOD("get_health"), &Entity::get_health);
ClassDB::bind_method(D_METHOD("get_mana"), &Entity::get_mana);
ClassDB::bind_method(D_METHOD("get_rage"), &Entity::get_rage);

View File

@ -41,7 +41,6 @@ SOFTWARE.
#include "./resources/entity_resource.h"
#include "stats/stat.h"
#include "../autoloads/entity_data_manager.h"
#include "../entity_enums.h"
#include "../utility/entity_create_info.h"
@ -50,15 +49,13 @@ SOFTWARE.
#include "../utility/cooldown.h"
#include "./data/entity_data_container.h"
#include "../profile_manager/actionbar/action_bar_profile.h"
#include "../profiles/actionbar/action_bar_profile.h"
#include "../profiles/input/input_profile.h"
#include "./ai/entity_ai.h"
#include "../data/aura_group.h"
#include "../profile_manager/input/input_profile.h"
#include "../profile_manager/profile_manager.h"
class EntityData;
class AuraData;
class Spell;
@ -191,8 +188,6 @@ class Entity : public Node {
GDCLASS(Entity, Node);
public:
void initialize(Ref<EntityCreateInfo> info);
//// Base ////
NodePath get_body_path();
@ -203,6 +198,20 @@ public:
void set_character_skeleton_path(NodePath value);
Node *get_character_skeleton();
//GUID
int gets_guid();
void sets_guid(int value);
int getc_guid();
void setc_guid(int value);
//EntityPlayerType
int gets_entity_player_type();
void sets_entity_player_type(int value);
int getc_entity_player_type();
void setc_entity_player_type(int value);
//EntityType
EntityEnums::EntityType gets_entity_type();
void sets_entity_type(EntityEnums::EntityType value);
@ -843,8 +852,8 @@ public:
String random_name();
void setup();
virtual void _setup();
void setup(Ref<EntityCreateInfo> info);
virtual void _setup(Ref<EntityCreateInfo> info);
void setup_actionbars();
//// AI ////
@ -938,6 +947,13 @@ public:
~Entity();
protected:
void _scraft(int id);
void _son_xp_gained(int value);
void _son_level_up(int level);
void _moved();
void _con_target_changed(Entity *entity, Entity *old_target);
void _son_death();
static void _bind_methods();
virtual void _notification(int p_what);
@ -963,6 +979,9 @@ private:
int _s_class_id;
int _c_class_id;
int _s_entity_player_type;
int _c_entity_player_type;
int _s_type;
int _c_type;
@ -1054,7 +1073,6 @@ private:
//// Targeting ////
int _s_target_guid;
Entity *_s_target;
Entity *_c_target;

View File

@ -22,6 +22,7 @@ SOFTWARE.
#include "entity_resource.h"
#include "../../singletons/entity_data_manager.h"
#include "../entity.h"
#include "../stats/stat.h"
#include "entity_resource_data.h"
@ -155,9 +156,7 @@ void EntityResource::receivec_update_string(String str) {
}
void EntityResource::resolve_references() {
if (EntityDataManager::get_instance() != NULL) {
_data = EntityDataManager::get_instance()->get_entity_resource(_data_id);
}
_data = EntityDataManager::get_instance()->get_entity_resource(_data_id);
}
Dictionary EntityResource::to_dict() {

View File

@ -22,7 +22,7 @@ SOFTWARE.
#include "entity_skill.h"
#include "../../autoloads/entity_data_manager.h"
#include "../../singletons/entity_data_manager.h"
Ref<EntitySkillData> EntitySkill::get_skill() {
return _skill;

View File

@ -22,6 +22,7 @@ SOFTWARE.
#include "entity_enums.h"
const String EntityEnums::BINDING_STRING_ENTITY_PLAYER_TYPES = "None,Player,Networked,AI,Display";
const String EntityEnums::BINDING_STRING_ENTITY_TYPES = "None,Creature,Totem,Idol,Humanoid,Mechanical,Beast,Dragonkin,Elemental,Ghost,Energy,Anomaly,Demon,Object";
const String EntityEnums::BINDING_STRING_ENTITY_CONTOLLER = "None,Player,AI";
const String EntityEnums::BINDING_STRING_ENTITY_FLAGS = "Untargetable,Hidden,Interactable,Hostile";
@ -35,6 +36,12 @@ const String EntityEnums::BINDING_STRING_ENTITY_GENDER = "Male,Female";
const String EntityEnums::BINDING_STRING_ENTITY_WINDOWS = "Loot,Container,Vendor";
void EntityEnums::_bind_methods() {
BIND_ENUM_CONSTANT(ENTITY_PLAYER_TYPE_NONE);
BIND_ENUM_CONSTANT(ENTITY_PLAYER_TYPE_PLAYER);
BIND_ENUM_CONSTANT(ENTITY_PLAYER_TYPE_NETWORKED);
BIND_ENUM_CONSTANT(ENTITY_PLAYER_TYPE_AI);
BIND_ENUM_CONSTANT(ENTITY_PLAYER_TYPE_DISPLAY);
BIND_ENUM_CONSTANT(ENITIY_TYPE_NONE);
BIND_ENUM_CONSTANT(ENITIY_TYPE_CREATURE);
BIND_ENUM_CONSTANT(ENITIY_TYPE_TOTEM);

View File

@ -30,6 +30,7 @@ class EntityEnums : public Object {
GDCLASS(EntityEnums, Object);
public:
static const String BINDING_STRING_ENTITY_PLAYER_TYPES;
static const String BINDING_STRING_ENTITY_TYPES;
static const String BINDING_STRING_ENTITY_CONTOLLER;
static const String BINDING_STRING_ENTITY_FLAGS;
@ -43,6 +44,14 @@ public:
static const String BINDING_STRING_ENTITY_GENDER;
static const String BINDING_STRING_ENTITY_WINDOWS;
enum EntityPlayerType {
ENTITY_PLAYER_TYPE_NONE,
ENTITY_PLAYER_TYPE_PLAYER,
ENTITY_PLAYER_TYPE_NETWORKED,
ENTITY_PLAYER_TYPE_AI,
ENTITY_PLAYER_TYPE_DISPLAY,
};
enum EntityType {
ENITIY_TYPE_NONE,
ENITIY_TYPE_CREATURE,
@ -263,6 +272,7 @@ protected:
static void _bind_methods();
};
VARIANT_ENUM_CAST(EntityEnums::EntityPlayerType);
VARIANT_ENUM_CAST(EntityEnums::EntityType);
VARIANT_ENUM_CAST(EntityEnums::EntityController);
VARIANT_ENUM_CAST(EntityEnums::EntityFlags);

View File

@ -24,6 +24,8 @@ SOFTWARE.
#include "../data/spell.h"
#include "../singletons/entity_data_manager.h"
//// SpellCastInfo ////
Entity *SpellCastInfo::get_caster() {
@ -162,12 +164,10 @@ void SpellCastInfo::resolve_references(Node *owner) {
_target = Object::cast_to<Entity>(owner->get_node_or_null(_target_path));
}
if (EntityDataManager::get_instance() != NULL) {
Ref<Spell> spell = EntityDataManager::get_instance()->get_spell(_spell_id);
Ref<Spell> spell = EntityDataManager::get_instance()->get_spell(_spell_id);
if (spell.is_valid()) {
_spell = spell;
}
if (spell.is_valid()) {
_spell = spell;
}
}

View File

@ -25,6 +25,7 @@ SOFTWARE.
#include "../data/aura.h"
#include "../data/spell.h"
#include "../entities/entity.h"
#include "../singletons/entity_data_manager.h"
bool SpellDamageInfo::get_immune() {
return _crit;
@ -167,12 +168,10 @@ void SpellDamageInfo::resolve_references(Node *owner) {
_dealer = Object::cast_to<Entity>(owner->get_node_or_null(_dealer_path));
_receiver = Object::cast_to<Entity>(owner->get_node_or_null(_receiver_path));
if (EntityDataManager::get_instance() != NULL) {
if (_damage_source_type == DAMAGE_SOURCE_SPELL) {
_damage_source = EntityDataManager::get_instance()->get_spell(_damage_source_id);
} else if (_damage_source_type == DAMAGE_SOURCE_AURA) {
_damage_source = EntityDataManager::get_instance()->get_aura(_damage_source_id);
}
if (_damage_source_type == DAMAGE_SOURCE_SPELL) {
_damage_source = EntityDataManager::get_instance()->get_spell(_damage_source_id);
} else if (_damage_source_type == DAMAGE_SOURCE_AURA) {
_damage_source = EntityDataManager::get_instance()->get_aura(_damage_source_id);
}
}

View File

@ -25,6 +25,7 @@ SOFTWARE.
#include "../data/aura.h"
#include "../data/spell.h"
#include "../entities/entity.h"
#include "../singletons/entity_data_manager.h"
bool SpellHealInfo::get_immune() {
return _immune;
@ -163,12 +164,10 @@ void SpellHealInfo::resolve_references(Node *owner) {
_dealer = Object::cast_to<Entity>(owner->get_node_or_null(_dealer_path));
_receiver = Object::cast_to<Entity>(owner->get_node_or_null(_receiver_path));
if (EntityDataManager::get_instance() != NULL) {
if (_heal_source_type == HEAL_SOURCE_SPELL) {
_heal_source = EntityDataManager::get_instance()->get_spell(_heal_source_id);
} else if (_heal_source_type == HEAL_SOURCE_AURA) {
_heal_source = EntityDataManager::get_instance()->get_aura(_heal_source_id);
}
if (_heal_source_type == HEAL_SOURCE_SPELL) {
_heal_source = EntityDataManager::get_instance()->get_spell(_heal_source_id);
} else if (_heal_source_type == HEAL_SOURCE_AURA) {
_heal_source = EntityDataManager::get_instance()->get_aura(_heal_source_id);
}
}

View File

@ -25,7 +25,7 @@ SOFTWARE.
#include "entity_enums.h"
#include "item_enums.h"
#include "autoloads/entity_data_manager.h"
#include "singletons/entity_data_manager.h"
#include "data/aura.h"
#include "data/aura_group.h"
@ -122,16 +122,17 @@ SOFTWARE.
#include "formations/ai_formation.h"
#include "profile_manager/input/input_profile.h"
#include "profile_manager/input/input_profile_modifier.h"
#include "profile_manager/input/input_profile_modifier_entry.h"
#include "profiles/input/input_profile.h"
#include "profiles/input/input_profile_modifier.h"
#include "profiles/input/input_profile_modifier_entry.h"
#include "profile_manager/actionbar/action_bar_button_entry.h"
#include "profile_manager/actionbar/action_bar_entry.h"
#include "profile_manager/actionbar/action_bar_profile.h"
#include "profiles/actionbar/action_bar_button_entry.h"
#include "profiles/actionbar/action_bar_entry.h"
#include "profiles/actionbar/action_bar_profile.h"
#include "profile_manager/class_profile.h"
#include "profile_manager/profile_manager.h"
#include "profiles/class_profile.h"
#include "singletons/profile_manager.h"
static EntityDataManager *entity_data_manager = NULL;
static ProfileManager *profile_manager = NULL;

View File

@ -21,8 +21,8 @@ SOFTWARE.
*/
#include "profile_manager.h"
#include "core/os/file_access.h"
#include "core/io/json.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"
const String ProfileManager::DEFAULT_PROFILE_FILE_NAME = "default.profile";
@ -105,9 +105,9 @@ void ProfileManager::_save() {
if (!f) {
ERR_FAIL_MSG("Couldn't open file: " + err);
}
f->store_line(JSON::print(to_dict()));
f->close();
f->close();
}
void ProfileManager::_load() {

View File

@ -27,7 +27,7 @@ SOFTWARE.
#include "core/vector.h"
#include "class_profile.h"
#include "../profiles/class_profile.h"
class ProfileManager : public Object {
GDCLASS(ProfileManager, Object);

View File

@ -22,88 +22,109 @@ SOFTWARE.
#include "entity_create_info.h"
int EntityCreateInfo::get_guid() const {
return _guid;
int EntityCreateInfo::get_guid() const {
return _guid;
}
void EntityCreateInfo::set_guid(const int value) {
_guid = value;
void EntityCreateInfo::set_guid(const int value) {
_guid = value;
}
bool EntityCreateInfo::get_networked() const {
return _networked;
}
void EntityCreateInfo::set_networked(const bool value) {
_networked = value;
}
int EntityCreateInfo::get_class_id() const {
return _class_id;
return _class_id;
}
void EntityCreateInfo::set_class_id(const int value) {
_class_id = value;
_class_id = value;
}
int EntityCreateInfo::get_entity_player_type() {
return _entity_player_type;
}
void EntityCreateInfo::set_entity_player_type(int value) {
_entity_player_type = value;
}
int EntityCreateInfo::get_network_owner() const {
return _network_owner;
return _network_owner;
}
void EntityCreateInfo::set_network_owner(const int value) {
_network_owner = value;
_network_owner = value;
}
EntityEnums::EntityController EntityCreateInfo::get_entity_controller() const {
return _entity_controller;
EntityEnums::EntityController EntityCreateInfo::get_entity_controller() const {
return _entity_controller;
}
void EntityCreateInfo::set_entity_controller(const EntityEnums::EntityController value) {
_entity_controller = value;
void EntityCreateInfo::set_entity_controller(const EntityEnums::EntityController value) {
_entity_controller = value;
}
String EntityCreateInfo::get_entity_name() const {
return _entity_name;
String EntityCreateInfo::get_entity_name() const {
return _entity_name;
}
void EntityCreateInfo::set_entity_name(const String &value) {
_entity_name = value;
void EntityCreateInfo::set_entity_name(const String &value) {
_entity_name = value;
}
String EntityCreateInfo::get_node_name() const {
return _entity_name;
int EntityCreateInfo::get_level() const {
return _level;
}
void EntityCreateInfo::set_node_name(const String &value) {
_entity_name = value;
void EntityCreateInfo::set_level(const int value) {
_level = value;
}
int EntityCreateInfo::get_level() const {
return _level;
int EntityCreateInfo::get_xp() const {
return _xp;
}
void EntityCreateInfo::set_level(const int value) {
_level = value;
}
int EntityCreateInfo::get_xp() const {
return _xp;
}
void EntityCreateInfo::set_xp(const int value) {
_xp = value;
void EntityCreateInfo::set_xp(const int value) {
_xp = value;
}
Transform EntityCreateInfo::get_transform() const {
return _transform;
return _transform;
}
void EntityCreateInfo::set_transform(const Transform &value) {
_transform = value;
_transform = value;
}
Transform2D EntityCreateInfo::get_transform2d() const {
return _transform2d;
return _transform2d;
}
void EntityCreateInfo::set_transform2d(const Transform2D &value) {
_transform2d = value;
_transform2d = value;
}
Ref<EntityData> EntityCreateInfo::get_entity_data() const {
return _entity_data;
Ref<EntityData> EntityCreateInfo::get_entity_data() const {
return _entity_data;
}
void EntityCreateInfo::set_entity_data(const Ref<EntityData> &value) {
_entity_data = value;
void EntityCreateInfo::set_entity_data(const Ref<EntityData> &value) {
_entity_data = value;
}
Dictionary EntityCreateInfo::get_serialized_data() {
return _serialized_data;
}
void EntityCreateInfo::set_serialized_data(const Dictionary &value) {
_serialized_data = value;
}
NodePath EntityCreateInfo::get_parent_path() const {
return _parent_path;
}
void EntityCreateInfo::set_parent_path(const NodePath &value) {
_parent_path = value;
}
EntityCreateInfo::EntityCreateInfo() {
_guid = 0;
_class_id = 0;
_network_owner = 0;
_guid = 0;
_class_id = 0;
_entity_player_type = 0;
_network_owner = 0;
_entity_controller = EntityEnums::ENITIY_CONTROLLER_NONE;
_level = 0;
_xp = 0;
@ -114,43 +135,59 @@ EntityCreateInfo::~EntityCreateInfo() {
}
void EntityCreateInfo::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_entity_controller"), &EntityCreateInfo::get_entity_controller);
ClassDB::bind_method(D_METHOD("set_entity_controller", "value"), &EntityCreateInfo::set_entity_controller);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_controller", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_entity_controller", "get_entity_controller");
ClassDB::bind_method(D_METHOD("get_guid"), &EntityCreateInfo::get_guid);
ClassDB::bind_method(D_METHOD("set_guid", "value"), &EntityCreateInfo::set_guid);
ADD_PROPERTY(PropertyInfo(Variant::INT, "guid"), "set_guid", "get_guid");
ClassDB::bind_method(D_METHOD("get_class_id"), &EntityCreateInfo::get_class_id);
ClassDB::bind_method(D_METHOD("set_class_id", "value"), &EntityCreateInfo::set_class_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "class_id", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_class_id", "get_class_id");
ClassDB::bind_method(D_METHOD("get_networked"), &EntityCreateInfo::get_networked);
ClassDB::bind_method(D_METHOD("set_networked", "value"), &EntityCreateInfo::set_networked);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "networked"), "set_networked", "get_networked");
ClassDB::bind_method(D_METHOD("get_network_owner"), &EntityCreateInfo::get_network_owner);
ClassDB::bind_method(D_METHOD("set_network_owner", "value"), &EntityCreateInfo::set_network_owner);
ADD_PROPERTY(PropertyInfo(Variant::INT, "network_owner", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_network_owner", "get_network_owner");
ClassDB::bind_method(D_METHOD("get_entity_controller"), &EntityCreateInfo::get_entity_controller);
ClassDB::bind_method(D_METHOD("set_entity_controller", "value"), &EntityCreateInfo::set_entity_controller);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_controller", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_entity_controller", "get_entity_controller");
ClassDB::bind_method(D_METHOD("get_entity_name"), &EntityCreateInfo::get_entity_name);
ClassDB::bind_method(D_METHOD("set_entity_name", "value"), &EntityCreateInfo::set_entity_name);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "player_name"), "set_entity_name", "get_entity_name");
ClassDB::bind_method(D_METHOD("get_class_id"), &EntityCreateInfo::get_class_id);
ClassDB::bind_method(D_METHOD("set_class_id", "value"), &EntityCreateInfo::set_class_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "class_id", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_class_id", "get_class_id");
ClassDB::bind_method(D_METHOD("get_node_name"), &EntityCreateInfo::get_node_name);
ClassDB::bind_method(D_METHOD("set_node_name", "value"), &EntityCreateInfo::set_node_name);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "node_name"), "set_node_name", "get_node_name");
ClassDB::bind_method(D_METHOD("get_entity_player_type"), &EntityCreateInfo::get_entity_player_type);
ClassDB::bind_method(D_METHOD("set_entity_player_type", "value"), &EntityCreateInfo::set_entity_player_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_player_type"), "set_entity_player_type", "get_entity_player_type");
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::INT, "level"), "set_level", "get_level");
ClassDB::bind_method(D_METHOD("get_network_owner"), &EntityCreateInfo::get_network_owner);
ClassDB::bind_method(D_METHOD("set_network_owner", "value"), &EntityCreateInfo::set_network_owner);
ADD_PROPERTY(PropertyInfo(Variant::INT, "network_owner", PROPERTY_HINT_ENUM, EntityEnums::BINDING_STRING_ENTITY_CONTOLLER), "set_network_owner", "get_network_owner");
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::INT, "xp"), "set_xp", "get_xp");
ClassDB::bind_method(D_METHOD("get_entity_name"), &EntityCreateInfo::get_entity_name);
ClassDB::bind_method(D_METHOD("set_entity_name", "value"), &EntityCreateInfo::set_entity_name);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "player_name"), "set_entity_name", "get_entity_name");
ClassDB::bind_method(D_METHOD("get_transform"), &EntityCreateInfo::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "value"), &EntityCreateInfo::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
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::INT, "level"), "set_level", "get_level");
ClassDB::bind_method(D_METHOD("get_transform2d"), &EntityCreateInfo::get_transform2d);
ClassDB::bind_method(D_METHOD("set_transform2d", "value"), &EntityCreateInfo::set_transform2d);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform2d"), "set_transform2d", "get_transform2d");
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::INT, "xp"), "set_xp", "get_xp");
ClassDB::bind_method(D_METHOD("get_entity_data"), &EntityCreateInfo::get_entity_data);
ClassDB::bind_method(D_METHOD("set_entity_data", "value"), &EntityCreateInfo::set_entity_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityData"), "set_entity_data", "get_entity_data");
}
ClassDB::bind_method(D_METHOD("get_transform"), &EntityCreateInfo::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "value"), &EntityCreateInfo::set_transform);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "transform"), "set_transform", "get_transform");
ClassDB::bind_method(D_METHOD("get_transform2d"), &EntityCreateInfo::get_transform2d);
ClassDB::bind_method(D_METHOD("set_transform2d", "value"), &EntityCreateInfo::set_transform2d);
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM2D, "transform2d"), "set_transform2d", "get_transform2d");
ClassDB::bind_method(D_METHOD("get_entity_data"), &EntityCreateInfo::get_entity_data);
ClassDB::bind_method(D_METHOD("set_entity_data", "value"), &EntityCreateInfo::set_entity_data);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "entity_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityData"), "set_entity_data", "get_entity_data");
ClassDB::bind_method(D_METHOD("get_serialized_data"), &EntityCreateInfo::get_serialized_data);
ClassDB::bind_method(D_METHOD("set_serialized_data", "value"), &EntityCreateInfo::set_serialized_data);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "serialized_data"), "set_serialized_data", "get_serialized_data");
ClassDB::bind_method(D_METHOD("get_parent_path"), &EntityCreateInfo::get_parent_path);
ClassDB::bind_method(D_METHOD("set_parent_path", "value"), &EntityCreateInfo::set_parent_path);
ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "parent_path"), "set_parent_path", "get_parent_path");
}

View File

@ -35,9 +35,15 @@ public:
int get_guid() const;
void set_guid(const int value);
bool get_networked() const;
void set_networked(const bool value);
int get_class_id() const;
void set_class_id(const int value);
int get_entity_player_type();
void set_entity_player_type(int value);
int get_network_owner() const;
void set_network_owner(const int value);
@ -47,9 +53,6 @@ public:
String get_entity_name() const;
void set_entity_name(const String &value);
String get_node_name() const;
void set_node_name(const String &value);
int get_level() const;
void set_level(const int value);
@ -65,6 +68,12 @@ public:
Ref<EntityData> get_entity_data() const;
void set_entity_data(const Ref<EntityData> &value);
Dictionary get_serialized_data();
void set_serialized_data(const Dictionary &value);
NodePath get_parent_path() const;
void set_parent_path(const NodePath &value);
EntityCreateInfo();
~EntityCreateInfo();
@ -73,7 +82,9 @@ protected:
private:
int _guid;
bool _networked;
int _class_id;
int _entity_player_type;
int _network_owner;
EntityEnums::EntityController _entity_controller;
String _entity_name;
@ -84,6 +95,8 @@ private:
Transform2D _transform2d;
Ref<EntityData> _entity_data;
Dictionary _serialized_data;
NodePath _parent_path;
};
#endif