waypoint selection bug, unequipped captain uniform sprites, repairtool sounds & particle tweaking, wire overlap bug, connectionpanel loading bug, looting dead crew members

This commit is contained in:
Regalis
2015-08-04 20:11:59 +03:00
parent 9149408b36
commit 048eb5713f
24 changed files with 154 additions and 71 deletions
+7 -7
View File
@@ -18,12 +18,12 @@
pickdistance="150" pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="captainTorso.png" depth="0.4"/> <Sprite texture ="captainLegs.png" sourcerect="0,49,52,17" depth="0.4"/>
<Body radius="8" density="5"/> <Body width="52" height="17"/>
<Wearable slots="Torso"> <Wearable slots="Any,Torso">
<sprite texture="captainTorso.png" limb="Torso" sourcerect="0,3,30,58" origin="0.5,0.45" depth="0.01"/> <sprite texture="captainTorso.png" limb="Torso" sourcerect="0,3,30,58" origin="0.5,0.48" depth="0.01"/>
<sprite texture="captainTorso.png" limb="RightHand" sourcerect="47,0,15,39" origin="0.45,0.6"/> <sprite texture="captainTorso.png" limb="RightHand" sourcerect="47,0,15,39" origin="0.45,0.6"/>
<sprite texture="captainTorso.png" limb="LeftHand" sourcerect="47,0,15,39" origin="0.45,0.6" depth="0.14"/> <sprite texture="captainTorso.png" limb="LeftHand" sourcerect="47,0,15,39" origin="0.45,0.6" depth="0.14"/>
@@ -38,11 +38,11 @@
pickdistance="150" pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="captainLegs.png" depth="0.4"/> <Sprite texture ="captainLegs.png" sourcerect="0,67,51,13" depth="0.4"/>
<Body radius="8" density="5"/> <Body width="51" height="13"/>
<Wearable slots="Legs"> <Wearable slots="Any,Legs">
<sprite texture="captainLegs.png" limb="Waist" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/> <sprite texture="captainLegs.png" limb="Waist" sourcerect="0,0,1,1" origin="0.5,0.5" hidelimb="true"/>
<sprite texture="captainLegs.png" limb="RightThigh" sourcerect="52,34,28,46" origin="0.5,0.5" depth="0.10" hidelimb="true"/> <sprite texture="captainLegs.png" limb="RightThigh" sourcerect="52,34,28,46" origin="0.5,0.5" depth="0.10" hidelimb="true"/>
<sprite texture="captainLegs.png" limb="LeftThigh" sourcerect="52,34,28,46" origin="0.5,0.5" depth="0.14" hidelimb="true"/> <sprite texture="captainLegs.png" limb="LeftThigh" sourcerect="52,34,28,46" origin="0.5,0.5" depth="0.14" hidelimb="true"/>
@@ -20,7 +20,7 @@
pickdistance="200" pickdistance="200"
price="50"> price="50">
<Sprite texture ="DivingMask.png" depth="0.4"/> <Sprite texture ="DivingMask.png" depth="0.5"/>
<Body radius="18" density="5"/> <Body radius="18" density="5"/>
@@ -42,7 +42,7 @@
pickdistance="200" pickdistance="200"
price="200"> price="200">
<Sprite texture ="DivingSuit.png" sourcerect="82,15,46,113" depth="0.4"/> <Sprite texture ="DivingSuit.png" sourcerect="82,15,46,113" depth="0.5"/>
<Body width="37" height="113" density="5"/> <Body width="37" height="113" density="5"/>
+1 -1
View File
@@ -77,7 +77,7 @@
<Explosion range="5" damage="20" stun="10" force="5.0"/> <Explosion range="5" damage="20" stun="10" force="5.0"/>
</StatusEffect> </StatusEffect>
<LightComponent color="1.0,1.0,1.0,1.0" Flicker="0.5"> <LightComponent color="0.1,0.8,1.0,1.0" Flicker="0.5">
<sprite texture="Content/Items/Electricity/lightsprite.png" origin="0.5,0.5"/> <sprite texture="Content/Items/Electricity/lightsprite.png" origin="0.5,0.5"/>
</LightComponent> </LightComponent>
</RepairTool> </RepairTool>
@@ -11,8 +11,8 @@
<Body width="16" height="7"/> <Body width="16" height="7"/>
<Pickable slots="Any"> <Pickable slots="Any">
<StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Weapons/stunGrenade.ogg"> <StatusEffect type="OnBroken" target="This" Condition="-100.0" sound="Content/Items/Reactor/explosion.ogg">
<Explosion range="10.0" structuredamage="600" damage="100" stun="5" force="20.0"/> <Explosion range="5.0" structuredamage="300" damage="200" stun="5" force="20.0"/>
</StatusEffect> </StatusEffect>
</Pickable> </Pickable>
</Item> </Item>
+5 -2
View File
@@ -51,7 +51,7 @@
<Sprite texture ="railgunloader.png" depth =" 0.8"/> <Sprite texture ="railgunloader.png" depth =" 0.8"/>
<ItemContainer hideitems="false" drawinventory="true" capacity="5" itempos="54,-61" iteminterval="40,0" canbeselected = "true"> <ItemContainer hideitems="false" drawinventory="true" capacity="5" itempos="54,-61" iteminterval="40,0" itemrotation="-90" canbeselected = "true">
<Containable name="Railgun Shell"/> <Containable name="Railgun Shell"/>
</ItemContainer> </ItemContainer>
@@ -63,7 +63,7 @@
<Sprite texture ="railgunshell.png" depth ="0.5"/> <Sprite texture ="railgunshell.png" depth ="0.5"/>
<Body radius="9" height="67"/> <Body width="87" height="18"/>
<Holdable slots="BothHands" holdpos="0,-50" handle1="-10,0" handle2="10,0" aimable="false"/> <Holdable slots="BothHands" holdpos="0,-50" handle1="-10,0" handle2="10,0" aimable="false"/>
@@ -71,6 +71,9 @@
<Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/> <Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
</Projectile> </Projectile>
<ItemContainer hideitems="true" capacity="1" canbeselected = "true">
<Containable name="smallitem"/>
</ItemContainer>
</Item> </Item>
</Items> </Items>
+1 -1
View File
@@ -5,7 +5,7 @@
Tags="smallitem" Tags="smallitem"
pickdistance="150"> pickdistance="150">
<Sprite texture ="idcard.png"/> <Sprite texture ="idcard.png" depth="0.5f"/>
<Body width="16" height="16" density="10"/> <Body width="16" height="16" density="10"/>
@@ -87,10 +87,10 @@
<weld <weld
startsizemin="0.9,0.9" startsizemax="1.1,1.1" startsizemin="0.9,0.9" startsizemax="1.1,1.1"
sizechangemin="-0.1,-0.1" sizechangemax="0.1,0.1" sizechangemin="-4.0,-0.1" sizechangemax="-4.0,-0.5"
startcolor="1.0, 1.0, 1.0" startalpha="1.0" startcolor="1.0, 1.0, 1.0" startalpha="1.0"
colorchange="0.0, 0.0, -1.0, -5.0" colorchange="0.0, 0.0, 0.0, -4.0"
lifetime="0.5" lifetime="0.25"
inwater="false" inwater="false"
velocitychange="0.0, 0.0"> velocitychange="0.0, 0.0">
<sprite texture="Content/Particles/flames.png" sourcerect="0,0,128,64" origin="0.15,0.5"/> <sprite texture="Content/Particles/flames.png" sourcerect="0,0,128,64" origin="0.15,0.5"/>
@@ -98,10 +98,10 @@
<plasma <plasma
startsizemin="0.9,0.9" startsizemax="1.1,1.1" startsizemin="0.9,0.9" startsizemax="1.1,1.1"
sizechangemin="-0.1,-0.1" sizechangemax="0.1,0.1" sizechangemin="-4.0,-0.5" sizechangemax="-4.0,-0.5"
startcolor="1.0, 1.0, 1.0" startalpha="1.0" startcolor="1.0, 1.0, 1.0" startalpha="1.0"
colorchange="0.0, 0.0, -1.0, -5.0" colorchange="0.0, 0.0, 0.0, -4.0"
lifetime="0.5" lifetime="0.25"
inwater="false" inwater="false"
velocitychange="0.0, 0.0"> velocitychange="0.0, 0.0">
<sprite texture="Content/Particles/flames.png" sourcerect="0,64,128,64" origin="0.15,0.5"/> <sprite texture="Content/Particles/flames.png" sourcerect="0,64,128,64" origin="0.15,0.5"/>
+68 -18
View File
@@ -34,7 +34,7 @@ namespace Subsurface
public readonly bool IsNetworkPlayer; public readonly bool IsNetworkPlayer;
private Inventory inventory; private CharacterInventory inventory;
public double LastNetworkUpdate; public double LastNetworkUpdate;
@@ -66,6 +66,7 @@ namespace Subsurface
protected float maxHealth; protected float maxHealth;
protected Item closestItem; protected Item closestItem;
private Character closestCharacter, selectedCharacter;
protected bool isDead; protected bool isDead;
@@ -93,7 +94,6 @@ namespace Subsurface
protected float soundInterval; protected float soundInterval;
private float bleeding; private float bleeding;
//private float blood;
private Sound[] sounds; private Sound[] sounds;
private float[] soundRange; private float[] soundRange;
@@ -113,7 +113,7 @@ namespace Subsurface
get { return AnimController.Mass; } get { return AnimController.Mass; }
} }
public Inventory Inventory public CharacterInventory Inventory
{ {
get { return inventory; } get { return inventory; }
} }
@@ -301,11 +301,11 @@ 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)
{ {
selectKeyHit = new Key(false); selectKeyHit = new Key(false);
actionKeyDown = new Key(true); actionKeyDown = new Key(true);
actionKeyHit = new Key(false); actionKeyHit = new Key(false);
secondaryKeyHit = new Key(false); secondaryKeyHit = new Key(false);
secondaryKeyDown = new Key(true); secondaryKeyDown = new Key(true);
selectedItems = new Item[2]; selectedItems = new Item[2];
@@ -330,7 +330,7 @@ namespace Subsurface
{ {
AnimController = new HumanoidAnimController(this, doc.Root.Element("ragdoll")); AnimController = new HumanoidAnimController(this, doc.Root.Element("ragdoll"));
AnimController.TargetDir = Direction.Right; AnimController.TargetDir = Direction.Right;
inventory = new CharacterInventory(10, this); inventory = new CharacterInventory(15, this);
} }
else else
{ {
@@ -432,11 +432,15 @@ namespace Subsurface
} }
Item item = new Item(itemPrefab, Position); Item item = new Item(itemPrefab, Position);
inventory.TryPutItem(item, item.AllowedSlots, false);
if (info.Job.EquipSpawnItem[i]) if (info.Job.EquipSpawnItem[i])
{ {
item.Equip(this); inventory.TryPutItem(item,
item.AllowedSlots.HasFlag(LimbSlot.Any) ? item.AllowedSlots & ~LimbSlot.Any : item.AllowedSlots, false);
}
else
{
inventory.TryPutItem(item, item.AllowedSlots, false);
} }
if (item.Prefab.Name == "ID Card" && spawnPoint != null) if (item.Prefab.Name == "ID Card" && spawnPoint != null)
@@ -460,8 +464,7 @@ namespace Subsurface
//find the closest item if selectkey has been hit, or if the character is being //find the closest item if selectkey has been hit, or if the character is being
//controlled by the player (in order to highlight it) //controlled by the player (in order to highlight it)
//closestItem = null; if (controlled == this)
if (controlled==this)
{ {
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition)); Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cam.ScreenToWorld(PlayerInput.MousePosition));
closestItem = FindClosestItem(mouseSimPos); closestItem = FindClosestItem(mouseSimPos);
@@ -474,6 +477,13 @@ namespace Subsurface
new NetworkEvent(NetworkEventType.PickItem, ID, true, closestItem.ID); new NetworkEvent(NetworkEventType.PickItem, ID, true, closestItem.ID);
} }
} }
closestCharacter = FindClosestCharacter(mouseSimPos);
if (closestCharacter != selectedCharacter) selectedCharacter = null;
if (closestCharacter!=null)
{
if (selectKeyHit.State) selectedCharacter = (selectedCharacter==null) ? closestCharacter : null;
}
} }
for (int i = 0; i < selectedItems.Length; i++ ) for (int i = 0; i < selectedItems.Length; i++ )
@@ -509,6 +519,31 @@ namespace Subsurface
return Item.FindPickable(pos, selectedConstruction == null ? mouseSimPos : selectedConstruction.SimPosition, null, selectedItems); return Item.FindPickable(pos, selectedConstruction == null ? mouseSimPos : selectedConstruction.SimPosition, null, selectedItems);
} }
private Character FindClosestCharacter(Vector2 mouseSimPos, float maxDist = 150.0f)
{
Character closestCharacter = null;
float closestDist = 0.0f;
maxDist = ConvertUnits.ToSimUnits(maxDist);
foreach (Character c in Character.CharacterList)
{
if (c == this) continue;
if (Vector2.Distance(SimPosition, c.SimPosition) > maxDist) continue;
float dist = Vector2.Distance(mouseSimPos, c.SimPosition);
if (dist < maxDist && closestCharacter==null || dist<closestDist)
{
closestCharacter = c;
closestDist = dist;
continue;
}
}
return closestCharacter;
}
/// <summary> /// <summary>
/// Control the character according to player input /// Control the character according to player input
/// </summary> /// </summary>
@@ -743,10 +778,10 @@ namespace Subsurface
private static GUIProgressBar drowningBar, healthBar; private static GUIProgressBar drowningBar, healthBar;
public void DrawHud(SpriteBatch spriteBatch, Camera cam) public void DrawHud(SpriteBatch spriteBatch, Camera cam)
{ {
if (drowningBar==null) if (drowningBar == null)
{ {
int width = 100, height = 20; int width = 100, height = 20;
drowningBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight/2, width, height), Color.Blue, 1.0f); drowningBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight / 2, width, height), Color.Blue, 1.0f);
healthBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight / 2 + 30, width, height), Color.Red, 1.0f); healthBar = new GUIProgressBar(new Rectangle(20, Game1.GraphicsHeight / 2 + 30, width, height), Color.Red, 1.0f);
} }
@@ -757,11 +792,26 @@ namespace Subsurface
healthBar.BarSize = health / maxHealth; healthBar.BarSize = health / maxHealth;
if (healthBar.BarSize < 1.0f) healthBar.Draw(spriteBatch); if (healthBar.BarSize < 1.0f) healthBar.Draw(spriteBatch);
if (Controlled.Inventory != null) Controlled.Inventory.Draw(spriteBatch); if (Controlled.Inventory != null) Controlled.Inventory.DrawOwn(spriteBatch);
if (closestItem != null && selectedConstruction==null) Color color = Color.Orange;
if (closestCharacter != null && closestCharacter.isDead)
{
Vector2 startPos = Position + (closestCharacter.Position - Position) * 0.7f;
startPos = cam.WorldToScreen(startPos);
Vector2 textPos = startPos;
float stringWidth = GUI.Font.MeasureString(closestCharacter.Info.Name).X;
textPos -= new Vector2(stringWidth / 2, 20);
spriteBatch.DrawString(GUI.Font, closestCharacter.Info.Name, textPos, Color.Black);
spriteBatch.DrawString(GUI.Font, closestCharacter.Info.Name, textPos + new Vector2(1, -1), Color.Orange);
if (selectedCharacter==closestCharacter) closestCharacter.inventory.Draw(spriteBatch);
}
else if (closestItem != null && selectedConstruction==null)
{ {
Color color = Color.Orange;
Vector2 startPos = Position + (closestItem.Position - Position) * 0.7f; Vector2 startPos = Position + (closestItem.Position - Position) * 0.7f;
startPos = cam.WorldToScreen(startPos); startPos = cam.WorldToScreen(startPos);
@@ -19,7 +19,8 @@ namespace Subsurface
private static LimbSlot[] limbSlots = new LimbSlot[] { private static LimbSlot[] limbSlots = new LimbSlot[] {
LimbSlot.Head, LimbSlot.Torso, LimbSlot.Legs, LimbSlot.LeftHand, LimbSlot.RightHand, LimbSlot.Head, LimbSlot.Torso, LimbSlot.Legs, LimbSlot.LeftHand, LimbSlot.RightHand,
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any }; LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any,
LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any, LimbSlot.Any};
private Vector2[] slotPositions; private Vector2[] slotPositions;
@@ -52,12 +53,12 @@ namespace Subsurface
case 4: case 4:
slotPositions[i] = new Vector2( slotPositions[i] = new Vector2(
spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 3), spacing * 2 + rectWidth + (spacing + rectWidth) * (i - 3),
Game1.GraphicsHeight - (spacing + rectHeight)); Game1.GraphicsHeight - (spacing + rectHeight)*3);
break; break;
default: default:
slotPositions[i] = new Vector2( slotPositions[i] = new Vector2(
spacing * (4 + (i - 5)) + rectWidth * (3 + (i - 5)), spacing * 2 + rectWidth + (spacing + rectWidth) * ((i - 3)%5),
Game1.GraphicsHeight - (spacing + rectHeight)); Game1.GraphicsHeight - (spacing + rectHeight) * ((i>9) ? 2 : 1));
break; break;
} }
} }
@@ -212,7 +213,7 @@ namespace Subsurface
} }
public override void Draw(SpriteBatch spriteBatch) public void DrawOwn(SpriteBatch spriteBatch)
{ {
if (doubleClickedItem!=null && doubleClickedItem.inventory!=this) if (doubleClickedItem!=null && doubleClickedItem.inventory!=this)
{ {
@@ -251,7 +252,7 @@ namespace Subsurface
slotRect.Y = (int)slotPositions[i].Y; slotRect.Y = (int)slotPositions[i].Y;
UpdateSlot(spriteBatch, slotRect, i, items[i], false); UpdateSlot(spriteBatch, slotRect, i, items[i], i>4);
if (draggingItem!=null && draggingItem == items[i]) draggingItemSlot = slotRect; if (draggingItem!=null && draggingItem == items[i]) draggingItemSlot = slotRect;
} }
@@ -58,8 +58,8 @@ namespace Subsurface.Items.Components
[HasDefaultValue(0.0f, false)] [HasDefaultValue(0.0f, false)]
public float ItemRotation public float ItemRotation
{ {
get { return itemRotation; } get { return MathHelper.ToDegrees(itemRotation); }
set { itemRotation = value; } set { itemRotation = MathHelper.ToRadians(value); }
} }
private float itemRotation; private float itemRotation;
@@ -183,6 +183,17 @@ namespace Subsurface.Items.Components
if (!attachable || item.body==null) return true; if (!attachable || item.body==null) return true;
item.Drop(); item.Drop();
var containedItems = item.ContainedItems;
if (containedItems!=null)
{
foreach (Item contained in containedItems)
{
if (contained.body == null) continue;
contained.SetTransform(item.SimPosition, contained.body.Rotation);
}
}
item.body.Enabled = false; item.body.Enabled = false;
item.body = null; item.body = null;
@@ -124,7 +124,7 @@ namespace Subsurface.Items.Components
Body targetBody = Submarine.PickBody(TransformedBarrelPos, targetPosition, ignoredBodies); Body targetBody = Submarine.PickBody(TransformedBarrelPos, targetPosition, ignoredBodies);
pickedPosition = Submarine.LastPickedPosition; pickedPosition = Submarine.LastPickedPosition;
if (targetBody==null || targetBody.UserData==null) return true; if (targetBody == null || targetBody.UserData == null) return true;
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character); //ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
@@ -552,8 +552,6 @@ namespace Subsurface.Items.Components
{ {
if (componentElement == null) return; if (componentElement == null) return;
foreach (XAttribute attribute in componentElement.Attributes()) foreach (XAttribute attribute in componentElement.Attributes())
{ {
ObjectProperty property = null; ObjectProperty property = null;
@@ -179,6 +179,10 @@ namespace Subsurface.Items.Components
foreach (Item contained in item.ContainedItems) foreach (Item contained in item.ContainedItems)
{ {
contained.Condition = 0.0f; contained.Condition = 0.0f;
if (contained.body!=null)
{
contained.body.SetTransform(item.SimPosition, contained.body.Rotation);
}
} }
return true; return true;
@@ -28,7 +28,7 @@ namespace Subsurface.Items.Components
private List<StatusEffect> effects; private List<StatusEffect> effects;
int[] wireId; public readonly int[] wireId;
public List<Connection> Recipients public List<Connection> Recipients
{ {
@@ -463,7 +463,7 @@ namespace Subsurface.Items.Components
} }
} }
wireId = null; //wireId = null;
} }
} }
@@ -75,20 +75,25 @@ namespace Subsurface.Items.Components
{ {
base.Load(element); base.Load(element);
connections.Clear(); List<Connection> loadedConnections = new List<Connection>();
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
switch (subElement.Name.ToString()) switch (subElement.Name.ToString())
{ {
case "input": case "input":
connections.Add(new Connection(subElement, item)); loadedConnections.Add(new Connection(subElement, item));
break; break;
case "output": case "output":
connections.Add(new Connection(subElement, item)); loadedConnections.Add(new Connection(subElement, item));
break; break;
} }
} }
for (int i = 0; i<loadedConnections.Count && i<connections.Count; i++)
{
loadedConnections[i].wireId.CopyTo(connections[i].wireId, 0);
}
} }
public override void Remove() public override void Remove()
@@ -274,12 +274,12 @@ namespace Subsurface.Items.Components
for (int i = 1; i < Nodes.Count; i++) for (int i = 1; i < Nodes.Count; i++)
{ {
DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], i, item.Color); DrawSection(spriteBatch, Nodes[i], Nodes[i - 1], item.Color);
} }
if (isActive && Vector2.Distance(newNodePos, Nodes[Nodes.Count - 1]) > nodeDistance) if (isActive && Vector2.Distance(newNodePos, Nodes[Nodes.Count - 1]) > nodeDistance)
{ {
DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, Nodes.Count, item.Color * 0.5f); DrawSection(spriteBatch, Nodes[Nodes.Count - 1], newNodePos, item.Color * 0.5f);
//nodes.Add(newNodePos); //nodes.Add(newNodePos);
} }
@@ -333,7 +333,7 @@ selectedNodeIndex = null;
} }
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, int i, Color color) private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color)
{ {
start.Y = -start.Y; start.Y = -start.Y;
end.Y = -end.Y; end.Y = -end.Y;
@@ -344,7 +344,7 @@ selectedNodeIndex = null;
new Vector2(0.0f, wireSprite.size.Y / 2.0f), new Vector2(0.0f, wireSprite.size.Y / 2.0f),
new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, 0.3f), new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, 0.3f),
SpriteEffects.None, SpriteEffects.None,
wireSprite.Depth + 0.1f + i * 0.00001f); wireSprite.Depth + ((item.ID % 100) * 0.00001f));
} }
public override XElement Save(XElement parentElement) public override XElement Save(XElement parentElement)
+10 -2
View File
@@ -450,13 +450,21 @@ namespace Subsurface
{ {
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive; if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
if (!ic.WasUsed) ic.StopSounds(ActionType.OnUse); //if (!ic.WasUsed)
ic.WasUsed = false; //{
// if (ic.Name == "RepairTool" && ic.IsActive)
// {
// System.Diagnostics.Debug.WriteLine("stop sounds");
// }
// ic.StopSounds(ActionType.OnUse);
//}
//ic.WasUsed = false;
if (!ic.IsActive) if (!ic.IsActive)
{ {
ic.StopSounds(ActionType.OnActive); ic.StopSounds(ActionType.OnActive);
ic.StopSounds(ActionType.OnUse);
continue; continue;
} }
if (condition > 0.0f) if (condition > 0.0f)
+1 -1
View File
@@ -436,7 +436,7 @@ namespace Subsurface
float dragCoefficient = 0.00001f; float dragCoefficient = 0.00001f;
float speedLength = speed.Length(); float speedLength = (speed == Vector2.Zero) ? 0.0f : speed.Length();
float drag = speedLength * speedLength * dragCoefficient * mass; float drag = speedLength * speedLength * dragCoefficient * mass;
if (speed != Vector2.Zero) if (speed != Vector2.Zero)
+1 -1
View File
@@ -73,7 +73,7 @@ namespace Subsurface
public override void DrawEditing(SpriteBatch spriteBatch, Camera cam) public override void DrawEditing(SpriteBatch spriteBatch, Camera cam)
{ {
if (editingHUD==null) if (editingHUD == null || editingHUD.UserData != this)
{ {
editingHUD = CreateEditingHUD(); editingHUD = CreateEditingHUD();
} }
@@ -258,7 +258,6 @@ namespace Subsurface.Networking
{ {
Character.Controlled = null; Character.Controlled = null;
Game1.GameScreen.Cam.TargetPos = Vector2.Zero; Game1.GameScreen.Cam.TargetPos = Vector2.Zero;
Game1.GameScreen.Cam.Zoom = 1.0f;
} }
else else
{ {
+1 -2
View File
@@ -162,8 +162,7 @@ namespace Subsurface.Particles
drawPosition = ConvertUnits.ToDisplayUnits(drawPosition); drawPosition = ConvertUnits.ToDisplayUnits(drawPosition);
prefab.sprite.Draw(spriteBatch, drawPosition, color*alpha, prefab.sprite.origin, drawRotation, size, SpriteEffects.None, prefab.sprite.Depth);
prefab.sprite.Draw(spriteBatch, drawPosition, color*alpha, drawRotation, size.X, SpriteEffects.None, prefab.sprite.Depth);
//spriteBatch.Draw( //spriteBatch.Draw(
// prefab.sprite.Texture, // prefab.sprite.Texture,
+5
View File
@@ -195,6 +195,11 @@ namespace Subsurface
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
} }
public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null)
{
spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
}
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Color color) public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Color color)
{ {
DrawTiled(spriteBatch, pos, targetSize, Vector2.Zero, color); DrawTiled(spriteBatch, pos, targetSize, Vector2.Zero, color);
Binary file not shown.