Skip to content

Instantly share code, notes, and snippets.

View RootKiller's full-sized avatar

Eryk Dwornicki RootKiller

View GitHub Profile
@RootKiller
RootKiller / godot-code-guidelines.md
Last active October 16, 2024 11:12
This is version of my coding guidelines for Godot projects.

Code Guidelines

The project is written in GDscript - the main scripting language of the Godot Game Engine.

We are following the general principles of writing scripts in Godot. However, there may be some subtle differences - so reading this document is mandatory for anyone who would want to write code for the project.

The guidelines were gradually created, so some source code that do not follow them may still exist. If you find it, fix it.

Style Guidelines

@RootKiller
RootKiller / GenerateProjectFiles.Internal.ps1
Created April 27, 2024 12:35
Set of files used for generating Unreal Project files via BAT compatible with Epic Games Launcher version of the Engine. I use it with 10x extension that works with both compiled and launcher engine projects.
$GenerateProjectFilesToolPath = (Get-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Unreal.ProjectFile\shell\rungenproj\command).'(default)'
Get-ChildItem -Path $PSScriptRoot\. -Filter *.uproject -File -Name | ForEach-Object {
$ProjectPath = "$PSScriptRoot\$_"
Write-Output "Discovered Unreal Project: '$ProjectPath'. Trying to generate project files..."
$FinalGenerateProjectFilesToolPath = $GenerateProjectFilesToolPath.replace("%1", $ProjectPath)
Invoke-Expression "& $FinalGenerateProjectFilesToolPath"
}
@RootKiller
RootKiller / DefaultInput.ini
Last active April 13, 2023 00:01
UE5 RawInput: DualSense
[/Script/RawInput.RawInputSettings]
+DeviceConfigurations=(VendorID="0x054C",ProductID="0x0CE6",AxisProperties=((Key=GenericUSBController_Axis1),(Key=GenericUSBController_Axis2),(Key=GenericUSBController_Axis3,bGamepadStick=True),(Key=GenericUSBController_Axis4,bGamepadStick=True),(Key=GenericUSBController_Axis5,bInverted=True,bGamepadStick=True),(Key=GenericUSBController_Axis6,bGamepadStick=True),(Key=GenericUSBController_Axis7),(Key=GenericUSBController_Axis8),(Key=GenericUSBController_Axis9),(Key=GenericUSBController_Axis10),(Key=GenericUSBController_Axis11),(Key=GenericUSBController_Axis12),(Key=GenericUSBController_Axis13),(Key=GenericUSBController_Axis14),(Key=GenericUSBController_Axis15),(Key=GenericUSBController_Axis16),(Key=GenericUSBController_Axis17),(Key=GenericUSBController_Axis18),(Key=GenericUSBController_Axis19),(Key=GenericUSBController_Axis20),(Key=GenericUSBController_Axis21),(Key=GenericUSBController_Axis22),(Key=GenericUSBController_Axis23),(Key=GenericUSBController_Axis24)),ButtonPropert
const float MaxObjectMassToGrabKg = 50.0f;
// Before
bool AJanuszCharacter::IsAbleToGrabComponent(UPrimitiveComponent* Component) const
{
if (Component->CalculateMass() > MaxObjectMassToGrabKg)
{
return false;
}
return true;
using UnityEngine;
class GameManager : MonoBehaviour
{
public static GameManager instance;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static Initialize()
{
if (instance == null)
// Before
if (m_planningMode == PLANNING_MODE_SHAFTS && hoveredCellY + 1 >= m_planningStartY)
// After
if ((m_planningMode == PLANNING_MODE_SHAFTS) && ((hoveredCellY + 1) >= m_planningStartY))
bool HumanBase::WalkTo(const Vector2& position)
{
if (m_state != HumanState::Walking) {
m_currentWalkPath = GetWorld()->FindPath(m_position, position);
if (m_currentWalkPath) {
if (!m_currentWalkPath->GetPointsCount()) {
m_position = position;
m_previousPosition = position;
bool HumanBase::WalkTo(const Vector2& position)
{
if (m_state == HumanState::Walking) {
return false;
}
m_currentWalkPath = GetWorld()->FindPath(m_position, position);
if (!m_currentWalkPath) {
return false;
@RootKiller
RootKiller / YourActorClassDetailsCustomization.cpp
Created January 14, 2022 15:21
Unreal Engine - Move property category in details panel
// Copyright XYZ. All Rights Reserved.
#include "YourActorDetailsCustomization.h"
#include "DetailLayoutBuilder.h"
void FYourActorClassDetailsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailLayout)
{
// Category Name is display name of Category you want to move
// ECategoryPriority is "how high" it should be.
DetailLayout.EditCategory("Category Name", FText::GetEmpty(), ECategoryPriority::Important);
@RootKiller
RootKiller / rtti_replacement.cpp
Created May 28, 2019 22:48
Simple RTTI replacement (C++)
#include <stdio.h>
struct type_id_t
{
const type_id_t *const parent;
const char *const name;
};
struct parent_t
{