Skip to content

Instantly share code, notes, and snippets.

View DoctorGester's full-sized avatar

Kirill Artemov DoctorGester

View GitHub Profile
ability(AbilityId.TopHat, {
projectileSpeed: 850,
damage: [100, 150, 200, 250, 300],
slow: 50,
slowDuration: [4.0, 4.5, 5.0, 5.5, 6.0]
}, ability => {
const slow = modifier<number>(modifier => {
modifier.changes((change, slow) => {
change.property(UnitProperty.moveSpeed, slow);
});
type Module = {
name: string,
dependencies: Dependency[],
exported: Record<string, any>,
execute: () => void
}
type Dependency = {
name: string
setter: (value: any) => void
declare let scheduler: Scheduler;
if (!scheduler) {
scheduler = {
tasks: new Map<Coroutine<any>, Task>()
};
}
type Scheduler = {
tasks: Map<Coroutine<any>, Task>;
local ffi = require "ffi"
ffi.cdef [[
void* malloc(size_t size);
typedef struct {
float x;
float y;
} vector;
]]
function process_node(node: ts.Node): ts.Node | undefined {
if (node.kind == ts.SyntaxKind.CallExpression) {
const call = node as ts.CallExpression;
const signature = checker.getResolvedSignature(call);
const decl = signature.declaration;
if (!decl) return;
if (decl.kind == ts.SyntaxKind.FunctionDeclaration && decl.name.escapedText == "enum_to_string") {
const argument = call.arguments[0];
function highlight_outline(cell_index_to_highlight: boolean[], color: XYZ) {
const cell_index_to_edges: Array<{ edge: Edge, from: XY, to: XY, deleted: boolean }[]> = [];
const unique_edges: { edge: Edge, from: XY, to: XY, deleted: boolean }[] = [];
function merge_edges(at: XY, going_towards: Edge, right_relative: number | undefined, left_relative: number | undefined, index: number) {
const right_neighbor = right_relative && cell_index_to_edges[right_relative];
const right_edge = right_neighbor && right_neighbor.find(old => old.edge == going_towards);
const left_neighbor = left_relative && cell_index_to_edges[left_relative];
const left_edge = left_neighbor && left_neighbor.find(old => old.edge == going_towards);
ACT_MELEE_VM_RELOAD 836
DOTA_LOADOUT_TYPE_OFFHAND_WEAPON 1
ACT_RUN_SCARED 112
ACT_MP_PRIMARY_GRENADE1_IDLE 696
rawget function: builtin#12
MODIFIER_EVENT_ON_ATTACK_FAIL 142
ACT_MP_RELOAD_SWIM 542
ACT_TURN_RIGHT 43
ACT_SLAM_DETONATOR_STICKWALL_DRAW 260
DOTA_HEROPICK_STATE_CM_SELECT8 26
function example_ui() {
const canvas = document.getElementById("canvas");
if (!canvas) {
return;
}
const state = default_state();
const spacing_between_blocks = 18;
const chat_input_area_height = 66;
local histograms = {}
local function make_debug_histogram(name, length, pattern)
return {
name = name,
times = {},
writes = 0,
length = length,
pattern = pattern
}
local aspect_ratio = 4 / 3
local game_width = 1000
local game_height = game_width / aspect_ratio
local bat_height = 200
local bat_width = 30
local bats = {}
local bat_lerp = 8
local ball_dimension = 25
local ball_speed = 0
local ball = {}