Merge pull request #91 from earthiverse/instances

Improve instance enter handling
This commit is contained in:
Kaan Soral
2024-02-04 17:25:12 +03:00
committed by GitHub
2 changed files with 14 additions and 2 deletions
+5
View File
@@ -1943,6 +1943,11 @@ function init_socket(args)
ui_log("Can't reach","gray");
transporting=false;
}
else if(response=="transport_cant_invalid")
{
ui_log("Instance not found","gray");
transporting=false;
}
else if(response=="transport_cant_item")
{
ui_log("Item not found","gray");
+8 -1
View File
@@ -5048,8 +5048,15 @@ function init_io() {
if (simple_distance(player, { in: f, map: f, x: ref[0], y: ref[1] }) > 120) {
return fail_response("transport_cant_reach");
}
if (data.name && instances[data.name] && instances[data.name].map == data.place) {
if (data.name) {
// Player requested to enter an existing instance
if (instances[data.name] && instances[data.name].map == data.place) {
// The instance exists
transport_player_to(player, data.name);
} else {
// The instance doesn't exist
return fail_response("transport_cant_invalid");
}
} else {
if (!consume_one_by_id(player, item)) {
return fail_response("transport_cant_item");