-
Notifications
You must be signed in to change notification settings - Fork 21
/
IGiantCropTweaks.cs
169 lines (130 loc) · 4.95 KB
/
IGiantCropTweaks.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#nullable enable
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI;
namespace Leclair.Stardew.GiantCropTweaks;
/// <summary>
/// Controls how Giant Crop Tweaks decides whether a giant crop
/// should re-plant the original crop beneath it when harvested.
/// </summary>
public enum ReplantBehavior {
/// <summary>Never re-plant.</summary>
Never,
/// <summary>Always re-plant.</summary>
Always,
/// <summary>If the original crop is a regrowing crop, re-plant.</summary>
WhenRegrowing
};
public interface IExtraGiantCropData {
/// <summary>
/// Must match the ID of an existing <see cref="GiantCrops"/>
/// instance in <c>Data/GiantCrops</c>.
/// </summary>
string Id { get; set; }
#region Behaviors
/// <summary>
/// Whether or not this giant crop can grow if the source crop
/// is fully grown, but has been harvested and has
/// not yet regrown. By default, this is true, but you may
/// want to turn this down for regrowable crops with high
/// chances of growing giant.
/// </summary>
bool CanGrowWhenNotFullyRegrown { get; set; }
/// <summary>
/// Whether or not this giant crop should be replanted when harvested.
/// By default, giant crops will be replanted if the base crop is
/// configured to re-grow.
/// </summary>
ReplantBehavior ShouldReplant { get; set; }
#endregion
#region Colors
/// <summary>
/// An optional list of colors to apply to this giant crop. The color
/// will be used for rendering the overlay texture, and may also be
/// used to color the harvest items.
/// </summary>
List<Color>? Colors { get; set; }
/// <summary>
/// If this is set to true, we will attempt to pick this giant crop's
/// color based on the <see cref="CropData.TintColors"/> of the
/// crop matching <see cref="GiantCropData.FromItemId"/>. This
/// overrides <see cref="Colors"/> if set.
/// </summary>
bool UseBaseCropTintColors { get; set; }
/// <summary>
/// When this giant crop is harvested, any items with item Ids in
/// this list will be converted to colored items using this giant
/// crop's color.
/// </summary>
List<string>? HarvestItemsToColor { get; set; }
/// <summary>
/// If this is true, each individual entry in <see cref="GiantCropData.HarvestItems"/>
/// will have its color randomized to allow more than one
/// color of item to drop. Only takes effect to items listed
/// in <see cref="HarvestItemsToColor"/>.
/// </summary>
bool RandomizeHarvestItemColors { get; set; }
#endregion
#region Overlay Texture
/// <summary>
/// An optional texture for an overlay. If this is set, a second layer
/// will be drawn with this texture.
/// </summary>
string? OverlayTexture { get; set; }
/// <summary>
/// Whether or not the overlay should be drawn as prismatic. If this is
/// true, the overlay color will not be used for rendering.
/// </summary>
bool OverlayPrismatic { get; set; }
/// <summary>
/// The top-left pixel position of the overlay sprite within the texture.
/// If this is null, <see cref="GiantCropData.TexturePosition"/> will
/// be used instead.
/// </summary>
Point? OverlayPosition { get; set; }
/// <summary>
/// The size of the overlay sprite, in tiles. If this is null,
/// <see cref="GiantCropData.TileSize"/> will be used instead.
/// </summary>
Point? OverlaySize { get; set; }
/// <summary>
/// The number of tiles the overlay should be offset from the
/// base sprite.
/// </summary>
Point OverlayOffset { get; set; }
#endregion
}
public interface IExtraGiantCropDataEditor : IDictionary<string, IExtraGiantCropData> {
IExtraGiantCropData GetOrCreate(string key);
}
public interface IGiantCropTweaks {
/// <summary>
/// Create a new <see cref="IExtraGiantCropData"/> instance. Note that this
/// does not add it to the data dictionary, but merely creates an instance.
/// To edit the dictionary, use the asset requested event and the method
/// here to get an editor.
/// </summary>
/// <returns>A new, blank data model.</returns>
IExtraGiantCropData CreateNew();
/// <summary>
/// Get an editor for editing GCT's data dictionary. This is intended to
/// be used within the asset requested event.
/// </summary>
/// <param name="assetData">The asset data you get when editing an
/// asset in the asset requested event.</param>
/// <returns>A dictionary-like interface for editing the asset.</returns>
IExtraGiantCropDataEditor GetEditor(IAssetData assetData);
/// <summary>
/// Get all the entries in the loaded data dictionary.
/// </summary>
IEnumerable<KeyValuePair<string, IExtraGiantCropData>> GetData();
/// <summary>
/// Try to get the data for a specific giant crop, if it exists.
/// </summary>
/// <param name="key">The crop Id to search for.</param>
/// <param name="data">The crop data, if it exists.</param>
/// <returns>Whether or not it was found.</returns>
bool TryGetData(string key, [NotNullWhen(true)] out IExtraGiantCropData? data);
}