Employee Only Areas using Doors +?

Relatively new to hacking with the API so thought I would ask here to finalize my build a little quicker.

Implementing employee only areas within my space so users can be assured they are talking to the right person. Implemented a door with password and utilized blank pngs for the 4 images, open close / active inactive. Here’s a few screenshots.

I would like to either remove the popup message that appears above the door or reduce the activation distance which I believe currently is around 4. Any suggestions on how to do this would be appreciated.

Cheers, Kenny

bouncePass Labs

So take some of this with a grain of salt, as I do not use the Gather native doors often, but within the JSON file of a space, you should be able to set the interact distance and the prompt to be as small as possible (which is currently a small grey blob).

The big questionmark is if the object will revert all changes when opened or closed. Unfortunately, that is just something that trial and error will tell us. That or a Gather engineer, whichever posts first.

I will hack together some console scripts to try and help you out, but until we figure out how much of the door object is hard coded, the changes might not stick.

1 Like

Here is some really hacky console/slash command editing tools. This will need to be pasted in full into your console (F12) to function.

var focusedItem;

game.registerCommand("resize") // Expects <height> <width>
game.registerCommand("interact-distance") // Expects <distance>
game.registerCommand("move") // Expects <x> <y>
game.registerCommand("set-prompt") // expects <message>. No message sets to single space.

game.subscribeToEvent("playerSendsCommand", ({playerSendsCommand},context) => {
    var parse = playerSendsCommand.command.split(" ");
    let temp = {};
    let change = false;
    switch (parse[0]) {
        case "resize":
            if(parse[1]){focusedItem.obj.height = +parse[1];change = true;}
            if(parse[2]){focusedItem.obj.width = +parse[2];change = true;}
            break;
        case "interact-distance":
            if(parse[1]){focusedItem.obj.distThreshold = +parse[1];change = true;}
            break;
        case "move":
            if(parse[1]){focusedItem.obj.x = +focusedItem.obj.x + +parse[1];change = true;}
            if(parse[2]){focusedItem.obj.y = +focusedItem.obj.y + +parse[2];change = true;}
            break;
        case "set-prompt":
            if(parse.length > 1){
                parse.shift();
                focusedItem.obj.previewMessage = parse.join(" ");
                change = true;
            }
            if(parse.length === 1){
                focusedItem.obj.previewMessage = " ";
                change = true;
            }
            break;
        default:
            break;
    }
    if(change){
        temp[focusedItem.obj.key] = focusedItem.obj;
        game.setMapObjects(focusedItem.mapId, temp, true);
    }
})

game.subscribeToEvent("playerTriggersItem", ({playerTriggersItem}, context) => {
    focusedItem = game.getObject(playerTriggersItem.closestObject)
    console.log(focusedItem.obj._name)
})

To use this, you will need to walk up to whichever object you would like to edit, and hit spacebar to focus it (name will appear in console as doublecheck). Then use the following in chat while you have the object focused:

  • /move <x> <y>, which will move the object by the given amounts in the given axis.
  • /resize <height> <width>, which will change the object height and width.
  • /interact-distance <distance>, which will change the interaction distance.
  • /set-prompt <message> or /set-prompt, which will set the prompt to the message, or a blank space.

Once you are done editing, refresh the page to clear the code. You will have to re-enter the code each time you refresh to edit again, but with spacebar, you can approach and modify objects one at a time without refreshing.

2 Likes

Excellent, thanks so much really appreciate it.

Just got back from vacation and had a chance to implement this and worked great. Thanks @Bill_Uncork-It