Added a few remaining things required for entity interactions.

This commit is contained in:
Relintai 2019-09-17 02:14:24 +02:00
parent 3d8010f028
commit 4aad057925
2 changed files with 59 additions and 0 deletions

View File

@ -1219,10 +1219,44 @@ void Entity::sinteract() {
_s_entity_data->sinteract(this);
}
bool Entity::canc_interact() {
if (!ObjectDB::instance_validate(_c_target)) {
return false;
}
EntityEnums::EntityInteractionType it = _c_target->getc_entity_interaction_type();
if (it == EntityEnums::ENITIY_INTERACTION_TYPE_NONE || it == EntityEnums::ENITIY_INTERACTION_TYPE_NORMAL) {
return false;
}
return true;
}
void Entity::crequest_interact() {
sinteract();
}
void Entity::ssend_open_loot_window() {
copen_loot_window();
}
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");
}
//XP Operations
void Entity::adds_xp(int value) {
_s_xp += value;
@ -3609,6 +3643,11 @@ void Entity::_bind_methods() {
//setup
BIND_VMETHOD(MethodInfo("_setup"));
//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);
@ -3759,8 +3798,18 @@ void Entity::_bind_methods() {
//Interactions
ClassDB::bind_method(D_METHOD("cans_interact"), &Entity::cans_interact);
ClassDB::bind_method(D_METHOD("sinteract"), &Entity::sinteract);
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);
//XP Operations
ClassDB::bind_method(D_METHOD("adds_xp", "value"), &Entity::adds_xp);
ClassDB::bind_method(D_METHOD("addc_xp", "value"), &Entity::addc_xp);

View File

@ -369,8 +369,18 @@ public:
//Interactions
bool cans_interact();
void sinteract();
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();
//XP Operations
void adds_xp(int value);
void addc_xp(int value);