Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Items/Components/Machines/MiniMap.cs
1 using Microsoft.Xna.Framework;
2 using System;
3 using System.Collections.Generic;
4 using System.Xml.Linq;
5 
7 {
8  partial class MiniMap : Powered
9  {
10  internal class HullData
11  {
12  public float? HullOxygenAmount,
13  HullWaterAmount;
14 
15  public float? ReceivedOxygenAmount,
16  ReceivedWaterAmount;
17 
18  public double LastOxygenDataTime, LastWaterDataTime;
19 
20  public readonly HashSet<IdCard> Cards = new HashSet<IdCard>();
21 
22  public bool Distort;
23  public float DistortionTimer;
24 
25  public List<Hull> LinkedHulls = new List<Hull>();
26  }
27 
28  private bool hasPower;
29 
30  [Editable, Serialize(false, IsPropertySaveable.Yes, description: "Does the machine require inputs from water detectors in order to show the water levels inside rooms.")]
32  {
33  get;
34  set;
35  }
36 
37  [Editable, Serialize(true, IsPropertySaveable.Yes, description: "Does the machine require inputs from oxygen detectors in order to show the oxygen levels inside rooms.")]
39  {
40  get;
41  set;
42  }
43 
44  [Editable, Serialize(true, IsPropertySaveable.Yes, description: "Should damaged walls be displayed by the machine.")]
45  public bool ShowHullIntegrity
46  {
47  get;
48  set;
49  }
50 
51  [Editable, Serialize(true, IsPropertySaveable.Yes, description: "Enable hull status mode.")]
52  public bool EnableHullStatus
53  {
54  get;
55  set;
56  }
57 
58  [Editable, Serialize(true, IsPropertySaveable.Yes, description: "Enable electrical view mode.")]
60  {
61  get;
62  set;
63  }
64 
65  [Editable, Serialize(true, IsPropertySaveable.Yes, description: "Enable item finder mode.")]
66  public bool EnableItemFinder
67  {
68  get;
69  set;
70  }
71 
72  public MiniMap(Item item, ContentXElement element)
73  : base(item, element)
74  {
75  IsActive = true;
76  InitProjSpecific();
77  }
78 
79  partial void InitProjSpecific();
80 
81  public override void Update(float deltaTime, Camera cam)
82  {
83  hasPower = Voltage > MinVoltage;
84  if (hasPower)
85  {
86  ApplyStatusEffects(ActionType.OnActive, deltaTime);
87  }
88  }
89 
93  public override float GetCurrentPowerConsumption(Connection connection = null)
94  {
95  if (connection != powerIn || !IsActive)
96  {
97  return 0;
98  }
99 
100  return PowerConsumption * MathHelper.Lerp(1.5f, 1.0f, item.Condition / item.MaxCondition);
101  }
102 
103  public override bool Pick(Character picker)
104  {
105  return picker != null;
106  }
107  }
108 }
void ApplyStatusEffects(ActionType type, float deltaTime, Character character=null, Limb targetLimb=null, Entity useTarget=null, Character user=null, Vector2? worldPosition=null, float afflictionMultiplier=1.0f)
override bool Pick(Character picker)
a Character has picked the item
override float GetCurrentPowerConsumption(Connection connection=null)
Power consumption of the MiniMap. Only consume power when active and adjust consumption based on cond...
ActionType
ActionTypes define when a StatusEffect is executed.
Definition: Enums.cs:19