mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Rename both ESS::get_instance, and ProfileManager::get_instance to <class>::get_singleton, to match Godot's standard.
This commit is contained in:
parent
7bbca9ae89
commit
d063f8da28
@ -328,7 +328,7 @@ Aura::Aura() {
|
||||
_is_debuff = false;
|
||||
_hide = false;
|
||||
_rank = 0;
|
||||
_scale_with_level = ESS::get_instance()->get_scale_spells_by_default();
|
||||
_scale_with_level = ESS::get_singleton()->get_scale_spells_by_default();
|
||||
|
||||
_damage_enabled = false;
|
||||
_damage_type = 0;
|
||||
@ -934,13 +934,13 @@ String Aura::_get_description(const int class_level, const int character_level)
|
||||
|
||||
if (valid) {
|
||||
if (o == '#') {
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, class_level / static_cast<float>(ESS::get_instance()->get_max_class_level()));
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, class_level / static_cast<float>(ESS::get_singleton()->get_max_class_level()));
|
||||
|
||||
value = static_cast<int>(value);
|
||||
}
|
||||
|
||||
if (o == '$') {
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, character_level / static_cast<float>(ESS::get_instance()->get_max_character_level()));
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, character_level / static_cast<float>(ESS::get_singleton()->get_max_character_level()));
|
||||
|
||||
value = static_cast<int>(value);
|
||||
}
|
||||
@ -1170,7 +1170,7 @@ void Aura::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
|
||||
if (property.name.ends_with("stat"))
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
} else if (prop.begins_with("Trigger_")) {
|
||||
int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int();
|
||||
if (frame >= _trigger_count) {
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
protected:
|
||||
void validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "stat") {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,53 +27,53 @@ SOFTWARE.
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
int XPData::get_character_max_level() {
|
||||
return ESS::get_instance()->get_max_character_level();
|
||||
return ESS::get_singleton()->get_max_character_level();
|
||||
}
|
||||
|
||||
int XPData::get_character_xp(int level) {
|
||||
ERR_FAIL_INDEX_V(level - 1, ESS::get_instance()->get_max_character_level(), 9999999);
|
||||
ERR_FAIL_INDEX_V(level - 1, ESS::get_singleton()->get_max_character_level(), 9999999);
|
||||
|
||||
return _character_xps.get(level - 1);
|
||||
}
|
||||
|
||||
void XPData::set_character_xp(int level, int value) {
|
||||
ERR_FAIL_INDEX(level - 1, ESS::get_instance()->get_max_character_level());
|
||||
ERR_FAIL_INDEX(level - 1, ESS::get_singleton()->get_max_character_level());
|
||||
|
||||
_character_xps.set(level - 1, value);
|
||||
}
|
||||
|
||||
bool XPData::can_character_level_up(int level) {
|
||||
return level < ESS::get_instance()->get_max_character_level();
|
||||
return level < ESS::get_singleton()->get_max_character_level();
|
||||
}
|
||||
|
||||
int XPData::get_class_max_level() {
|
||||
return ESS::get_instance()->get_max_class_level();
|
||||
return ESS::get_singleton()->get_max_class_level();
|
||||
}
|
||||
|
||||
int XPData::get_class_xp(int level) {
|
||||
ERR_FAIL_INDEX_V(level - 1, ESS::get_instance()->get_max_class_level(), 9999999);
|
||||
ERR_FAIL_INDEX_V(level - 1, ESS::get_singleton()->get_max_class_level(), 9999999);
|
||||
|
||||
return _class_xps.get(level - 1);
|
||||
}
|
||||
|
||||
void XPData::set_class_xp(int level, int value) {
|
||||
ERR_FAIL_INDEX(level - 1, ESS::get_instance()->get_max_class_level());
|
||||
ERR_FAIL_INDEX(level - 1, ESS::get_singleton()->get_max_class_level());
|
||||
|
||||
_class_xps.set(level - 1, value);
|
||||
}
|
||||
|
||||
bool XPData::can_class_level_up(int level) {
|
||||
return level < ESS::get_instance()->get_max_class_level();
|
||||
return level < ESS::get_singleton()->get_max_class_level();
|
||||
}
|
||||
|
||||
XPData::XPData() {
|
||||
_character_xps.resize(ESS::get_instance()->get_max_character_level());
|
||||
_character_xps.resize(ESS::get_singleton()->get_max_character_level());
|
||||
|
||||
for (int i = 0; i < _character_xps.size(); ++i) {
|
||||
_character_xps.set(i, 0);
|
||||
}
|
||||
|
||||
_class_xps.resize(ESS::get_instance()->get_max_class_level());
|
||||
_class_xps.resize(ESS::get_singleton()->get_max_class_level());
|
||||
|
||||
for (int i = 0; i < _class_xps.size(); ++i) {
|
||||
_class_xps.set(i, 0);
|
||||
@ -89,7 +89,7 @@ bool XPData::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (prop_name.begins_with("level_")) {
|
||||
int level = prop_name.get_slice("/", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_character_level())
|
||||
if (level >= ESS::get_singleton()->get_max_character_level())
|
||||
return false;
|
||||
|
||||
_character_xps.write[level] = p_value;
|
||||
@ -98,7 +98,7 @@ bool XPData::_set(const StringName &p_name, const Variant &p_value) {
|
||||
} else if (prop_name.begins_with("class_level_")) {
|
||||
int level = prop_name.get_slice("/", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_class_level())
|
||||
if (level >= ESS::get_singleton()->get_max_class_level())
|
||||
return false;
|
||||
|
||||
_class_xps.write[level] = p_value;
|
||||
@ -115,7 +115,7 @@ bool XPData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
if (prop_name.begins_with("character_level")) {
|
||||
int level = prop_name.get_slice("/", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_character_level())
|
||||
if (level >= ESS::get_singleton()->get_max_character_level())
|
||||
return false;
|
||||
|
||||
r_ret = _character_xps[level];
|
||||
@ -124,7 +124,7 @@ bool XPData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
} else if (prop_name.begins_with("class_level")) {
|
||||
int level = prop_name.get_slice("/", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_class_level())
|
||||
if (level >= ESS::get_singleton()->get_max_class_level())
|
||||
return false;
|
||||
|
||||
r_ret = _class_xps[level];
|
||||
@ -139,11 +139,11 @@ void XPData::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
//int property_usange = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL;
|
||||
//int property_usange = PROPERTY_USAGE_DEFAULT;
|
||||
|
||||
for (int i = 1; i <= ESS::get_instance()->get_max_character_level(); ++i) {
|
||||
for (int i = 1; i <= ESS::get_singleton()->get_max_character_level(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "character_level/" + String::num(i)));
|
||||
}
|
||||
|
||||
for (int i = 1; i <= ESS::get_instance()->get_max_class_level(); ++i) {
|
||||
for (int i = 1; i <= ESS::get_singleton()->get_max_class_level(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "class_level/" + String::num(i)));
|
||||
}
|
||||
}
|
||||
|
@ -28,18 +28,18 @@ SOFTWARE.
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
Ref<ItemTemplate> EquipmentData::get_slot(int index) {
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_instance()->equip_slot_get_count(), Ref<ItemTemplate>());
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemTemplate>());
|
||||
|
||||
return _entries[index];
|
||||
}
|
||||
void EquipmentData::set_slot(int index, Ref<ItemTemplate> entry) {
|
||||
ERR_FAIL_INDEX(index, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(index, ESS::get_singleton()->equip_slot_get_count());
|
||||
|
||||
_entries.write[index] = entry;
|
||||
}
|
||||
|
||||
Ref<ItemInstance> EquipmentData::get_item(int index) {
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_instance()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
|
||||
Ref<ItemTemplate> ede = _entries[index];
|
||||
|
||||
@ -50,7 +50,7 @@ Ref<ItemInstance> EquipmentData::get_item(int index) {
|
||||
}
|
||||
|
||||
EquipmentData::EquipmentData() {
|
||||
_entries.resize(ESS::get_instance()->equip_slot_get_count());
|
||||
_entries.resize(ESS::get_singleton()->equip_slot_get_count());
|
||||
}
|
||||
|
||||
EquipmentData::~EquipmentData() {
|
||||
@ -63,8 +63,8 @@ bool EquipmentData::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (name.get_slicec('/', 0) == "slot") {
|
||||
StringName prop = name.get_slicec('/', 1);
|
||||
|
||||
if (ESS::get_instance()->equip_slot_is_property(prop)) {
|
||||
int id = ESS::get_instance()->equip_slot_get_property_id(prop);
|
||||
if (ESS::get_singleton()->equip_slot_is_property(prop)) {
|
||||
int id = ESS::get_singleton()->equip_slot_get_property_id(prop);
|
||||
|
||||
if (_entries.size() < id) {
|
||||
return false;
|
||||
@ -89,8 +89,8 @@ bool EquipmentData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
if (name.get_slicec('/', 0) == "slot") {
|
||||
StringName prop = name.get_slicec('/', 1);
|
||||
|
||||
if (ESS::get_instance()->equip_slot_is_property(prop)) {
|
||||
int id = ESS::get_instance()->equip_slot_get_property_id(prop);
|
||||
if (ESS::get_singleton()->equip_slot_is_property(prop)) {
|
||||
int id = ESS::get_singleton()->equip_slot_get_property_id(prop);
|
||||
|
||||
if (_entries.size() < id) {
|
||||
return false;
|
||||
@ -110,8 +110,8 @@ bool EquipmentData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
}
|
||||
|
||||
void EquipmentData::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "slot/" + ESS::get_instance()->equip_slot_get_property_name(i), PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate"));
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::OBJECT, "slot/" + ESS::get_singleton()->equip_slot_get_property_name(i), PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,8 +113,8 @@ void ItemInstance::_from_dict(const Dictionary &dict) {
|
||||
|
||||
_item_template_path = dict.get("item_path", 0);
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
_item_template = ESS::get_instance()->get_resource_db()->get_item_template_path(_item_template_path);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
_item_template = ESS::get_singleton()->get_resource_db()->get_item_template_path(_item_template_path);
|
||||
}
|
||||
|
||||
_stack_size = dict.get("stack_size", 0);
|
||||
|
@ -92,7 +92,7 @@ ItemStatModifier::ItemStatModifier() {
|
||||
|
||||
void ItemStatModifier::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "stat_id") {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ ItemTemplate::ItemTemplate() {
|
||||
_item_sub_sub_type = ItemEnums::ITEM_SUB_SUB_TYPE_NONE;
|
||||
_rarity = ItemEnums::ITEM_RARITY_NONE;
|
||||
_armor_type = ItemEnums::ARMOR_TYPE_NONE;
|
||||
_equip_slot = ESS::get_instance()->equip_slot_get_count();
|
||||
_equip_slot = ESS::get_singleton()->equip_slot_get_count();
|
||||
_price = 0;
|
||||
|
||||
_scale_x = 0;
|
||||
@ -444,9 +444,9 @@ void ItemTemplate::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
|
||||
if (property.name.ends_with("stat_id"))
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
} else if (prop == "equip_slot") {
|
||||
property.hint_string = ESS::get_instance()->equip_slot_get_string();
|
||||
property.hint_string = ESS::get_singleton()->equip_slot_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ ItemTemplateStatModifier::ItemTemplateStatModifier() {
|
||||
|
||||
void ItemTemplateStatModifier::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "stat_id") {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ void ModelVisual::_validate_property(PropertyInfo &property) const {
|
||||
String name = property.name;
|
||||
|
||||
if (name == "layer") {
|
||||
property.hint_string = ESS::get_instance()->texture_layers_get();
|
||||
property.hint_string = ESS::get_singleton()->texture_layers_get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -223,17 +223,17 @@ void ModelVisualEntry::_validate_property(PropertyInfo &property) const {
|
||||
String name = property.name;
|
||||
|
||||
if (name == "group") {
|
||||
property.hint_string = ESS::get_instance()->model_visual_groups_get();
|
||||
property.hint_string = ESS::get_singleton()->model_visual_groups_get();
|
||||
} else if (name == "bone") {
|
||||
if (ESS::get_instance()->skeletons_bones_count() > _entity_type) {
|
||||
property.hint_string = ESS::get_instance()->skeletons_bones_index_get(_entity_type);
|
||||
if (ESS::get_singleton()->skeletons_bones_count() > _entity_type) {
|
||||
property.hint_string = ESS::get_singleton()->skeletons_bones_index_get(_entity_type);
|
||||
} else {
|
||||
property.hint_string = "";
|
||||
}
|
||||
} else if (name == "entity_type") {
|
||||
property.hint_string = ESS::get_instance()->entity_types_get();
|
||||
property.hint_string = ESS::get_singleton()->entity_types_get();
|
||||
} else if (name == "override_layer") {
|
||||
property.hint_string = ESS::get_instance()->texture_layers_get();
|
||||
property.hint_string = ESS::get_singleton()->texture_layers_get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ EntitySpeciesData::~EntitySpeciesData() {
|
||||
|
||||
void EntitySpeciesData::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "type") {
|
||||
property.hint_string = ESS::get_instance()->entity_types_get();
|
||||
property.hint_string = ESS::get_singleton()->entity_types_get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ int SpeciesInstance::get_species_id() const {
|
||||
void SpeciesInstance::set_species_id(int value) {
|
||||
_id = value;
|
||||
|
||||
_species = ESS::get_instance()->get_resource_db()->get_entity_species_data(_id);
|
||||
_species = ESS::get_singleton()->get_resource_db()->get_entity_species_data(_id);
|
||||
}
|
||||
|
||||
StringName SpeciesInstance::get_species_path() const {
|
||||
@ -49,7 +49,7 @@ StringName SpeciesInstance::get_species_path() const {
|
||||
void SpeciesInstance::set_species_path(const StringName &value) {
|
||||
_path = value;
|
||||
|
||||
_species = ESS::get_instance()->get_resource_db()->get_entity_species_data_path(_path);
|
||||
_species = ESS::get_singleton()->get_resource_db()->get_entity_species_data_path(_path);
|
||||
}
|
||||
|
||||
Ref<EntitySpeciesData> SpeciesInstance::get_species() {
|
||||
|
@ -698,7 +698,7 @@ void Spell::handle_gcd(Ref<SpellCastInfo> info) {
|
||||
ERR_FAIL_COND(!info.is_valid());
|
||||
|
||||
if (_global_cooldown_enabled && _cast_time_enabled) {
|
||||
float gcd = info->get_caster()->stat_gets_current(ESS::get_instance()->stat_get_id("Global Cooldown"));
|
||||
float gcd = info->get_caster()->stat_gets_current(ESS::get_singleton()->stat_get_id("Global Cooldown"));
|
||||
|
||||
info->get_caster()->gcd_starts(gcd);
|
||||
}
|
||||
@ -753,13 +753,13 @@ String Spell::_get_description(const int class_level, const int character_level)
|
||||
|
||||
if (valid) {
|
||||
if (o == '#') {
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, class_level / static_cast<float>(ESS::get_instance()->get_max_class_level()));
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, class_level / static_cast<float>(ESS::get_singleton()->get_max_class_level()));
|
||||
|
||||
value = static_cast<int>(value);
|
||||
}
|
||||
|
||||
if (o == '$') {
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, character_level / static_cast<float>(ESS::get_instance()->get_max_character_level()));
|
||||
value = Variant::evaluate(Variant::OP_MULTIPLY, value, character_level / static_cast<float>(ESS::get_singleton()->get_max_character_level()));
|
||||
|
||||
value = static_cast<int>(value);
|
||||
}
|
||||
@ -791,7 +791,7 @@ Spell::Spell() {
|
||||
|
||||
_level = 1;
|
||||
_rank = 0;
|
||||
_scale_with_level = ESS::get_instance()->get_scale_spells_by_default();
|
||||
_scale_with_level = ESS::get_singleton()->get_scale_spells_by_default();
|
||||
|
||||
_global_cooldown_enabled = true;
|
||||
_is_local_spell = false;
|
||||
@ -1045,7 +1045,7 @@ void Spell::_handle_effect(Ref<SpellCastInfo> info) {
|
||||
|
||||
void Spell::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name.ends_with("_stat")) {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ Dictionary AuraData::_to_dict() {
|
||||
}
|
||||
void AuraData::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
ERR_FAIL_COND(!ESS::get_instance()->get_resource_db().is_valid());
|
||||
ERR_FAIL_COND(!ESS::get_singleton()->get_resource_db().is_valid());
|
||||
|
||||
_aura_id = dict.get("aura_id", 0);
|
||||
_aura_path = dict.get("aura_path", "");
|
||||
@ -319,7 +319,7 @@ void AuraData::_from_dict(const Dictionary &dict) {
|
||||
_aura_group = dict.get("aura_group", 0);
|
||||
//int aura_id = dict.get("aura_id", 0);
|
||||
|
||||
_aura = ESS::get_instance()->get_resource_db()->get_aura_path(_aura_path);
|
||||
_aura = ESS::get_singleton()->get_resource_db()->get_aura_path(_aura_path);
|
||||
|
||||
_is_timed = dict.get("is_timed", true);
|
||||
_damage = dict.get("damage", 0);
|
||||
|
@ -839,7 +839,7 @@ EntityData::~EntityData() {
|
||||
|
||||
void EntityData::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "entity_type") {
|
||||
property.hint_string = ESS::get_instance()->entity_types_get();
|
||||
property.hint_string = ESS::get_singleton()->entity_types_get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,8 +406,8 @@ void Entity::setc_entity_data_id(int value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
setc_entity_data(ESS::get_instance()->get_resource_db()->get_entity_data(_c_class_id));
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
setc_entity_data(ESS::get_singleton()->get_resource_db()->get_entity_data(_c_class_id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,8 +581,8 @@ void Entity::_setup() {
|
||||
}
|
||||
|
||||
if (gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY) {
|
||||
if (ESS::get_instance()->get_use_global_class_level()) {
|
||||
Ref<ClassProfile> cp = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path());
|
||||
if (ESS::get_singleton()->get_use_global_class_level()) {
|
||||
Ref<ClassProfile> cp = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path());
|
||||
|
||||
if (cp.is_valid()) {
|
||||
int leveldiff = cp->get_level() - _s_class_level;
|
||||
@ -613,11 +613,11 @@ void Entity::_setup() {
|
||||
|
||||
ERR_FAIL_COND(!cc.is_valid());
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
stat_set_base(i, _s_entity_data->get_stat_data()->get_base(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
stat_setc_current(i, stat_gets_current(i));
|
||||
stat_set_dirty(i, false);
|
||||
}
|
||||
@ -662,7 +662,7 @@ void Entity::_setup() {
|
||||
if (_s_entity_data->get_equipment_data().is_valid()) {
|
||||
Ref<EquipmentData> eqd = _s_entity_data->get_equipment_data();
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
Ref<ItemInstance> ii = eqd->get_item(i);
|
||||
|
||||
if (ii.is_valid())
|
||||
@ -713,26 +713,26 @@ void Entity::_setup() {
|
||||
sets_class_xp(clxp);
|
||||
sets_character_xp(chxp);
|
||||
|
||||
if (ESS::get_instance()->get_allow_class_spell_learning()) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
if (ESS::get_singleton()->get_allow_class_spell_learning()) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
|
||||
if (class_profile.is_valid() && class_profile->has_custom_data("spells")) {
|
||||
Vector<String> spells = class_profile->get_custom_data("spells");
|
||||
|
||||
for (int i = 0; i < spells.size(); ++i) {
|
||||
spell_adds_id(ESS::get_instance()->get_resource_db()->spell_path_to_id(spells.get(i)));
|
||||
spell_adds_id(ESS::get_singleton()->get_resource_db()->spell_path_to_id(spells.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ESS::get_instance()->get_allow_class_recipe_learning()) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
if (ESS::get_singleton()->get_allow_class_recipe_learning()) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
|
||||
if (class_profile.is_valid() && class_profile->has_custom_data("recipes")) {
|
||||
Vector<String> recipes = class_profile->get_custom_data("recipes");
|
||||
|
||||
for (int i = 0; i < recipes.size(); ++i) {
|
||||
craft_adds_recipe_id(ESS::get_instance()->get_resource_db()->craft_recipe_path_to_id(recipes.get(i)));
|
||||
craft_adds_recipe_id(ESS::get_singleton()->get_resource_db()->craft_recipe_path_to_id(recipes.get(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -746,7 +746,7 @@ void Entity::setup_actionbars() {
|
||||
return;
|
||||
}
|
||||
|
||||
//ProfileManager *pm = ProfileManager::get_instance();
|
||||
//ProfileManager *pm = ProfileManager::get_singleton();
|
||||
|
||||
//if (pm != NULL) {
|
||||
// Ref<ClassProfile> cp = pm->get_class_profile(gets_entity_data()->get_id());
|
||||
@ -999,7 +999,7 @@ int Entity::pet_getc_count() {
|
||||
//// Profiles ////
|
||||
|
||||
Ref<ClassProfile> Entity::get_class_profile() {
|
||||
return ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
return ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
}
|
||||
|
||||
//// Serialization ////
|
||||
@ -1048,7 +1048,7 @@ Dictionary Entity::_to_dict() {
|
||||
|
||||
Dictionary sd;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
Dictionary sdict;
|
||||
|
||||
sdict["base"] = stat_get_base(i);
|
||||
@ -1066,7 +1066,7 @@ Dictionary Entity::_to_dict() {
|
||||
|
||||
Dictionary equipment;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
Ref<ItemInstance> ii = _s_equipment[i];
|
||||
|
||||
if (ii.is_valid())
|
||||
@ -1173,7 +1173,7 @@ Dictionary Entity::_to_dict() {
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
dict["free_spell_points"] = _s_free_spell_points;
|
||||
|
||||
Dictionary known_spells;
|
||||
@ -1213,7 +1213,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
sets_model_index(static_cast<int>(static_cast<int>(dict.get("model_index", 0))));
|
||||
|
||||
if (ESS::get_instance()->get_use_global_class_level()) {
|
||||
if (ESS::get_singleton()->get_use_global_class_level()) {
|
||||
_s_class_level = (dict.get("class_level", 0));
|
||||
_s_class_xp = (dict.get("class_xp", 0));
|
||||
} else {
|
||||
@ -1234,7 +1234,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
Dictionary stats = dict.get("stats", Dictionary());
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
Dictionary sd = stats.get(String::num(i), Dictionary());
|
||||
|
||||
stat_set_base(i, sd.get("base", 0));
|
||||
@ -1253,7 +1253,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
Dictionary equipment = dict.get("equipment", Dictionary());
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
if (equipment.has(String::num(i))) {
|
||||
Ref<ItemInstance> ii = _s_equipment[i];
|
||||
|
||||
@ -1288,7 +1288,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
StringName data_path = ird.get("data_path", "");
|
||||
|
||||
Ref<EntityResourceData> resd = ESS::get_instance()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
Ref<EntityResourceData> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
|
||||
ERR_CONTINUE(!resd.is_valid());
|
||||
|
||||
@ -1418,8 +1418,8 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
for (int i = 0; i < known_recipes.size(); ++i) {
|
||||
StringName crn = known_recipes.get(String::num(i), "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
Ref<CraftRecipe> cr = ESS::get_instance()->get_resource_db()->get_craft_recipe_path(crn);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
Ref<CraftRecipe> cr = ESS::get_singleton()->get_resource_db()->get_craft_recipe_path(crn);
|
||||
|
||||
if (cr.is_valid()) {
|
||||
craft_adds_recipe(cr);
|
||||
@ -1429,7 +1429,7 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
sets_free_spell_points(dict.get("free_spell_points", 0));
|
||||
|
||||
Dictionary known_spells = dict.get("known_spells", Dictionary());
|
||||
@ -1437,8 +1437,8 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
for (int i = 0; i < known_spells.size(); ++i) {
|
||||
StringName spell_path = known_spells.get(String::num(i), "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
Ref<Spell> sp = ESS::get_instance()->get_resource_db()->get_spell_path(spell_path);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
Ref<Spell> sp = ESS::get_singleton()->get_resource_db()->get_spell_path(spell_path);
|
||||
|
||||
if (sp.is_valid()) {
|
||||
_s_spells.push_back(sp);
|
||||
@ -1485,8 +1485,8 @@ void Entity::_from_dict(const Dictionary &dict) {
|
||||
|
||||
StringName edp = dict.get("entity_data_path", "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
sets_entity_data(ESS::get_instance()->get_resource_db()->get_entity_data_path(edp));
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
sets_entity_data(ESS::get_singleton()->get_resource_db()->get_entity_data_path(edp));
|
||||
}
|
||||
|
||||
sets_entity_data_path(edp);
|
||||
@ -1620,19 +1620,19 @@ void Entity::craft_adds_recipe(Ref<CraftRecipe> craft_recipe) {
|
||||
ORPC(craft_addc_recipe_id, craft_recipe->get_id());
|
||||
}
|
||||
void Entity::craft_adds_recipe_id(int id) {
|
||||
ERR_FAIL_COND(!ESS::get_instance());
|
||||
ERR_FAIL_COND(!ESS::get_singleton());
|
||||
|
||||
if (craft_hass_recipe_id(id))
|
||||
return;
|
||||
|
||||
Ref<CraftRecipe> craft_recipe = ESS::get_instance()->get_resource_db()->get_craft_recipe(id);
|
||||
Ref<CraftRecipe> craft_recipe = ESS::get_singleton()->get_resource_db()->get_craft_recipe(id);
|
||||
|
||||
ERR_FAIL_COND(!craft_recipe.is_valid());
|
||||
|
||||
_s_craft_recipes.push_back(craft_recipe);
|
||||
|
||||
if (ESS::get_instance()->get_allow_class_recipe_learning() && (_s_entity_player_type == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY)) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
if (ESS::get_singleton()->get_allow_class_recipe_learning() && (_s_entity_player_type == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY)) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
|
||||
if (class_profile->has_custom_data("recipes")) {
|
||||
Vector<String> recipes = class_profile->get_custom_data("recipes");
|
||||
@ -1740,12 +1740,12 @@ void Entity::craft_addc_recipe(Ref<CraftRecipe> craft_recipe) {
|
||||
emit_signal("ccraft_recipe_added", this, craft_recipe);
|
||||
}
|
||||
void Entity::craft_addc_recipe_id(int id) {
|
||||
ERR_FAIL_COND(!ESS::get_instance());
|
||||
ERR_FAIL_COND(!ESS::get_singleton());
|
||||
|
||||
if (craft_hasc_recipe_id(id))
|
||||
return;
|
||||
|
||||
Ref<CraftRecipe> craft_recipe = ESS::get_instance()->get_resource_db()->get_craft_recipe(id);
|
||||
Ref<CraftRecipe> craft_recipe = ESS::get_singleton()->get_resource_db()->get_craft_recipe(id);
|
||||
|
||||
ERR_FAIL_COND(!craft_recipe.is_valid());
|
||||
|
||||
@ -1789,42 +1789,42 @@ int Entity::craft_getc_recipe_count() {
|
||||
//// Stat System ////
|
||||
|
||||
EntityStat Entity::get_stat(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), EntityStat());
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), EntityStat());
|
||||
|
||||
return _stats[stat_id];
|
||||
}
|
||||
|
||||
void Entity::set_stat(const int stat_id, const EntityStat &entry) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.set(stat_id, entry);
|
||||
}
|
||||
|
||||
bool Entity::stat_get_dirty(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), false);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), false);
|
||||
|
||||
return _stats[stat_id].dirty;
|
||||
}
|
||||
void Entity::stat_set_dirty(const int stat_id, const bool value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].dirty = value;
|
||||
}
|
||||
|
||||
float Entity::stat_get_base(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].base;
|
||||
}
|
||||
void Entity::stat_set_base(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].base = value;
|
||||
|
||||
stat_recalculate(stat_id);
|
||||
}
|
||||
void Entity::stat_mod_base(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].base += value;
|
||||
|
||||
@ -1832,12 +1832,12 @@ void Entity::stat_mod_base(const int stat_id, const float value) {
|
||||
}
|
||||
|
||||
float Entity::stat_get_base_calculated(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].base_calculated;
|
||||
}
|
||||
void Entity::stat_set_base_calculated(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].base_calculated = value;
|
||||
|
||||
@ -1845,19 +1845,19 @@ void Entity::stat_set_base_calculated(const int stat_id, const float value) {
|
||||
}
|
||||
|
||||
float Entity::stat_get_bonus(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].bonus;
|
||||
}
|
||||
void Entity::stat_set_bonus(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].bonus = value;
|
||||
|
||||
stat_recalculate(stat_id);
|
||||
}
|
||||
void Entity::stat_mod_bonus(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].bonus += value;
|
||||
|
||||
@ -1865,19 +1865,19 @@ void Entity::stat_mod_bonus(const int stat_id, const float value) {
|
||||
}
|
||||
|
||||
float Entity::stat_get_percent(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].percent;
|
||||
}
|
||||
void Entity::stat_set_percent(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].percent = value;
|
||||
|
||||
stat_recalculate(stat_id);
|
||||
}
|
||||
void Entity::stat_mod_percent(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].percent += value;
|
||||
|
||||
@ -1885,7 +1885,7 @@ void Entity::stat_mod_percent(const int stat_id, const float value) {
|
||||
}
|
||||
|
||||
void Entity::stat_mod(const int stat_id, const float base, const float bonus, const float percent) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].base += base;
|
||||
_stats.write[stat_id].bonus += bonus;
|
||||
@ -1895,23 +1895,23 @@ void Entity::stat_mod(const int stat_id, const float base, const float bonus, co
|
||||
}
|
||||
|
||||
float Entity::stat_gets_current(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].scurrent;
|
||||
}
|
||||
void Entity::stat_sets_current(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].scurrent = value;
|
||||
}
|
||||
|
||||
float Entity::stat_getc_current(const int stat_id) const {
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_instance()->stat_get_count(), 0);
|
||||
ERR_FAIL_INDEX_V(stat_id, ESS::get_singleton()->stat_get_count(), 0);
|
||||
|
||||
return _stats[stat_id].ccurrent;
|
||||
}
|
||||
void Entity::stat_setc_current(const int stat_id, const float value) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_stats.write[stat_id].ccurrent = value;
|
||||
|
||||
@ -1919,7 +1919,7 @@ void Entity::stat_setc_current(const int stat_id, const float value) {
|
||||
}
|
||||
|
||||
void Entity::stat_recalculate(const int stat_id) {
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(stat_id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
stat_sets_current(stat_id, (stat_get_base(stat_id) + stat_get_base_calculated(stat_id) + stat_get_bonus(stat_id)) * (stat_get_percent(stat_id) / 100.0));
|
||||
|
||||
@ -1958,14 +1958,14 @@ void Entity::notification_cstat_changed(const int statid, const float current) {
|
||||
}
|
||||
|
||||
void Entity::ssend_stat(int id, int ccurrent) {
|
||||
ERR_FAIL_INDEX(id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
//Only the owner needs access to stats
|
||||
ORPC(creceive_stat, id, ccurrent);
|
||||
}
|
||||
|
||||
void Entity::creceive_stat(int id, int ccurrent) {
|
||||
ERR_FAIL_INDEX(id, ESS::get_instance()->stat_get_count());
|
||||
ERR_FAIL_INDEX(id, ESS::get_singleton()->stat_get_count());
|
||||
|
||||
stat_setc_current(id, ccurrent);
|
||||
}
|
||||
@ -2067,7 +2067,7 @@ void Entity::equips(int equip_slot, int bag_slot) {
|
||||
call("_equips", equip_slot, bag_slot);
|
||||
}
|
||||
void Entity::_equips(int equip_slot, int bag_slot) {
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_singleton()->equip_slot_get_count());
|
||||
ERR_FAIL_COND(!_s_bag.is_valid());
|
||||
|
||||
Ref<ItemInstance> bag_item = _s_bag->get_item(bag_slot);
|
||||
@ -2098,7 +2098,7 @@ void Entity::_equips(int equip_slot, int bag_slot) {
|
||||
ORPC(equip_csuccess, equip_slot, bag_slot);
|
||||
}
|
||||
void Entity::equip_csuccess(int equip_slot, int bag_slot) {
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_singleton()->equip_slot_get_count());
|
||||
ERR_FAIL_COND(!_c_bag.is_valid());
|
||||
|
||||
Ref<ItemInstance> old_bag_item = _c_bag->get_item(bag_slot);
|
||||
@ -2116,7 +2116,7 @@ void Entity::equip_csuccess(int equip_slot, int bag_slot) {
|
||||
equip_con_success(equip_slot, old_bag_item, old_equipped_item, bag_slot);
|
||||
}
|
||||
void Entity::equip_cfail(int equip_slot, int bag_slot) {
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(equip_slot, ESS::get_singleton()->equip_slot_get_count());
|
||||
ERR_FAIL_COND(!_c_bag.is_valid());
|
||||
|
||||
Ref<ItemInstance> bag_item = _c_bag->get_item(bag_slot);
|
||||
@ -2126,23 +2126,23 @@ void Entity::equip_cfail(int equip_slot, int bag_slot) {
|
||||
}
|
||||
|
||||
Ref<ItemInstance> Entity::equip_gets_slot(int index) {
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_instance()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
|
||||
return _s_equipment[index];
|
||||
}
|
||||
void Entity::equip_sets_slot(int index, Ref<ItemInstance> item) {
|
||||
ERR_FAIL_INDEX(index, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(index, ESS::get_singleton()->equip_slot_get_count());
|
||||
|
||||
_s_equipment.write[index] = item;
|
||||
}
|
||||
|
||||
Ref<ItemInstance> Entity::equip_getc_slot(int index) {
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_instance()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemInstance>());
|
||||
|
||||
return _c_equipment[index];
|
||||
}
|
||||
void Entity::equip_setc_slot(int index, Ref<ItemInstance> item) {
|
||||
ERR_FAIL_INDEX(index, ESS::get_instance()->equip_slot_get_count());
|
||||
ERR_FAIL_INDEX(index, ESS::get_singleton()->equip_slot_get_count());
|
||||
|
||||
_c_equipment.write[index] = item;
|
||||
}
|
||||
@ -2324,7 +2324,7 @@ void Entity::resource_addc_rpc(int index, String data) {
|
||||
|
||||
int data_id = dict.get("data_id", 0);
|
||||
|
||||
Ref<EntityResourceData> resd = ESS::get_instance()->get_resource_db()->get_entity_resource(data_id);
|
||||
Ref<EntityResourceData> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource(data_id);
|
||||
|
||||
ERR_FAIL_COND(!resd.is_valid());
|
||||
|
||||
@ -2691,7 +2691,7 @@ void Entity::levelup_sclass(int value) {
|
||||
if (value <= 0)
|
||||
return;
|
||||
|
||||
if (_s_class_level == ESS::get_instance()->get_max_class_level())
|
||||
if (_s_class_level == ESS::get_singleton()->get_max_class_level())
|
||||
return;
|
||||
|
||||
_s_class_level += value;
|
||||
@ -2710,7 +2710,7 @@ void Entity::levelup_scharacter(int value) {
|
||||
if (value <= 0)
|
||||
return;
|
||||
|
||||
if (_s_character_level == ESS::get_instance()->get_max_character_level())
|
||||
if (_s_character_level == ESS::get_singleton()->get_max_character_level())
|
||||
return;
|
||||
|
||||
_s_character_level += value;
|
||||
@ -2747,7 +2747,7 @@ void Entity::item_crequest_use(int item_id) {
|
||||
RPCS(item_uses, item_id);
|
||||
}
|
||||
void Entity::_item_uses(int item_id) {
|
||||
Ref<ItemTemplate> it = ESS::get_instance()->get_resource_db()->get_item_template(item_id);
|
||||
Ref<ItemTemplate> it = ESS::get_singleton()->get_resource_db()->get_item_template(item_id);
|
||||
|
||||
ERR_FAIL_COND(!it.is_valid());
|
||||
|
||||
@ -3871,17 +3871,17 @@ void Entity::cast_spell_successc(Ref<SpellCastInfo> info) {
|
||||
}
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown>> *Entity::cooldowns_gets() {
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_gets() {
|
||||
return &_s_cooldowns;
|
||||
}
|
||||
Vector<Ref<Cooldown>> *Entity::cooldowns_getc() {
|
||||
Vector<Ref<Cooldown> > *Entity::cooldowns_getc() {
|
||||
return &_c_cooldowns;
|
||||
}
|
||||
|
||||
HashMap<int, Ref<Cooldown>> *Entity::cooldown_get_maps() {
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_maps() {
|
||||
return &_s_cooldown_map;
|
||||
}
|
||||
HashMap<int, Ref<Cooldown>> *Entity::cooldown_get_mapc() {
|
||||
HashMap<int, Ref<Cooldown> > *Entity::cooldown_get_mapc() {
|
||||
return &_c_cooldown_map;
|
||||
}
|
||||
|
||||
@ -4025,10 +4025,10 @@ int Entity::cooldown_getc_count() {
|
||||
}
|
||||
|
||||
//Category Cooldowns
|
||||
Vector<Ref<CategoryCooldown>> Entity::category_cooldowns_gets() {
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_gets() {
|
||||
return _s_category_cooldowns;
|
||||
}
|
||||
Vector<Ref<CategoryCooldown>> Entity::category_cooldowns_getc() {
|
||||
Vector<Ref<CategoryCooldown> > Entity::category_cooldowns_getc() {
|
||||
return _c_category_cooldowns;
|
||||
}
|
||||
|
||||
@ -4258,8 +4258,8 @@ void Entity::spell_adds(Ref<Spell> spell) {
|
||||
|
||||
_s_spells.push_back(spell);
|
||||
|
||||
if (ESS::get_instance()->get_allow_class_spell_learning() && (_s_entity_player_type == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY)) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
if (ESS::get_singleton()->get_allow_class_spell_learning() && (_s_entity_player_type == EntityEnums::ENTITY_PLAYER_TYPE_PLAYER || gets_entity_player_type() == EntityEnums::ENTITY_PLAYER_TYPE_DISPLAY)) {
|
||||
Ref<ClassProfile> class_profile = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(_s_entity_data->get_path());
|
||||
|
||||
if (class_profile->has_custom_data("spells")) {
|
||||
Vector<String> spells = class_profile->get_custom_data("spells");
|
||||
@ -4290,7 +4290,7 @@ void Entity::spell_adds(Ref<Spell> spell) {
|
||||
ORPCOBJ(spell_addc_rpc, spell->get_id(), spell_addc, spell);
|
||||
}
|
||||
void Entity::spell_adds_id(int id) {
|
||||
Ref<Spell> spell = ESS::get_instance()->get_resource_db()->get_spell(id);
|
||||
Ref<Spell> spell = ESS::get_singleton()->get_resource_db()->get_spell(id);
|
||||
|
||||
ERR_FAIL_COND(!spell.is_valid());
|
||||
|
||||
@ -4368,14 +4368,14 @@ int Entity::spell_getc_count() {
|
||||
}
|
||||
|
||||
void Entity::spell_addc_rpc(int id) {
|
||||
ERR_FAIL_COND(ESS::get_instance() == NULL);
|
||||
ERR_FAIL_COND(ESS::get_singleton() == NULL);
|
||||
|
||||
spell_addc(ESS::get_instance()->get_resource_db()->get_spell(id));
|
||||
spell_addc(ESS::get_singleton()->get_resource_db()->get_spell(id));
|
||||
}
|
||||
void Entity::spell_removec_rpc(int id) {
|
||||
ERR_FAIL_COND(ESS::get_instance() == NULL);
|
||||
ERR_FAIL_COND(ESS::get_singleton() == NULL);
|
||||
|
||||
spell_removec(ESS::get_instance()->get_resource_db()->get_spell(id));
|
||||
spell_removec(ESS::get_singleton()->get_resource_db()->get_spell(id));
|
||||
}
|
||||
|
||||
//Skills
|
||||
@ -5247,7 +5247,7 @@ void Entity::set_actionbar_locked(bool value) {
|
||||
}
|
||||
|
||||
Ref<ActionBarProfile> Entity::get_action_bar_profile() {
|
||||
Ref<ClassProfile> cp = ProfileManager::get_instance()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path());
|
||||
Ref<ClassProfile> cp = ProfileManager::get_singleton()->getc_player_profile()->get_class_profile(gets_entity_data()->get_path());
|
||||
|
||||
if (cp.is_valid()) {
|
||||
set_actionbar_locked(cp->get_actionbar_locked());
|
||||
@ -5336,7 +5336,7 @@ void Entity::update(float delta) {
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
if (stat_get_dirty(i)) {
|
||||
ssend_stat(i, stat_gets_current(i));
|
||||
|
||||
@ -5681,7 +5681,7 @@ Entity::Entity() {
|
||||
//_action_bar_profile.instance();
|
||||
_actionbar_locked = false;
|
||||
|
||||
_stats.resize(ESS::get_instance()->stat_get_count());
|
||||
_stats.resize(ESS::get_singleton()->stat_get_count());
|
||||
|
||||
_sai_state = EntityEnums::AI_STATE_OFF;
|
||||
_sai_state_stored = EntityEnums::AI_STATE_OFF;
|
||||
@ -5695,8 +5695,8 @@ Entity::Entity() {
|
||||
_s_pet_formation_index = 0;
|
||||
_s_pet_ai_state = EntityEnums::AI_STATE_OFF;
|
||||
|
||||
_s_equipment.resize(ESS::get_instance()->equip_slot_get_count());
|
||||
_c_equipment.resize(ESS::get_instance()->equip_slot_get_count());
|
||||
_s_equipment.resize(ESS::get_singleton()->equip_slot_get_count());
|
||||
_c_equipment.resize(ESS::get_singleton()->equip_slot_get_count());
|
||||
|
||||
SET_RPC_REMOTE("csend_request_rank_increase");
|
||||
SET_RPC_REMOTE("csend_request_rank_decrease");
|
||||
@ -5988,9 +5988,9 @@ void Entity::_crafts(int id) {
|
||||
}
|
||||
|
||||
void Entity::_notification_sxp_gained(int value) {
|
||||
if (ESS::get_instance()->get_use_class_xp() && ESS::get_instance()->get_automatic_class_levelups()) {
|
||||
if (ESS::get_instance()->get_resource_db()->get_xp_data()->can_class_level_up(gets_class_level())) {
|
||||
int xpr = ESS::get_instance()->get_resource_db()->get_xp_data()->get_class_xp(gets_class_level());
|
||||
if (ESS::get_singleton()->get_use_class_xp() && ESS::get_singleton()->get_automatic_class_levelups()) {
|
||||
if (ESS::get_singleton()->get_resource_db()->get_xp_data()->can_class_level_up(gets_class_level())) {
|
||||
int xpr = ESS::get_singleton()->get_resource_db()->get_xp_data()->get_class_xp(gets_class_level());
|
||||
|
||||
if (xpr <= gets_class_xp()) {
|
||||
levelup_sclass(1);
|
||||
@ -5999,8 +5999,8 @@ void Entity::_notification_sxp_gained(int value) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ESS::get_instance()->get_resource_db()->get_xp_data()->can_character_level_up(gets_character_level())) {
|
||||
int xpr = ESS::get_instance()->get_resource_db()->get_xp_data()->get_character_xp(gets_character_level());
|
||||
if (ESS::get_singleton()->get_resource_db()->get_xp_data()->can_character_level_up(gets_character_level())) {
|
||||
int xpr = ESS::get_singleton()->get_resource_db()->get_xp_data()->get_character_xp(gets_character_level());
|
||||
|
||||
if (xpr <= gets_character_xp()) {
|
||||
levelup_scharacter(1);
|
||||
@ -6018,14 +6018,14 @@ void Entity::_notification_scharacter_level_up(int level) {
|
||||
if (!ecd.is_valid())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_main_stat_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_main_stat_count(); ++i) {
|
||||
int st = gets_entity_data()->get_stat_data()->get_level_stat_data()->get_stat_diff(i, gets_character_level() - level, gets_character_level());
|
||||
|
||||
stat_mod_base(i, st);
|
||||
}
|
||||
|
||||
if (!ESS::get_instance()->get_use_class_xp()) {
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (!ESS::get_singleton()->get_use_class_xp()) {
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
sets_free_spell_points(gets_free_spell_points() + ecd->get_spell_points_per_level() * level);
|
||||
|
||||
sets_free_talent_points(gets_free_talent_points() + level);
|
||||
@ -6041,7 +6041,7 @@ void Entity::_notification_sclass_level_up(int level) {
|
||||
if (!ecd.is_valid())
|
||||
return;
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
sets_free_spell_points(gets_free_spell_points() + ecd->get_spell_points_per_level() * level);
|
||||
|
||||
sets_free_talent_points(gets_free_talent_points() + level);
|
||||
@ -6108,7 +6108,7 @@ void Entity::_notification_sdeath() {
|
||||
}
|
||||
|
||||
void Entity::_spell_learns(int id) {
|
||||
if (ESS::get_instance()->get_use_spell_points()) {
|
||||
if (ESS::get_singleton()->get_use_spell_points()) {
|
||||
ERR_FAIL_COND(gets_free_spell_points() <= 0);
|
||||
}
|
||||
|
||||
@ -6133,7 +6133,7 @@ void Entity::_spell_learns(int id) {
|
||||
|
||||
spell_adds(sp);
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
sets_free_spell_points(_s_free_spell_points - 1);
|
||||
|
||||
return;
|
||||
@ -6234,7 +6234,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
sets_model_index(static_cast<int>(static_cast<int>(dict.get("model_index", 0))));
|
||||
|
||||
if (ESS::get_instance()->get_use_global_class_level()) {
|
||||
if (ESS::get_singleton()->get_use_global_class_level()) {
|
||||
_s_class_level = (dict.get("class_level", 0));
|
||||
_s_class_xp = (dict.get("class_xp", 0));
|
||||
} else {
|
||||
@ -6255,7 +6255,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
Dictionary equipment = dict.get("equipment", Dictionary());
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
if (equipment.has(String::num(i))) {
|
||||
Ref<ItemInstance> ii = _s_equipment[i];
|
||||
|
||||
@ -6282,7 +6282,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
StringName data_path = ird.get("data_path", "");
|
||||
|
||||
Ref<EntityResourceData> resd = ESS::get_instance()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
Ref<EntityResourceData> resd = ESS::get_singleton()->get_resource_db()->get_entity_resource_path(data_path);
|
||||
|
||||
ERR_CONTINUE(!resd.is_valid());
|
||||
|
||||
@ -6412,8 +6412,8 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
for (int i = 0; i < known_recipes.size(); ++i) {
|
||||
StringName crn = known_recipes.get(String::num(i), "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
Ref<CraftRecipe> cr = ESS::get_instance()->get_resource_db()->get_craft_recipe_path(crn);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
Ref<CraftRecipe> cr = ESS::get_singleton()->get_resource_db()->get_craft_recipe_path(crn);
|
||||
|
||||
if (cr.is_valid()) {
|
||||
craft_adds_recipe(cr);
|
||||
@ -6423,7 +6423,7 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
sets_free_spell_points(dict.get("free_spell_points", 0));
|
||||
|
||||
Dictionary known_spells = dict.get("known_spells", Dictionary());
|
||||
@ -6431,8 +6431,8 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
for (int i = 0; i < known_spells.size(); ++i) {
|
||||
StringName spell_path = known_spells.get(String::num(i), "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
Ref<Spell> sp = ESS::get_instance()->get_resource_db()->get_spell_path(spell_path);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
Ref<Spell> sp = ESS::get_singleton()->get_resource_db()->get_spell_path(spell_path);
|
||||
|
||||
if (sp.is_valid()) {
|
||||
_s_spells.push_back(sp);
|
||||
@ -6479,8 +6479,8 @@ bool Entity::_set(const StringName &p_name, const Variant &p_value) {
|
||||
|
||||
StringName edp = dict.get("entity_data_path", "");
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
sets_entity_data(ESS::get_instance()->get_resource_db()->get_entity_data_path(edp));
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
sets_entity_data(ESS::get_singleton()->get_resource_db()->get_entity_data_path(edp));
|
||||
}
|
||||
|
||||
sets_entity_data_path(edp);*/
|
||||
@ -6524,7 +6524,7 @@ bool Entity::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
|
||||
Dictionary equipment;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->equip_slot_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
|
||||
Ref<ItemInstance> ii = _s_equipment[i];
|
||||
|
||||
if (ii.is_valid())
|
||||
@ -6631,7 +6631,7 @@ bool Entity::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
if (ESS::get_instance()->get_use_spell_points())
|
||||
if (ESS::get_singleton()->get_use_spell_points())
|
||||
dict["free_spell_points"] = _s_free_spell_points;
|
||||
|
||||
Dictionary known_spells;
|
||||
@ -6669,7 +6669,7 @@ void Entity::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
//int property_usange = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL;
|
||||
int property_usange = PROPERTY_USAGE_DEFAULT;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::REAL, "stat/" + itos(i) + "/base", PROPERTY_HINT_NONE, "", property_usange));
|
||||
p_list->push_back(PropertyInfo(Variant::REAL, "stat/" + itos(i) + "/percent", PROPERTY_HINT_NONE, "", property_usange));
|
||||
p_list->push_back(PropertyInfo(Variant::REAL, "stat/" + itos(i) + "/scurrent", PROPERTY_HINT_NONE, "", property_usange));
|
||||
@ -6680,7 +6680,7 @@ void Entity::_validate_property(PropertyInfo &property) const {
|
||||
String name = property.name;
|
||||
|
||||
if (name == "sentity_player_type" || name == "centity_player_type") {
|
||||
property.hint_string = ESS::get_instance()->entity_types_get();
|
||||
property.hint_string = ESS::get_singleton()->entity_types_get();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7193,7 +7193,7 @@ void Entity::_bind_methods() {
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "centity_data", PROPERTY_HINT_RESOURCE_TYPE, "EntityData", 0), "setc_entity_data", "getc_entity_data");
|
||||
|
||||
//todo
|
||||
//for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
//for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
// ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "stats/" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "Stat"), "set_stat_int", "get_stat_int", i);
|
||||
//}
|
||||
|
||||
|
@ -699,11 +699,11 @@ public:
|
||||
|
||||
//// Cooldowns ////
|
||||
|
||||
Vector<Ref<Cooldown>> *cooldowns_gets();
|
||||
Vector<Ref<Cooldown>> *cooldowns_getc();
|
||||
Vector<Ref<Cooldown> > *cooldowns_gets();
|
||||
Vector<Ref<Cooldown> > *cooldowns_getc();
|
||||
|
||||
HashMap<int, Ref<Cooldown>> *cooldown_get_maps();
|
||||
HashMap<int, Ref<Cooldown>> *cooldown_get_mapc();
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_maps();
|
||||
HashMap<int, Ref<Cooldown> > *cooldown_get_mapc();
|
||||
|
||||
bool cooldown_hass(int spell_id);
|
||||
void cooldown_adds(int spell_id, float value);
|
||||
@ -721,8 +721,8 @@ public:
|
||||
|
||||
//Category Cooldowns
|
||||
|
||||
Vector<Ref<CategoryCooldown>> category_cooldowns_gets();
|
||||
Vector<Ref<CategoryCooldown>> category_cooldowns_getc();
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_gets();
|
||||
Vector<Ref<CategoryCooldown> > category_cooldowns_getc();
|
||||
|
||||
bool category_cooldown_hass(int category_id);
|
||||
void category_cooldown_adds(int category_id, float value);
|
||||
@ -1126,13 +1126,13 @@ private:
|
||||
|
||||
//// Equipment ////
|
||||
|
||||
Vector<Ref<ItemInstance>> _s_equipment;
|
||||
Vector<Ref<ItemInstance>> _c_equipment;
|
||||
Vector<Ref<ItemInstance> > _s_equipment;
|
||||
Vector<Ref<ItemInstance> > _c_equipment;
|
||||
|
||||
//// Resources ////
|
||||
|
||||
Vector<Ref<EntityResource>> _s_resources;
|
||||
Vector<Ref<EntityResource>> _c_resources;
|
||||
Vector<Ref<EntityResource> > _s_resources;
|
||||
Vector<Ref<EntityResource> > _c_resources;
|
||||
|
||||
//// GCD ////
|
||||
|
||||
@ -1153,8 +1153,8 @@ private:
|
||||
|
||||
//// AuraComponent ////
|
||||
|
||||
Vector<Ref<AuraData>> _s_auras;
|
||||
Vector<Ref<AuraData>> _c_auras;
|
||||
Vector<Ref<AuraData> > _s_auras;
|
||||
Vector<Ref<AuraData> > _c_auras;
|
||||
|
||||
int _s_entity_type;
|
||||
int _c_entity_type;
|
||||
@ -1165,14 +1165,14 @@ private:
|
||||
int _c_entity_flags;
|
||||
|
||||
//// Cooldowns ////
|
||||
Vector<Ref<Cooldown>> _s_cooldowns;
|
||||
Vector<Ref<Cooldown>> _c_cooldowns;
|
||||
Vector<Ref<Cooldown> > _s_cooldowns;
|
||||
Vector<Ref<Cooldown> > _c_cooldowns;
|
||||
|
||||
HashMap<int, Ref<Cooldown>> _s_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown>> _c_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown> > _s_cooldown_map;
|
||||
HashMap<int, Ref<Cooldown> > _c_cooldown_map;
|
||||
|
||||
Vector<Ref<CategoryCooldown>> _s_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown>> _c_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown> > _s_category_cooldowns;
|
||||
Vector<Ref<CategoryCooldown> > _c_category_cooldowns;
|
||||
|
||||
int _s_active_category_cooldowns;
|
||||
int _c_active_category_cooldowns;
|
||||
@ -1192,8 +1192,8 @@ private:
|
||||
|
||||
//// Data ////
|
||||
|
||||
Vector<Ref<EntityDataContainer>> _s_data;
|
||||
Vector<Ref<EntityDataContainer>> _c_data;
|
||||
Vector<Ref<EntityDataContainer> > _s_data;
|
||||
Vector<Ref<EntityDataContainer> > _c_data;
|
||||
|
||||
//// Actionbars ////
|
||||
|
||||
@ -1202,26 +1202,26 @@ private:
|
||||
|
||||
//// Crafting System ////
|
||||
|
||||
Vector<Ref<CraftRecipe>> _s_craft_recipes;
|
||||
Vector<Ref<CraftRecipe>> _c_craft_recipes;
|
||||
Vector<Ref<CraftRecipe> > _s_craft_recipes;
|
||||
Vector<Ref<CraftRecipe> > _c_craft_recipes;
|
||||
|
||||
//// Known Spells ////
|
||||
|
||||
int _s_free_spell_points;
|
||||
int _c_free_spell_points;
|
||||
|
||||
Vector<Ref<Spell>> _s_spells;
|
||||
Vector<Ref<Spell>> _c_spells;
|
||||
Vector<Ref<Spell> > _s_spells;
|
||||
Vector<Ref<Spell> > _c_spells;
|
||||
|
||||
//// Skills ////
|
||||
|
||||
Vector<Ref<EntitySkill>> _s_skills;
|
||||
Vector<Ref<EntitySkill>> _c_skills;
|
||||
Vector<Ref<EntitySkill> > _s_skills;
|
||||
Vector<Ref<EntitySkill> > _c_skills;
|
||||
|
||||
//// Stat Allocations ////
|
||||
|
||||
//int _unallocated_stats;
|
||||
//int _stat_allocations[ESS::get_instance()->stat_get_count()];
|
||||
//int _stat_allocations[ESS::get_singleton()->stat_get_count()];
|
||||
|
||||
//// Inventory ////
|
||||
|
||||
@ -1260,7 +1260,7 @@ private:
|
||||
|
||||
// Callbacks
|
||||
|
||||
Vector<Ref<SpellCastInfo>> _physics_process_scis;
|
||||
Vector<Ref<SpellCastInfo> > _physics_process_scis;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -165,7 +165,7 @@ void EntityResource::receivec_update_string(const String str) {
|
||||
}
|
||||
|
||||
void EntityResource::resolve_references() {
|
||||
set_resource_data(ESS::get_instance()->get_resource_db()->get_entity_resource_path(_data_path));
|
||||
set_resource_data(ESS::get_singleton()->get_resource_db()->get_entity_resource_path(_data_path));
|
||||
}
|
||||
|
||||
Dictionary EntityResource::to_dict() {
|
||||
@ -192,13 +192,13 @@ Dictionary EntityResource::_to_dict() {
|
||||
}
|
||||
void EntityResource::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
ERR_FAIL_COND(!ESS::get_instance()->get_resource_db().is_valid());
|
||||
ERR_FAIL_COND(!ESS::get_singleton()->get_resource_db().is_valid());
|
||||
|
||||
_dirty = dict.get("dirty", false);
|
||||
_should_process = dict.get("should_process", false);
|
||||
|
||||
_data_path = dict.get("data_path", "");
|
||||
//_data_id = ESS::get_instance()->get_resource_db()->entity_data_path_to_id(_data_path);
|
||||
//_data_id = ESS::get_singleton()->get_resource_db()->entity_data_path_to_id(_data_path);
|
||||
|
||||
//_data_id = dict.get("data_id", 0);
|
||||
_current = dict.get("current", 0);
|
||||
|
@ -32,12 +32,12 @@ void EntityResourceHealth::_init() {
|
||||
stamina_stat_id = 0;
|
||||
health_stat_id = 0;
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Stamina")) {
|
||||
stamina_stat_id = ESS::get_instance()->stat_get_id("Stamina");
|
||||
if (ESS::get_singleton()->stat_is_property("Stamina")) {
|
||||
stamina_stat_id = ESS::get_singleton()->stat_get_id("Stamina");
|
||||
}
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Health")) {
|
||||
health_stat_id = ESS::get_instance()->stat_get_id("Health");
|
||||
if (ESS::get_singleton()->stat_is_property("Health")) {
|
||||
health_stat_id = ESS::get_singleton()->stat_get_id("Health");
|
||||
}
|
||||
}
|
||||
void EntityResourceHealth::_ons_added(Node *entity) {
|
||||
|
@ -32,8 +32,8 @@ void EntityResourceSpeed::_init() {
|
||||
|
||||
speed_stat_id = 0;
|
||||
|
||||
if (ESS::get_instance()->stat_is_property("Speed"))
|
||||
speed_stat_id = ESS::get_instance()->stat_get_id("Speed");
|
||||
if (ESS::get_singleton()->stat_is_property("Speed"))
|
||||
speed_stat_id = ESS::get_singleton()->stat_get_id("Speed");
|
||||
}
|
||||
void EntityResourceSpeed::_ons_added(Node *entity) {
|
||||
refresh();
|
||||
|
@ -48,8 +48,8 @@ int EntitySkill::get_skill_id() {
|
||||
void EntitySkill::set_skill_id(int value) {
|
||||
_skill_id = value;
|
||||
|
||||
if (ESS::get_instance() != NULL) {
|
||||
_skill = ESS::get_instance()->get_resource_db()->get_entity_skill(_skill_id);
|
||||
if (ESS::get_singleton() != NULL) {
|
||||
_skill = ESS::get_singleton()->get_resource_db()->get_entity_skill(_skill_id);
|
||||
}
|
||||
|
||||
emit_signal("skill_changed", Ref<EntitySkill>(this));
|
||||
|
@ -25,14 +25,14 @@ SOFTWARE.
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
int ComplexLevelStatData::get_stat_for_level(int main_stat, int level) {
|
||||
ERR_FAIL_INDEX_V(level, ESS::get_instance()->get_max_character_level(), 0);
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_instance()->stat_get_main_stat_count(), 0);
|
||||
ERR_FAIL_INDEX_V(level, ESS::get_singleton()->get_max_character_level(), 0);
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_singleton()->stat_get_main_stat_count(), 0);
|
||||
|
||||
return _stat_per_level[level][main_stat];
|
||||
}
|
||||
void ComplexLevelStatData::set_stat_for_level(int main_stat, int level, int value) {
|
||||
ERR_FAIL_INDEX(level, ESS::get_instance()->get_max_character_level());
|
||||
ERR_FAIL_INDEX(main_stat, ESS::get_instance()->stat_get_main_stat_count());
|
||||
ERR_FAIL_INDEX(level, ESS::get_singleton()->get_max_character_level());
|
||||
ERR_FAIL_INDEX(main_stat, ESS::get_singleton()->stat_get_main_stat_count());
|
||||
|
||||
_stat_per_level.write[level].set(main_stat, value);
|
||||
}
|
||||
@ -48,11 +48,11 @@ int ComplexLevelStatData::_get_stat_diff(int main_stat, int old_level, int new_l
|
||||
}
|
||||
|
||||
ComplexLevelStatData::ComplexLevelStatData() {
|
||||
_stat_per_level.resize(ESS::get_instance()->get_max_character_level());
|
||||
_stat_per_level.resize(ESS::get_singleton()->get_max_character_level());
|
||||
|
||||
int msc = ESS::get_instance()->stat_get_main_stat_count();
|
||||
int msc = ESS::get_singleton()->stat_get_main_stat_count();
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->get_max_character_level(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->get_max_character_level(); ++i) {
|
||||
_stat_per_level.write[i].resize(msc);
|
||||
|
||||
for (int j = 0; j < msc; ++j) {
|
||||
@ -62,7 +62,7 @@ ComplexLevelStatData::ComplexLevelStatData() {
|
||||
}
|
||||
|
||||
ComplexLevelStatData::~ComplexLevelStatData() {
|
||||
for (int i = 0; i < ESS::get_instance()->get_max_character_level(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->get_max_character_level(); ++i) {
|
||||
_stat_per_level.write[i].clear();
|
||||
}
|
||||
}
|
||||
@ -74,15 +74,15 @@ bool ComplexLevelStatData::_set(const StringName &p_name, const Variant &p_value
|
||||
String level_prop = prop_name.get_slice("/", 0);
|
||||
int level = level_prop.get_slice("_", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_character_level())
|
||||
if (level >= ESS::get_singleton()->get_max_character_level())
|
||||
return false;
|
||||
|
||||
String prop = prop_name.get_slice("/", 1);
|
||||
|
||||
if (ESS::get_instance()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(prop);
|
||||
if (ESS::get_singleton()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(prop);
|
||||
|
||||
if (stat_id >= ESS::get_instance()->stat_get_main_stat_count()) {
|
||||
if (stat_id >= ESS::get_singleton()->stat_get_main_stat_count()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -104,15 +104,15 @@ bool ComplexLevelStatData::_get(const StringName &p_name, Variant &r_ret) const
|
||||
String level_prop = prop_name.get_slice("/", 0);
|
||||
int level = level_prop.get_slice("_", 1).to_int();
|
||||
|
||||
if (level >= ESS::get_instance()->get_max_character_level())
|
||||
if (level >= ESS::get_singleton()->get_max_character_level())
|
||||
return false;
|
||||
|
||||
String prop = prop_name.get_slice("/", 1);
|
||||
|
||||
if (ESS::get_instance()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(prop);
|
||||
if (ESS::get_singleton()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(prop);
|
||||
|
||||
if (stat_id >= ESS::get_instance()->stat_get_main_stat_count()) {
|
||||
if (stat_id >= ESS::get_singleton()->stat_get_main_stat_count()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -131,11 +131,11 @@ void ComplexLevelStatData::_get_property_list(List<PropertyInfo> *p_list) const
|
||||
//int property_usange = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL;
|
||||
int property_usange = PROPERTY_USAGE_DEFAULT;
|
||||
|
||||
int msc = ESS::get_instance()->stat_get_main_stat_count();
|
||||
int msc = ESS::get_singleton()->stat_get_main_stat_count();
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->get_max_character_level(); ++i) {
|
||||
for (int i = 0; i < ESS::get_singleton()->get_max_character_level(); ++i) {
|
||||
for (int j = 0; j < msc; ++j) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "level_" + String::num(i + 1) + "/" + ESS::get_instance()->stat_get_property_name(j), PROPERTY_HINT_NONE, "", property_usange));
|
||||
p_list->push_back(PropertyInfo(Variant::INT, "level_" + String::num(i + 1) + "/" + ESS::get_singleton()->stat_get_property_name(j), PROPERTY_HINT_NONE, "", property_usange));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,18 +25,18 @@ SOFTWARE.
|
||||
#include "../../singletons/ess.h"
|
||||
|
||||
int SimpleLevelStatData::get_stat_per_level(int main_stat) {
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_instance()->stat_get_main_stat_count(), 0);
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_singleton()->stat_get_main_stat_count(), 0);
|
||||
|
||||
return _stat_per_level[main_stat];
|
||||
}
|
||||
void SimpleLevelStatData::set_stat_per_level(int main_stat, int value) {
|
||||
ERR_FAIL_INDEX(main_stat, ESS::get_instance()->stat_get_main_stat_count());
|
||||
ERR_FAIL_INDEX(main_stat, ESS::get_singleton()->stat_get_main_stat_count());
|
||||
|
||||
_stat_per_level.set(main_stat, value);
|
||||
}
|
||||
|
||||
int SimpleLevelStatData::_get_stat_diff(int main_stat, int old_level, int new_level) {
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_instance()->stat_get_main_stat_count(), 0);
|
||||
ERR_FAIL_INDEX_V(main_stat, ESS::get_singleton()->stat_get_main_stat_count(), 0);
|
||||
|
||||
int s = _stat_per_level[main_stat];
|
||||
|
||||
@ -46,7 +46,7 @@ int SimpleLevelStatData::_get_stat_diff(int main_stat, int old_level, int new_le
|
||||
}
|
||||
|
||||
SimpleLevelStatData::SimpleLevelStatData() {
|
||||
_stat_per_level.resize(ESS::get_instance()->stat_get_main_stat_count());
|
||||
_stat_per_level.resize(ESS::get_singleton()->stat_get_main_stat_count());
|
||||
|
||||
for (int i = 0; i < _stat_per_level.size(); ++i) {
|
||||
_stat_per_level.set(i, 0);
|
||||
@ -58,10 +58,10 @@ SimpleLevelStatData::~SimpleLevelStatData() {
|
||||
}
|
||||
|
||||
bool SimpleLevelStatData::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (ESS::get_instance()->stat_is_property(p_name)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(p_name);
|
||||
if (ESS::get_singleton()->stat_is_property(p_name)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(p_name);
|
||||
|
||||
if (stat_id >= ESS::get_instance()->stat_get_main_stat_count()) {
|
||||
if (stat_id >= ESS::get_singleton()->stat_get_main_stat_count()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -74,10 +74,10 @@ bool SimpleLevelStatData::_set(const StringName &p_name, const Variant &p_value)
|
||||
}
|
||||
|
||||
bool SimpleLevelStatData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
if (ESS::get_instance()->stat_is_property(p_name)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(p_name);
|
||||
if (ESS::get_singleton()->stat_is_property(p_name)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(p_name);
|
||||
|
||||
if (stat_id >= ESS::get_instance()->stat_get_main_stat_count()) {
|
||||
if (stat_id >= ESS::get_singleton()->stat_get_main_stat_count()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -93,8 +93,8 @@ void SimpleLevelStatData::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
//int property_usange = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL;
|
||||
int property_usange = PROPERTY_USAGE_DEFAULT;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_main_stat_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, ESS::get_instance()->stat_get_property_name(i), PROPERTY_HINT_NONE, "", property_usange));
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_main_stat_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::INT, ESS::get_singleton()->stat_get_property_name(i), PROPERTY_HINT_NONE, "", property_usange));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void StatData::set_mod_stat_multiplier(int index, float value) {
|
||||
|
||||
StatData::StatData() {
|
||||
//TODO remove? let properties handle this?
|
||||
_entries.resize(ESS::get_instance()->stat_get_count());
|
||||
_entries.resize(ESS::get_singleton()->stat_get_count());
|
||||
|
||||
for (int i = 0; i < _entries.size(); ++i) {
|
||||
_entries.set(i, 0);
|
||||
@ -116,8 +116,8 @@ bool StatData::_set(const StringName &p_name, const Variant &p_value) {
|
||||
if (name.get_slicec('/', 0) == "stat") {
|
||||
StringName prop = name.get_slicec('/', 1);
|
||||
|
||||
if (ESS::get_instance()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(prop);
|
||||
if (ESS::get_singleton()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(prop);
|
||||
|
||||
if (_entries.size() < stat_id) {
|
||||
_entries.resize(stat_id + 1);
|
||||
@ -142,8 +142,8 @@ bool StatData::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
if (name.get_slicec('/', 0) == "stat") {
|
||||
StringName prop = name.get_slicec('/', 1);
|
||||
|
||||
if (ESS::get_instance()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_instance()->stat_get_property_id(prop);
|
||||
if (ESS::get_singleton()->stat_is_property(prop)) {
|
||||
int stat_id = ESS::get_singleton()->stat_get_property_id(prop);
|
||||
|
||||
if (_entries.size() < stat_id) {
|
||||
r_ret = 0;
|
||||
@ -168,8 +168,8 @@ void StatData::_get_property_list(List<PropertyInfo> *p_list) const {
|
||||
//int property_usange = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_INTERNAL;
|
||||
int property_usange = PROPERTY_USAGE_DEFAULT;
|
||||
|
||||
for (int i = 0; i < ESS::get_instance()->stat_get_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::REAL, "stat/" + ESS::get_instance()->stat_get_property_name(i), PROPERTY_HINT_NONE, "", property_usange));
|
||||
for (int i = 0; i < ESS::get_singleton()->stat_get_count(); ++i) {
|
||||
p_list->push_back(PropertyInfo(Variant::REAL, "stat/" + ESS::get_singleton()->stat_get_property_name(i), PROPERTY_HINT_NONE, "", property_usange));
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,9 +183,9 @@ void StatData::_validate_property(PropertyInfo &property) const {
|
||||
}
|
||||
|
||||
if (prop.ends_with("stat_id")) {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
} else if (prop.ends_with("target_stat_id")) {
|
||||
property.hint_string = ESS::get_instance()->stat_get_string();
|
||||
property.hint_string = ESS::get_singleton()->stat_get_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ void SpellCastInfo::resolve_references(Node *owner) {
|
||||
_target = Object::cast_to<Entity>(owner->get_node_or_null(_target_path));
|
||||
}
|
||||
|
||||
Ref<Spell> spell = ESS::get_instance()->get_resource_db()->get_spell(_spell_id);
|
||||
Ref<Spell> spell = ESS::get_singleton()->get_resource_db()->get_spell(_spell_id);
|
||||
|
||||
if (spell.is_valid()) {
|
||||
_spell = spell;
|
||||
|
@ -172,9 +172,9 @@ void SpellDamageInfo::resolve_references(Node *owner) {
|
||||
_receiver = Object::cast_to<Entity>(owner->get_node_or_null(_receiver_path));
|
||||
|
||||
if (_damage_source_type == DAMAGE_SOURCE_SPELL) {
|
||||
_damage_source = ESS::get_instance()->get_resource_db()->get_spell(_damage_source_id);
|
||||
_damage_source = ESS::get_singleton()->get_resource_db()->get_spell(_damage_source_id);
|
||||
} else if (_damage_source_type == DAMAGE_SOURCE_AURA) {
|
||||
_damage_source = ESS::get_instance()->get_resource_db()->get_aura(_damage_source_id);
|
||||
_damage_source = ESS::get_singleton()->get_resource_db()->get_aura(_damage_source_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,9 +168,9 @@ void SpellHealInfo::resolve_references(Node *owner) {
|
||||
_receiver = Object::cast_to<Entity>(owner->get_node_or_null(_receiver_path));
|
||||
|
||||
if (_heal_source_type == HEAL_SOURCE_SPELL) {
|
||||
_heal_source = ESS::get_instance()->get_resource_db()->get_spell(_heal_source_id);
|
||||
_heal_source = ESS::get_singleton()->get_resource_db()->get_spell(_heal_source_id);
|
||||
} else if (_heal_source_type == HEAL_SOURCE_AURA) {
|
||||
_heal_source = ESS::get_instance()->get_resource_db()->get_aura(_heal_source_id);
|
||||
_heal_source = ESS::get_singleton()->get_resource_db()->get_aura(_heal_source_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,11 +279,11 @@ void register_entity_spell_system_types() {
|
||||
|
||||
entity_data_manager = memnew(ESS);
|
||||
ClassDB::register_class<ESS>();
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("ESS", ESS::get_instance()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("ESS", ESS::get_singleton()));
|
||||
|
||||
profile_manager = memnew(ProfileManager);
|
||||
ClassDB::register_class<ProfileManager>();
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_instance()));
|
||||
Engine::get_singleton()->add_singleton(Engine::Singleton("ProfileManager", ProfileManager::get_singleton()));
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
//EditorPlugins::add_by_type<ESSEditorPlugin>();
|
||||
|
@ -28,7 +28,7 @@ SOFTWARE.
|
||||
|
||||
ESS *ESS::instance;
|
||||
|
||||
ESS *ESS::get_instance() {
|
||||
ESS *ESS::get_singleton() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class ESS : public Object {
|
||||
GDCLASS(ESS, Object);
|
||||
|
||||
public:
|
||||
static ESS *get_instance();
|
||||
static ESS *get_singleton();
|
||||
|
||||
bool get_use_spell_points() const;
|
||||
void set_use_spell_points(const bool value);
|
||||
|
@ -31,7 +31,7 @@ SOFTWARE.
|
||||
|
||||
ProfileManager *ProfileManager::_instance;
|
||||
|
||||
ProfileManager *ProfileManager::get_instance() {
|
||||
ProfileManager *ProfileManager::get_singleton() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class ProfileManager : public Object {
|
||||
GDCLASS(ProfileManager, Object);
|
||||
|
||||
public:
|
||||
static ProfileManager *get_instance();
|
||||
static ProfileManager *get_singleton();
|
||||
|
||||
bool get_automatic_load() const;
|
||||
void set_automatic_load(const bool load);
|
||||
|
@ -66,18 +66,18 @@ Dictionary Cooldown::_to_dict() {
|
||||
Dictionary dict;
|
||||
|
||||
//dict["spell_id"] = _spell_id;
|
||||
dict["spell_path"] = ESS::get_instance()->get_resource_db()->spell_id_to_path(_spell_id);
|
||||
dict["spell_path"] = ESS::get_singleton()->get_resource_db()->spell_id_to_path(_spell_id);
|
||||
dict["remaining"] = _remaining;
|
||||
|
||||
return dict;
|
||||
}
|
||||
void Cooldown::_from_dict(const Dictionary &dict) {
|
||||
ERR_FAIL_COND(dict.empty());
|
||||
ERR_FAIL_COND(!ESS::get_instance()->get_resource_db().is_valid());
|
||||
ERR_FAIL_COND(!ESS::get_singleton()->get_resource_db().is_valid());
|
||||
|
||||
StringName spell_path = dict.get("spell_path", "");
|
||||
//_spell_id = dict.get("spell_id", 0);
|
||||
_spell_id = ESS::get_instance()->get_resource_db()->spell_path_to_id(spell_path);
|
||||
_spell_id = ESS::get_singleton()->get_resource_db()->spell_path_to_id(spell_path);
|
||||
_remaining = dict.get("remaining", 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user