Skip to content

Instantly share code, notes, and snippets.

@Rio6
Rio6 / stickyTab.js
Last active May 16, 2020 21:33
Istrolid sticky fleet tab for browsers that doesn't support position: sticky
(function() {
var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
var slice = [].slice;
eval(onecup.import());
FleetMode.prototype.newTab = false;
FleetMode.prototype.editTab = false;
@Rio6
Rio6 / replay.js
Last active April 10, 2024 01:14
Replay script - records, save, and replay istrolid games
/*
* Replay script - records, save, and replay istrolid games
*
* After loading the script, it's recommended to rejoin the server or press the
* "Reset Game" button in case of local to reload the interpolator.
*
* Loading non-normal saves - saves from modded games, corrupted or modified
* saves - might brake the game client. Just restart the game and not to load
* that file.
*
@Rio6
Rio6 / unitbubble.js
Last active January 30, 2020 07:30
show unit data in a bubble when selected. Press t to toggle
var ub_window_body = ub_window_body || window.body;
var ub_battlemode_onkeydown = ub_battlemode_onkeydown || battleMode.onkeydown;
var ub_enabled = false;
function ub_drawBubble() {
let fmod = function(a,b) { return Number((a - (Math.floor(a / b) * b)).toPrecision(8)); };
let wrapAngle = th => {
let rst = fmod(th + Math.PI, 2 * Math.PI);
return rst < 0 ? rst + Math.PI : rst - Math.PI;
};
@Rio6
Rio6 / autostarter.js
Last active July 30, 2019 22:17
Auto start game when you are host in istrolid
var autostart = autostart || {
hasPlayer: false,
lastState: sim.state,
intv: null,
say: function(msg) {
if(chat.channel === "local") {
chat.lines.push({
text: msg,
name: commander.name,
color: commander.color,
@Rio6
Rio6 / istrolid-turing.js
Created July 13, 2019 05:12
Make tesla turing complete
parts.TeslaTurret.prototype.energyDamage = 10000;
parts.TeslaTurret.prototype.damage = 0;
parts.TeslaTurret.prototype.bounceRange = 150;
parts.TeslaTurret.prototype.maxZap = 2;
if(typeof(log_makeBullet) === "undefined") {
log_makeBullet = parts.TeslaTurret.prototype.makeBullet;
}
if(typeof(log_zap) === "undefined") {
#!/bin/sh
# A script to record a screen area using ffmpeg
while getopts hwso:: opts; do
case $opts in
h)
echo "$0 [-w | -s] [-o dir]"
exit
;;
w)
echo "Select win"
@Rio6
Rio6 / teamChat.js
Last active June 22, 2019 21:31
Team chat for istrolid
/*
* Super hackable team chat
*
* Put $ sign in front of your message and it will get encrypted
* Only people who has this script and is on your team will be able to understand it
*/
if(!teamChat) {
var teamChat = {
network_end: RootConnection.prototype.send,
@Rio6
Rio6 / ffaui.js
Last active July 14, 2020 23:08
UI fix for istrolid custom FFA mode
(function() {
var ffaTypes = ["FFA", "IO", "Race"];
eval(onecup["import"]());
quickScorePlayer = function(player) {
if (player.side === "dead") {
return;
}
@Rio6
Rio6 / _partLoader.js
Last active April 16, 2020 19:41
Community made parts. _partLoader.js loads all the parts automatically with images so you just need to load that one. Try load this mod before others if there's any conflict with other mods.
/*
* Loads all weapons in this gist, plus their images
*/
if(!window.partLoader_partsLoaded) {
let imgloaderUrl = "https://gist.githubusercontent.com/Rio6/456ce90a98f38d74d095e7caf5a63f31/raw/"; // image loader
let parts = [
"https://gist.githubusercontent.com/Rio6/51e853a5d8252a9a362c80e29f6c82d1/raw/energyBeam.js", // Leach beam
"https://gist.githubusercontent.com/Rio6/51e853a5d8252a9a362c80e29f6c82d1/raw/jwdeWeapons.js", // Battle Cannon, Needle Gun
@Rio6
Rio6 / apod-bg
Last active May 27, 2019 01:05
Use apod as wallpaper
#!/bin/sh
#wait for internet
while ! ping -q -w 1 -c 1 apod.nasa.gov > /dev/null; do sleep 5; done
html=$(curl https://apod.nasa.gov/apod/astropix.html)
yturl=$(grep -Eom1 "https://www.youtube.com/embed/[^\"]+" <<< "$html")
if [ ! -z $yturl ]; then
youtube-dl "$yturl" -o /tmp/apod
name=$(echo /tmp/apod.* | cut -f 1 -d ' ')