mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-04-17 21:26:35 +02:00
Refactored the way the server can open windows. Also they work with networking now.
This commit is contained in:
parent
6c1c5eca46
commit
ca498d753c
@ -1403,7 +1403,7 @@ bool Entity::can_equip_item(ItemEnums::EquipSlots equip_slot, Ref<ItemInstance>
|
||||
bool Entity::_can_equip_item(ItemEnums::EquipSlots equip_slot, Ref<ItemInstance> item) {
|
||||
//deequip
|
||||
if (!item.is_valid())
|
||||
return true;
|
||||
return true;
|
||||
|
||||
Ref<ItemTemplate> it = item->get_item_template();
|
||||
|
||||
@ -1790,24 +1790,21 @@ void Entity::crequest_interact() {
|
||||
sinteract();
|
||||
}
|
||||
|
||||
void Entity::ssend_open_loot_window() {
|
||||
copen_loot_window();
|
||||
void Entity::ssend_open_window(int window_id) {
|
||||
ORPC(copen_window, window_id);
|
||||
}
|
||||
void Entity::ssend_open_container_window() {
|
||||
copen_container_window();
|
||||
}
|
||||
void Entity::ssend_open_vendor_window() {
|
||||
copen_vendor_window();
|
||||
}
|
||||
|
||||
void Entity::copen_loot_window() {
|
||||
emit_signal("onc_open_loot_winow_request");
|
||||
}
|
||||
void Entity::copen_container_window() {
|
||||
emit_signal("onc_open_container_winow_request");
|
||||
}
|
||||
void Entity::copen_vendor_window() {
|
||||
emit_signal("onc_open_vendor_winow_request");
|
||||
void Entity::copen_window(int window_id) {
|
||||
switch (window_id) {
|
||||
case EntityEnums::ENTITY_WINDOW_LOOT:
|
||||
emit_signal("onc_open_loot_winow_request");
|
||||
break;
|
||||
case EntityEnums::ENTITY_WINDOW_CONTAINER:
|
||||
emit_signal("onc_open_container_winow_request");
|
||||
break;
|
||||
case EntityEnums::ENTITY_WINDOW_VENDOR:
|
||||
emit_signal("onc_open_vendor_winow_request");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//XP Operations
|
||||
@ -4992,9 +4989,7 @@ Entity::Entity() {
|
||||
|
||||
SET_RPC_REMOTE("sinteract");
|
||||
|
||||
SET_RPC_REMOTE("copen_loot_window");
|
||||
SET_RPC_REMOTE("copen_container_window");
|
||||
SET_RPC_REMOTE("copen_vendor_window");
|
||||
SET_RPC_REMOTE("copen_window");
|
||||
|
||||
//XP Operations
|
||||
|
||||
@ -5479,13 +5474,8 @@ void Entity::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("canc_interact"), &Entity::canc_interact);
|
||||
ClassDB::bind_method(D_METHOD("crequest_interact"), &Entity::crequest_interact);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("ssend_open_loot_window"), &Entity::ssend_open_loot_window);
|
||||
ClassDB::bind_method(D_METHOD("ssend_open_container_window"), &Entity::ssend_open_container_window);
|
||||
ClassDB::bind_method(D_METHOD("ssend_open_vendor_window"), &Entity::ssend_open_vendor_window);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("copen_loot_window"), &Entity::copen_loot_window);
|
||||
ClassDB::bind_method(D_METHOD("copen_container_window"), &Entity::copen_container_window);
|
||||
ClassDB::bind_method(D_METHOD("copen_vendor_window"), &Entity::copen_vendor_window);
|
||||
ClassDB::bind_method(D_METHOD("ssend_open_window", "window_id"), &Entity::ssend_open_window);
|
||||
ClassDB::bind_method(D_METHOD("copen_window", "window_id"), &Entity::copen_window);
|
||||
|
||||
//XP Operations
|
||||
ADD_SIGNAL(MethodInfo("son_xp_gained", PropertyInfo(Variant::OBJECT, "entity", PROPERTY_HINT_RESOURCE_TYPE, "Entity"), PropertyInfo(Variant::INT, "value")));
|
||||
|
@ -501,13 +501,8 @@ public:
|
||||
bool canc_interact();
|
||||
void crequest_interact();
|
||||
|
||||
void ssend_open_loot_window();
|
||||
void ssend_open_container_window();
|
||||
void ssend_open_vendor_window();
|
||||
|
||||
void copen_loot_window();
|
||||
void copen_container_window();
|
||||
void copen_vendor_window();
|
||||
void ssend_open_window(int window_id);
|
||||
void copen_window(int window_id);
|
||||
|
||||
//XP Operations
|
||||
void adds_xp(int value);
|
||||
|
@ -12,6 +12,7 @@ const String EntityEnums::BINDING_STRING_ENTITY_IMMUNITY_FLAGS = "Stun,Root,Free
|
||||
const String EntityEnums::BINDING_STRING_ENTITY_INTERACTION_TYPE = "Normal,Speak,Loot,Use,None";
|
||||
const String EntityEnums::BINDING_STRING_ENTITY_PLAYSTYLE_TYPE = "Melee,Spell,Hybrid,None";
|
||||
const String EntityEnums::BINDING_STRING_ENTITY_GENDER = "Male,Female";
|
||||
const String EntityEnums::BINDING_STRING_ENTITY_WINDOWS = "Loot,Container,Vendor";
|
||||
|
||||
const int EntityEnums::PLAYER_RESOURCE_TYPES_RAGE = 0;
|
||||
const int EntityEnums::PLAYER_RESOURCE_TYPES_MANA = 1;
|
||||
@ -175,6 +176,10 @@ void EntityEnums::_bind_methods() {
|
||||
BIND_ENUM_CONSTANT(GENDER_MALE);
|
||||
BIND_ENUM_CONSTANT(GENDER_FEMALE);
|
||||
|
||||
BIND_ENUM_CONSTANT(ENTITY_WINDOW_LOOT);
|
||||
BIND_ENUM_CONSTANT(ENTITY_WINDOW_CONTAINER);
|
||||
BIND_ENUM_CONSTANT(ENTITY_WINDOW_VENDOR);
|
||||
|
||||
BIND_CONSTANT(GENDER_COUNT);
|
||||
BIND_CONSTANT(MAX_LEVEL);
|
||||
BIND_CONSTANT(BASE_XP);
|
||||
|
@ -20,6 +20,7 @@ public:
|
||||
static const String BINDING_STRING_ENTITY_INTERACTION_TYPE;
|
||||
static const String BINDING_STRING_ENTITY_PLAYSTYLE_TYPE;
|
||||
static const String BINDING_STRING_ENTITY_GENDER;
|
||||
static const String BINDING_STRING_ENTITY_WINDOWS;
|
||||
|
||||
static const int PLAYER_RESOURCE_TYPES_RAGE;
|
||||
static const int PLAYER_RESOURCE_TYPES_MANA;
|
||||
@ -227,6 +228,13 @@ public:
|
||||
GENDER_FEMALE = 1,
|
||||
};
|
||||
|
||||
enum EntityWindows {
|
||||
ENTITY_WINDOW_LOOT = 0,
|
||||
ENTITY_WINDOW_CONTAINER = 1,
|
||||
ENTITY_WINDOW_VENDOR = 2,
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
GENDER_COUNT = 2,
|
||||
MAX_LEVEL = 50,
|
||||
@ -250,5 +258,6 @@ VARIANT_ENUM_CAST(EntityEnums::EntityImmunityFlags);
|
||||
VARIANT_ENUM_CAST(EntityEnums::EntityInteractionType);
|
||||
VARIANT_ENUM_CAST(EntityEnums::EntityClassPlaystyleType);
|
||||
VARIANT_ENUM_CAST(EntityEnums::EntityGender);
|
||||
VARIANT_ENUM_CAST(EntityEnums::EntityWindows);
|
||||
|
||||
#endif
|
||||
|
@ -125,7 +125,6 @@ public:
|
||||
ENTITY_TEXTURE_LAYER_OVERLAY = 12
|
||||
};
|
||||
|
||||
|
||||
static String get_equip_slot_string(int slot);
|
||||
static String get_armor_type_string(int type);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user