Skip to content

Commit

Permalink
fix(animations): correct melee looking squished
Browse files Browse the repository at this point in the history
  • Loading branch information
wrycu committed Oct 8, 2023
1 parent 25de37a commit 787710b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
`2.0.4` - ?

- Add Brazilian translation (thanks `neour#4842`!)
- FIX: Correct Melee animation looking squished ([#102](https://github.com/wrycu/StarWarsFFG-Enhancements/issues/102)) (thanks `tim-bersau` for reporting and `SourTarte` for providing a fix!)

`2.0.3` - 2023-03-01

Expand Down
33 changes: 24 additions & 9 deletions scripts/animation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// noinspection JSUnresolvedVariable,JSUnresolvedFunction,ES6ConvertVarToLetConst

import { setting_image, setting_audio } from "./settings.js";
import { log_msg as log } from "./util.js";
import {setting_image, setting_audio} from "./settings.js";
import {log_msg as log} from "./util.js";

export function init() {
log("attack_animation", "Initializing");
Expand Down Expand Up @@ -404,26 +404,41 @@ async function play_animation(animation_file, sound_file, skill, source, count)
},
angle: -90,
};
} else {
} else if (skill.toLowerCase().includes("ranged")) {
var ray = new Ray(tokens[0].center, Array.from(game.user.targets)[i].center);
var animation_config = {
position: tokens[0].center,
file: animation_file,
anchor: {
x: 0.125,
y: 0.5,
x: 0.125, //default = 0.125
y: 0.5, //default is 0.5
},
angle: -(ray.angle * 57.3),
scale: {
x: ray.distance / 1200,
y: ray.distance <= 200 ? 0.66 : ray.distance / 1200,
x: ray.distance / 1200, //default is ray.distance / 1200
y: ray.distance / 1200 <= 200 ? 0.66 : ray.distance / 1200, //default is ray.distance <= 200 ? 0.66 : ray.distance / 1200
},
};
} else {
var ray = new Ray(tokens[0].center, Array.from(game.user.targets)[i].center);
var animation_config = {
position: tokens[0].center,
file: animation_file,
anchor: {
x: 0.4, //default = 0.125
y: 0.5, //default is 0.5
},
angle: -(ray.angle * 57.3),
scale: {
x: ray.distance / 1200 <= 200 ? 0.66 : ray.distance / 1200, //default is ray.distance / 1200
y: ray.distance / 1200 <= 200 ? 0.66 : ray.distance / 1200, //default is ray.distance <= 200 ? 0.66 : ray.distance / 1200
},
}
}
canvas.specials.playVideo(animation_config);
game.socket.emit("module.fxmaster", animation_config);

AudioHelper.play({ src: sound_file, volume: 0.3, autoplay: true, loop: false }, true);
AudioHelper.play({src: sound_file, volume: 0.3, autoplay: true, loop: false}, true);
await sleepNow(250);
}
}
Expand All @@ -448,7 +463,7 @@ class attack_animation_UISettings extends FormApplication {
const canConfigure = game.user.can("SETTINGS_MODIFY");

const data = {
system: { title: game.system.title, menus: [], settings: [] },
system: {title: game.system.title, menus: [], settings: []},
};

// Classify all settings
Expand Down

0 comments on commit 787710b

Please sign in to comment.