public ItemComponent(Item item, XElement element) { this.item = item; originalElement = element; name = element.Name.ToString(); SerializableProperties = SerializableProperty.GetProperties(this); requiredItems = new Dictionary <RelatedItem.RelationType, List <RelatedItem> >(); requiredSkills = new List <Skill>(); #if CLIENT hasSoundsOfType = new bool[Enum.GetValues(typeof(ActionType)).Length]; sounds = new Dictionary <ActionType, List <ItemSound> >(); #endif SelectKey = InputType.Select; try { string selectKeyStr = element.GetAttributeString("selectkey", "Select"); selectKeyStr = ToolBox.ConvertInputType(selectKeyStr); SelectKey = (InputType)Enum.Parse(typeof(InputType), selectKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid select key in " + element + "!", e); } PickKey = InputType.Select; try { string pickKeyStr = element.GetAttributeString("pickkey", "Select"); pickKeyStr = ToolBox.ConvertInputType(pickKeyStr); PickKey = (InputType)Enum.Parse(typeof(InputType), pickKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid pick key in " + element + "!", e); } SerializableProperties = SerializableProperty.DeserializeProperties(this, element); ParseMsg(); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "activeconditional": case "isactive": IsActiveConditionals = IsActiveConditionals ?? new List <PropertyConditional>(); foreach (XAttribute attribute in subElement.Attributes()) { if (PropertyConditional.IsValid(attribute)) { IsActiveConditionals.Add(new PropertyConditional(attribute)); } } break; case "requireditem": case "requireditems": SetRequiredItems(subElement); break; case "requiredskill": case "requiredskills": if (subElement.Attribute("name") != null) { DebugConsole.ThrowError("Error in item config \"" + item.ConfigFile + "\" - skill requirement in component " + GetType().ToString() + " should use a skill identifier instead of the name of the skill."); continue; } string skillIdentifier = subElement.GetAttributeString("identifier", ""); requiredSkills.Add(new Skill(skillIdentifier, subElement.GetAttributeInt("level", 0))); break; case "statuseffect": var statusEffect = StatusEffect.Load(subElement, item.Name); if (statusEffectLists == null) { statusEffectLists = new Dictionary <ActionType, List <StatusEffect> >(); } List <StatusEffect> effectList; if (!statusEffectLists.TryGetValue(statusEffect.type, out effectList)) { effectList = new List <StatusEffect>(); statusEffectLists.Add(statusEffect.type, effectList); } effectList.Add(statusEffect); break; default: if (LoadElemProjSpecific(subElement)) { break; } ItemComponent ic = Load(subElement, item, item.ConfigFile, false); if (ic == null) { break; } ic.Parent = this; ic.IsActive = isActive; OnActiveStateChanged += ic.SetActiveState; item.AddComponent(ic); break; } } }
protected SpriteDeformation(XElement element, SpriteDeformationParams deformationParams) { this.Params = deformationParams; SerializableProperty.DeserializeProperties(deformationParams, element); Deformation = new Vector2[deformationParams.Resolution.X, deformationParams.Resolution.Y]; }
//---------------------------------------------------- public ParticlePrefab(XElement element) { Name = element.Name.ToString(); Sprites = new List <Sprite>(); SerializableProperties = SerializableProperty.DeserializeProperties(this, element); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "sprite": Sprites.Add(new Sprite(subElement)); break; case "spritesheet": case "animatedsprite": Sprites.Add(new SpriteSheet(subElement)); break; case "particleemitter": case "emitter": case "subemitter": SubEmitters.Add(new ParticleEmitterPrefab(subElement)); break; } } //if velocity change in water is not given, it defaults to the normal velocity change if (element.Attribute("velocitychangewater") == null) { VelocityChangeWater = VelocityChange; } if (element.Attribute("angularvelocity") != null) { AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f); AngularVelocityMax = AngularVelocityMin; } if (element.Attribute("startsize") != null) { StartSizeMin = element.GetAttributeVector2("startsize", Vector2.One); StartSizeMax = StartSizeMin; } if (element.Attribute("sizechange") != null) { SizeChangeMin = element.GetAttributeVector2("sizechange", Vector2.Zero); SizeChangeMax = SizeChangeMin; } if (element.Attribute("startrotation") != null) { StartRotationMin = element.GetAttributeFloat("startrotation", 0.0f); StartRotationMax = StartRotationMin; } if (CollisionRadius <= 0.0f) { CollisionRadius = Sprites.Count > 0 ? 1 : Sprites[0].SourceRect.Width / 2.0f; } }
public bool Deserialize(XElement element) { SerializableProperties = SerializableProperty.DeserializeProperties(this, element); return(SerializableProperties != null); }
public virtual void Reset() { SerializableProperties = SerializableProperty.DeserializeProperties(this, originalElement); ParseMsg(); OverrideRequiredItems(originalElement); }
public DamageParticle(XElement element) { SerializableProperty.DeserializeProperties(this, element); }
public LightSourceParams(float range, Color color) { SerializableProperties = SerializableProperty.DeserializeProperties(this); Range = range; Color = color; }
public ItemComponent(Item item, XElement element) { this.item = item; name = element.Name.ToString(); properties = SerializableProperty.GetProperties(this); //canBePicked = ToolBox.GetAttributeBool(element, "canbepicked", false); //canBeSelected = ToolBox.GetAttributeBool(element, "canbeselected", false); //msg = ToolBox.GetAttributeString(element, "msg", ""); requiredItems = new List <RelatedItem>(); requiredSkills = new List <Skill>(); #if CLIENT sounds = new Dictionary <ActionType, List <ItemSound> >(); #endif SelectKey = InputType.Select; try { string selectKeyStr = element.GetAttributeString("selectkey", "Select"); selectKeyStr = ToolBox.ConvertInputType(selectKeyStr); SelectKey = (InputType)Enum.Parse(typeof(InputType), selectKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid select key in " + element + "!", e); } PickKey = InputType.Select; try { string pickKeyStr = element.GetAttributeString("pickkey", "Select"); pickKeyStr = ToolBox.ConvertInputType(pickKeyStr); PickKey = (InputType)Enum.Parse(typeof(InputType), pickKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid pick key in " + element + "!", e); } properties = SerializableProperty.DeserializeProperties(this, element); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "requireditem": case "requireditems": RelatedItem ri = RelatedItem.Load(subElement); if (ri != null) { requiredItems.Add(ri); } break; case "requiredskill": case "requiredskills": string skillName = subElement.GetAttributeString("name", ""); requiredSkills.Add(new Skill(skillName, subElement.GetAttributeInt("level", 0))); break; case "statuseffect": var statusEffect = StatusEffect.Load(subElement); if (statusEffectLists == null) { statusEffectLists = new Dictionary <ActionType, List <StatusEffect> >(); } List <StatusEffect> effectList; if (!statusEffectLists.TryGetValue(statusEffect.type, out effectList)) { effectList = new List <StatusEffect>(); statusEffectLists.Add(statusEffect.type, effectList); } effectList.Add(statusEffect); break; default: if (LoadElemProjSpecific(subElement)) { break; } ItemComponent ic = Load(subElement, item, item.ConfigFile, false); if (ic == null) { break; } ic.Parent = this; item.components.Add(ic); break; } } }
private void LoadSettings() { XDocument doc = null; if (File.Exists(SettingsFile)) { doc = XMLExtensions.TryLoadXml(SettingsFile); } if (doc == null) { doc = new XDocument(new XElement("serversettings")); } SerializableProperties = SerializableProperty.DeserializeProperties(this, doc.Root); AutoRestart = doc.Root.GetAttributeBool("autorestart", false); Voting.AllowSubVoting = SubSelectionMode == SelectionMode.Vote; Voting.AllowModeVoting = ModeSelectionMode == SelectionMode.Vote; selectedLevelDifficulty = doc.Root.GetAttributeFloat("LevelDifficulty", 20.0f); GameMain.NetLobbyScreen.SetLevelDifficulty(selectedLevelDifficulty); GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); string[] defaultAllowedClientNameChars = new string[] { "32-33", "38-46", "48-57", "65-90", "91", "93", "95-122", "192-255", "384-591", "1024-1279", "19968-21327", "21329-40959", "13312-19903", "131072-173791", "173824-178207", "178208-183983", "63744-64255", "194560-195103" //CJK }; string[] allowedClientNameCharsStr = doc.Root.GetAttributeStringArray("AllowedClientNameChars", defaultAllowedClientNameChars); if (doc.Root.GetAttributeString("AllowedClientNameChars", "") == "65-90,97-122,48-59") { allowedClientNameCharsStr = defaultAllowedClientNameChars; } foreach (string allowedClientNameCharRange in allowedClientNameCharsStr) { string[] splitRange = allowedClientNameCharRange.Split('-'); if (splitRange.Length == 0 || splitRange.Length > 2) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } int min = -1; if (!int.TryParse(splitRange[0], out min)) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } int max = min; if (splitRange.Length == 2) { if (!int.TryParse(splitRange[1], out max)) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } } if (min > -1 && max > -1) { AllowedClientNameChars.Add(new Pair <int, int>(min, max)); } } AllowedRandomMissionTypes = new List <MissionType>(); string[] allowedMissionTypeNames = doc.Root.GetAttributeStringArray( "AllowedRandomMissionTypes", Enum.GetValues(typeof(MissionType)).Cast <MissionType>().Select(m => m.ToString()).ToArray()); foreach (string missionTypeName in allowedMissionTypeNames) { if (Enum.TryParse(missionTypeName, out MissionType missionType)) { if (missionType == Barotrauma.MissionType.None) { continue; } if (MissionPrefab.HiddenMissionClasses.Contains(missionType)) { continue; } AllowedRandomMissionTypes.Add(missionType); } } ServerName = doc.Root.GetAttributeString("name", ""); if (ServerName.Length > NetConfig.ServerNameMaxLength) { ServerName = ServerName.Substring(0, NetConfig.ServerNameMaxLength); } ServerMessageText = doc.Root.GetAttributeString("ServerMessage", ""); GameMain.NetLobbyScreen.SelectedModeIdentifier = GameModeIdentifier; //handle Random as the mission type, which is no longer a valid setting //MissionType.All offers equivalent functionality if (MissionType == "Random") { MissionType = "All"; } GameMain.NetLobbyScreen.MissionTypeName = MissionType; GameMain.NetLobbyScreen.SetBotSpawnMode(BotSpawnMode); GameMain.NetLobbyScreen.SetBotCount(BotCount); GameMain.NetLobbyScreen.SetMaxMissionCount(MaxMissionCount); List <string> monsterNames = CharacterPrefab.Prefabs.Select(p => p.Identifier).ToList(); MonsterEnabled = new Dictionary <string, bool>(); foreach (string s in monsterNames) { if (!MonsterEnabled.ContainsKey(s)) { MonsterEnabled.Add(s, true); } } }
private void LoadSettings() { XDocument doc = null; if (File.Exists(SettingsFile)) { doc = XMLExtensions.TryLoadXml(SettingsFile); } if (doc == null || doc.Root == null) { doc = new XDocument(new XElement("serversettings")); } SerializableProperties = SerializableProperty.DeserializeProperties(this, doc.Root); AutoRestart = doc.Root.GetAttributeBool("autorestart", false); #if CLIENT if (autoRestart) { GameMain.NetLobbyScreen.SetAutoRestart(autoRestart, AutoRestartInterval); } #endif subSelectionMode = SelectionMode.Manual; Enum.TryParse(doc.Root.GetAttributeString("SubSelection", "Manual"), out subSelectionMode); Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote; modeSelectionMode = SelectionMode.Manual; Enum.TryParse(doc.Root.GetAttributeString("ModeSelection", "Manual"), out modeSelectionMode); Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote; var traitorsEnabled = TraitorsEnabled; Enum.TryParse(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled); TraitorsEnabled = traitorsEnabled; GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); AllowedRandomMissionTypes = doc.Root.GetAttributeStringArray( "AllowedRandomMissionTypes", MissionPrefab.MissionTypes.ToArray()).ToList(); if (GameMain.NetLobbyScreen != null #if CLIENT && GameMain.NetLobbyScreen.ServerMessage != null #endif ) { #if SERVER GameMain.NetLobbyScreen.ServerName = doc.Root.GetAttributeString("name", ""); GameMain.NetLobbyScreen.SelectedModeName = GameMode; GameMain.NetLobbyScreen.MissionTypeName = MissionType; #endif GameMain.NetLobbyScreen.ServerMessageText = doc.Root.GetAttributeString("ServerMessage", ""); } #if CLIENT showLogButton.Visible = SaveServerLogs; #endif List <string> monsterNames = GameMain.Config.SelectedContentPackage.GetFilesOfType(ContentType.Character); for (int i = 0; i < monsterNames.Count; i++) { monsterNames[i] = Path.GetFileName(Path.GetDirectoryName(monsterNames[i])); } monsterEnabled = new Dictionary <string, bool>(); foreach (string s in monsterNames) { if (!monsterEnabled.ContainsKey(s)) { monsterEnabled.Add(s, true); } } extraCargo = new Dictionary <ItemPrefab, int>(); AutoBanTime = doc.Root.GetAttributeFloat("autobantime", 60); MaxAutoBanTime = doc.Root.GetAttributeFloat("maxautobantime", 360); }
private void LoadSettings() { XDocument doc = null; if (File.Exists(SettingsFile)) { doc = XMLExtensions.TryLoadXml(SettingsFile); } if (doc == null || doc.Root == null) { doc = new XDocument(new XElement("serversettings")); } SerializableProperties = SerializableProperty.DeserializeProperties(this, doc.Root); AutoRestart = doc.Root.GetAttributeBool("autorestart", false); Voting.AllowSubVoting = SubSelectionMode == SelectionMode.Vote; Voting.AllowModeVoting = ModeSelectionMode == SelectionMode.Vote; selectedLevelDifficulty = doc.Root.GetAttributeFloat("LevelDifficulty", 20.0f); GameMain.NetLobbyScreen.SetLevelDifficulty(selectedLevelDifficulty); var traitorsEnabled = TraitorsEnabled; Enum.TryParse(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled); TraitorsEnabled = traitorsEnabled; GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); var botSpawnMode = BotSpawnMode.Fill; Enum.TryParse(doc.Root.GetAttributeString("BotSpawnMode", "Fill"), out botSpawnMode); BotSpawnMode = botSpawnMode; //"65-90", "97-122", "48-59" = upper and lower case english alphabet and numbers string[] allowedClientNameCharsStr = doc.Root.GetAttributeStringArray("AllowedClientNameChars", new string[] { "65-90", "97-122", "48-59" }); foreach (string allowedClientNameCharRange in allowedClientNameCharsStr) { string[] splitRange = allowedClientNameCharRange.Split('-'); if (splitRange.Length == 0 || splitRange.Length > 2) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } int min = -1; if (!int.TryParse(splitRange[0], out min)) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } int max = min; if (splitRange.Length == 2) { if (!int.TryParse(splitRange[1], out max)) { DebugConsole.ThrowError("Error in server settings - " + allowedClientNameCharRange + " is not a valid range for characters allowed in client names."); continue; } } if (min > -1 && max > -1) { AllowedClientNameChars.Add(new Pair <int, int>(min, max)); } } AllowedRandomMissionTypes = new List <MissionType>(); string[] allowedMissionTypeNames = doc.Root.GetAttributeStringArray( "AllowedRandomMissionTypes", Enum.GetValues(typeof(MissionType)).Cast <MissionType>().Select(m => m.ToString()).ToArray()); foreach (string missionTypeName in allowedMissionTypeNames) { if (Enum.TryParse(missionTypeName, out MissionType missionType)) { if (missionType == Barotrauma.MissionType.None) { continue; } AllowedRandomMissionTypes.Add(missionType); } } ServerName = doc.Root.GetAttributeString("name", ""); ServerMessageText = doc.Root.GetAttributeString("ServerMessage", ""); GameMain.NetLobbyScreen.SelectedModeIdentifier = GameModeIdentifier; GameMain.NetLobbyScreen.MissionTypeName = MissionType; GameMain.NetLobbyScreen.SetBotSpawnMode(BotSpawnMode); GameMain.NetLobbyScreen.SetBotCount(BotCount); List <string> monsterNames = GameMain.Instance.GetFilesOfType(ContentType.Character).ToList(); for (int i = 0; i < monsterNames.Count; i++) { monsterNames[i] = Path.GetFileName(Path.GetDirectoryName(monsterNames[i])); } MonsterEnabled = new Dictionary <string, bool>(); foreach (string s in monsterNames) { if (!MonsterEnabled.ContainsKey(s)) { MonsterEnabled.Add(s, true); } } AutoBanTime = doc.Root.GetAttributeFloat("autobantime", 60); MaxAutoBanTime = doc.Root.GetAttributeFloat("maxautobantime", 360); }
private void LoadSettings() { XDocument doc = null; if (File.Exists(SettingsFile)) { doc = XMLExtensions.TryLoadXml(SettingsFile); } if (doc == null || doc.Root == null) { doc = new XDocument(new XElement("serversettings")); } SerializableProperties = SerializableProperty.DeserializeProperties(this, doc.Root); AutoRestart = doc.Root.GetAttributeBool("autorestart", false); #if CLIENT if (autoRestart) { GameMain.NetLobbyScreen.SetAutoRestart(autoRestart, AutoRestartInterval); } #endif subSelectionMode = SelectionMode.Manual; Enum.TryParse <SelectionMode>(doc.Root.GetAttributeString("SubSelection", "Manual"), out subSelectionMode); Voting.AllowSubVoting = subSelectionMode == SelectionMode.Vote; modeSelectionMode = SelectionMode.Manual; Enum.TryParse <SelectionMode>(doc.Root.GetAttributeString("ModeSelection", "Manual"), out modeSelectionMode); Voting.AllowModeVoting = modeSelectionMode == SelectionMode.Vote; var traitorsEnabled = TraitorsEnabled; Enum.TryParse <YesNoMaybe>(doc.Root.GetAttributeString("TraitorsEnabled", "No"), out traitorsEnabled); TraitorsEnabled = traitorsEnabled; GameMain.NetLobbyScreen.SetTraitorsEnabled(traitorsEnabled); if (GameMain.NetLobbyScreen != null #if CLIENT && GameMain.NetLobbyScreen.ServerMessage != null #endif ) { #if SERVER GameMain.NetLobbyScreen.ServerName = doc.Root.GetAttributeString("name", ""); GameMain.NetLobbyScreen.SelectedModeName = GameMode; GameMain.NetLobbyScreen.MissionTypeName = MissionType; #endif GameMain.NetLobbyScreen.ServerMessageText = doc.Root.GetAttributeString("ServerMessage", ""); } #if CLIENT showLogButton.Visible = SaveServerLogs; #endif List <string> monsterNames = Directory.GetDirectories("Content/Characters").ToList(); for (int i = 0; i < monsterNames.Count; i++) { monsterNames[i] = monsterNames[i].Replace("Content/Characters", "").Replace("/", "").Replace("\\", ""); } monsterEnabled = new Dictionary <string, bool>(); foreach (string s in monsterNames) { monsterEnabled.Add(s, true); } extraCargo = new Dictionary <ItemPrefab, int>(); }
public ItemComponent(Item item, XElement element) { this.item = item; originalElement = element; name = element.Name.ToString(); SerializableProperties = SerializableProperty.GetProperties(this); requiredItems = new Dictionary <RelatedItem.RelationType, List <RelatedItem> >(); requiredSkills = new List <Skill>(); #if CLIENT sounds = new Dictionary <ActionType, List <ItemSound> >(); #endif SelectKey = InputType.Select; try { string selectKeyStr = element.GetAttributeString("selectkey", "Select"); selectKeyStr = ToolBox.ConvertInputType(selectKeyStr); SelectKey = (InputType)Enum.Parse(typeof(InputType), selectKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid select key in " + element + "!", e); } PickKey = InputType.Select; try { string pickKeyStr = element.GetAttributeString("pickkey", "Select"); pickKeyStr = ToolBox.ConvertInputType(pickKeyStr); PickKey = (InputType)Enum.Parse(typeof(InputType), pickKeyStr, true); } catch (Exception e) { DebugConsole.ThrowError("Invalid pick key in " + element + "!", e); } SerializableProperties = SerializableProperty.DeserializeProperties(this, element); ParseMsg(); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "requireditem": case "requireditems": RelatedItem ri = RelatedItem.Load(subElement, item.Name); if (ri != null) { if (!requiredItems.ContainsKey(ri.Type)) { requiredItems.Add(ri.Type, new List <RelatedItem>()); } requiredItems[ri.Type].Add(ri); } else { DebugConsole.ThrowError("Error in item config \"" + item.ConfigFile + "\" - component " + GetType().ToString() + " requires an item with no identifiers."); } break; case "requiredskill": case "requiredskills": if (subElement.Attribute("name") != null) { DebugConsole.ThrowError("Error in item config \"" + item.ConfigFile + "\" - skill requirement in component " + GetType().ToString() + " should use a skill identifier instead of the name of the skill."); continue; } string skillIdentifier = subElement.GetAttributeString("identifier", ""); requiredSkills.Add(new Skill(skillIdentifier, subElement.GetAttributeInt("level", 0))); break; case "statuseffect": var statusEffect = StatusEffect.Load(subElement, item.Name); if (statusEffectLists == null) { statusEffectLists = new Dictionary <ActionType, List <StatusEffect> >(); } List <StatusEffect> effectList; if (!statusEffectLists.TryGetValue(statusEffect.type, out effectList)) { effectList = new List <StatusEffect>(); statusEffectLists.Add(statusEffect.type, effectList); } effectList.Add(statusEffect); break; case "aitarget": AITarget = new AITarget(item, subElement) { Enabled = isActive }; break; default: if (LoadElemProjSpecific(subElement)) { break; } ItemComponent ic = Load(subElement, item, item.ConfigFile, false); if (ic == null) { break; } ic.Parent = this; item.AddComponent(ic); break; } } }
//---------------------------------------------------- public ParticlePrefab(XElement element, ContentFile file) { Name = element.Name.ToString(); FilePath = file.Path; ContentPackage = file.ContentPackage; DisplayName = TextManager.Get("particle." + Name, true) ?? Name; Sprites = new List <Sprite>(); SerializableProperties = SerializableProperty.DeserializeProperties(this, element); foreach (XElement subElement in element.Elements()) { switch (subElement.Name.ToString().ToLowerInvariant()) { case "sprite": Sprites.Add(new Sprite(subElement)); break; case "spritesheet": case "animatedsprite": Sprites.Add(new SpriteSheet(subElement)); break; case "particleemitter": case "emitter": case "subemitter": SubEmitters.Add(new ParticleEmitterPrefab(subElement)); break; } } if (Sprites.Count == 0) { DebugConsole.ThrowError($"Particle prefab \"{Name}\" in the file \"{file}\" has no sprites defined!"); } //if velocity change in water is not given, it defaults to the normal velocity change if (element.Attribute("velocitychangewater") == null) { VelocityChangeWater = VelocityChange; } if (element.Attribute("angularvelocity") != null) { AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f); AngularVelocityMax = AngularVelocityMin; } if (element.Attribute("startsize") != null) { StartSizeMin = element.GetAttributeVector2("startsize", Vector2.One); StartSizeMax = StartSizeMin; } if (element.Attribute("sizechange") != null) { SizeChangeMin = element.GetAttributeVector2("sizechange", Vector2.Zero); SizeChangeMax = SizeChangeMin; } if (element.Attribute("startrotation") != null) { StartRotationMin = element.GetAttributeFloat("startrotation", 0.0f); StartRotationMax = StartRotationMin; } if (CollisionRadius <= 0.0f) { CollisionRadius = Sprites.Count > 0 ? 1 : Sprites[0].SourceRect.Width / 2.0f; } }