Survivalcraft API 1.8.2.3 v1.8.2.3
Survivalcraft 2.4
载入中...
搜索中...
未找到
ComponentClothing.cs
浏览该文件的文档.
1using Engine;
6
7namespace Game {
10
12
14
16
18
20
22
24
26
28
30
32
34
36
37 public string m_skinTextureName;
38
40
42
44
45 public Random m_random = new();
46
48
50
52
56 public bool EnableDressLimit;
57
58 public static string fName = "ComponentClothing";
59
60 public List<int> m_clothesList = [];
61
62 public Dictionary<ClothingSlot, List<int>> m_clothes = [];
65
66 public static List<ClothingSlot> m_innerSlotsOrderList = [];
67
68 public static List<ClothingSlot> m_outerSlotsOrderList = [];
69
70 public static bool ShowClothedTexture = false;
71
72 public static bool DrawClothedTexture = true;
73
76
77 public Dictionary<ClothingSlot, float> InsulationBySlots = [];
78 public float Insulation { get; set; }
79
80 public ClothingSlot LeastInsulatedSlot { get; set; }
81
82 public float SteedMovementSpeedFactor { get; set; }
83
85
87
89
90 public int VisibleSlotsCount {
91 get => SlotsCount;
92 set { }
93 }
94
95 public int ActiveSlotIndex {
96 get => -1;
97 set { }
98 }
99
100 public virtual ReadOnlyList<int> GetClothes(ClothingSlot slot) => new(m_clothes[slot]);
101
103 float x = 0f;
104 float leastSlotInsulation = InsulationBySlots[0];
105 int leastInsulatedSlot = 0;
106 for (int i = 0; i < SlotsCount && i < InsulationBySlots.Count; i++) {
107 x += 1f / InsulationBySlots[i];
108 if (leastSlotInsulation > InsulationBySlots[i]) {
109 leastInsulatedSlot = i;
110 leastSlotInsulation = InsulationBySlots[i];
111 }
112 }
113 Insulation = 1f / x;
114 LeastInsulatedSlot = leastInsulatedSlot;
115 return Insulation;
116 }
117
118 public virtual void SetClothes(ClothingSlot slot, IEnumerable<int> clothes) {
119 IEnumerable<int> enumerable = clothes as List<int> ?? clothes.ToList();
120 if (!m_clothes[slot].SequenceEqual(enumerable)) {
121 m_clothes[slot].Clear();
122 m_clothes[slot].AddRange(enumerable);
124 float densityModiferAppliedBefore = m_densityModifierApplied;
127 foreach (ClothingSlot clothingSlot in ClothingSlot.ClothingSlots.Values) {
128 InsulationBySlots[clothingSlot] = clothingSlot.BasicInsulation;
129 }
130 foreach (KeyValuePair<ClothingSlot, List<int>> clothe in m_clothes) {
131 foreach (int item in clothe.Value) {
133 ClothingData clothingData = block.GetClothingData(item);
134 clothingData?.OnClotheSet(this);
135 }
136 }
137 float num2 = m_densityModifierApplied - densityModiferAppliedBefore;
138 m_componentBody.Density += num2;
140 }
142 "SetClothes",
143 loader => {
144 loader.SetClothes(this, slot, enumerable);
145 return false;
146 }
147 );
148 }
149
150 [Obsolete("Use ApplyArmorProtection(Attackment attackment) instead.")]
151 public float ApplyArmorProtection(float attackPower) =>
153
154 public float ApplyArmorProtection(Attackment attackment) {
155 bool Applied = false;
156 float attackPowerAfterProtection = attackment.AttackPower;
157 //ApplyArmorProtection接口废弃,并且只有在下面的接口都没有模组用的时候,才允许模组用这个接口。
158 if (!ModsManager.ModHooks.ContainsKey("DecideArmorProtectionSequence")
159 && !ModsManager.ModHooks.ContainsKey("ApplyProtectionBeforeClothes")
160 && !!ModsManager.ModHooks.ContainsKey("ApplyProtectionAfterClothes")) {
162 "ApplyArmorProtection",
163 modLoader => {
164#pragma warning disable CS0618
165 attackment.AttackPower = modLoader.ApplyArmorProtection(this, attackment.AttackPower, Applied, out bool flag2);
166#pragma warning restore CS0618
167 Applied |= flag2;
168 return false;
169 }
170 );
171 }
172 if (!Applied) {
173 //决定参与结算的衣物列表
174 float num = m_random.Float(0f, 1f);
175 ClothingSlot slot = num < 0.1f ? ClothingSlot.Feet :
176 num < 0.3f ? ClothingSlot.Legs :
177 num < 0.9f ? ClothingSlot.Torso : ClothingSlot.Head;
178 List<int> listBeforeProtection = new(GetClothes(slot));
180 "ApplyProtectionBeforeClothes",
181 loader => {
182 // ReSharper disable AccessToModifiedClosure
183 loader.ApplyProtectionBeforeClothes(this, attackment, ref attackPowerAfterProtection);
184 // ReSharper restore AccessToModifiedClosure
185 return false;
186 }
187 );
189 "DecideArmorProtectionSequence",
190 loader => {
191 loader.DecideArmorProtectionSequence(this, attackment, num, listBeforeProtection);
192 return false;
193 }
194 );
195 List<int> listAfterProtection = new(listBeforeProtection);
196 //对每件衣物,结算护甲
197 for (int i = 0; i < listBeforeProtection.Count; i++) {
198 int value = listBeforeProtection[i];
200 ClothingData clothingData = block.GetClothingData(value);
201 if (clothingData == null) {
202 continue;
203 }
204 try {
205 clothingData.ApplyArmorProtection(
206 this,
207 listBeforeProtection,
208 listAfterProtection,
209 i,
210 attackment,
211 ref attackPowerAfterProtection
212 );
213 }
214 catch (Exception e) {
215 Log.Error($"ClothingData of clothing{clothingData.DisplayName} applies armor protection error: {e}");
216 }
217 }
218 //移除护甲结算后,破损衣物
219 int num4 = 0;
220 while (num4 < listAfterProtection.Count) {
221 Block block = BlocksManager.Blocks[Terrain.ExtractContents(listAfterProtection[num4])];
222 if (!block.CanWear(listAfterProtection[num4])) {
223 listAfterProtection.RemoveAt(num4);
224 }
225 else {
226 num4++;
227 }
228 }
229 listAfterProtection.Sort((a, b) => {
232 return (clothingDataA?.Layer ?? 0) - (clothingDataB?.Layer ?? 0);
233 }
234 );
236 "ApplyProtectionAfterClothes",
237 loader => {
238 loader.ApplyProtectionAfterClothes(this, attackment, listAfterProtection, ref attackPowerAfterProtection);
239 return false;
240 }
241 );
242 //最后SetClothes
243 SetClothes(slot, listAfterProtection);
244 }
245 return MathF.Max(attackPowerAfterProtection, 0f);
246 }
247
248 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap) {
249 m_innerSlotsOrderList.Clear();
251 m_innerSlotsOrderList.Reverse(2, 2); //让Legs显示在feet之前
252 m_outerSlotsOrderList.Clear();
254 m_subsystemGameInfo = Project.FindSubsystem<SubsystemGameInfo>(true);
255 m_subsystemParticles = Project.FindSubsystem<SubsystemParticles>(true);
256 m_subsystemAudio = Project.FindSubsystem<SubsystemAudio>(true);
257 m_subsystemTime = Project.FindSubsystem<SubsystemTime>(true);
258 m_subsystemTerrain = Project.FindSubsystem<SubsystemTerrain>(true);
259 m_subsystemPickables = Project.FindSubsystem<SubsystemPickables>(true);
260 m_componentGui = Entity.FindComponent<ComponentGui>(true);
261 m_componentHumanModel = Entity.FindComponent<ComponentHumanModel>(true);
262 m_componentBody = Entity.FindComponent<ComponentBody>(true);
264 m_componentVitalStats = Entity.FindComponent<ComponentVitalStats>(true);
265 m_componentLocomotion = Entity.FindComponent<ComponentLocomotion>(true);
266 m_componentPlayer = Entity.FindComponent<ComponentPlayer>(true);
267 EnableDressLimit = m_subsystemGameInfo.WorldSettings.GameMode != 0
268 && m_subsystemGameInfo.WorldSettings.AreAdventureSurvivalMechanicsEnabled;
270 Insulation = 0f;
272 foreach (ClothingSlot clothingSlot in m_innerSlotsOrder) {
273 m_clothes[clothingSlot] = [];
274 }
275 ValuesDictionary value = valuesDictionary.GetValue<ValuesDictionary>("Clothes");
276 foreach (string key in ClothingSlot.ClothingSlots.Keys) {
277 SetClothes(ClothingSlot.ClothingSlots[key], HumanReadableConverter.ValuesListFromString<int>(';', value.GetValue<string>(key)));
278 }
279 Display.DeviceReset += Display_DeviceReset;
280 }
281
282 public override void Save(ValuesDictionary valuesDictionary, EntityToIdMap entityToIdMap) {
283 ValuesDictionary valuesDictionary2 = new();
284 valuesDictionary.SetValue("Clothes", valuesDictionary2);
285 foreach (string key in ClothingSlot.ClothingSlots.Keys) {
286 valuesDictionary2.SetValue(key, HumanReadableConverter.ValuesListToString(';', m_clothes[ClothingSlot.ClothingSlots[key]].ToArray()));
287 }
288 }
289
290 public override void Dispose() {
291 base.Dispose();
292 if (m_skinTexture != null
294 m_skinTexture.Dispose();
295 m_skinTexture = null;
296 }
297 if (m_innerClothedTexture != null) {
298 m_innerClothedTexture.Dispose();
300 }
301 if (m_outerClothedTexture != null) {
302 m_outerClothedTexture.Dispose();
304 }
305 Display.DeviceReset -= Display_DeviceReset;
306 }
307
308 public virtual void Update(float dt) {
309 //触发ClothingData.Update
310 foreach (ClothingSlot slot in m_innerSlotsOrder) {
311 foreach (int clothe in GetClothes(slot)) {
313 ClothingData clothingData = block.GetClothingData(clothe);
314 clothingData?.Update?.Invoke(clothe, this);
315 }
316 }
317 foreach (ClothingSlot slot in m_outerSlotsOrder) {
318 foreach (int clothe in GetClothes(slot)) {
320 ClothingData clothingData = block.GetClothingData(clothe);
321 clothingData?.Update?.Invoke(clothe, this);
322 }
323 }
324 //生存模式每0.5秒执行一次,不允许玩家越级穿衣物
325 if (EnableDressLimit && m_subsystemTime.PeriodicGameTimeEvent(0.5, 0.0)) {
326 foreach (ClothingSlot clothingSlot in ClothingSlot.ClothingSlots.Values) {
327 bool flag = false;
328 m_clothesList.Clear();
329 m_clothesList.AddRange(GetClothes(clothingSlot));
330 int num = 0;
331 while (num < m_clothesList.Count) {
332 int value = m_clothesList[num];
334 ClothingData clothingData = block.GetClothingData(value);
335 if (clothingData == null) {
336 m_clothesList.RemoveAt(num);
337 flag = true;
338 }
339 if (clothingData != null
340 && clothingData.PlayerLevelRequired > m_componentPlayer.PlayerData.Level) {
341 m_componentGui.DisplaySmallMessage(
342 string.Format(LanguageControl.Get(fName, 1), clothingData.PlayerLevelRequired, clothingData.DisplayName),
343 Color.White,
344 true,
345 true
346 );
347 m_subsystemPickables.AddPickable(value, 1, m_componentBody.Position, null, null, Entity);
348 m_clothesList.RemoveAt(num);
349 flag = true;
350 }
351 else {
352 num++;
353 }
354 }
355 if (flag) {
356 SetClothes(clothingSlot, m_clothesList);
357 }
358 }
359 }
360 if (m_subsystemTime.PeriodicGameTimeEvent(2.0, 0.0)
361 && ((m_componentLocomotion.LastWalkOrder.HasValue && m_componentLocomotion.LastWalkOrder.Value != Vector2.Zero)
362 || (m_componentLocomotion.LastSwimOrder.HasValue && m_componentLocomotion.LastSwimOrder.Value != Vector3.Zero)
363 || m_componentLocomotion.LastJumpOrder != 0f)) {
364 if (m_lastTotalElapsedGameTime.HasValue) {
365 foreach (ClothingSlot clothingSlot in ClothingSlot.ClothingSlots.Values) {
366 bool setClothesNeeded = false;
367 m_clothesList.Clear();
368 m_clothesList.AddRange(GetClothes(clothingSlot));
369 for (int i = 0; i < m_clothesList.Count; i++) {
370 int value2 = m_clothesList[i];
372 ClothingData clothingData2 = block2.GetClothingData(value2);
373 if (clothingData2 == null) {
374 continue;
375 }
376 clothingData2.UpdateGraduallyDamagedOverTime(this, i, dt);
377 if (m_clothesList[i] != value2) {
378 setClothesNeeded = true;
379 }
380 }
381 //移除已经损坏的衣物
382 int num4 = 0;
383 while (num4 < m_clothesList.Count) {
385 if (!block.CanWear(m_clothesList[num4])) {
386 m_clothesList.RemoveAt(num4);
387 }
388 else {
389 num4++;
390 }
391 }
392 if (setClothesNeeded) {
393 SetClothes(clothingSlot, m_clothesList);
394 }
395 }
396 }
397 m_lastTotalElapsedGameTime = m_subsystemGameInfo.TotalElapsedGameTime;
398 }
400 }
401
402 public virtual int GetSlotValue(int slotIndex) => GetClothes(slotIndex).LastOrDefault();
403
404 public virtual int GetSlotCount(int slotIndex) {
405 if (GetClothes(slotIndex).Count <= 0) {
406 return 0;
407 }
408 return 1;
409 }
410
411 public virtual int GetSlotCapacity(int slotIndex, int value) => 0;
412
413 public virtual int GetSlotProcessCapacity(int slotIndex, int value) {
415 bool notToProcessVanilla = false;
416 int maxCapacity = 0;
418 "ClothingSlotProcessCapacity",
419 loader => {
420 loader.ClothingSlotProcessCapacity(this, slotIndex, value, ref notToProcessVanilla, out int capacity);
421 maxCapacity = Math.Max(capacity, maxCapacity);
422 return false;
423 }
424 );
425 if (!notToProcessVanilla
426 && maxCapacity < 1) {
427 if (block.GetNutritionalValue(value) > 0f) {
428 return 1;
429 }
430 if (block.CanWear(value)
431 && CanWearClothing(value)) {
432 return 1;
433 }
434 }
435 return maxCapacity;
436 }
437
438 public virtual void AddSlotItems(int slotIndex, int value, int count) { }
439
440 public virtual void ProcessSlotItems(int slotIndex, int value, int count, int processCount, out int processedValue, out int processedCount) {
441 int pValue = 0;
442 int pCount = 0;
443 bool skippedByMods = false;
445 "ClothingProcessSlotItems",
446 modLoader => {
447 modLoader.ClothingProcessSlotItems(
448 this,
449 slotIndex,
450 ref value,
451 ref count,
452 ref pValue,
453 ref pCount,
454 skippedByMods,
455 out bool skipVanilla
456 );
457#pragma warning disable CS0618
458 modLoader.ClothingProcessSlotItems(
460 slotIndex,
461 ref value,
462 ref count,
463 ref pCount,
464 ref pValue,
465 skippedByMods,
466 out bool glitchedLoaderResult
467 );
468 bool oldLoaderResult = modLoader.ClothingProcessSlotItems(
471 slotIndex,
472 value,
473 count
474 );
475#pragma warning restore CS0618
476 skippedByMods |= oldLoaderResult;
477 skippedByMods |= skipVanilla;
478 skippedByMods |= glitchedLoaderResult;
479 return false;
480 }
481 );
482 processedCount = pCount;
483 processedValue = pValue;
484 if (skippedByMods) {
485 return;
486 }
487 if (processCount != 1) {
488 return;
489 }
491 if (block.GetNutritionalValue(value) > 0f) {
492 if (block is BucketBlock) {
493 processedValue = EmptyBucketBlock.Index;
494 processedCount = 1;
495 }
496 if (count > 1
497 && processedCount > 0
498 && processedValue != value) {
499 processedValue = value;
500 processedCount = processCount;
501 }
502 else if (block.Eat(m_componentVitalStats, value)
503 || !m_componentVitalStats.Eat(value)) {
504 processedValue = value;
505 processedCount = processCount;
506 }
507 }
508 if (block.CanWear(value)) {
509 ClothingData clothingData = block.GetClothingData(value);
510 if (clothingData == null) {
511 return;
512 }
513 clothingData.Mount?.Invoke(value, this);
514 List<int> list = [..GetClothes(clothingData.Slot), value];
515 SetClothes(clothingData.Slot, list);
516 }
517 }
518
519 public virtual int RemoveSlotItems(int slotIndex, int count) {
520 if (count == 1) {
521 List<int> list = new(GetClothes(slotIndex));
522 if (list.Count > 0) {
523 int value = list[^1];
525 ClothingData clothingData = block.GetClothingData(value);
526 clothingData?.Dismount?.Invoke(value, this);
527 list.RemoveAt(list.Count - 1);
528 SetClothes(slotIndex, list);
529 return 1;
530 }
531 }
532 return 0;
533 }
534
535 public virtual void DropAllItems(Vector3 position) {
536 Random random = new();
537 SubsystemPickables subsystemPickables = Project.FindSubsystem<SubsystemPickables>(true);
538 for (int i = 0; i < SlotsCount; i++) {
539 int slotCount = GetSlotCount(i);
540 if (slotCount > 0) {
541 int slotValue = GetSlotValue(i);
542 int count = RemoveSlotItems(i, slotCount);
543 Vector3 value = random.Float(5f, 10f)
544 * Vector3.Normalize(new Vector3(random.Float(-1f, 1f), random.Float(1f, 2f), random.Float(-1f, 1f)));
545 subsystemPickables.AddPickable(slotValue, count, position, value, null, Entity);
546 }
547 }
548 }
549
550 public virtual void Display_DeviceReset() {
552 }
553
554 public virtual bool CanWearClothing(int value) {
556 ClothingData clothingData = block.GetClothingData(value);
557 if (clothingData == null) {
558 return false;
559 }
560 IList<int> list = GetClothes(clothingData.Slot);
561 if (list.Count == 0) {
562 return true;
563 }
564 int value2 = list[list.Count - 1];
566 ClothingData clothingData2 = block2.GetClothingData(value2);
567 if (clothingData2 == null) {
568 return false;
569 }
570 return clothingData.Layer > clothingData2.Layer;
571 }
572
573 public virtual void UpdateRenderTargets() {
574 if (m_skinTexture == null
575 || m_componentPlayer.PlayerData.CharacterSkinName != m_skinTextureName) {
577 m_skinTextureName = m_componentPlayer.PlayerData.CharacterSkinName;
578 Utilities.Dispose(ref m_innerClothedTexture);
579 Utilities.Dispose(ref m_outerClothedTexture);
580 }
581 if (m_innerClothedTexture == null
582 || m_innerClothedTexture.Width != m_skinTexture.Width
583 || m_innerClothedTexture.Height != m_skinTexture.Height) {
585 m_componentHumanModel.TextureOverride = m_innerClothedTexture;
587 }
588 if (m_outerClothedTexture == null
589 || m_outerClothedTexture.Width != m_skinTexture.Width
590 || m_outerClothedTexture.Height != m_skinTexture.Height) {
592 m_componentOuterClothingModel.TextureOverride = m_outerClothedTexture;
594 }
597 Rectangle scissorRectangle = Display.ScissorRectangle;
598 RenderTarget2D renderTarget = Display.RenderTarget;
599 try {
600 Display.RenderTarget = m_innerClothedTexture;
602 int num = 0;
603 TexturedBatch2D texturedBatch2D = m_primitivesRenderer.TexturedBatch(
605 false,
606 num++,
608 null,
611 );
612 texturedBatch2D.QueueQuad(
615 0f,
617 Vector2.One,
619 );
620 ClothingSlot[] innerSlotsOrder = m_innerSlotsOrder;
621 foreach (ClothingSlot slot in innerSlotsOrder) {
622 foreach (int clothe in GetClothes(slot)) {
624 ClothingData clothingData = block.GetClothingData(clothe);
625 if (clothingData == null) {
626 continue;
627 }
628 clothingData.Texture ??= ContentManager.Get<Texture2D>(clothingData._textureName);
629 Color fabricColor = clothingData.GetColor(this, clothe);
630 texturedBatch2D = m_primitivesRenderer.TexturedBatch(
631 clothingData.Texture,
632 false,
633 num++,
635 null,
638 );
639 if (!clothingData.IsOuter) {
640 texturedBatch2D.QueueQuad(
641 new Vector2(0f, 0f),
643 0f,
645 Vector2.One,
646 fabricColor
647 );
648 }
649 }
650 }
651 m_primitivesRenderer.Flush();
652 Display.RenderTarget = m_outerClothedTexture;
654 num = 0;
655 innerSlotsOrder = m_outerSlotsOrder;
656 foreach (ClothingSlot slot2 in innerSlotsOrder) {
657 foreach (int clothe2 in GetClothes(slot2)) {
659 ClothingData clothingData2 = block2.GetClothingData(clothe2);
660 if (clothingData2 == null) {
661 continue;
662 }
663 clothingData2.Texture ??= ContentManager.Get<Texture2D>(clothingData2._textureName);
664 Color fabricColor2 = clothingData2.GetColor(this, clothe2);
665 texturedBatch2D = m_primitivesRenderer.TexturedBatch(
666 clothingData2.Texture,
667 false,
668 num++,
670 null,
673 );
674 if (clothingData2.IsOuter) {
675 texturedBatch2D.QueueQuad(
676 new Vector2(0f, 0f),
678 0f,
680 Vector2.One,
681 fabricColor2
682 );
683 }
684 }
685 }
686 m_primitivesRenderer.Flush();
687 }
688 finally {
689 Display.RenderTarget = renderTarget;
690 Display.ScissorRectangle = scissorRectangle;
691 }
692 }
693 }
694 }
695}
Engine.Vector3 Vector3
static readonly BlendState NonPremultiplied
static readonly DepthStencilState None
static void Clear(Vector4? color, float? depth=null, int? stencil=null)
static Rectangle ScissorRectangle
static RenderTarget2D RenderTarget
void QueueQuad(Vector2 corner1, Vector2 corner2, float depth, Vector2 texCoord1, Vector2 texCoord2, Color color)
static void Error(object message)
定义 Log.cs:80
The spell "Attackment" is wrong, But it is not recommended to change it because many mods rely on thi...
virtual ClothingData GetClothingData(int value)
virtual bool CanWear(int value)
virtual bool Eat(ComponentVitalStats vitalStats, int value)
virtual float GetNutritionalValue(int value)
static Texture2D LoadTexture(string name)
virtual void OnClotheSet(ComponentClothing componentClothing)
在ComponentClothing执行SetClothes()时触发,用于调整ComponentClothing中的一些参数
Action< int, ComponentClothing > Update
ComponentClothing更新时触发。
virtual void UpdateGraduallyDamagedOverTime(ComponentClothing componentClothing, int indexInClothesList, float dt)
在ComponentClothing中每帧都会调用的UpdateGraduallyDamagedOverTime(),主要用于控制衣物随时间逐渐损坏
virtual Color GetColor(ComponentClothing componentClothing, int value)
获取衣物穿着在身上时的颜色附加
virtual void ApplyArmorProtection(ComponentClothing componentClothing, List< int > clothesBeforeProtection, List< int > clothesAfterProtection, int sequence, Attackment attackment, ref float attackPowerAfterProtection)
计算单件护甲的防御
Action< int, ComponentClothing > Mount
装备
Action< int, ComponentClothing > Dismount
卸载
static ClothingSlot Feet
static Dictionary< string, ClothingSlot > ClothingSlots
调用自定义部位(比如手臂)的ClothingSlot,可以用ClothingSlot.ClothingSlots["Arms"]
static ClothingSlot Head
static ClothingSlot Torso
static ClothingSlot Legs
virtual void Update(float dt)
SubsystemPickables m_subsystemPickables
static ClothingSlot[] m_innerSlotsOrder
SubsystemParticles m_subsystemParticles
static List< ClothingSlot > m_innerSlotsOrderList
static List< ClothingSlot > m_outerSlotsOrderList
static ClothingSlot[] m_outerSlotsOrder
PrimitivesRenderer2D m_primitivesRenderer
ComponentVitalStats m_componentVitalStats
ComponentHumanModel m_componentHumanModel
bool EnableDressLimit
穿戴衣服限制
SubsystemGameInfo m_subsystemGameInfo
virtual void SetClothes(ClothingSlot slot, IEnumerable< int > clothes)
virtual int GetSlotCapacity(int slotIndex, int value)
virtual void DropAllItems(Vector3 position)
virtual void ProcessSlotItems(int slotIndex, int value, int count, int processCount, out int processedValue, out int processedCount)
virtual void AddSlotItems(int slotIndex, int value, int count)
override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
Dictionary< ClothingSlot, List< int > > m_clothes
override void Save(ValuesDictionary valuesDictionary, EntityToIdMap entityToIdMap)
virtual int GetSlotValue(int slotIndex)
ComponentOuterClothingModel m_componentOuterClothingModel
ComponentLocomotion m_componentLocomotion
Dictionary< ClothingSlot, float > InsulationBySlots
virtual int GetSlotCount(int slotIndex)
virtual int GetSlotProcessCapacity(int slotIndex, int value)
virtual bool CanWearClothing(int value)
float ApplyArmorProtection(float attackPower)
virtual ReadOnlyList< int > GetClothes(ClothingSlot slot)
float ApplyArmorProtection(Attackment attackment)
virtual int RemoveSlotItems(int slotIndex, int count)
实际移除的数量
static object Get(Type type, string name)
static bool IsContent(object content)
static string Get(string className, int key)
获取在当前语言类名键对应的字符串
float Float()
virtual Pickable AddPickable(Pickable pickable)
static int ExtractContents(int value)
ValuesDictionary ValuesDictionary
static void HookAction(string HookName, Func< ModLoader, bool > action)
执行Hook
static Dictionary< string, ModHook > ModHooks
static Color Transparent
定义 Color.cs:5
static Color White
static readonly Vector2 Zero
static readonly Vector2 One
static Vector3 Normalize(Vector3 v)
static readonly Vector3 Zero
static readonly Vector3 UnitY