Limb collisions can damage hull again, new UI for steering, sonar & reactor, fabricators can require more than one of each ingredient, timer for character imploding, AICharacter position syncing changes, watcher, commands can also be given to controlled character

This commit is contained in:
Regalis
2016-01-13 22:19:01 +02:00
parent 5513637fe5
commit eb20af622d
23 changed files with 400 additions and 204 deletions
@@ -154,6 +154,63 @@ namespace Barotrauma.Items.Components
powerPerTemp = 1.0f;
IsActive = true;
var button = new GUIButton(new Rectangle(410, 70, 40,40), "+", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
ShutDownTemp += 100.0f;
return true;
};
button = new GUIButton(new Rectangle(460, 70, 40, 40), "-", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
ShutDownTemp -= 100.0f;
return true;
};
button = new GUIButton(new Rectangle(410, 170, 100, 40), "TURN ON", GUI.Style, GuiFrame);
button.OnClicked = ToggleAutoTemp;
button = new GUIButton(new Rectangle(210, 290, 40, 40), "+", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
FissionRate += 1.0f;
return true;
};
button = new GUIButton(new Rectangle(210, 340, 40, 40), "-", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
FissionRate -= 1.0f;
return true;
};
button = new GUIButton(new Rectangle(500, 290, 40, 40), "+", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
CoolingRate += 1.0f;
return true;
};
button = new GUIButton(new Rectangle(500, 340, 40, 40), "-", GUI.Style, GuiFrame);
button.OnPressed = () =>
{
unsentChanges = true;
CoolingRate -= 1.0f;
return true;
};
}
public override void Update(float deltaTime, Camera cam)
@@ -231,7 +288,7 @@ namespace Barotrauma.Items.Components
}
//fission rate can't be lowered below a certain amount if the core is too hot
FissionRate = Math.Max(fissionRate, heat / 200.0f);
//FissionRate = Math.Max(fissionRate, heat / 200.0f);
//the power generated by the reactor is equal to the temperature
currPowerConsumption = -temperature*powerPerTemp;
@@ -372,6 +429,7 @@ namespace Barotrauma.Items.Components
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
GuiFrame.Update(1.0f / 60.0f);
GuiFrame.Draw(spriteBatch);
float xOffset = (graphTimer / (float)updateGraphInterval);
@@ -390,61 +448,32 @@ namespace Barotrauma.Items.Components
new Rectangle(x + 30, y + 30, 400, 250), 10000.0f, xOffset, Color.Yellow);
spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + shutDownTemp, new Vector2(x + 450, y + 80), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 110, 40, 40), "+", true))
{
unsentChanges = true;
ShutDownTemp += 100.0f;
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 500, y + 110, 40, 40), "-", true))
{
unsentChanges = true;
ShutDownTemp -= 100.0f;
}
spriteBatch.DrawString(GUI.Font, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 450, y + 210, 100, 40), ((autoTemp) ? "TURN OFF" : "TURN ON")))
{
unsentChanges = true;
autoTemp = !autoTemp;
}
y += 300;
spriteBatch.DrawString(GUI.Font, "Fission rate: " + (int)fissionRate + " %", new Vector2(x + 30, y), Color.White);
DrawGraph(fissionRateGraph, spriteBatch,
new Rectangle(x + 30, y + 30, 200, 100), 100.0f, xOffset, Color.Orange);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 30, 40, 40), "+", true))
{
unsentChanges = true;
FissionRate += 1.0f;
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 80, 40, 40), "-", true))
{
unsentChanges = true;
FissionRate -= 1.0f;
}
spriteBatch.DrawString(GUI.Font, "Cooling rate: " + (int)coolingRate + " %", new Vector2(x + 320, y), Color.White);
DrawGraph(coolingRateGraph, spriteBatch,
new Rectangle(x + 320, y + 30, 200, 100), 100.0f, xOffset, Color.LightBlue);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 30, 40, 40), "+", true))
{
unsentChanges = true;
CoolingRate += 1.0f;
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 540, y + 80, 40, 40), "-", true))
{
unsentChanges = true;
CoolingRate -= 1.0f;
}
//y = y - 260;
}
private bool ToggleAutoTemp(GUIButton button, object userdata)
{
unsentChanges = true;
autoTemp = !autoTemp;
button.Text = autoTemp ? "TURN OFF" : "TURN ON";
return true;
}
static void UpdateGraph<T>(IList<T> graph, T newValue)