Skip to content

Instantly share code, notes, and snippets.

View ProdigySim's full-sized avatar

Michael Busby ProdigySim

View GitHub Profile
@ProdigySim
ProdigySim / l4d2_scoringwip.sp
Created February 4, 2013 12:07
Current progress of scoring WIP
#include <sourcemod>
#include <sdktools>
#include <left4downtown>
#include <l4d2_direct>
#define L4D2UTIL_STOCKS_ONLY
#include <l4d2util>
//#include <sendproxy>
public Action:L4D2_OnEndVersusModeRound(bool:countSurvivors)
#include <left4downtown>
Handle:g_SurvSetCVar;
public OnPluginStart()
{
g_SurvSetCVar = CreateConVar("l4d_force_survivorset", "2",
"Forces specified survivor set (0 - do not force, 1 - force l4d1 set, 2 - force l4d2 set (allows to use l4d2 survivors voices in l4d1 campaigns))",
FCVAR_PLUGIN);
}
@ProdigySim
ProdigySim / SteamConnectionDemo.cs
Created March 8, 2014 21:14
Trying to write an async wrapper for SteamKit's SteamClient
using SteamKit2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SteamConnection
{
class Program
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
public class Class1
{
static Class1()
{
DoThing();
}
@ProdigySim
ProdigySim / cterrorplayer_updatezombiefrustration.cpp
Created July 8, 2014 10:39
CTerrorPlayer::UpdateZombieFrustration()
// Reverse-engineered CTerrorPlayer::UpdateZombieFrustration().
// I can claim no copyright for this code.
// This representation of code was produced by reverse engineering for interoperability.
// Any resemblance to original source is completely accidental.
void CTerrorPlayer::UpdateZombieFrustration()
{
if ( !ZombieFrustration.GetBool())
|| this->GetTeamNumber() != 3
|| this->GetClass() != 8
/*
Finale Can't Spawn Glitch Fix (C) 2014 Michael Busby
All trademarks are property of their respective owners.
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 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
@ProdigySim
ProdigySim / gist:1acc6edf67601cd9c025
Created May 13, 2015 00:48
passcard verification
Verifying I am +prodigysim on my passcard. https://onename.com/prodigysim
const fs = require('fs');
const crateData = JSON.parse(fs.readFileSync('crates-neater.json', 'utf-8'));
function crateWithAny(data) {
const itemNames = typeof data == 'string' ? Array.from(arguments) : data;
return crateData.filter(crate => itemNames.reduce((hasItem, item) => hasItem || item in crate, false));
}
const l3cc = crateWithAny('Level 3 Backpack', 'Level 3 Helmet', 'Level 3 Military Vest').length;
@ProdigySim
ProdigySim / filterMap.ts
Created August 16, 2018 17:08
Doing some neat typescript stuff.
type FilterFn<T> = (item: T) => boolean;
type FilterMap<T> = Record<string, FilterFn<T>>;
function filterMap<T, U extends FilterMap<T>>(items: T[], filterMap: U) {
const filters = new Map<string, FilterFn<T>>();
Object.keys(filterMap).forEach((key) => filters.set(key, filterMap[key]));
const itemMap: Partial<Record<keyof U, T>> = {};
for (const item of items) {
const matchedFilter = Array.from(filters).find(([key, filterFn]) => {
@ProdigySim
ProdigySim / values.ts
Created January 15, 2019 04:53
Tyescript Values macro
// Get the types of all properties of T:
type Values<T> = T[keyof T];