Skip to content

Instantly share code, notes, and snippets.

View angavrilov's full-sized avatar

Alexander Gavrilov angavrilov

View GitHub Profile
@angavrilov
angavrilov / io_import_scene_unreal_psa_psk.py
Last active October 20, 2015 07:33
Tweaks for the blender PSK importer
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@angavrilov
angavrilov / ModuleManager_B9.cfg
Last active August 29, 2015 13:56
KAS config for some mod parts.
///////// B9 Linear RCS ///////
@PART[B9_Control_RCS_Port_R1]
{
MODULE
{
name = KASModuleGrab
evaPartPos = (0.0, 0.00, -0.18)
evaPartDir = (0,0,-1)
storable = true
storedSize = 3
@angavrilov
angavrilov / FPS.cs
Last active January 3, 2016 11:59
A trivial FPS indicator for KSP
// LICENSE: Public Domain
using System;
using UnityEngine;
namespace FPS
{
[KSPAddon(KSPAddon.Startup.EveryScene, false)]
public class FPSIndicator : MonoBehaviour
{
@angavrilov
angavrilov / check_block_items.lua
Created May 7, 2012 17:01
A script to verify integrity of block item lists and occupancy.
-- This scripts verifies that:
--
-- 1) Item has flags.on_ground <=> it is in the correct block item list
-- 2) A tile has items in block item list <=> it has occupancy.item
function check_block_items()
local cnt = 0
local icnt = 0
local found = {}
@angavrilov
angavrilov / cmptiles.lua
Created April 20, 2012 11:23
Lua script to list and/or compare tiletype subsets
-- Lists and/or compares two tiletype material groups.
-- Usage: lua cmptiles.lua material1 [material2]
local nmat1,nmat2=...
local mat1 = df.tiletype_material[nmat1]
local mat2 = df.tiletype_material[nmat2]
local tmat1 = {}
local tmat2 = {}
@angavrilov
angavrilov / filter.pl
Created January 6, 2012 10:33
job_item.unk1 to items.other vector mapping
my %lines;
my %switches;
my %jumps;
while (<>) {
$jumps{hex $1}{hex $2}++ if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)/);
if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)\s+\[label=\"([0-9,-]+)\"/) {
$switches{hex $1}{$3} = hex $2;
} elsif (/^n([0-9a-f]+)\s+\[label=\".*?\\nmov\s+eax,0x([0-9a-fA-F]+)\\l/) {
void __cdecl sub_89289C0(int unit)
{
int unit; // esi@1
int unf_vec_end; // eax@3
int v3; // edx@3
int v4; // edx@4
int unf_vec_start; // ecx@4
int item_id; // edi@5
signed int v7; // edx@7
signed int v8; // eax@8
@angavrilov
angavrilov / general_ref_unit.h
Created December 14, 2011 15:47
Sample structures from the code generator
#ifndef DF_GENERAL_REF_UNIT_H
#define DF_GENERAL_REF_UNIT_H
#ifndef DF_GENERAL_REF_H
#include "general_ref.h"
#endif
namespace df {
struct general_ref_unit : general_ref {
int32_t unit_id;
static virtual_identity<general_ref_unit> _identity;
protected:
@angavrilov
angavrilov / slime-utils-walker.lisp
Created October 29, 2011 08:23
A macroexpand-in-context hack for SLIME
(require 'asdf)
(asdf:load-system :hu.dwim.walker)
;;;; Walker interface implementation
(defpackage :swank-macro-context
(:use :cl :hu.dwim.walker :hu.dwim.def :contextl :metabang-bind)
(:export #:apply-expander))
(in-package :swank-macro-context)
@angavrilov
angavrilov / filter.pl
Created May 23, 2011 14:12
DF thought codes
my %lines;
my %switches;
my %jumps;
while (<>) {
$jumps{hex $1}{hex $2}++ if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)/);
if (/^n([0-9a-f]+)\s+->\s+n([0-9a-f]+)\s+\[label=\"([0-9,-]+)\"/) {
$switches{hex $1}{$3} = hex $2;
} elsif (/^n([0-9a-f]+)\s+\[label=\".*?\\l'(.*)'\\l/) {