mark feature

This commit is contained in:
Jill 2023-03-06 15:21:38 +03:00
parent d731d65bb7
commit 1369d15c39
Signed by: oat
GPG Key ID: 33489AA58A955108
3 changed files with 24 additions and 1 deletions

View File

@ -37,6 +37,7 @@
"world_state": "Spear",
"jillo/bounce": 0.6,
"jillo/immune_to_dart_maggots": true
"jillo/immune_to_dart_maggots": true,
"jillo/has_mark": true
}
}

View File

@ -18,6 +18,7 @@ class Plugin : BaseUnityPlugin {
BounceFeature.AddHooks();
ImmuneToDartMaggotsFeature.AddHooks();
MarkFeature.AddHooks();
} catch (Exception err) {
Logger.LogError($"error initializing: {err}");
}

View File

@ -0,0 +1,21 @@
using SlugBase.Features;
using static SlugBase.Features.FeatureTypes;
using SlugBase;
namespace JilloSlug;
internal static class MarkFeature {
public static readonly PlayerFeature<bool> Mark = PlayerBool("jillo/has_mark");
public static void AddHooks() {
On.SaveState.ctor += SaveState_ctor;
}
private static void SaveState_ctor(On.SaveState.orig_ctor orig, SaveState self, SlugcatStats.Name slugcat, PlayerProgression progression) {
orig(self, slugcat, progression);
if (SlugBaseCharacter.TryGet(slugcat, out var chara) && Mark.TryGet(chara, out bool hasMark) && hasMark) {
self.deathPersistentSaveData.theMark = true;
}
}
}