-
Notifications
You must be signed in to change notification settings - Fork 5
/
OriConfig.cs
97 lines (71 loc) · 2.5 KB
/
OriConfig.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System.ComponentModel;
using System.Runtime.Serialization;
using Microsoft.Xna.Framework;
using Newtonsoft.Json;
using Terraria;
using Terraria.ModLoader.Config;
namespace OriMod;
/// <summary>
/// Configurations for the player's own Ori settings.
/// </summary>
public class OriConfigClient1 : ModConfig {
private const string ConfigPath = $"$Mods.{nameof(OriMod)}.Configs.{nameof(OriConfigClient1)}";
private const string HeaderPath = $"{ConfigPath}.Headers";
public override ConfigScope Mode => ConfigScope.ClientSide;
[Header($"{HeaderPath}.Gameplay")]
[DefaultValue(true)]
public bool playerLight;
[DefaultValue(false)]
public bool globalPlayerLight;
[Header($"{HeaderPath}.Controls")]
[DefaultValue(0)]
public float stompHoldDownDelay;
[DefaultValue(false)]
public bool softCrouch;
[DefaultValue("Default"), OptionStrings(new[] { "Default", "Not Down", "Only Up" })]
public string airJumpCondition;
[DefaultValue(true)]
public bool smoothCamera;
[JsonIgnore]
internal bool BurrowToMouse => burrowControls == "Mouse";
[DefaultValue("Mouse"), OptionStrings(new[] { "WASD", "Mouse" })]
public string burrowControls;
[DefaultValue("Target"), OptionStrings(new[] { "Target", "Player" })]
public string bashMode;
[DefaultValue("false")]
public bool blockControlsInMenu;
[Header($"{HeaderPath}.Aesthetics")]
[DefaultValue(typeof(Color), "210, 255, 255, 255"), ColorNoAlpha]
public Color playerColor;
[DefaultValue(typeof(Color), "0, 0, 0, 0")]
public Color playerColorSecondary;
[DefaultValue(typeof(bool), "true")]
public bool dyeEnabled;
[DefaultValue(typeof(bool), "true")]
public bool dyeEnabledAll;
[DefaultValue(typeof(float), "0.65")]
public float dyeLerp;
[DefaultValue("Transparent"), OptionStrings(new[] { "Transparent", "Red", "Disabled" })]
public string flashMode;
[Header($"{HeaderPath}.Experimental")]
[DefaultValue(typeof(bool), "false")]
public bool eChargeDashHoming;
public override void OnLoaded() {
OriMod.ConfigClient = this;
}
[OnDeserialized]
public void OnDeserializedMethod(StreamingContext stream) {
playerColor.A = 255;
if (stompHoldDownDelay < 0) {
stompHoldDownDelay = 0;
}
}
public override void OnChanged() {
Player player = Main.LocalPlayer;
if (!player.active) return;
OriPlayer oPlayer = player.GetModPlayer<OriPlayer>();
oPlayer.SpriteColorPrimary = playerColor;
oPlayer.SpriteColorSecondary = playerColorSecondary;
oPlayer.DyeColorBlend = dyeLerp;
}
}