Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export class Drop {
game.log('%CreatureName' + creature.id + '% picks up ' + this.name + ':');
creature.hint(this.name, 'msg_effects');

// Play pickup sound effect
game.soundsys.playSFX('sounds/upgrade');

creature.dropCollection.push(this);

creature.updateAlteration();
Expand Down
16 changes: 16 additions & 0 deletions src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,17 @@ function getReg() {
* read log from file
* @returns {Promise<string>}
*/
let isLoadingLog = false;

function readLogFromFile() {
// TODO: This would probably be better off in ./src/utility/gamelog.ts
// Set a trap to block consecutive calls (prevent multiple file pickers)
if (isLoadingLog) {
return Promise.reject(new Error('Already loading a log file'));
}

isLoadingLog = true;

return new Promise((resolve, reject) => {
const fileInput = document.createElement('input') as HTMLInputElement;
fileInput.accept = '.ab';
Expand All @@ -408,14 +417,21 @@ function readLogFromFile() {
reader.readAsText(file);

reader.onload = () => {
isLoadingLog = false;
resolve(reader.result);
};

reader.onerror = () => {
isLoadingLog = false;
reject(reader.error);
};
};

// Reset flag if dialog is cancelled
fileInput.oncancel = () => {
isLoadingLog = false;
};

fileInput.click();
});
}
Expand Down
9 changes: 9 additions & 0 deletions src/utility/hex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ export class Hex {
game.activeCreature.highlightCurrentHexesAsDashed();
}

// Set cursor to progress when hovering active creature with no ability selected
const creature = game.grid.getCreaturesAt(this.x, this.y)[0];
if (creature && creature === game.activeCreature && game.UI.selectedAbility === -1) {
$j('body').css('cursor', 'progress');
}

game.signals.hex.dispatch('over', { hex: this });
grid.selectedHex = this;
this.onSelectFn(this);
Expand All @@ -210,6 +216,9 @@ export class Hex {
game.activeCreature.clearDashedOverlayOnHexes();
}

// Reset cursor to default when leaving active creature
$j('body').css('cursor', 'default');

game.signals.hex.dispatch('out', { hex: this });
grid.clearHexViewAlterations();
this.onHoverOffFn(this);
Expand Down
Loading