Skip to content

Instantly share code, notes, and snippets.

@workhorsy
workhorsy / gist:de200661fd593e56e9ef6297ac8ef86f
Created April 18, 2025 14:39
Basic Godot Utility functions
# Copyright (c) 2025 WhizArts
# Basic Godot Utility functions
extends Node
const INT32_MAX := int(int(pow(2, 31)) - 1)
const INT64_MAX := int(int(pow(2, 63)) - 1)
const UINT32_MAX := int(pow(2, 32))
func recursively_get_all_children(target : Node) -> Array:
@workhorsy
workhorsy / ChickenCrisisCredits.txt
Created February 26, 2024 07:22
Chicken Crisis Credits
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3D Models
-------------------------------------------------------------------------------
3 Great Feathers Pack
CC BY 4.0
https://creativecommons.org/licenses/by/4.0/
https://sketchfab.com/3d-models/3-great-feathers-pack-ee6a816aa4bf46e399a0169ed826c276
American style house
@workhorsy
workhorsy / check_uids.py
Created February 21, 2024 23:50
Godot 4 check unique UIDS
import os
from os.path import splitext
uid_to_file = {}
headers = ["[gd_scene ", "[gd_resource "]
exts = [".tscn", ".tres"]
@workhorsy
workhorsy / gist:2fc431338ad76372374591a69c5d20ad
Created February 19, 2023 07:18
GDScript DirectoryIterator
class DirectoryIterator:
var _path : String
var _dir : Directory
var _file_name := ""
var _skip_navigational := false
var _skip_hidden := false
func _init(path : String, skip_navigational := false, skip_hidden := false) -> void:
_path = path
_skip_navigational = skip_navigational
var rng := RandomNumberGenerator.new()
func _ready() -> void:
# Set seed here
rng.set_seed(3)
# Will print the same 10 numbers each run
for i in range(10):
var my_random_number = rng.randi_range(0, 2)
print(my_random_number)
extends Control
var _thread : Thread = null
var _to_load := []
var _to_load_mutex := Mutex.new()
func start_async_loader() -> void:
_thread = Thread.new()
vec4 int_to_vec4(const int data) {
int mask = shift_left(shift_right(data, 8), 8);
float r = float(data - mask) / 255.0;
mask = shift_left(shift_right(data, 16), 16);
float g = float(shift_right(data - mask, 8)) / 255.0;
mask = shift_left(shift_right(data, 24), 24);
float b = float(shift_right(data - mask, 16)) / 255.0;
# Here is a sloppy hack to get a Godot resource type without having to load it first
func get_resource_type(file_name : String) -> GDScriptNativeClass:
var f := File.new()
f.open(file_name, File.READ)
var text := f.get_as_text()
#[gd_resource type="ParticlesMaterial" load_steps=3 format=2]
for line in text.split("\n"):
line = line.rstrip("\r")
if line.find("[gd_resource") == 0 and line.find("]") == line.length()-1:
# Spatial moves without physics
func _physics_process(delta : float) -> void:
var speed := 1.0
var velocity := self.transform.basis.z * speed
self.transform.origin += velocity * delta
# KinematicBody moves with physics
func _physics_process(delta : float) -> void:
var speed := 1.0
var velocity := self.transform.basis.z * speed
Check these things to get more PPC CPU info:
"/sys/devices/system/cpu/cpu%d"
"/sys/devices/system/cpu/subcores_per_core"
"/sys/devices/system/cpu/dscr_default"
"/proc/device-tree/cpus/%s/ibm,ppc-interrupt-server#s"
Is this installed by default on PPC Linux?:
https://github.com/ibm-power-utilities/powerpc-utils