statuseffect setvalue, new diving suit sprite & character slowdown, welded door sprite

This commit is contained in:
Regalis
2015-09-26 00:41:43 +03:00
parent 53e729ea11
commit da00b083ed
21 changed files with 137 additions and 57 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+13 -8
View File
@@ -42,22 +42,27 @@
pickdistance="200" pickdistance="200"
price="200"> price="200">
<Sprite texture ="DivingSuit.png" sourcerect="82,15,46,113" depth="0.5"/> <Sprite texture ="DivingSuit.png" sourcerect="82,0,46,128" depth="0.55"/>
<Body width="37" height="113" density="5"/> <Body width="37" height="113" density="5"/>
<Wearable slots="Head,Torso,Legs"> <Wearable slots="Head,Torso,Legs">
<sprite texture="DivingSuit.png" limb="Head" sourcerect="1,94,32,33" origin="0.5,0.5" depth="0.02"/> <sprite texture="DivingSuit.png" limb="Torso" sourcerect="40,0,42,97" origin="0.5,0.55" depthlimb="Head" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="Torso" sourcerect="40,0,38,65" origin="0.5,0.33" depth="0.01"/>
<sprite texture="DivingSuit.png" limb="RightHand" sourcerect="21,0,18,50" origin="0.45,0.4"/> <sprite texture="DivingSuit.png" limb="RightHand" sourcerect="0,78,15,50" origin="0.45,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftHand" sourcerect="21,0,18,50" origin="0.45,0.4"/> <sprite texture="DivingSuit.png" limb="LeftHand" sourcerect="0,78,15,50" origin="0.45,0.4" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/> <sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,19,43" origin="0.5,0.4" depth="0.005" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/> <sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,19,43" origin="0.5,0.4" depth="0.005" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightThigh" sourcerect="22,0,18,44" origin="0.5,0.5" depth="0.01" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftThigh" sourcerect="22,0,18,44" origin="0.5,0.5" depth="0.01" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="RightLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
<sprite texture="DivingSuit.png" limb="LeftLeg" sourcerect="17,47,21,51" origin="0.5,0.55" depth="0.02" hidelimb="true"/>
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/> <StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank,human" Condition="-0.5" Oxygen="20.0"/>
<StatusEffect type="OnWearing" target="Character" PressureProtection="100.0"/> <StatusEffect type="OnWearing" target="Character" PressureProtection="100.0" SpeedMultiplier="0.7" LowPassMultiplier="0.2" setvalue="true" disabledeltatime="true"/>
</Wearable> </Wearable>
<ItemContainer capacity="1" hideitems="true"> <ItemContainer capacity="1" hideitems="true">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 38 KiB

+5 -3
View File
@@ -4,10 +4,11 @@
linkable="true" linkable="true"
pickdistance="150.0"> pickdistance="150.0">
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.8" origin="0.5,0.5"/> <Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.01" origin="0.5,0.5"/>
<Door> <Door>
<Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.0" origin="0.5,0.0"/> <Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.05" origin="0.5,0.0"/>
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
</Door> </Door>
<AiTarget sightrange="5000.0"/> <AiTarget sightrange="5000.0"/>
@@ -26,10 +27,11 @@
linkable="true" linkable="true"
pickdistance="150.0"> pickdistance="150.0">
<Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.8" origin="0.5,0.5"/> <Sprite texture ="door.png" sourcerect="0,0,48,208" depth="0.01" origin="0.5,0.5"/>
<Door window="0,-18,10,89"> <Door window="0,-18,10,89">
<Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.0" origin="0.5,0.0"/> <Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.0" origin="0.5,0.0"/>
<WeldedSprite texture ="door.png" sourcerect="104,0,48,208" depth="0.0" origin="0.0,0.0"/>
</Door> </Door>
<AiTarget sightrange="5000.0"/> <AiTarget sightrange="5000.0"/>
+1 -1
View File
@@ -5,7 +5,7 @@
Tags="smallitem" Tags="smallitem"
pickdistance="150"> pickdistance="150">
<Sprite texture ="idcard.png" depth="0.8f"/> <Sprite texture ="idcard.png" depth="0.8"/>
<Body width="16" height="16"/> <Body width="16" height="16"/>
+19 -5
View File
@@ -134,10 +134,12 @@ namespace Subsurface
get { return selectedCharacter; } get { return selectedCharacter; }
} }
//public AITarget AiTarget private float lowPassMultiplier;
//{ public float LowPassMultiplier
// get { return aiTarget; } {
//} get { return lowPassMultiplier; }
set { lowPassMultiplier = MathHelper.Clamp(value, 0.0f, 1.0f); }
}
public float SoundRange public float SoundRange
{ {
@@ -196,6 +198,12 @@ namespace Subsurface
} }
} }
public float SpeedMultiplier
{
get;
set;
}
public Item[] SelectedItems public Item[] SelectedItems
{ {
get { return selectedItems; } get { return selectedItems; }
@@ -296,7 +304,6 @@ namespace Subsurface
public Character(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false) public Character(string file, Vector2 position, CharacterInfo characterInfo = null, bool isNetworkPlayer = false)
{ {
keys = new Key[Enum.GetNames(typeof(InputType)).Length]; keys = new Key[Enum.GetNames(typeof(InputType)).Length];
keys[(int)InputType.Select] = new Key(false); keys[(int)InputType.Select] = new Key(false);
keys[(int)InputType.ActionHeld] = new Key(true); keys[(int)InputType.ActionHeld] = new Key(true);
@@ -319,6 +326,8 @@ namespace Subsurface
//blood = 100.0f; //blood = 100.0f;
aiTarget = new AITarget(this); aiTarget = new AITarget(this);
lowPassMultiplier = 1.0f;
Properties = ObjectProperty.GetProperties(this); Properties = ObjectProperty.GetProperties(this);
Info = characterInfo==null ? new CharacterInfo(file) : characterInfo; Info = characterInfo==null ? new CharacterInfo(file) : characterInfo;
@@ -499,6 +508,9 @@ namespace Subsurface
if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && GetInputState(InputType.Run)) if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && GetInputState(InputType.Run))
targetMovement *= 3.0f; targetMovement *= 3.0f;
targetMovement *= SpeedMultiplier;
SpeedMultiplier = 1.0f;
AnimController.TargetMovement = targetMovement; AnimController.TargetMovement = targetMovement;
AnimController.IsStanding = true; AnimController.IsStanding = true;
@@ -740,6 +752,8 @@ namespace Subsurface
UpdateSightRange(); UpdateSightRange();
aiTarget.SoundRange = 0.0f; aiTarget.SoundRange = 0.0f;
lowPassMultiplier = MathHelper.Lerp(lowPassMultiplier, 1.0f, 0.1f);
if (needsAir) if (needsAir)
{ {
if (AnimController.HeadInWater) if (AnimController.HeadInWater)
+12 -1
View File
@@ -414,11 +414,22 @@ namespace Subsurface
Vector2 origin = wearingItemSprite.Sprite.Origin; Vector2 origin = wearingItemSprite.Sprite.Origin;
if (body.Dir == -1.0f) origin.X = wearingItemSprite.Sprite.SourceRect.Width - origin.X; if (body.Dir == -1.0f) origin.X = wearingItemSprite.Sprite.SourceRect.Width - origin.X;
float depth = sprite.Depth - 0.000001f;
if (wearingItemSprite.DepthLimb==LimbType.None)
{
Limb depthLimb = character.AnimController.GetLimb(wearingItemSprite.DepthLimb);
if (depthLimb!=null)
{
depth = depthLimb.sprite.Depth - 0.000001f;
}
}
wearingItemSprite.Sprite.Draw(spriteBatch, wearingItemSprite.Sprite.Draw(spriteBatch,
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
color, origin, color, origin,
-body.DrawRotation, -body.DrawRotation,
1.0f, spriteEffect, sprite.Depth - 0.000001f); 1.0f, spriteEffect, depth);
} }
if (!GameMain.DebugDraw) return; if (!GameMain.DebugDraw) return;
+14 -3
View File
@@ -21,6 +21,8 @@ namespace Subsurface
public string[] propertyNames; public string[] propertyNames;
private object[] propertyEffects; private object[] propertyEffects;
private bool setValue;
private bool disableDeltaTime; private bool disableDeltaTime;
private string[] onContainingNames; private string[] onContainingNames;
@@ -63,7 +65,6 @@ namespace Subsurface
IEnumerable<XAttribute> attributes = element.Attributes(); IEnumerable<XAttribute> attributes = element.Attributes();
List<XAttribute> propertyAttributes = new List<XAttribute>(); List<XAttribute> propertyAttributes = new List<XAttribute>();
disableDeltaTime = ToolBox.GetAttributeBool(element, "disabledeltatime", false);
foreach (XAttribute attribute in attributes) foreach (XAttribute attribute in attributes)
{ {
@@ -96,6 +97,12 @@ namespace Subsurface
targetTypes |= (TargetType)Enum.Parse(typeof(TargetType), s, true); targetTypes |= (TargetType)Enum.Parse(typeof(TargetType), s, true);
} }
break;
case "disabledeltatime":
disableDeltaTime = ToolBox.GetAttributeBool(attribute, false);
break;
case "setvalue":
setValue = ToolBox.GetAttributeBool(attribute, false);
break; break;
case "targetnames": case "targetnames":
string[] names = attribute.Value.Split(','); string[] names = attribute.Value.Split(',');
@@ -220,11 +227,15 @@ namespace Subsurface
Type type = value.GetType(); Type type = value.GetType();
if (type == typeof(float)) if (type == typeof(float))
{ {
property.TrySetValue((float)property.GetValue() + (float)value * deltaTime); float floatValue = (float)value * deltaTime;
if (!setValue) floatValue += (float)property.GetValue();
property.TrySetValue(floatValue);
} }
else if (type == typeof(int)) else if (type == typeof(int))
{ {
property.TrySetValue((int)property.GetValue() + (int)value * deltaTime); int intValue = (int)((int)value * deltaTime);
if (!setValue) intValue += (int)property.GetValue();
property.TrySetValue(intValue);
} }
else if (type == typeof(bool)) else if (type == typeof(bool))
{ {
+20 -4
View File
@@ -98,7 +98,7 @@ namespace Subsurface.Items.Components
PhysicsBody body; PhysicsBody body;
Sprite doorSprite; Sprite doorSprite, weldedSprite;
public Door(Item item, XElement element) public Door(Item item, XElement element)
: base(item, element) : base(item, element)
@@ -108,9 +108,15 @@ namespace Subsurface.Items.Components
// isOpen = false; // isOpen = false;
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
if (subElement.Name.ToString().ToLower() != "sprite") continue; switch (subElement.Name.ToString().ToLower())
doorSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile)); {
break; case "sprite":
doorSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile));
break;
case "weldedsprite":
weldedSprite = new Sprite(subElement, Path.GetDirectoryName(item.Prefab.ConfigFile));
break;
}
} }
doorRect = new Rectangle( doorRect = new Rectangle(
@@ -258,6 +264,11 @@ namespace Subsurface.Items.Components
//prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color); //prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
if (stuck>0.0f && weldedSprite!=null)
{
weldedSprite.Draw(spriteBatch, new Vector2(item.Rect.X, -item.Rect.Y), Color.White*(stuck/100.0f), 0.0f, 1.0f);
}
if (openState == 1.0f) if (openState == 1.0f)
{ {
body.Enabled = false; body.Enabled = false;
@@ -311,6 +322,8 @@ namespace Subsurface.Items.Components
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f) public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
{ {
if (isStuck) return;
if (connection.Name=="toggle") if (connection.Name=="toggle")
{ {
isOpen = !isOpen; isOpen = !isOpen;
@@ -319,6 +332,9 @@ namespace Subsurface.Items.Components
{ {
isOpen = (signal!="0"); isOpen = (signal!="0");
} }
//opening a partially stuck door makes it less stuck
if (isOpen) stuck = MathHelper.Clamp(stuck-30.0f, 0.0f, 100.0f); ;
} }
} }
} }
@@ -59,10 +59,9 @@ namespace Subsurface.Items.Components
{ {
float hullPercentage = 0.0f; float hullPercentage = 0.0f;
if (hull1 != null) hullPercentage = (hull1.Volume / hull1.FullVolume) * 100.0f; if (hull1 != null) hullPercentage = (hull1.Volume / hull1.FullVolume) * 100.0f;
flowPercentage = ((float)targetLevel - hullPercentage); FlowPercentage = ((float)targetLevel - hullPercentage) * 10.0f;
} }
currPowerConsumption = powerConsumption * Math.Abs(flowPercentage / 100.0f); currPowerConsumption = powerConsumption * Math.Abs(flowPercentage / 100.0f);
if (voltage < minVoltage) return; if (voltage < minVoltage) return;
@@ -72,10 +71,7 @@ namespace Subsurface.Items.Components
float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage; float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage;
//flowPercentage = maxFlow * powerFactor; //flowPercentage = maxFlow * powerFactor;
float deltaVolume = 0.0f; float deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor;
deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor;
hull1.Volume += deltaVolume; hull1.Volume += deltaVolume;
if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f; if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f;
@@ -171,7 +167,7 @@ namespace Subsurface.Items.Components
float tempTarget; float tempTarget;
if (float.TryParse(signal, NumberStyles.Any, CultureInfo.InvariantCulture, out tempTarget)) if (float.TryParse(signal, NumberStyles.Any, CultureInfo.InvariantCulture, out tempTarget))
{ {
targetLevel = MathHelper.Clamp(tempTarget, 0.0f, 100.0f); targetLevel = MathHelper.Clamp((tempTarget+100.0f)/2.0f, 0.0f, 100.0f);
} }
} }
@@ -152,7 +152,7 @@ namespace Subsurface.Items.Components
if (PlayerInput.LeftButtonDown()) if (PlayerInput.LeftButtonDown())
{ {
targetVelocity = PlayerInput.MousePosition - new Vector2(velRect.Center.X, velRect.Center.Y); TargetVelocity = PlayerInput.MousePosition - new Vector2(velRect.Center.X, velRect.Center.Y);
targetVelocity.Y = -targetVelocity.Y; targetVelocity.Y = -targetVelocity.Y;
valueChanged = true; valueChanged = true;
+10 -6
View File
@@ -9,11 +9,14 @@ namespace Subsurface.Items.Components
{ {
public Sprite Sprite; public Sprite Sprite;
public bool HideLimb; public bool HideLimb;
public LimbType DepthLimb;
public WearableSprite(Sprite sprite, bool hideLimb) public WearableSprite(Sprite sprite, bool hideLimb, LimbType depthLimb = LimbType.None)
{ {
Sprite = sprite; Sprite = sprite;
HideLimb = hideLimb; HideLimb = hideLimb;
DepthLimb = depthLimb;
} }
} }
@@ -31,8 +34,8 @@ namespace Subsurface.Items.Components
var sprites = element.Elements().Where(x => x.Name.ToString() == "sprite").ToList(); var sprites = element.Elements().Where(x => x.Name.ToString() == "sprite").ToList();
int spriteCount = sprites.Count(); int spriteCount = sprites.Count();
wearableSprite = new WearableSprite[spriteCount]; wearableSprite = new WearableSprite[spriteCount];
limbType = new LimbType[spriteCount]; limbType = new LimbType[spriteCount];
limb = new Limb[spriteCount]; limb = new Limb[spriteCount];
int i = 0; int i = 0;
foreach (XElement subElement in sprites) foreach (XElement subElement in sprites)
@@ -53,11 +56,12 @@ namespace Subsurface.Items.Components
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath; spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
var sprite = new Sprite(subElement, "", spritePath); var sprite = new Sprite(subElement, "", spritePath);
wearableSprite[i] = new WearableSprite(sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false)); wearableSprite[i] = new WearableSprite(sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false),
//sprite[i].origin = new Vector2(sourceRect.Width / 2.0f, sourceRect.Height / 2.0f); (LimbType)Enum.Parse(typeof(LimbType),
ToolBox.GetAttributeString(subElement, "depthlimb", "None"), true));
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType), limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
ToolBox.GetAttributeString(subElement, "limb", "Head")); ToolBox.GetAttributeString(subElement, "limb", "Head"), true);
i++; i++;
} }
+2 -3
View File
@@ -565,9 +565,9 @@ namespace Subsurface
Color color = (isSelected && editing) ? color = Color.Red : spriteColor; Color color = (isSelected && editing) ? color = Color.Red : spriteColor;
if (isHighlighted) color = Color.Orange; if (isHighlighted) color = Color.Orange;
if (prefab.sprite!=null) if (prefab.sprite != null)
{ {
if (body==null) if (body == null)
{ {
prefab.sprite.DrawTiled(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color); prefab.sprite.DrawTiled(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
} }
@@ -577,7 +577,6 @@ namespace Subsurface
} }
} }
foreach (ItemComponent component in components) component.Draw(spriteBatch, editing); foreach (ItemComponent component in components) component.Draw(spriteBatch, editing);
if (!editing || (body!=null && !body.Enabled)) if (!editing || (body!=null && !body.Enabled))
+2
View File
@@ -76,6 +76,8 @@ namespace Subsurface
element.Add( element.Add(
new XAttribute("name", JoinedNames), new XAttribute("name", JoinedNames),
new XAttribute("type", type.ToString())); new XAttribute("type", type.ToString()));
if (!string.IsNullOrWhiteSpace("msg")) element.Add(new XAttribute("msg", Msg));
} }
public static RelatedItem Load(XElement element) public static RelatedItem Load(XElement element)
+1 -2
View File
@@ -237,6 +237,7 @@ namespace Subsurface
soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f); soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f);
flowForce = Vector2.Zero; flowForce = Vector2.Zero;
lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, 0.05f);
if (open == 0.0f) return; if (open == 0.0f) return;
@@ -253,8 +254,6 @@ namespace Subsurface
UpdateRoomToRoom(deltaTime); UpdateRoomToRoom(deltaTime);
} }
lerpedFlowForce = Vector2.Lerp(lerpedFlowForce, flowForce, 0.05f);
if (FlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume) if (FlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume)
{ {
//UpdateFlowForce(); //UpdateFlowForce();
+4 -4
View File
@@ -532,9 +532,9 @@ namespace Subsurface
stream.Dispose(); stream.Dispose();
} }
catch catch (Exception e)
{ {
DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed!"); DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed! ("+e.Message+")");
return null; return null;
} }
} }
@@ -545,9 +545,9 @@ namespace Subsurface
doc = XDocument.Load(file); doc = XDocument.Load(file);
} }
catch catch (Exception e)
{ {
DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed!"); DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed! (" + e.Message + ")");
return null; return null;
} }
} }
+8 -1
View File
@@ -117,7 +117,14 @@ namespace Subsurface.Particles
{ {
if (gap.isHorizontal != isHorizontal) continue; if (gap.isHorizontal != isHorizontal) continue;
if (gap.Open < 0.01f) continue; if (gap.Open < 0.01f) continue;
if (gap.linkedTo[0]==currentHull && gap.linkedTo[1]!=null) if (gap.linkedTo.Count==1)
{
if (!adjacentHulls.Contains(gap.linkedTo[0] as Hull))
{
adjacentHulls.Add(gap.linkedTo[0] as Hull);
}
}
else if (gap.linkedTo[0] == currentHull && gap.linkedTo[1] != null)
{ {
if (!adjacentHulls.Contains(gap.linkedTo[1] as Hull)) if (!adjacentHulls.Contains(gap.linkedTo[1] as Hull))
{ {
+1 -1
View File
@@ -283,7 +283,7 @@ namespace Subsurface
if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1); if (subList.CountChildren > 0 && subList.Selected == null) subList.Select(-1);
if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1); if (GameModePreset.list.Count > 0 && modeList.Selected == null) modeList.Select(-1);
if (infoFrame.children.Find(c => c.UserData as string == "playyourself") == null) if (playerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
{ {
var playYourself = new GUITickBox(new Rectangle(-30, -30, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame); var playYourself = new GUITickBox(new Rectangle(-30, -30, 20, 20), "Play yourself", Alignment.TopLeft, playerFrame);
playYourself.Selected = GameMain.Server.CharacterInfo != null; playYourself.Selected = GameMain.Server.CharacterInfo != null;
@@ -176,6 +176,8 @@ namespace Subsurface
lowpassHFGain = 0.2f; lowpassHFGain = 0.2f;
} }
lowpassHFGain *= Character.Controlled.LowPassMultiplier;
} }
//how fast the sub is moving, scaled to 0.0 -> 1.0 //how fast the sub is moving, scaled to 0.0 -> 1.0
+15 -3
View File
@@ -161,9 +161,18 @@ namespace Subsurface
public static bool GetAttributeBool(XElement element, string name, bool defaultValue) public static bool GetAttributeBool(XElement element, string name, bool defaultValue)
{ {
if (element.Attribute(name) == null) return defaultValue; var attribute = element.Attribute(name);
if (attribute == null) return defaultValue;
string val = element.Attribute(name).Value.ToLower().Trim(); string val = attribute.Value.ToLower().Trim();
return GetAttributeBool(attribute, defaultValue);
}
public static bool GetAttributeBool(XAttribute attribute, bool defaultValue)
{
if (attribute == null) return defaultValue;
string val = attribute.Value.ToLower().Trim();
if (val == "true") if (val == "true")
{ {
return true; return true;
@@ -174,10 +183,13 @@ namespace Subsurface
} }
else else
{ {
DebugConsole.ThrowError("Error in " + element + "! ''" + val + "'' is not a valid boolean value"); DebugConsole.ThrowError("Error in " + attribute.Value.ToString() + "! ''" + val + "'' is not a valid boolean value");
return false; return false;
} }
} }
public static Vector2 GetAttributeVector2(XElement element, string name, Vector2 defaultValue) public static Vector2 GetAttributeVector2(XElement element, string name, Vector2 defaultValue)
{ {
if (element.Attribute(name) == null) return defaultValue; if (element.Attribute(name) == null) return defaultValue;
Binary file not shown.