test
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
export default function animationSync() {
|
||||
import planeSchoolHandle from "./planeschool";
|
||||
|
||||
export default function animationSync() {
|
||||
mp.events.add("SERVER:LoadAnimations", () => {
|
||||
animationSyncData.register("Cuffed", "mp_arresting", "idle", -1, true, 50);
|
||||
animationSyncData.register("doArrest", "mp_arrest_paired", "cop_p2_back_right", 3000, false, 0);
|
||||
@@ -64,18 +66,18 @@
|
||||
});
|
||||
}, 100);
|
||||
|
||||
mp.events.addDataHandler("AnimationData", (entity, string) => {
|
||||
mp.events.addDataHandler("AnimationData", (entity: PlayerMp, string) => {
|
||||
if (string == null) {
|
||||
entity.clearTasksImmediately();
|
||||
entity.animationData = null;
|
||||
return;
|
||||
}
|
||||
let lastAnim;
|
||||
|
||||
playAnim(entity, string);
|
||||
});
|
||||
|
||||
async function playAnim(entity, string) {
|
||||
while (true) {
|
||||
if (lastAnim && entity.isPlayingAnim(lastAnim.dict, lastAnim.name, 3))
|
||||
continue;
|
||||
mp.gui.chat.push("transition to " + string);
|
||||
let index = mp.game.joaat(string);
|
||||
let animData = animationSyncData.animations[index];
|
||||
|
||||
@@ -85,21 +87,18 @@
|
||||
let { id, name, animDict, animName, duration, loop, flag } = animData;
|
||||
|
||||
loadAnimDict(animDict, function () {
|
||||
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, -1, parseInt(flag), 0, !1, !1, !1)
|
||||
mp.players.exists(entity) && 0 !== entity.handle && entity.taskPlayAnim(animDict, animName, 1, 0, duration, parseInt(flag), 0, !1, !1, !1)
|
||||
});
|
||||
|
||||
while (entity.isPlayingAnim(animDict, animName, 3)) {
|
||||
await mp.game.waitAsync(0);
|
||||
}
|
||||
|
||||
let pair = pairData.find(pair => pair.from == name);
|
||||
if (!pair)
|
||||
break;
|
||||
|
||||
string = pair.transitionTo;
|
||||
mp.gui.chat.push("transition to " + string);
|
||||
|
||||
lastAnim = { dict: animDict, name: animName };
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function loadAnimDict(animDict, callback) {
|
||||
if (mp.game.streaming.hasAnimDictLoaded(animDict)) return void callback();
|
||||
|
||||
Reference in New Issue
Block a user