private MyEntityStat AddStat(MyStringHash statId, MyObjectBuilder_EntityStat objectBuilder) { MyEntityStat stat = null; if (!m_stats.TryGetValue(statId, out stat)) { stat = new MyEntityStat(); stat.Init(objectBuilder); m_stats.Add(statId, stat); } else stat.ClearEffects(); return stat; }
private MyEntityStat AddStat(MyStringHash statId, MyObjectBuilder_EntityStat objectBuilder, bool forceNewValues = false) { MyEntityStat stat = null; if (m_stats.TryGetValue(statId, out stat)) { if(!forceNewValues) objectBuilder.Value = stat.CurrentRatio; stat.ClearEffects(); m_stats.Remove(statId); } stat = new MyEntityStat(); stat.Init(objectBuilder); m_stats.Add(statId, stat); return stat; }