Skip to content

Instantly share code, notes, and snippets.

View Shilo's full-sized avatar

Shilo Shilo

View GitHub Profile
@Shilo
Shilo / SoundManager.cs
Last active February 21, 2024 02:40
Audio manager singleton that pools audio players.
using Godot;
using System.Collections.Generic;
public partial class SoundManager : Node
{
private const int MaxSimultaneousSounds = 32;
private const int SuppressSoundTimeMs = 100;
private readonly List<AudioStreamPlayer2D> _inactiveAudioPlayers = new();
private readonly List<AudioStreamPlayer2D> _activeAudioPlayers = new();
@Shilo
Shilo / Camera.cs
Last active February 9, 2024 03:40
Simple camera shake script in Godot 4.
using Godot;
using System;
public partial class Camera : Camera2D
{
public enum ShakeStrengthType
{
Low,
Medium,
High
@Shilo
Shilo / TileMapEditor.gd
Last active February 4, 2024 12:23
Simple runtime tilemap editor that will draw the a terrain from a tileset. (Left click = place, Right click = remove, Middle click = pan)
class_name TileMapEditor extends TileMap
enum InputState {
NONE,
PLACE,
REMOVE,
PAN
}
var input_state: InputState = InputState.NONE
@Shilo
Shilo / ReplaceSelectedText.ahk
Created February 6, 2019 11:59
AutoHotkey script to replace selected text.
^space::
oCB := ClipboardAll
Clipboard =
Send ^c
ClipWait,1
beforeText := "BEFORE_TEXT_HERE"
afterText := "AFTER_TEXT_HERE"
Clipboard := beforeText . Clipboard . afterText
Send ^v
Clipboard := oCB
@Shilo
Shilo / AutoCollisionShape3D.cs
Last active October 24, 2023 15:51
Godot tool for auto syncing position and size of collision shape 3d with a target mesh instance 3d. (GDScript or C#)
using Godot;
[Tool, GlobalClass]
public partial class AutoCollisionShape3D : CollisionShape3D
{
[Export]
public MeshInstance3D MeshInstance;
[ExportGroup("Editor Auto Sync")]
[Export]
@Shilo
Shilo / index.html
Last active June 21, 2023 14:22 — forked from chrisvfritz/index.html
Simplest possible HTML template
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>
This is an example paragraph.<br />
Anything in the <strong>body</strong> tag will appear on the page.<br />
Just like this <strong>p</strong> tag and its contents.
@Shilo
Shilo / KeyboardManager.swift
Created May 27, 2022 13:24
Simple and dirty MacOS key simulating. (Based on: https://github.com/meowmeowmeowcat/keypress )
#if targetEnvironment(macCatalyst)
import Foundation
let src = CGEventSource(stateID: CGEventSourceStateID.hidSystemState)
let loc = CGEventTapLocation.cghidEventTap
public class KeyboardManager {
enum KeyError: Error {
case KeyNotFound
}
@Shilo
Shilo / UITextDocumentProxy+Additions.swift
Last active September 28, 2022 07:50
UITextDocumentProxy additions for text input reading and deleting.
//
// UITextDocumentProxy+Additions.swift
//
//
// Created by Shilo White on 6/5/22.
//
#if canImport(UIKit)
import Foundation
import UIKit
@Shilo
Shilo / CastCPPVoidToNil.lua
Last active September 22, 2022 08:18
Roblox studio scripting tricks. (Examples)
local function test()
end
typeof( (test()) )
@Shilo
Shilo / Holster.lua
Created August 26, 2022 10:44
Un-optimized holstering system for tools in Roblox Studio.
local holsteredTools = {}
local function HolsterTools(attachment)
local player = script.Parent.Parent.Parent
if not player:IsA("Player") then return end
local character = player.Character
if not character then return end
local tool = character:FindFirstChild(script.Parent.Name)