Skip to content

Commit

Permalink
Tune-Shark-V3 -- Pause Events are in Runtime now
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkPool-SP authored Jan 15, 2025
1 parent 77c9643 commit b7e0861
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions extensions/SharkPool/Tune-Shark-V3.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// By: SharkPool
// License: MIT AND LGPL-3.0

// Version V.3.4.21
// Version V.3.4.22

(function (Scratch) {
"use strict";
Expand Down Expand Up @@ -49,18 +49,6 @@
let soundBank = {};
let settings = { flagCtrl: false, canSave: false };

// Create an Event for when Pause Project is Activated
// Save original function if it exists
let ogPauseFunc = Object.getOwnPropertyDescriptor(runtime.ioDevices.clock, "_paused")?.set;
Object.defineProperty(runtime.ioDevices.clock, "_paused", {
set: function(value) {
this._pausedValue = value;
runtime.emit("SP_TUNE3_PROJECT_PAUSE", value);
if (ogPauseFunc) ogPauseFunc.call(this, value);
},
get: function() { return this._pausedValue }
});

class SPtuneShark3 {
constructor() {
this.loadStorage = function(storage) {
Expand Down Expand Up @@ -146,10 +134,8 @@
}
});
});
runtime.on("SP_TUNE3_PROJECT_PAUSE", () => {
if (runtime.ioDevices.clock._paused) this.ctrlSounds({ CONTROL: "pause" });
else this.ctrlSounds({ CONTROL: "unpause" });
});
runtime.on("RUNTIME_PAUSED", () => this.ctrlSounds({ CONTROL: "pause" }));
runtime.on("RUNTIME_UNPAUSED", () => this.ctrlSounds({ CONTROL: "unpause" }));
}
getInfo() {
return {
Expand Down

0 comments on commit b7e0861

Please sign in to comment.