From 59dbd6ceb162b7ceb29745864b9302081c5bed1f Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 21 Jun 2020 00:16:59 +0200 Subject: [PATCH] Moved around a few things in Entity's to and from dict. --- entities/entity.cpp | 105 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 82 insertions(+), 23 deletions(-) diff --git a/entities/entity.cpp b/entities/entity.cpp index 5fe23f6..e241901 100644 --- a/entities/entity.cpp +++ b/entities/entity.cpp @@ -1101,28 +1101,46 @@ void Entity::from_dict(const Dictionary &dict) { Dictionary Entity::_to_dict() { Dictionary dict; + //// Transforms //// + + //Not needed (at least atm) + //// PlayerData //// dict["guid"] = _s_guid; //dict["entity_data_id"] = _s_class_id; - dict["type"] = _s_type; - dict["model_index"] = _s_model_index; - dict["class_level"] = gets_class_level(); - dict["class_xp"] = gets_class_xp(); - - dict["character_level"] = _s_character_level; - dict["character_xp"] = _s_character_xp; - dict["money"] = _s_money; - dict["seed"] = _s_seed; if (_s_entity_data.is_valid()) dict["entity_data_path"] = _s_entity_data->get_path(); else dict["entity_data_path"] = _s_entity_data_path; + //int _s_entity_player_type; + + dict["type"] = _s_type; + dict["model_index"] = _s_model_index; + dict["class_level"] = gets_class_level(); + dict["character_level"] = _s_character_level; + + dict["class_xp"] = gets_class_xp(); + dict["character_xp"] = _s_character_xp; + + dict["money"] = _s_money; + //dict["send_flag"] = _s_send_flag; dict["entity_name"] = _s_entity_name; + dict["interaction_type"] = static_cast(_s_interaction_type); + + //int _s_is_dead; + + dict["seed"] = _s_seed; + + dict["entity_type"] = _s_entity_type; + dict["immunity_flags"] = _s_immunity_flags; + dict["entity_flags"] = _s_entity_flags; + dict["entity_controller"] = _s_entity_controller; + //// Stats //// Dictionary sd; @@ -1200,11 +1218,6 @@ Dictionary Entity::_to_dict() { dict["auras"] = auras; - dict["entity_type"] = _s_entity_type; - dict["immunity_flags"] = _s_immunity_flags; - dict["entity_flags"] = _s_entity_flags; - dict["entity_controller"] = _s_entity_controller; - //// Cooldowns //// Dictionary cds; @@ -1296,12 +1309,34 @@ Dictionary Entity::_to_dict() { dict["actionbar_locked"] = _actionbar_locked; //dict["actionbar_profile"] = _action_bar_profile->to_dict(); + // AI + + //not needed + + //Pets + + //Not yet properly implemented + + // Callbacks + + //Probably not needed + //Vector > _physics_process_scis; + return dict; } void Entity::_from_dict(const Dictionary &dict) { ERR_FAIL_COND(dict.empty()); - sets_entity_type((int)((int)dict.get("type", 0))); + //// Transforms //// + + //Not needed for now + + //// PlayerData //// + + sets_guid(dict.get("guid", 0)); + sets_entity_type(dict.get("type", 0)); + + //entity_data_path at end sets_model_index(static_cast(static_cast(dict.get("model_index", 0)))); @@ -1320,8 +1355,20 @@ void Entity::_from_dict(const Dictionary &dict) { sets_entity_name(dict.get("entity_name", "")); + sets_entity_interaction_type(static_cast(static_cast(dict.get("interaction_type", 0)))); + + //int _s_is_dead; + sets_seed(dict.get("seed", _s_seed)); + //EntityPlayerType not needed + sets_immunity_flags(dict.get("immunity_flags", 0)); + sets_entity_flags(dict.get("entity_flags", 0)); + EntityEnums::EntityController contr = static_cast(static_cast(dict.get("entity_controller", 0))); + + sets_original_entity_controller(contr); + sets_entity_controller(contr); + //// Stats //// Dictionary stats = dict.get("stats", Dictionary()); @@ -1409,6 +1456,10 @@ void Entity::_from_dict(const Dictionary &dict) { _s_state = dict.get("state", Dictionary()); _c_state = _s_state; + //// SpellCastData //// + + //Not needed + //// Auras //// _s_auras.clear(); @@ -1428,14 +1479,6 @@ void Entity::_from_dict(const Dictionary &dict) { //_c_auras.push_back(r); } - sets_entity_type((int)((int)dict.get("entity_type", 0))); - sets_immunity_flags(dict.get("immunity_flags", 0)); - sets_entity_flags(dict.get("entity_flags", 0)); - EntityEnums::EntityController contr = static_cast(static_cast(dict.get("entity_controller", 0))); - - sets_original_entity_controller(contr); - sets_entity_controller(contr); - //// Cooldowns //// _s_cooldowns.clear(); @@ -1599,6 +1642,22 @@ void Entity::_from_dict(const Dictionary &dict) { } sets_entity_data_path(edp); + + // AI + + //Not needed right now + + //Pets + + //NYI + + // Networking + + //Not Needed + + // Callbacks + + //Not Needed } ////// Stat System //////