Skip to content

Instantly share code, notes, and snippets.

View Petethegoat's full-sized avatar
😍

Pete Goodfellow Petethegoat

😍
View GitHub Profile
@Petethegoat
Petethegoat / -OOF code
Last active December 14, 2015 14:38
This is the code fo-ACK
/mob/living/carbon/human/proc/forcesay(list/append)
if(client)
var/virgin = 1 //has the text been modified yet?
var/temp = winget(client, "input", "text")
if(findtext(temp, "Say \"", 1, 7) && length(temp) > 5)
temp = replacetext(temp, ";", "") //general radio
if(findtext(trim_left(temp), ":", 6, 7)) //dept radio
temp = copytext(trim_left(temp), 8)
@Petethegoat
Petethegoat / gist:5137995
Last active December 14, 2015 19:39
fucked up goddamn bullshit
/proc/in_range(source, user)
if(get_dist(source, user) <= 1)
return 1
return 0 //not in range and not telekinetic
/obj/machinery/Topic(href, href_list)
..()
if(stat & (NOPOWER|BROKEN))
world << "src.stat"
@Petethegoat
Petethegoat / gist:5138116
Created March 11, 2013 21:51
sleeper bullshit
/obj/machinery/sleep_console
name = "sleeper console"
icon = 'icons/obj/Cryogenic2.dmi'
icon_state = "console"
anchored = 1 //About time someone fixed this.
density = 1
var/obj/machinery/sleeper/connected = null
/obj/machinery/sleep_console/New()
@Petethegoat
Petethegoat / VertexBlendMasked
Created April 22, 2013 22:59
Shader for Unity that vertex blends two textures with a mask. Imperfect.
Shader "Custom/VertexBlendMaskedCleanEdges" {
Properties
{
_Over ("Over", 2D) = "white" {}
_Under ("Under", 2D) = "white" {}
_Mask ("Mask", 2D) = "white" {}
_Bias ("Edge Bias", Range(0.5, 30.0)) = 4.0
_Edge ("Edge Sharpness", Float) = 10.0
_Fall ("Blend Falloff", Float) = 1.0
}
// To prepare a Google Spreadsheet for this:
// make sure the spreadsheet has been published to web (FILE >> PUBLISH TO WEB), which is NOT the same as sharing to web
// To use in a different script:
// 1) include "using Google.GData.Client;"
// 2) include "using Google.GData.Spreadsheets;"
// 3) call "GDocService.GetSpreadsheet( string spreadsheetKey );", see DebugTest section for sample usage
// uncomment to enable debug output
// #define debugTest
@Petethegoat
Petethegoat / ptg_lockNatoTrailer.sqf
Last active August 29, 2015 13:57
Prevents anyone riding in the trailer of the open top HEMTT transport.
//Prevents anyone riding in the trailer of the open top HEMTT transport.
//One passenger may still ride in the front.
//Usage:
//null = this execVM "ptg_lockNatoTrailer.sqf.sqf";
_this lockCargo [1, true];
_this lockCargo [2, true];
_this lockCargo [3, true];
_this lockCargo [4, true];
@Petethegoat
Petethegoat / ptg_garrison.sqf
Created March 8, 2014 19:41
This is designed for garrisoning AI in buildings, without preventing them from reacting when enemies are too close for their firing positions to be useful- very near to, or inside the building. You can choose to disable reaction if you don't want the additional overhead.
//This is designed for garrisoning AI in buildings, without preventing them from reacting when enemies are too close for their firing positions to be useful- very near to, or inside the building. You can choose to disable reaction if you don't want the additional overhead.
//Usage:
//null = [this, "UP", true] execVM "ptg_garrison.sqf";
//When should garrisoned units check for close enemies? In seconds.
_INTERVAL = 5;
//How close should an enemy be before they abandon their position? In meters.
_RANGE = 8;
//Fake defines so you can just execVM from init.
@Petethegoat
Petethegoat / ptg_pickMarker.sqf
Last active August 29, 2015 13:57
This will move a unit to a random marker, and rotate it in the direction of that marker. Supports any number of markers.
//This will move a unit to a random marker, and rotate it in the direction of that marker. Supports any number of markers.
//Usage:
//null = [this, "mrk_1", "mrk_2", "mrk_3", "mrk_x"] execVM "ptg_pickMarker.sqf";
_unit = _this select 0;
_pick = (floor random ((count _this) - 1)) + 1;
_marker = _this select _pick;
_unit setPosATL getMarkerPos _marker;
_unit setDir markerDir _marker;
@Petethegoat
Petethegoat / DropToFloor.cs
Last active November 2, 2016 08:31
Editor script for Unity that drops the selected gameobject to the ground, based on it's extents. Doesn't handle convex shapes at all. Put in Assets/Editor/DropToFloor.cs
using UnityEngine;
using UnityEditor;
namespace Goodfellow.Utils
{
public class DropToFloor
{
/*
These are the supported keys (can also be combined together):
MenuLoading
The loading screen.
MenuOptions
The main menu.
MenuLoad
The load game dialog.
MenuPrefs