返回模组列表
Piss Rock
游戏玩法

Piss Rock

作者:lamaliv1

Replaces the Waterfall Giant with the Piss Rock as wished by Frost Prime

创建时间

2026年6月9日

更新时间

2026年6月9日

在 Nexus Mods 查看

详情介绍

此模组描述由作者在 Nexus Mods 上以英文提供。

Context at 5:17:55



YouTube: kO-6SiDtB3I



Installation instructions

THIS MOD IS FOR THE PUBLIC BETA BRANCH


(because it edits the new background)
(but might work for 0.103.0 idk)

go to the steam folder for slay the spire 2
for Windows
C:\Program Files (x86)\Steam\steamapps\common\Slay the Spire 2
or Mac
/Users/<UserName>/Library/Application Support/Steam/steamapps/common/Slay the Spire 2/SlayTheSpire2.app/Contents/MacOS/create an mods folder
and unpack/extract the zip there so it looks like that
C:\Program Files (x86)\Steam\steamapps\common\Slay the Spire 2\
└── mods\
    └── PissRock\
          ├──  PissRock.dll
          ├──  PissRock.pck
          └──  PissRock.json( PissRock folder is optional, the dll, pck, json just have to be together unpacked somewhere in mods folder)

This is the complete code in the DLL. I don't want a public  "Piss Rock" GitHub repository visible to employers. lol.
just changes some color values for the waterfall giant scene as i was to lazy to replace the complete scene manually, and replaces some assets.
using Godot;
using HarmonyLib;
using MegaCrit.Sts2.Core.Modding;
using MegaCrit.Sts2.Core.Nodes.Rooms;
using MegaCrit.Sts2.Core.Rooms;

namespace PissRock.PissRockCode;

[ModInitializer(nameof(Initialize))]
public partial class PissRockMainFile : Node
{
    public const string ModId = "PissRock"; //At the moment, this is used only for the Logger and harmony names.

    public static MegaCrit.Sts2.Core.Logging.Logger Logger { get; } =
        new(ModId, MegaCrit.Sts2.Core.Logging.LogType.Generic);

    public static void Initialize()
    {
        Harmony harmony = new(ModId);

        harmony.PatchAll();
    }
}

[HarmonyPatch(typeof(NCombatBackground), "SetLayers")]
static class NCombatBackgroundSetLayersHuePatch
{
    const string ShaderCode = @"
shader_type canvas_item;
uniform float hue_shift = -0.36944;
vec3 rgb2hsv(vec3 c){vec4 K=vec4(0.0,-1.0/3.0,2.0/3.0,-1.0);vec4 p=mix(vec4(c.bg,K.wz),vec4(c.gb,K.xy),step(c.b,c.g));vec4 q=mix(vec4(p.xyw,c.r),vec4(c.r,p.yzx),step(p.x,c.r));float d=q.x-min(q.w,q.y);float e=1.0e-10;return vec3(abs(q.z+(q.w-q.y)/(6.0*d+e)),d/(q.x+e),q.x);}
vec3 hsv2rgb(vec3 c){vec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);vec3 p=abs(fract(c.xxx+K.xyz)*6.0-K.www);return c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);}
void fragment(){vec4 b=texture(TEXTURE,UV)*COLOR;vec3 h=rgb2hsv(b.rgb);h.x=fract(h.x+hue_shift);COLOR=vec4(hsv2rgb(h),b.a);}";

    const float HueShift = -133f / 360f;   // Godot hue is 0–1, not degrees
    static ShaderMaterial? _mat;

static void Postfix(NCombatBackground __instance, BackgroundAssets bg)
    {
        var path = bg.BackgroundScenePath?.ToLowerInvariant().Replace("_", "") ?? "";
        if (!path.Contains("waterfallgiant")) return;

        _mat ??= new ShaderMaterial { Shader = new Shader { Code = ShaderCode } };

        var layer = __instance.GetNodeOrNull("Layer_00");
        if (layer == null) return;
        Walk(layer);
    }

    static void Walk(Node node)
    {
        switch (node)
        {
            case GpuParticles2D p:
                p.Material = _mat;
                break;
            case Sprite2D s:
            {
                var c = s.Modulate;
                var h = Mathf.PosMod(c.H + HueShift, 1f);   // PosMod wraps the negative shift
                s.Modulate = Color.FromHsv(h, c.S, c.V, c.A);
                break;
            }
        }

        foreach (var child in node.GetChildren())
            Walk(child);
    }
}