let lastHref;
let reloadInv = setInterval(() => {
if (lastHref !== window.location.href && /^https?:\/\/(www\.)?freeriderhd\.com\/create/.test(window.location.href)) main();
lastHref = window.location.href;
});
const main = i => i = setInterval(() => {
if (!GameManager.game) return;
clearInterval(i);
let lastTicks = 0;
createjs.Ticker.on('tick', () => {
const { ticks, playerManager: { firstPlayer: { _baseVehicle, _baseVehicleType, _tempVehicle } } } = GameManager.game.currentScene;
if (!_tempVehicle && (ticks > lastTicks || (!ticks && lastTicks))) {
for (const hb of [_baseVehicle.head, _baseVehicle.frontWheel, _baseVehicle.rearWheel]) {
const rad = Math.ceil(hb.radius / 2) + 1;
let lastX = hb.pos.x - hb.radius / 2 + 4;
let lastY = hb.pos.y - hb.radius / 2 - 4;
for (let i = 0; i <= 360; i += 36) {
const x = lastX + rad * Math.cos(i * Math.PI / 180);
const y = lastY + rad * Math.sin(i * Math.PI / 180);
GameManager.game.currentScene.track.addSceneryLine(lastX, lastY, x, y);
lastX = x;
lastY = y;
}
}
}
lastTicks = ticks;
});
});
//Done, copy till the line above!
Script 2 Below...
Script 2: Animator:
What is it:
Create animations easily in editor mode. Upon installing the script you will see an "Add Frame" button in the area where it says "Publish" and such.
(function main() {
const lastHref = window.location.href;
const reloadInv = setInterval(() => {
if (lastHref !== window.location.href) {
clearInterval(reloadInv);
main();
}
}, 1000);
if (!/^https?:\/\/(www\.)?freeriderhd\.com\/create/.test(window.location.href)) return;
const topInv = setInterval(() => {
const top = document.querySelector('.topMenu');
if (!top) return;
clearInterval(topInv);
setInterval(() => {
if (top.querySelector('#animate')) return;
top.innerHTML += '<div class="topMenu-button topMenu-button_offline" title="New Frame" id="animate"><span class="editorgui_icons editorgui_icons-icon_offline_editor"></span><span class="text">Add Frame</span></div>';
let x = 0;
top.querySelector('#animate').onclick = () => {
GameManager.game.currentScene.track.addPowerups([['W', ...[x, 30, x += 1000, 30].map(x => x.toString(32))].join(' ')]);
for (const line of [...GameManager.game.currentScene.track.physicsLines]) {
if (!line.remove && line.p1.x < x && line.p1.x > (x - 1500)) GameManager.game.currentScene.track.addPhysicsLine(line.p1.x + 1000, line.p1.y, line.p2.x + 1000, line.p2.y);
}
};
});
});
})();
//Done, copy till the line above!