diff --git a/Subsurface/Content/Items/Reactor/reactor.xml b/Subsurface/Content/Items/Reactor/reactor.xml
index d2a637f34..758928870 100644
--- a/Subsurface/Content/Items/Reactor/reactor.xml
+++ b/Subsurface/Content/Items/Reactor/reactor.xml
@@ -18,7 +18,7 @@
-
+
diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml
index d9db63348..178323658 100644
--- a/Subsurface/Content/Items/Weapons/weapons.xml
+++ b/Subsurface/Content/Items/Weapons/weapons.xml
@@ -49,13 +49,11 @@
-
+
-
-
diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs
index ffd8599f3..86fbf8737 100644
--- a/Subsurface/Source/Characters/Character.cs
+++ b/Subsurface/Source/Characters/Character.cs
@@ -732,11 +732,6 @@ namespace Subsurface
Vector2 healthBarPos = new Vector2(Position.X - 50, -Position.Y - 50.0f);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X - 2, (int)healthBarPos.Y - 2, 100 + 4, 15 + 4), Color.Black, false);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)healthBarPos.X, (int)healthBarPos.Y, (int)(100.0f * (health / maxHealth)), 15), Color.Red, true);
-
-
- //GUI.DrawLine(spriteBatch, ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y),
- // ConvertUnits.ToDisplayUnits(animController.limbs[0].SimPosition.X, animController.limbs[0].SimPosition.Y) +
- // ConvertUnits.ToDisplayUnits(animController.targetMovement.X, animController.targetMovement.Y), Color.Green);
}
diff --git a/Subsurface/Source/Items/Components/Machines/Pump.cs b/Subsurface/Source/Items/Components/Machines/Pump.cs
index 1d48fa454..d162e1e42 100644
--- a/Subsurface/Source/Items/Components/Machines/Pump.cs
+++ b/Subsurface/Source/Items/Components/Machines/Pump.cs
@@ -112,15 +112,24 @@ namespace Subsurface.Items.Components
targetLevel = null;
isActive = !isActive;
if (!isActive) currPowerConsumption = 0.0f;
+ item.NewComponentEvent(this, true);
}
spriteBatch.DrawString(GUI.Font, "Flow percentage: " + (int)flowPercentage + " %", new Vector2(x + 20, y + 80), Color.White);
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 200, y + 70, 40, 40), "+", true)) FlowPercentage += 1.0f;
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 70, 40, 40), "-", true)) FlowPercentage -= 1.0f;
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 200, y + 70, 40, 40), "+", true))
+ {
+ FlowPercentage += 1.0f;
+ item.NewComponentEvent(this, true);
+ }
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 70, 40, 40), "-", true))
+ {
+ FlowPercentage -= 1.0f;
+ item.NewComponentEvent(this, true);
+ }
- item.NewComponentEvent(this, true);
+
}
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
diff --git a/Subsurface/Source/Items/Components/Machines/Reactor.cs b/Subsurface/Source/Items/Components/Machines/Reactor.cs
index 0f8eae963..316512dbc 100644
--- a/Subsurface/Source/Items/Components/Machines/Reactor.cs
+++ b/Subsurface/Source/Items/Components/Machines/Reactor.cs
@@ -269,10 +269,12 @@ namespace Subsurface.Items.Components
}
+ bool valueChanged = false;
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
isActive = true;
+
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
@@ -291,27 +293,59 @@ namespace Subsurface.Items.Components
spriteBatch.DrawString(GUI.Font, "Fission rate: " + (int)fissionRate + " %", new Vector2(x + 30, y + 30), Color.White);
DrawGraph(fissionRateGraph, spriteBatch, x + 30, y + 50, 100.0f, xOffset);
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 30, 40, 40), "+", true)) FissionRate += 1.0f;
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 80, 40, 40), "-", true)) FissionRate -= 1.0f;
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 30, 40, 40), "+", true))
+ {
+ valueChanged = true;
+ FissionRate += 1.0f;
+ }
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 80, 40, 40), "-", true))
+ {
+ valueChanged = true;
+ FissionRate -= 1.0f;
+ }
y += 130;
spriteBatch.DrawString(GUI.Font, "Cooling rate: " + (int)coolingRate + " %", new Vector2(x + 30, y + 30), Color.White);
DrawGraph(coolingRateGraph, spriteBatch, x + 30, y + 50, 100.0f, xOffset);
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 30, 40, 40), "+", true)) CoolingRate += 1.0f;
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 80, 40, 40), "-", true)) CoolingRate -= 1.0f;
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 30, 40, 40), "+", true))
+ {
+ valueChanged = true;
+ CoolingRate += 1.0f;
+ }
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 280, y + 80, 40, 40), "-", true))
+ {
+ valueChanged = true;
+ CoolingRate -= 1.0f;
+ }
y = y - 260;
spriteBatch.DrawString(GUI.Font, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 400, y + 30), Color.White);
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 400, y + 60, 100, 40), ((autoTemp) ? "TURN OFF" : "TURN ON"))) autoTemp = !autoTemp;
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 400, y + 60, 100, 40), ((autoTemp) ? "TURN OFF" : "TURN ON")))
+ {
+ valueChanged = true;
+ autoTemp = !autoTemp;
+ }
spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + shutDownTemp, new Vector2(x + 400, y + 150), Color.White);
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 400, y + 180, 40, 40), "+", true)) shutDownTemp += 100.0f;
- if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 180, 40, 40), "-", true)) shutDownTemp -= 100.0f;
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 400, y + 180, 40, 40), "+", true))
+ {
+ valueChanged = true;
+ shutDownTemp += 100.0f;
+ }
+ if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 180, 40, 40), "-", true))
+ {
+ valueChanged = true;
+ shutDownTemp -= 100.0f;
+ }
- item.NewComponentEvent(this, true);
+ if (valueChanged)
+ {
+ item.NewComponentEvent(this, true);
+ valueChanged = false;
+ }
}
static void UpdateGraph(IList graph, T newValue)
diff --git a/Subsurface/Source/Items/Components/Machines/Steering.cs b/Subsurface/Source/Items/Components/Machines/Steering.cs
index f61e7c734..5b3054390 100644
--- a/Subsurface/Source/Items/Components/Machines/Steering.cs
+++ b/Subsurface/Source/Items/Components/Machines/Steering.cs
@@ -21,6 +21,9 @@ namespace Subsurface.Items.Components
private static PathFinder pathFinder;
+ private float networkUpdateTimer;
+ private bool valueChanged;
+
bool AutoPilot
{
get { return autoPilot; }
@@ -90,6 +93,16 @@ namespace Subsurface.Items.Components
TargetVelocity = targetSpeed*100.0f;
}
}
+ else if (valueChanged)
+ {
+ networkUpdateTimer -= deltaTime;
+ if (networkUpdateTimer<=0.0f)
+ {
+ item.NewComponentEvent(this, true);
+ networkUpdateTimer = 1.0f;
+ valueChanged = false;
+ }
+ }
item.SendSignal(targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out");
item.SendSignal((-targetVelocity.Y).ToString(CultureInfo.InvariantCulture), "velocity_y_out");
@@ -136,7 +149,7 @@ namespace Subsurface.Items.Components
targetVelocity = PlayerInput.MousePosition - new Vector2(velRect.Center.X, velRect.Center.Y);
targetVelocity.Y = -targetVelocity.Y;
- item.NewComponentEvent(this, true);
+ valueChanged = true;
}
}
}
diff --git a/Subsurface/Source/Items/Components/Power/PowerContainer.cs b/Subsurface/Source/Items/Components/Power/PowerContainer.cs
index 68ec01427..e6f7da900 100644
--- a/Subsurface/Source/Items/Components/Power/PowerContainer.cs
+++ b/Subsurface/Source/Items/Components/Power/PowerContainer.cs
@@ -195,9 +195,9 @@ namespace Subsurface.Items.Components
spriteBatch.DrawString(GUI.Font, "Recharge rate: " + (rechargeSpeed / maxRechargeSpeed), new Vector2(x + 30, y + 100), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 50, y + 150, 40, 40), "+", true))
- {
- item.NewComponentEvent(this, true);
+ {
rechargeSpeed = Math.Min(rechargeSpeed + 10.0f, maxRechargeSpeed);
+ item.NewComponentEvent(this, true);
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 150, 40, 40), "-", true))
diff --git a/Subsurface/Source/Items/Components/Signal/LightComponent.cs b/Subsurface/Source/Items/Components/Signal/LightComponent.cs
index 9b044c3fc..d10d2b8f9 100644
--- a/Subsurface/Source/Items/Components/Signal/LightComponent.cs
+++ b/Subsurface/Source/Items/Components/Signal/LightComponent.cs
@@ -38,7 +38,12 @@ namespace Subsurface.Items.Components
get { return ToolBox.Vector4ToString(lightColor.ToVector4()); }
set
{
- lightColor = new Color(ToolBox.ParseToVector4(value));
+ Vector4 newColor = ToolBox.ParseToVector4(value);
+ newColor.X = MathHelper.Clamp(newColor.X, 0.0f, 1.0f);
+ newColor.Y = MathHelper.Clamp(newColor.Y, 0.0f, 1.0f);
+ newColor.Z = MathHelper.Clamp(newColor.Z, 0.0f, 1.0f);
+ newColor.W = MathHelper.Clamp(newColor.W, 0.0f, 1.0f);
+ lightColor = new Color(newColor);
}
}
diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs
index 26b59ee79..0554968e8 100644
--- a/Subsurface/Source/Networking/GameClient.cs
+++ b/Subsurface/Source/Networking/GameClient.cs
@@ -500,6 +500,8 @@ namespace Subsurface.Networking
character.ID = ID;
character.Inventory.ID = inventoryID;
+ character.IsNetworkPlayer = true;
+
character.GiveJobItems(closestWaypoint);
return character;
@@ -516,7 +518,7 @@ namespace Subsurface.Networking
msg.Write((byte)type);
msg.Write(message);
- client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
+ client.SendMessage(msg, NetDeliveryMethod.Unreliable);
}
///
diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs
index a400bc616..d1f497177 100644
--- a/Subsurface/Source/Networking/GameServer.cs
+++ b/Subsurface/Source/Networking/GameServer.cs
@@ -439,11 +439,9 @@ namespace Subsurface.Networking
public void EndGame(string endMessage)
{
- Submarine.Unload();
-
- gameStarted = false;
- if (connectedClients.Count>0)
+
+ if (connectedClients.Count > 0)
{
NetOutgoingMessage msg = server.CreateMessage();
msg.Write((byte)PacketTypes.EndGame);
@@ -461,6 +459,10 @@ namespace Subsurface.Networking
}
}
+ Submarine.Unload();
+
+ gameStarted = false;
+
Game1.NetLobbyScreen.Select();
DebugConsole.ThrowError(endMessage);
@@ -565,12 +567,12 @@ namespace Subsurface.Networking
}
if (recipients.Count>0)
{
- server.SendMessage(msg, recipients, NetDeliveryMethod.ReliableUnordered, 0);
+ server.SendMessage(msg, recipients, NetDeliveryMethod.Unreliable, 0);
}
}
else
{
- server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0);
+ server.SendMessage(msg, server.Connections, NetDeliveryMethod.Unreliable, 0);
}
}
diff --git a/Subsurface/Source/Networking/NetworkEvent.cs b/Subsurface/Source/Networking/NetworkEvent.cs
index c7892d490..e2d699ffc 100644
--- a/Subsurface/Source/Networking/NetworkEvent.cs
+++ b/Subsurface/Source/Networking/NetworkEvent.cs
@@ -18,7 +18,7 @@ namespace Subsurface.Networking
{
public static List events = new List();
- private static bool[] isImportant = { false, true, true, true, true, true };
+ private static bool[] isImportant = { false, true, false, true, true, true };
private int id;
diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo
index 51bbc9abe..8fc1e8c16 100644
Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ