-fixed a typo in fabricableItem requirement & added checking for said typos
- fixed being able to set battery recharge sped over the limits - fixed vents being added to OxygenGenerator.ventlist multiple times - fixed item.Submarine not being set if pulling an item from a fabricator - some tutorial fixes - fixed TraitorMode endmessage not being shown if the sub isn't at the end and neither character is dead - SalvageQuest fails if the item has been destroyed -
This commit is contained in:
@@ -134,6 +134,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
picker = character;
|
||||
|
||||
if (character != null) item.Submarine = character.Submarine;
|
||||
|
||||
if (item.body == null)
|
||||
{
|
||||
if (body!=null)
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
|
||||
if (throwPos < -0.0)
|
||||
{
|
||||
|
||||
Vector2 throwVector = picker.CursorPosition - picker.AnimController.RefLimb.Position;
|
||||
Vector2 throwVector = picker.CursorWorldPosition - picker.WorldPosition;
|
||||
throwVector = Vector2.Normalize(throwVector);
|
||||
|
||||
item.Drop();
|
||||
|
||||
@@ -94,18 +94,17 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
spriteBatch.DrawString(GUI.Font, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White);
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 30, 40, 40), "+", true))
|
||||
{
|
||||
targetForce += 1.0f;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
}
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 80, 40, 40), "-", true))
|
||||
{
|
||||
targetForce -= 1.0f;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 30, 40, 40), "+", true))
|
||||
{
|
||||
targetForce += 1.0f;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateBroken(float deltaTime, Camera cam)
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public FabricableItem(XElement element)
|
||||
{
|
||||
string name = ToolBox.GetAttributeString(element, "name", "").ToLower();
|
||||
string name = ToolBox.GetAttributeString(element, "name", "");
|
||||
|
||||
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == name) as ItemPrefab;
|
||||
TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == name.ToLower()) as ItemPrefab;
|
||||
if (TargetItem == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in Fabricable Item! Item ''" + element.Name + "'' not found.");
|
||||
DebugConsole.ThrowError("Error in fabricable item "+name+"! Item ''" + element.Name + "'' not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,12 @@ namespace Barotrauma.Items.Components
|
||||
foreach (string requiredItemName in requiredItemNames)
|
||||
{
|
||||
ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLower() == requiredItemName.Trim().ToLower()) as ItemPrefab;
|
||||
if (requiredItem == null) continue;
|
||||
if (requiredItem == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error in fabricable item " + name + "! Required item ''" + requiredItemName + "'' not found.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
var existing = RequiredItems.Find(r => r.Item1 == requiredItem);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
@@ -73,7 +74,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
running = true;
|
||||
|
||||
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 1000.0f;
|
||||
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount*100.0f;
|
||||
item.CurrentHull.Oxygen += CurrFlow * deltaTime;
|
||||
|
||||
UpdateVents(CurrFlow);
|
||||
@@ -88,7 +89,9 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
private void GetVents()
|
||||
{
|
||||
{
|
||||
ventList.Clear();
|
||||
|
||||
foreach (MapEntity entity in item.linkedTo)
|
||||
{
|
||||
Item linkedItem = entity as Item;
|
||||
@@ -101,7 +104,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void UpdateVents(float deltaOxygen)
|
||||
{
|
||||
if (ventList.Count == 0) return;
|
||||
if (!ventList.Any()) return;
|
||||
|
||||
deltaOxygen = deltaOxygen / ventList.Count;
|
||||
foreach (Vent v in ventList)
|
||||
|
||||
@@ -161,16 +161,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
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);
|
||||
var button = new GUIButton(new Rectangle(410, 70, 40, 40), "-", GUI.Style, GuiFrame);
|
||||
button.OnPressed = () =>
|
||||
{
|
||||
unsentChanges = true;
|
||||
@@ -179,6 +170,15 @@ namespace Barotrauma.Items.Components
|
||||
return true;
|
||||
};
|
||||
|
||||
button = new GUIButton(new Rectangle(460, 70, 40,40), "+", GUI.Style, GuiFrame);
|
||||
button.OnPressed = () =>
|
||||
{
|
||||
unsentChanges = true;
|
||||
ShutDownTemp += 100.0f;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
autoTempTickBox = new GUITickBox(new Rectangle(410, 170, 20, 20), "Automatic temperature control", Alignment.TopLeft, GuiFrame);
|
||||
autoTempTickBox.OnSelected = ToggleAutoTemp;
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace Barotrauma.Items.Components
|
||||
DrawGraph(loadGraph, spriteBatch,
|
||||
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);
|
||||
spriteBatch.DrawString(GUI.Font, "Shutdown Temperature: " + (int)shutDownTemp, new Vector2(x + 450, y + 80), Color.White);
|
||||
|
||||
//spriteBatch.DrawString(GUI.Font, "Automatic Temperature Control: " + ((autoTemp) ? "ON" : "OFF"), new Vector2(x + 450, y + 180), Color.White);
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Barotrauma.Items.Components
|
||||
var button = new GUIButton(new Rectangle(160, 50, 30,30), "-", GUI.Style, GuiFrame);
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
rechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f);
|
||||
RechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f);
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
return true;
|
||||
@@ -86,7 +86,7 @@ namespace Barotrauma.Items.Components
|
||||
button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame);
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
rechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f);
|
||||
RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f);
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
return true;
|
||||
@@ -213,8 +213,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.WriteRangedSingle(MathHelper.Clamp(rechargeSpeed/MaxRechargeSpeed, 0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(charge/capacity,0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(rechargeSpeed / MaxRechargeSpeed, 0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(charge / capacity, 0.0f, 1.0f), 0.0f, 1.0f, 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user