Skip to content

Commit

Permalink
Option to disable pathfinding
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Dec 17, 2023
1 parent 618f52d commit 24056b2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions srcjs/stendhal.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ <h3></h3>
<label class="checksetting"><input type="checkbox" id="chk_movecont">Continuous movement</label>
<label class="checksetting"><input type="checkbox" id="chk_pvtsnd">Private message notifications</label>
<label class="checksetting"><input type="checkbox" id="chk_clickindicator">Display clicks/touches</label>
<label class="checksetting"><input type="checkbox" id="chk_pathfinding">Click ground to move</label>
</div>
<div id="settings_panel3" class="verticalgroup vgroupcolr">
<div>
Expand Down
3 changes: 3 additions & 0 deletions srcjs/stendhal/entity/Ground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export class Ground {
}

onclick(x: number, y: number, dblclick: boolean) {
if (!stendhal.config.getBoolean("client.pathfinding")) {
return;
}
var gameX = x + stendhal.ui.gamewindow.offsetX;
var gameY = y + stendhal.ui.gamewindow.offsetY;
var action = {
Expand Down
3 changes: 3 additions & 0 deletions srcjs/stendhal/ui/component/MiniMapComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ export class MiniMapComponent extends Component {
}

onClick(event: MouseEvent) {
if (!stendhal.config.getBoolean("client.pathfinding")) {
return;
}
let pos = stendhal.ui.html.extractPosition(event);
let x = Math.floor((pos.canvasRelativeX + this.xOffset) / this.scale);
let y = Math.floor((pos.canvasRelativeY + this.yOffset) / this.scale);
Expand Down
3 changes: 3 additions & 0 deletions srcjs/stendhal/ui/dialog/SettingsDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export class SettingsDialog extends DialogContentComponent {
this.createCheckBox("chk_clickindicator", "input.click.indicator",
"Displaying clicks", "Not displaying clicks");

this.createCheckBox("chk_pathfinding", "client.pathfinding",
"Pathfinding on ground enabled", "Pathfinding on ground disabled");


/* *** right panel *** */

Expand Down
1 change: 1 addition & 0 deletions srcjs/stendhal/util/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ declare var stendhal: any;
export class ConfigManager {

private readonly defaults = {
"client.pathfinding": "true",
"ui.sound": "false",
"ui.sound.master.volume": "100",
"ui.sound.ambient.volume": "100",
Expand Down

0 comments on commit 24056b2

Please sign in to comment.