Skip to content

Instantly share code, notes, and snippets.

View CapsAdmin's full-sized avatar
🌜
Lua

Elias Hogstvedt CapsAdmin

🌜
Lua
View GitHub Profile
@CapsAdmin
CapsAdmin / screen.lua
Created July 11, 2013 03:34
some sort of 3d world
screens = screens or {}
screens.active_screens = screens.active_screens or {}
screens.lock_player = false
screens.mouse_delta = Vector(0, 0, 0)
screens.focused_screen = NULL
do -- meta
local SCREEN = {}
SCREEN.__index = SCREEN
@CapsAdmin
CapsAdmin / gist:6571845
Created September 15, 2013 15:40
requires freetypegl compiled as a dll
local header = [[
typedef union
{
int data[4];
int x;
int y;
int z;
struct {
int w;
};
--[[
basic instrumental and statistical profiler which only provides the raw data
the statistical profiler is wip and is for luajit 2.1 alpha only
garbage details may not be accurate (i think garbage can be collected in between??)
times are probably in microsecond so * 100 and get rid of around 5 decimals
BASIC USE
profiler.Start()
local pack = vpk.Open(steam.GetInstallPath() .. "/steamapps/common/GarrysMod/sourceengine/hl2_sound_vo_english_dir.vpk")
vfs.Mount({
id = "test",
root = "",
callback = function(type, path, ...)
if type == "find" then
path = path:sub(2)
path = path .. "/"
local music = utilities.RemoveOldObject(audio.CreateSource("sounds/cantina.ogg"))
music:Play()
music:SetLooping(true)
local distortion = audio.CreateEffect("distortion")
distortion:SetParam("lowpass_cutoff", 1000)
distortion:SetParam("gain", 1)
music:AddEffect(distortion)
local reverb = audio.CreateEffect("eaxreverb", {decay_time = 5, diffusion = 5, gain = 1}) -- whatever floats your boat!
1 = al.GenSource()
cdata<const char *>: 0x04db1540 = alc.GetString(784)
[audio] opening device "PreSonus FireStudio Audio (PreSonus FireStudio Audio)" for input
cdata<struct ALCdevice_struct *>: 0x04dd3710 = alc.CaptureOpenDevice("PreSonus FireStudio Audio (PreSonus FireStudio Audio)", 44100, 4353, 4096)
nil = alc.CaptureStart(cdata<struct ALCdevice_struct *>: 0x04dd3710)
2 = al.GenBuffer()
nil = al.BufferData(2, 4353, cdata<short [4096]>: 0x0e9d59f0, 4096, 44100)
nil = al.SourceQueueBuffers(1, 1, cdata<unsigned int [1]>: 0x00e230d0)
3 = al.GenBuffer()
nil = al.BufferData(3, 4353, cdata<short [4096]>: 0x0e9d1d30, 4096, 44100)
--[[
Copyright (C) 2011 Chris Osgood <chris at luadev.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
local function MakeEnum(filename)
_G["FAST_ADDON_" .. filename:Left(-5):upper()] = true
end
local function load_files(dir)
for _, luafile in pairs((file.Find(dir .. "/*.lua", "LUA"))) do
local path = string.format(dir .. "/%s", luafile)
MakeEnum(luafile)
function()
local buffName = "Twilight Ward"
local buff = UnitAura("player", buffName)
local timeRemain = ""
if buff then
local timeNow = GetTime()
local timeExpires = select(7, UnitAura("player", buffName))
local timeLeft = timeExpires - timeNow
-- meta
local Player = FindMetaTable("Player")
intDefaultPlayerSpeed = 210
intDefaultSlowSpeed = 30
function Player:SlowDown(intTime)
self.SlowDownTimes = self.SlowDownTimes or {}
self.SlowTime = CurTime() + intTime
end