Skip to content

Instantly share code, notes, and snippets.

View slippycheeze's full-sized avatar

Daniel Pittman slippycheeze

View GitHub Profile
@slippycheeze
slippycheeze / EDDI-message-received.cottle
Last active April 11, 2023 10:17
EDDI message received script update
{_ is this a duplicate of the previous value? _}
{set duplicate to [
"source": event.source = state.sc_last_message_source,
"from": event.from = state.sc_last_message_from,
"message": event.message = state.sc_last_message_message
]}
{SetState('sc_last_message_source', event.source)}
{SetState('sc_last_message_from', event.from)}
{SetState('sc_last_message_message', event.message)}
// ==UserScript==
// @name Elite Dangerous: old forum URL redirector - frontier.co.uk
// @namespace rimspace.net
// @match *://forums.frontier.co.uk/showthread.php/*
// @grant none
// @run-at document-start
// @version 1.0
// @author Daniel Pittman <daniel@rimspace.net>
// @description when you land on an old forum URL, instead redirect to the "modern" equivalent.
// does not try and rewrite the URL before you hit the 404 page, though.
public class PrintUnlockableTechTrees: cmk.NMS.Script.QueryClass {
protected override void Execute() {
var Unlockable = Game.ExtractMbin<GcUnlockableTrees>("METADATA/REALITY/TABLES/UNLOCKABLEITEMTREES.MBIN");
foreach (var tree in Enum.GetValues<UnlockableItemTreeEnum>()) {
Log.AddHeading(Enum.GetName<UnlockableItemTreeEnum>(tree));
PrintTree(Unlockable.Trees[(int)tree]);
}
}
string Translate(string id) => Game.FindLanguageData(id)?.Text ?? id;
@slippycheeze
slippycheeze / Freighter-containerh-sceneref.cs
Last active December 4, 2022 19:44
No Mans Sky Freighter HullA ContainerH bugfix - now the venator freighter won't replace an entire ship segment with a broken cargo bubble!
public class Freighter_Containerh_Sceneref: SCModClass {
protected override void Execute() {
Log.AddInformation("Trying to fix the freighter bug where destroying a cargo container changes the entire section...");
var scene = ExtractMbin<TkSceneNodeData>("MODELS/COMMON/SPACECRAFT/INDUSTRIAL/CARGO/CARGOLARGEA.SCENE.MBIN");
// 1. find the bit where the cargo container children are at; a LOCATOR above their MESH data, in this case.
var container = scene
.Children
.Flatten(node => node.Children)
.Where(node => {
protected static void OnAfterExecute(NMS.Script.ModFiles modfiles, CancellationToken cancel) {
// gather all the warnings and above from the log
var alerts = modfiles.ExecuteLog
.Where(item => item.Type == LogItemType.Warning || item.Type == LogItemType.Failure)
.ToList();
if (alerts.Any()) {
int warnings = alerts.Where(item => item.Type == LogItemType.Warning).Count();
int errors = alerts.Where(item => item.Type == LogItemType.Failure).Count();
var heading = new StringBuilder("—————< ");
if (warnings > 0) heading.AppendFormat("{0} WARNINGS", warnings);
// WTF, why there no kitchen?
[HarmonyPatch(typeof(RoomRoleWorker_Kitchen), "GetScore")]
internal static class RoomRoleWorker_Kitchen__HandleDesignationCategoryChanges {
public static IEnumerable<CodeInstruction> Transpiler(
IEnumerable<CodeInstruction> code,
ILGenerator generator,
MethodBase original
) {
string name = original.ShortDescription();
try {
<?xml version="1.0" encoding="utf-8"?>
<Patch>
<Operation Class="XmlExtensions.Conditional">
<xpath>Defs/ThingDef[defName="VFEA_AncientChemfuelPoweredGenerator"]</xpath>
<caseTrue>
<Operation Class="XmlExtensions.PatchOperationSafeAdd">
<xpath>Defs/ThingDef[defName="VFEA_AncientChemfuelPoweredGenerator"]/comps/li/fuelFilter/thingDefs</xpath>
<compare>Both</compare>
<value>
<li MayRequire="Scruffy.Content.ONIAnimals">OxR_Coal</li>
<?xml version="1.0" encoding="utf-8"?>
<Patch>
<Operation Class="XmlExtensions.PatchOperationSafeAddOrReplace" MayRequire="Kompadt.Warhammer.Dryad">
<xpath>Defs/MeditationFocusDef[defName="Natural"]</xpath>
<compare>Both</compare>
<value>
<requiredBackstoriesAny>
<li>
<categoryName>KTDryadGood</categoryName>
<slot>Childhood</slot>
@slippycheeze
slippycheeze / obfuscate.rb
Created April 16, 2011 03:42
Obfuscated Ruby for producing Obfusctated Ruby.
c = "\n !\"#'()*+,./01234678;<=ABCDEGINOPRSTUVY[\\]_abcdefghijlmnopqrstuvxy{|}".split('')
i = <<'EOT' .gsub(/\n/, '').to_i(36)
cuwnbkpknpgvndxhiywcb8v7r6px9dgwojmf4inpx5a0irzlmxiaisomq7ir6zx1yhrkk42gltj7vy
nibeul3djwhv9hy0jcjptfh9vvwmnw3xyn4k32gjflrdbb3f1t1xt3w690js9ri5idnch6f9y1ym6r
a2e9okgnsrofg1ztnq9zdbtfh7qmhy22psuo3cdxv1aaq3bf7q0bv12nj8ld7tshysxekfz8jwmff7
k0okucxt2abkmapldjqb6m2vzo43r3g4j9zscr8svoi3ktv63jddl5dokfgl1rmi9sygylc8jor243
ywnovju7t8kvuf2bpy33zkp6w7k97lok9ymo8shfs9m83rq85snkiex96hjykqkf8noaeap18b2rvo
4vrmdy6a7pm28m5b7ye9e58i0xp89ckgx9xuth43ngwfgmoomp2v5dau2ep3hovpthhmklo47j7ds4
714qvy44hmzk24v95gycadjnqkvrbqqip3k7ap901q0eiuvouweg9mlsm4r6y78rpamf8rlqzltyw8
3uf9qqs9sz0au0hyjicqiu3m5xb40yydj6qfigauo1wlmdctonk3a3e9s5vyhrxqmmck89fsupxprp
// This is just an excerpt, of course...
namespace CrashLanding {
public class Ticker_MTcounter : Building {
public void DoSpawn(int tickAmt) {
Predicate<IntVec3> validator = (Predicate<IntVec3>) (x => {
foreach (IntVec3 c in GenAdj.OccupiedRect(x, Rot4.North, new IntVec2(3, 3))) {
if (!c.InBounds(this.Map) || c.Fogged(this.Map) || !c.Standable(this.Map) || c.Roofed(this.Map) && c.GetRoof(this.Map).isThickRoof)
return false;
foreach (Thing thing in c.GetThingList(this.Map)) {
if (thing.def.preventSkyfallersLandingOn)