Skip to content

Instantly share code, notes, and snippets.

View CheezusChrust's full-sized avatar

Matt CheezusChrust

  • Canada
  • 22:27 (UTC -04:00)
View GitHub Profile
@CheezusChrust
CheezusChrust / vegetationplacer.lua
Last active July 27, 2023 20:10
Basic StarfallEx chip for placing vegetation on maps - this chip is old and probably buggy, be warned
--@name Vegetation Painter
--@author Cheezus
--@shared
--[[
Basic usage:
0. Start Hammer on the SAME VERSION of the map you're currently playing on; you may need to do a fresh compile
1. Define whatever foliage models you want placed using vegetation.models table below
2. Spawn the chip and hold your use key (default E) to place foliage and your walk key (default ALT) to erase
3. Type /export to export current vegetation models to Hammer
4. Type /clear to remove current vegetation models from Hammer (in case you've made a mistake)
@name Car Steering v2.3.1
@inputs A D Active Base:entity
@outputs SteeringAngle
@persist E:entity [HoloLastPos LastHoloLastPos]:vector MaxAngle SteeringRate SteeringSmoothRate CasterAngle LastRun
@persist SlipCounterForce GyroCounterForce CounterMax HoloLastYaw
@persist AntiWobbleAngle AntiWobbleMul
@trigger Base
@model models/sprops/rectangles_thin/size_2/rect_12x12x1_5.mdl
####################[READ ME]####################
@CheezusChrust
CheezusChrust / gforce.lua
Created June 5, 2021 01:04
GForce display for each player when sitting in a seat - place this in autorun
if SERVER then
hook.Add("PlayerEnteredVehicle", "GForce::EnterVehicle", function(ply, veh)
ply.gforceLastPos = veh:GetPos()
ply.gforceLastVel = Vector()
end)
hook.Add("PlayerLeaveVehicle", "GForce::ExitVehicle", function(ply, Veh)
ply.gforceLastPos = nil
ply.gforceLastVel = nil
end)
@CheezusChrust
CheezusChrust / Torque Curve Visualizer.lua
Last active October 21, 2022 19:04
Spawn on a StarfallEx screen, play with the numbers inside.
--@name tools/Torque Curve Visualizer v1.1
--@author Cheezus
--@shared
if CLIENT then
local Engine = {}
Engine.name = "427 V8"
--[[
ACF3 curves:
@CheezusChrust
CheezusChrust / FileExtensionChanger4000.py
Created January 12, 2022 00:42
Changes the file extension of all files in the directory of this file. Don't know who else may need this but have it anyways.
import os
import time
extensionFrom = ".txt"
extensionTo = ".qc"
count = 0
for f in os.listdir():
if f.endswith(extensionFrom):
count += 1
@CheezusChrust
CheezusChrust / torquetest.lua
Last active March 31, 2022 16:00
Simple test to confirm GMod's inertia unit (it's kg*m^2)
if SERVER then
util.AddNetworkString("TorqueTest")
util.AddNetworkString("TorqueTestEntity")
local ply = me --If you aren't running this with luapad set this to your player entity
local e = ents.Create("prop_physics")
e:SetModel("models/props_junk/wood_crate001a.mdl")
e:SetPos(ply:GetPos() + Vector( 0, 0, 100 ))
e:Spawn()
@CheezusChrust
CheezusChrust / simulated_gearbox.lua
Last active February 15, 2023 02:01
A simple simulated gearbox
--@name Simulated Gearbox
--@author Cheezus
--@shared
local crankAxis = Vector(0, 0, 1) -- Rotation axis of the crankshaft
local flywheelAxis = Vector(0, 0, 1) -- Rotation axis of the flywheel
crankAxis:normalize()
flywheelAxis:normalize()
if SERVER then
@CheezusChrust
CheezusChrust / Car Steering v3.4.lua
Last active March 27, 2023 21:30
A Starfall-based SetAng steering chip with decent counter-steering abilities
--@name Car Steering v3.4
--@author Cheezus
--@shared
--@model models/sprops/rectangles_thin/size_2/rect_12x12x1_5.mdl
local showAxes = true
local frontWheelPos = Vector(50, 0, 0) -- Between your front wheels
local rightAxis = Vector(0, -1, 0) -- The RIGHT facing direction of your car
local upAxis = Vector(0, 0, 1) -- The UP facing direction of your car
@CheezusChrust
CheezusChrust / chipmonitor.lua
Created October 27, 2022 01:14
Simple CPU monitor for Starfalls and E2s, spawn on a Starfall screen component to use
--@name tools/CPU Tracker
--@author Cheezus
--@shared
-- To use this chip, spawn it on a Starfall screen component
if SERVER then
if chip():isWeldedTo() then
chip():isWeldedTo():linkComponent(chip())
end
--@name Mesh Loader
--@author Cheezus
--@shared
local debugPrints = true -- Shows info about tri count and loading progress
if CLIENT then
local globalScale = Vector(0.1) -- Scale all meshes added by this amount, or add a scale vector to individual meshes
local offsetPos = Vector(0, 0, 0) -- Offsets are relative to chip/base
local offsetAngle = Angle(0, 0, 0)