Skip to content

Instantly share code, notes, and snippets.

View spacechase0's full-sized avatar

Casey W spacechase0

View GitHub Profile
@spacechase0
spacechase0 / Content.cs
Created May 8, 2017 03:20
Stardew Valley: Load a Tiled map file directly
// You will need "TiledNet" from NuGet. (Also found here: https://github.com/napen123/Tiled.Net)
using Tiled;
private class TileMapping
{
public TileSheet tileSheet = null;
public int tileId = 0;
public TileMapping() { }
public TileMapping( TileSheet ts, int id )
@spacechase0
spacechase0 / xnb.cpp
Last active June 23, 2017 20:18
Xnb tool
#include <boost/filesystem.hpp>
#include <SFML/Graphics/Image.hpp>
#include <util/File.hpp>
#include <xnb/File.hpp>
namespace fs = boost::filesystem;
void extract( xnb::File& file, const std::string& output )
{
}
Many commands that ask for an NPC (such as faceDirection) can take 'farmer' as well.
removeObjects - Clears all objects from the current location.
cmenu, customize, customizeMenu - Opens the character menu (new game, not wizard).
mainMenu, mainmenu, removeDebris - Removes all debris (such as dropped items).
pick, pickax, pickaxe - Adds a new basic pickaxe to your inventory.
where, whereis <S:NPC> - Prints the location and coordinates of <NPC>.
bloomDay - The game's bloom. Doesn't work.
cat <I:X> <I:Y> - Adds a cat at (<X>, <Y>) in the current location.
museumloot - Marks artifacts as found and adds minerals to inventory. Stops when the inventory is full.
@spacechase0
spacechase0 / .cs
Created November 5, 2017 20:19
Custom NPCs Spouse Room
private void locChanged( object sender, EventArgsCurrentLocationChanged args )
{
if ( args.NewLocation.name == "FarmHouse" )
{
var house = args.NewLocation as FarmHouse;
var displayingSpouseRoom = Helper.Reflection.GetPrivateField<bool>(house, "displayingSpouseRoom");
if (displayingSpouseRoom.GetValue() && Game1.player.isMarried() )
{
var data = CustomNpcData.get(Game1.player.getSpouse().name);
@spacechase0
spacechase0 / NodeGraph.cpp
Last active August 24, 2024 16:06
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{
@spacechase0
spacechase0 / .cs
Last active May 12, 2021 07:28
Generic Mod Config Menu example
// Your config class
public class DummyConfig
{
public bool dummyBool = true;
public int dummyInt1 = 50;
public int dummyInt2 = 50;
public float dummyFloat1 = 0.5f;
public float dummyFloat2 = 0.5f;
public string dummyString1 = "Kirby";
public string dummyString2 = "Default";
@spacechase0
spacechase0 / CecilMod.cs
Created August 14, 2020 10:56
BiggerCraftables.Cecil
using Mono.Cecil;
using Mono.Cecil.Cil;
using Netcode;
using StardewModdingAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@spacechase0
spacechase0 / Mod.cs
Last active January 21, 2021 04:40
SDV/SMAPI custom net root
using Harmony;
using Netcode;
using SpaceShared;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewModdingAPI.Utilities;
using StardewValley;
using StardewValley.Network;
using System;
using System.Collections.Generic;
@spacechase0
spacechase0 / JsonHelper.cs
Last active January 25, 2021 01:07
Net type serialization
namespace StardewModdingAPI.Toolkit.Serialization
{
public class MyNetConverter : JsonConverter
{
public override bool CanRead => true;
public override bool CanWrite => true;
public override bool CanConvert( Type objectType )
{
//Console.WriteLine( "checking " + objectType );
return typeof( AbstractNetSerializable ).IsAssignableFrom( objectType );
@spacechase0
spacechase0 / Root.gd
Created July 8, 2021 06:42
SpaceECS (name subject to change)
extends Node2D
func _physics_process(delta):
var vels = get_tree().get_nodes_in_group( "components/VelocityComponent" )
for node in vels:
var vel = ComponentServer.get_component( node, "VelocityComponent" )
node.move_and_collide( vel.velocity * delta )
var velsCS = get_tree().get_nodes_in_group( "components/VelocityCSComponent" )
for node in velsCS: