Skip to content

Instantly share code, notes, and snippets.

View bearlikelion's full-sized avatar

Mark bearlikelion

View GitHub Profile
@bearlikelion
bearlikelion / Weapon.gd
Created January 20, 2025 20:00
SurvivalScape's Enemy Targeting Code
func target_enemy() -> void:
Player.target_enemy = null
var enemies_in_range : Array[Area2D] = get_overlapping_areas()
if enemies_in_range.size() > 0:
enemies_in_range = enemies_in_range.slice(0, 100)
can_fire = true
for enemy : Node2D in enemies_in_range:
# Always target boss if in range
if enemy.is_in_group("boss"):
@bearlikelion
bearlikelion / voip.gd
Last active May 3, 2025 05:27
SurfsUp Voip.gd
class_name Voice
extends Node
const VOIP = preload("res://Scenes/Player/voip.tscn")
const REF_SAMPLE_RATE : int = 44100
@export var use_loopback: bool = false
var current_sample_rate: int = 48000
var local_playback: AudioStreamGeneratorPlayback = null
import bpy
from collections import defaultdict
def get_texture_image(obj):
"""Returns the image texture of the first image node in the first material."""
if not obj.data.materials:
return None
mat = obj.data.materials[0]
if mat and mat.use_nodes:
for node in mat.node_tree.nodes:
@bearlikelion
bearlikelion / hack.gd
Created May 17, 2025 03:39
Example injectible hack for Godot using --script
extends SceneTree
func _initialize():
print("You've been hacked")
@bearlikelion
bearlikelion / remove-script.patch
Last active May 17, 2025 05:20
Ignore godot's --script command line argument
diff --git a/main/main.cpp b/main/main.cpp
index 1c7955f089..8a37d67eb7 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -3700,7 +3700,8 @@ int Main::start() {
else if (E->next()) {
bool parsed_pair = true;
if (E->get() == "-s" || E->get() == "--script") {
- script = E->next()->get();
+ script = "";
@bearlikelion
bearlikelion / godot_smp_mark.patch
Last active August 23, 2025 17:27
Godot SMP Linux Crashfix
diff --git a/godotsteam_multiplayer_peer.cpp b/godotsteam_multiplayer_peer.cpp
index df4b525..b190601 100644
--- a/godotsteam_multiplayer_peer.cpp
+++ b/godotsteam_multiplayer_peer.cpp
@@ -270,6 +270,8 @@ void SteamMultiplayerPeer::lobby_chat_update(LobbyChatUpdate_t *p_chat_update) {
add_peer(p_chat_update->m_ulSteamIDUserChanged);
} else {
// If they didn't enter, it doesn't matter why, they are leaving
+ // Collect connections to remove to avoid iterator invalidation
+ LocalVector<HSteamNetConnection> connections_to_remove;