Skip to content

Instantly share code, notes, and snippets.

View willnationsdev's full-sized avatar

Will Nations willnationsdev

View GitHub Profile
shader_type spatial;
render_mode shadows_disabled;
uniform float rim = 0.25;
uniform float rim_tint = 0.5;
uniform sampler2D albedo : hint_albedo;
uniform float specular;
uniform float roughness = 1.0;
uniform bool disable_lighting = false;
uniform vec4 shadow_color : hint_color;
@willnationsdev
willnationsdev / node.gd
Last active July 3, 2018 16:09
Helping someone simplify code 1
extends Node
# you should rename all your bullet properties from "first_bullet" to "bullet_1", etc.
func _on_equipment_weapon_equipped(weapon_data, weapon_slot):
if weapon_data.id <= 0: return
get_parent().set("bullet_" + str(weapon_slot), Global_equipment.get(weapon_data.sub_type_a.replace("_weapon", "_ammo")))
# This method relies entirely on naming conventions, so it is much more fragile to change.
# However, this is easily the simplest possible way of reducing the amount of code involved.
@willnationsdev
willnationsdev / jquery.hasClassRegEx.js
Created May 4, 2018 14:07 — forked from naturalkei/jquery.hasClassRegEx.js
jQuery.hasClassRegEx() hasClass by using a Regex
(function($)
{
$.fn.hasClassRegEx = function(regex)
{
var classes = $(this).attr('class');
if(!classes || !regex){ return false; }
classes = classes.split(' ');
var len = classes.length;
@willnationsdev
willnationsdev / Migration.md
Created April 18, 2018 03:26 — forked from dploeger/Migration.md
Migration Notes Godot 2 => Godot 3
@willnationsdev
willnationsdev / Migration.md
Created April 18, 2018 03:26 — forked from dploeger/Migration.md
Migration Notes Godot 2 => Godot 3
@willnationsdev
willnationsdev / sample.jns
Last active February 13, 2018 22:46
JourneyScript concept
# JourneyScript is a narrative scripting language that allows us to
# control the content, context, and flow of dialogue. It is designed
# to mimic as closely as possible the format of a screenplay, but
# it also enables writers to define custom logic and behavior.
# Content is broken up into dialogue segments. The Journey system
# simply provides an "advance" method to programmers which shifts
# the content into the next segment.
# This is a single-line comment.
@willnationsdev
willnationsdev / gdnative_guide_windows64debug.md
Last active June 16, 2022 14:41
A quick guide on building a GDNative C++ project

Creating a GDNative Library (Windows)

This guide specifically shows how to get a Windows 10 x64 OS compiled for a Windows x64 Debug dynamic library and integrate it into a Godot project.

To begin, make sure you are running the appropriate command line tool as an administrator.

Create a SimpleLibrary directory and enter it. This is where our Godot and GDNative projects will exist. For later use, we will also create subdirectories for libraries (lib) and source code (src). Once inside, we get a copy of each necessary repository for C++ NativeScript bindings generation and enter into the cpp_bindings directory.

mkdir SimpleLibrary

@willnationsdev
willnationsdev / gitref.gd
Created January 1, 2018 07:49
GitRef: a Reference type for tracking pending changes to another target object.
# GitRef
# Author: willnationsdev
# Enables users to pass around a reference to pending changes for another target object.
# The changes can be applied to the target or reset with the apply() and reset() functions.
# To create layers of pending changes, call branch() and receive a new GitRef with the
# calling GitRef as its upstream reference.
# In a chained GitRef, apply() and reset() still modify the target as before, but now
# revert() can be called to reset the target to the state of the upstream GitRef.
extends Reference
@willnationsdev
willnationsdev / res_utility.gd
Last active December 26, 2017 16:24
Create flat or tiered view dictionaries of directories in Godot Engine.
# A collection of static functions for searching through the res:// directory.
tool
extends Reference
##### CLASSES #####
##### SIGNALS #####
##### CONSTANTS #####
@willnationsdev
willnationsdev / godot_module_docs.md
Created December 24, 2017 13:59
How to create documentation for a Godot Module

So after fiddling and experimenting, I kinda figured out the workflow of writing custom docs for your custom module :D

  1. Make a new directory doc_classes in the root of your custom module.

  2. Add following code to config.py:

    def get_doc_classes(): return [ "YourClassName", ]