/
CollectibleType.cs
157 lines (128 loc) · 4.95 KB
/
CollectibleType.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
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Vintagestory.API.Client;
using Vintagestory.API.Common;
using Vintagestory.API.Config;
using Vintagestory.API.Datastructures;
using Vintagestory.API.MathTools;
namespace Vintagestory.ServerMods.NoObf
{
[JsonObject(MemberSerialization.OptIn)]
public abstract class CollectibleType : RegistryObjectType
{
[JsonProperty]
public CollectibleBehaviorType[] Behaviors = new CollectibleBehaviorType[0];
[JsonProperty]
public byte[] LightHsv = new byte[] { 0, 0, 0 };
[JsonProperty]
public float RenderAlphaTest = 0.05f;
[JsonProperty]
public int StorageFlags = 1;
[JsonProperty]
public int MaxStackSize = 1;
[JsonProperty]
public float AttackPower = 0.5f;
[JsonProperty]
public int Durability;
[JsonProperty]
public Size3f Dimensions = new Size3f(0.5f, 0.5f, 0.5f);
[JsonProperty]
public EnumItemDamageSource[] DamagedBy;
[JsonProperty]
public EnumTool? Tool = null;
[JsonProperty]
public float AttackRange = GlobalConstants.DefaultAttackRange;
[JsonProperty]
public Dictionary<EnumBlockMaterial, float> MiningSpeed;
[JsonProperty]
public int ToolTier;
[JsonProperty]
[Obsolete("Use tool tier")]
public int MiningTier { get { return ToolTier; } set { ToolTier = value; } }
[JsonProperty]
public EnumMatterState MatterState = EnumMatterState.Solid;
[JsonProperty]
public HeldSounds HeldSounds;
// Determines on whether an object floats on liquids or not
// Water has a density of 1000
[JsonProperty]
public int MaterialDensity = 9999;
[JsonProperty, JsonConverter(typeof(JsonAttributesConverter))]
public JsonObject Attributes;
[JsonProperty]
public CompositeShape Shape = null;
[JsonProperty]
public ModelTransform GuiTransform;
[JsonProperty]
public ModelTransform FpHandTransform;
[JsonProperty]
public ModelTransform TpHandTransform;
[JsonProperty]
public ModelTransform TpOffHandTransform;
[JsonProperty]
public ModelTransform GroundTransform;
[JsonProperty]
public CompositeTexture Texture;
[JsonProperty]
public Dictionary<string, CompositeTexture> Textures;
[JsonProperty]
public CombustibleProperties CombustibleProps = null;
[JsonProperty]
public FoodNutritionProperties NutritionProps = null;
[JsonProperty]
public TransitionableProperties[] TransitionableProps = null;
[JsonProperty]
public GrindingProperties GrindingProps = null;
[JsonProperty]
public CrushingProperties CrushingProps = null;
[JsonProperty]
public bool LiquidSelectable = false;
[JsonProperty]
public Dictionary<string, string[]> CreativeInventory = new Dictionary<string, string[]>();
[JsonProperty]
public CreativeTabAndStackList[] CreativeInventoryStacks;
[JsonProperty]
public string HeldTpHitAnimation = "breakhand";
[JsonProperty]
public string HeldRightTpIdleAnimation;
[JsonProperty]
public string HeldLeftTpIdleAnimation;
[JsonProperty]
public string HeldLeftReadyAnimation = "helditemready";
[JsonProperty]
public string HeldRightReadyAnimation = "helditemready";
[JsonProperty("heldTpIdleAnimation")]
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
private string HeldOldTpIdleAnimation;
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
[JsonProperty]
public string HeldTpUseAnimation = "interactstatic";
[JsonProperty]
public AdvancedParticleProperties[] ParticleProperties = null;
[OnDeserialized]
internal void OnDeserializedMethod(StreamingContext context)
{
OnDeserialized();
}
virtual internal void OnDeserialized()
{
GuiTransform.EnsureDefaultValues();
FpHandTransform.EnsureDefaultValues();
TpHandTransform.EnsureDefaultValues();
if (TpOffHandTransform == null) TpOffHandTransform = TpHandTransform.Clone();
TpOffHandTransform.EnsureDefaultValues();
GroundTransform.EnsureDefaultValues();
if (Texture != null)
{
if (Textures == null) Textures = new Dictionary<string, CompositeTexture>(1);
Textures["all"] = Texture;
}
if (HeldOldTpIdleAnimation != null && HeldRightTpIdleAnimation == null)
{
HeldRightTpIdleAnimation = HeldOldTpIdleAnimation;
}
}
}
}