Skip to content

Instantly share code, notes, and snippets.

@r0ms
r0ms / torgeternity-otf-dsr.js
Last active February 6, 2026 11:21
[TorgEternity] Foundy VTT Macro On the Fly DSR
(async () => {
// UI Styling
const parchment = `background: #fdf6e3; color: #1a1c1d; padding: 15px; font-family: 'Segoe UI', sans-serif; border: 2px solid #333; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); box-sizing: border-box; display: flex; flex-direction: column; overflow-y: auto;`;
const h2Style = `color: #856704; margin: 0; text-transform: uppercase; font-weight: 900; letter-spacing: 2px;`;
const labelStyle = `font-weight: 900; text-transform: uppercase; font-size: 0.7rem; color: #444; margin-bottom: 2px; display: block;`;
const fieldStyle = `height: 28px; line-height: 26px; box-sizing: border-box; background: #fff; border: 1px solid #333; color: #000; padding: 0 8px; width: 100%; font-family: monospace; font-size: 0.85rem; vertical-align: middle;`;
// TE Styles (pulled from torgeternity.css (may break in the future ... ))
const torgStyles = {
h1: "font-family: Alaska; background-image: url('../../../systems/torgeternity/images/tab-header.webp'); background-repeat: no-
@r0ms
r0ms / add-torg-eternity-zone-to-region-scene.js
Last active November 20, 2025 00:45
Add Torg:Eternity Zone to Region Scene Macro
const T_REGIONS = [
{
"name": "Very Vulnerable Zone",
"color": "#ff2600",
"shapes": [],
"elevation": {
"bottom": null,
"top": null
},
"behaviors": [
@r0ms
r0ms / array-utils.js
Created January 22, 2016 13:18
Utils for javascript Array. It probably exists somewhere but it was just for fun :)
Array.prototype.unique = function(property) {
if(!property){
return this.filter(function(element, index){
return this.indexOf(element) === index;
}, this);
}
return this;
};
Array.prototype.flatten = function() {
@r0ms
r0ms / raphColDetect.js
Last active December 18, 2015 03:48
Raphael JS : Multiple Draggable Rectangle Detection Collision
/* Detecting collision between 2 rectangle */
/* Credit to Bill : http://stackoverflow.com/users/1029936/bill */
rect_collision = function (x1, y1, size1, x2, y2, size2) {
var a = {top: y1, bottom: y1+size1, left: x1, right: x1+size1};
var b = {top: y2, bottom: y2+size2, left: x2, right: x2+size2};
// this is the general way to figure out if two rects are overlapping
return !(a.left >= b.right || a.right <= b.left ||
a.top >= b.bottom || a.bottom <= b.top);