Skip to content

Instantly share code, notes, and snippets.

View fadookie's full-sized avatar
🕹️
😹

Eliot Lash fadookie

🕹️
😹
View GitHub Profile
@fadookie
fadookie / CameraAnchor.cs
Last active April 29, 2024 12:19
Screen-relative anchoring component for Unity3D. Find more Unity code at http://www.eliotlash.com/2015/01/unity3d-components-and-code-snippets/
/***
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623
* It is also copied in this gist below.
*
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
*/
/* The MIT License (MIT)
@fadookie
fadookie / yagpdb-sendMessage.awk
Created August 29, 2023 01:13
YAGPDB Custom Command to send a message to a channel without an embed.
{{/* ACTUAL CODE DONT TOUCH */}}
{{$hasContent := false}} {{$content := false}} {{$contentV := ""}} {{$channel := false}} {{$channelV := .Channel.ID}}
{{$flags := cslice "-channel" "-content"}}
{{- range $k, $v := .CmdArgs -}}
{{- if eq . "-content"}} {{$content = true}} {{else if in $flags .}} {{$content = false}} {{end -}}
{{- if and ($content) (not (eq . "-content"))}} {{$hasContent = true}} {{$contentV = joinStr " " $contentV .}} {{end -}}
{{- if eq . "-channel"}} {{$channel = true}} {{else if in $flags .}} {{$channel = false}} {{end -}}
{{- if and ($channel) (not (eq . "-channel"))}} {{$checkChannel := reReplace `<|>|#` . ""}} {{with getChannelOrThread $checkChannel}} {{$channelV = .ID}} {{end}} {{end -}}
{{- end -}}
#ifndef NOISE_SIMPLEX_FUNC
#define NOISE_SIMPLEX_FUNC
/*
Description:
Array- and textureless CgFx/HLSL 2D, 3D and 4D simplex noise functions.
a.k.a. simplified and optimized Perlin noise.
The functions have very good performance
and no dependencies on external data.
@fadookie
fadookie / decky-plugin-template-errors.txt
Last active February 19, 2024 22:10
Error output from decky-plugin-template builddeploy step.
Error: the task 'depsetup' neither specifies a command nor a dependsOn property. The task will be ignored. Its definition is:
{
"label": "depsetup",
"type": "shell",
"group": "none",
"detail": "Install depedencies for basic setup",
"linux": {
"command": "${workspaceFolder}/.vscode/setup.sh"
},
"problemMatcher": []
@fadookie
fadookie / Zscript-learning-rant.md
Last active October 24, 2023 11:21
Rant about learning GZDoom scripting/Zscript

In response to Which ZDooM Script Language to Use?

Just wanted to chime in here as someone who recently learned all three for my first WAD project. I was also given the advice "Learn Zscript", so I did. But I have to say, coming as a total beginner in Doom modding and learning Zscript was definitely jumping off the deep end, even for an experienced programmer like myself. Please excuse my ignorance if I am missing out on things here, and I would love to be enlightened to the contrary, but I would like to share from my recent and hard-won experiences.

There is an awful lot of context that you need to understand in order to be productive as a Doom scripter. And currently, since Zscript is the newest and most advanced scripting language, it has the least documentation of any of them (and what documentation there is tends to assume familiarity with the other two systems.)

I've heard several folks mention similarity to C++ as a reason to learn it. And it'

@fadookie
fadookie / runAndroid.sh
Last active September 21, 2022 08:56
Script to install, run, and open logcat for a Unity Android App
#!/bin/sh
# Script to install, run, and open logcat for a Unity Android App.
# I needed this as one of my libraries has a critical post-build script so I can't use "Build and Run" anymore - this is the "and Run" part.
# Be sure to update these variables to match your app's publishing/build settings:
APK_PATH='builds/android/basecode.apk'
BUNDLE_ID='com.eliotlash.basecode'
alias unilogcat='adb logcat|egrep "Unity"'
adb install -r "${APK_PATH}" && adb logcat -c && adb shell am start -n "${BUNDLE_ID}/com.unity3d.player.UnityPlayerNativeActivity" && echo 'DONE, LOG:' && unilogcat
@fadookie
fadookie / Standard-noFog.shader
Last active May 16, 2022 10:26
Unity 5.2.1f1 Standard Shader with Fog disabled.
Shader "Custom/Standard (No fog)"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
# The Davar Sisters - Parody of The Schuyler Sisters from Hamilton
[ADOLIN]
There’s nothing lighteyes love more
Than going to the shattered plains and slummin’ it with the poor
They pull up in their carriages and gawk
At the soldiers in the common
Just to watch them talk
Take Lin Davar: the man was loaded
Uh-oh, but little did he know that
@fadookie
fadookie / rules.yaml
Created January 10, 2021 21:18
"Ohio" Sub Example for OpenRA Modding
OHIOSUB:
Inherits: ^Ship
Inherits@AUTOTARGET: ^AutoTargetAllAssaultMove
Buildable:
Queue: Ship
BuildAtProductionType: Submarine
BuildPaletteOrder: 60
Prerequisites: ~syrd, atek, ~techlevel.unrestricted
Description: Submerged anti-ground siege unit\nwith anti-air capabilities.\nCan detect other submarines.\n Strong vs Buildings, Ground units, Aircraft\n Weak vs Naval units\n Special Ability: Submerge
Valued:
@fadookie
fadookie / Barycentric3.cs
Last active November 28, 2020 08:24
Barycentric coordinate wrapper for Unity Vector3. Optimized mesh extension methods for picking random points on a mesh or submesh.
/// <summary>
/// Wrapper/utility class for Vector3 that provides methods for manipulating Barycentric coordinates.
///
/// Uses math from http://answers.unity3d.com/answers/613726/view.html
///
/// Copyright (c) 2015 Eliot Lash
///
/// 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