Update resource values and unlock new miracles; refactor tier loading logic

This commit is contained in:
2025-08-23 16:10:57 +02:00
parent cd715a24cb
commit 9da3b02a46
18 changed files with 149 additions and 140 deletions

View File

@@ -7,12 +7,12 @@
{ {
"type": "AddResource", "type": "AddResource",
"targetResource": "Followers", "targetResource": "Followers",
"value": 100 "value": 10
}, },
{ {
"type": "AddResource", "type": "AddResource",
"targetResource": "Corruption", "targetResource": "Corruption",
"value": 0.02 "value": 0.5
} }
] ]
} }

View File

@@ -1,14 +0,0 @@
{
"name": "Divine Frenzy",
"faithCost": 200,
"followersRequired": 50,
"unlockedByDefault": true,
"effects": [
{
"type": "ApplyBuff",
"targetBuffStat": "FaithPerFollower",
"multiplier": 2.0,
"duration": 30
}
]
}

View File

@@ -1,15 +0,0 @@
{
"name": "Divine Sacrifice",
"faithCost": 250,
"unlockedByDefault": false,
"followersRequired": 100,
"effects": [
{
"type": "ConvertResource",
"fromResource": "Followers",
"fromAmount": 50,
"toResource": "Faith",
"toAmount": 1000
}
]
}

View File

@@ -1,15 +0,0 @@
{
"name": "Purge Sins",
"faithCost": 100,
"followersRequired": 20,
"unlockedByDefault": true,
"effects": [
{
"type": "ConvertResource",
"fromResource": "Followers",
"fromAmount": 20,
"toResource": "Corruption",
"toAmount": -5
}
]
}

View File

@@ -1,14 +0,0 @@
{
"name": "Refined Dogma",
"faithCost": 1000,
"followersRequired": 250,
"unlockedByDefault": true,
"effects": [
{
"type": "ModifyStat",
"targetStat": "FaithPerFollower",
"op": "Add",
"value": 0.1
}
]
}

View File

@@ -0,0 +1,14 @@
{
"name": "Ritual of Cleansing",
"faithCost": 1000,
"followersRequired": 200,
"productionRequired": 100,
"unlockedByDefault": false,
"effects": [
{
"type": "AddResource",
"targetResource": "Corruption",
"value": -10
}
]
}

View File

@@ -0,0 +1,18 @@
{
"name": "Sustainable Practices",
"faithCost": 1200,
"followersRequired": 300,
"productionRequired": 150,
"unlockedByDefault": false,
"effects": [
{
"type": "ModifyStat",
"targetStat": "CorruptionPerSecond",
"op": "Add",
"value": -0.1
},
{
"type": "DestroySelf"
}
]
}

View File

@@ -1,13 +0,0 @@
{
"name": "Advanced Worship",
"faithCost": 500,
"unlockedByDefault": true,
"followersRequired": 100,
"effects": [
{
"type": "UnlockMiracle",
"miraclesToUnlock": [ "divine_sacrifice" ]
},
{ "type": "DestroySelf" }
]
}

View File

@@ -6,7 +6,7 @@
"effects": [ "effects": [
{ {
"type": "UnlockMiracle", "type": "UnlockMiracle",
"miraclesToUnlock": [ "erect_shrine", "communal_effort" ] "miraclesToUnlock": [ "erect_shrine", "communal_effort", "sustainable_practices", "ritual_of_cleansing" ]
}, },
{ "type": "DestroySelf" } { "type": "DestroySelf" }
], ],

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://bxlaf72h3pftt" uid="uid://2wsb1jsmtifq"
path="res://.godot/imported/hut_tier_1.png-4ce775c649cfe5f92a10187bc1930a9b.ctex" path="res://.godot/imported/follower_tier_1.png-d66a290ad46b1bb9ea69b54444ab5725.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://Mods/Tiers/hut_tier_1.png" source_file="res://Mods/Tiers/Followers/follower_tier_1.png"
dest_files=["res://.godot/imported/hut_tier_1.png-4ce775c649cfe5f92a10187bc1930a9b.ctex"] dest_files=["res://.godot/imported/follower_tier_1.png-d66a290ad46b1bb9ea69b54444ab5725.ctex"]
[params] [params]

View File

@@ -3,27 +3,32 @@
{ {
"tierEnum": "Tier1", "tierEnum": "Tier1",
"threshold": 0, "threshold": 0,
"scenePath": "res://Scenes/Followers/followers_tier_1.tscn" "imagePath": "res://Sprites/Follower.png",
"scale": {"x": 0.1, "y": 0.1}
}, },
{ {
"tierEnum": "Tier2", "tierEnum": "Tier2",
"threshold": 200, "threshold": 200,
"scenePath": "res://Scenes/Followers/followers_tier_2.tscn" "imagePath": "res://Sprites/Follower.png",
"scale": {"x": 0.1, "y": 0.1}
}, },
{ {
"tierEnum": "Tier3", "tierEnum": "Tier3",
"threshold": 500, "threshold": 500,
"scenePath": "res://Scenes/Followers/followers_tier_3.tscn" "imagePath": "res://Sprites/Follower.png",
"scale": {"x": 0.1, "y": 0.1}
}, },
{ {
"tierEnum": "Tier4", "tierEnum": "Tier4",
"threshold": 1000, "threshold": 1000,
"scenePath": "res://Scenes/Followers/followers_tier_4.tscn" "imagePath": "res://Sprites/Follower.png",
"scale": {"x": 0.1, "y": 0.1}
}, },
{ {
"tierEnum": "Tier5", "tierEnum": "Tier5",
"threshold": 2500, "threshold": 2500,
"scenePath": "res://Scenes/Followers/followers_tier_5.tscn" "imagePath": "res://Sprites/Follower.png",
"scale": {"x": 0.1, "y": 0.1}
} }
] ]
} }

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cj7bgonxgavdf"
path="res://.godot/imported/hut_tier_2.png-70fb7df6fa976626a267fd1e203d6a0e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Mods/Tiers/hut_tier_2.png"
dest_files=["res://.godot/imported/hut_tier_2.png-70fb7df6fa976626a267fd1e203d6a0e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -3,14 +3,14 @@
{ {
"tierEnum": "Tier1", "tierEnum": "Tier1",
"threshold": 150, "threshold": 150,
"imagePath": "user://Mods/Tiers/Huts/hut_tier_1.png", "imagePath": "res://Mods/Tiers/Huts/hut_tier_1.png",
"scale": {"x": 0.01, "y": 0.01} "scale": {"x": 0.05, "y": 0.05}
}, },
{ {
"tierEnum": "Tier2", "tierEnum": "Tier2",
"threshold": 750, "threshold": 750,
"imagePath": "user://Mods/Tiers/Huts/hut_tier_2.png", "imagePath": "res://Mods/Tiers/Huts/hut_tier_2.png",
"scale": {"x": 0.01, "y": 0.01} "scale": {"x": 0.05, "y": 0.05}
} }
] ]
} }

View File

@@ -1,5 +1,4 @@
using System; using System;
using System.Text.Json;
using Godot; using Godot;
using Godot.Collections; using Godot.Collections;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -19,12 +18,26 @@ public static class MiracleLoader
{ "DestroySelf", typeof(DestroySelfEffect) } { "DestroySelf", typeof(DestroySelfEffect) }
}; };
public static System.Collections.Generic.Dictionary<string, MiracleDefinition> LoadMiraclesFromDirectory(string path) public static System.Collections.Generic.Dictionary<string, MiracleDefinition> LoadAllMiracles()
{ {
var loadedMiracles = new System.Collections.Generic.Dictionary<string, MiracleDefinition>(); var loadedMiracles = new System.Collections.Generic.Dictionary<string, MiracleDefinition>();
using var dir = DirAccess.Open(path);
if (dir == null) return loadedMiracles;
LoadMiraclesFromPath("res://Mods/Miracles", loadedMiracles);
LoadMiraclesFromPath("user://Mods/Miracles", loadedMiracles);
GD.Print($"Finished loading. Total unique miracles: {loadedMiracles.Count}");
return loadedMiracles;
}
private static void LoadMiraclesFromPath(string path, System.Collections.Generic.Dictionary<string, MiracleDefinition> miracles)
{
if (!DirAccess.DirExistsAbsolute(path))
{
GD.Print($"Mod directory not found, skipping: {path}");
return;
}
using var dir = DirAccess.Open(path);
dir.ListDirBegin(); dir.ListDirBegin();
var fileName = dir.GetNext(); var fileName = dir.GetNext();
while (!string.IsNullOrEmpty(fileName)) while (!string.IsNullOrEmpty(fileName))
@@ -33,17 +46,15 @@ public static class MiracleLoader
{ {
var filePath = path.PathJoin(fileName); var filePath = path.PathJoin(fileName);
var fileNameNoExt = fileName.GetBaseName(); var fileNameNoExt = fileName.GetBaseName();
var miracle = LoadMiracleFromFile(filePath, fileNameNoExt); // Pass the ID var miracle = LoadMiracleFromFile(filePath, fileNameNoExt);
if (miracle != null) if (miracle != null)
{ {
loadedMiracles.Add(fileNameNoExt, miracle); // Add or overwrite the miracle in the dictionary.
miracles[fileNameNoExt] = miracle;
} }
} }
fileName = dir.GetNext(); fileName = dir.GetNext();
} }
GD.Print($"Loaded {loadedMiracles.Count} miracles from {path}");
return loadedMiracles;
} }
private static MiracleDefinition LoadMiracleFromFile(string filePath, string miracleId) private static MiracleDefinition LoadMiracleFromFile(string filePath, string miracleId)

View File

@@ -7,7 +7,21 @@ namespace ParasiticGod.Scripts.Core;
public static class TierLoader public static class TierLoader
{ {
public static List<TierDefinition> LoadTiersFromFile(string filePath) public static List<TierDefinition> LoadTiers(string baseFilePath, string userFilePath)
{
// Prioritize the user's file. If it exists, load it.
if (FileAccess.FileExists(userFilePath))
{
GD.Print($"Loading user tier file: {userFilePath}");
return LoadTierListFromFile(userFilePath);
}
// Otherwise, fall back to the base game's file.
GD.Print($"Loading base tier file: {baseFilePath}");
return LoadTierListFromFile(baseFilePath);
}
private static List<TierDefinition> LoadTierListFromFile(string filePath)
{ {
var loadedTiers = new List<TierDefinition>(); var loadedTiers = new List<TierDefinition>();
@@ -27,17 +41,25 @@ public static class TierLoader
foreach (var dto in tierListDto.Tiers) foreach (var dto in tierListDto.Tiers)
{ {
var image = Image.LoadFromFile(dto.ImagePath); Texture2D texture = null;
if (image == null) if (dto.ImagePath.StartsWith("res://"))
{ {
GD.PushError($"Failed to load image at path: {dto.ImagePath}"); texture = GD.Load<Texture2D>(dto.ImagePath);
continue;
} }
else if (dto.ImagePath.StartsWith("user://"))
{
var image = Image.LoadFromFile(dto.ImagePath);
if (image != null)
{
texture = ImageTexture.CreateFromImage(image);
}
}
var tierDef = new TierDefinition var tierDef = new TierDefinition
{ {
Threshold = dto.Threshold, Threshold = dto.Threshold,
TierEnum = dto.TierEnum, TierEnum = dto.TierEnum,
Texture = ImageTexture.CreateFromImage(image), Texture = texture,
Scale = new Vector2(dto.Scale.X, dto.Scale.Y) Scale = new Vector2(dto.Scale.X, dto.Scale.Y)
}; };
loadedTiers.Add(tierDef); loadedTiers.Add(tierDef);

View File

@@ -28,9 +28,9 @@ public partial class GameBus : Node
public override void _EnterTree() public override void _EnterTree()
{ {
Instance = this; Instance = this;
AllMiracles = MiracleLoader.LoadMiraclesFromDirectory("user://Mods/Miracles"); AllMiracles = MiracleLoader.LoadAllMiracles();
FollowerTiers = TierLoader.LoadTiersFromFile("user://Mods/Tiers/follower_tiers.json"); FollowerTiers = TierLoader.LoadTiers("res://Mods/Tiers/follower_tiers.json", "user://Mods/Tiers/follower_tiers.json");
HutTiers = TierLoader.LoadTiersFromFile("user://Mods/Tiers/hut_tiers.json"); HutTiers = TierLoader.LoadTiers("res://Mods/Tiers/hut_tiers.json","user://Mods/Tiers/hut_tiers.json");
} }
public override void _ExitTree() public override void _ExitTree()

44
export_presets.cfg Normal file
View File

@@ -0,0 +1,44 @@
[preset.0]
name="Linux"
platform="Linux"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="Builds/parasitic-god.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=0
binary_format/embed_pck=true
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
dotnet/include_scripts_content=false
dotnet/include_debug_symbols=false
dotnet/embed_build_outputs=false