Endworm attacks working, itemlabel text saving bugfix, deconstructors & fabricators need power, engine sprite, disable wire node dragging in character mode, only hit with one meleeweapon at a time, fixrequirement text overflow fix, mapentities can hace multiple categories, Gap.FindHull fix, Waypoint ladder & gap saving, stuff
This commit is contained in:
@@ -54,6 +54,17 @@ namespace Barotrauma.Items.Components
|
||||
if (character == null || reloadTimer>0.0f) return false;
|
||||
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
|
||||
|
||||
//don't allow hitting if the character is already hitting with another weapon
|
||||
for (int i = 0; i < 2; i++ )
|
||||
{
|
||||
if (character.SelectedItems[i] == null || character.SelectedItems[i] == Item) continue;
|
||||
|
||||
var otherWeapon = character.SelectedItems[i].GetComponent<MeleeWeapon>();
|
||||
if (otherWeapon == null) continue;
|
||||
|
||||
if (otherWeapon.hitting) return false;
|
||||
}
|
||||
|
||||
SetUser(character);
|
||||
|
||||
if (hitPos < MathHelper.Pi * 0.69f) return false;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Barotrauma.Items.Components
|
||||
[HasDefaultValue("", true), Editable(100)]
|
||||
public string Text
|
||||
{
|
||||
get { return textBlock.Text; }
|
||||
get { return textBlock.Text.Replace("\n", ""); }
|
||||
set
|
||||
{
|
||||
if (value == TextBlock.Text || item.Rect.Width < 5) return;
|
||||
|
||||
@@ -8,7 +8,7 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
class Deconstructor : ItemComponent
|
||||
class Deconstructor : Powered
|
||||
{
|
||||
GUIProgressBar progressBar;
|
||||
GUIButton activateButton;
|
||||
@@ -39,7 +39,12 @@ namespace Barotrauma.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
progressTimer += deltaTime;
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (powerConsumption == 0.0f) voltage = 1.0f;
|
||||
|
||||
progressTimer += deltaTime*voltage;
|
||||
Voltage -= deltaTime * 10.0f;
|
||||
|
||||
var targetItem = container.Inventory.Items.FirstOrDefault(i => i != null);
|
||||
progressBar.BarSize = Math.Min(progressTimer / targetItem.Prefab.DeconstructTime, 1.0f);
|
||||
@@ -83,6 +88,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
SetActive(!IsActive);
|
||||
|
||||
currPowerConsumption = IsActive ? powerConsumption : 0.0f;
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Barotrauma.Items.Components
|
||||
if (powerConsumption == 0.0f) voltage = 1.0f;
|
||||
|
||||
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
|
||||
if (Force != 0.0f)
|
||||
if (Force > 1.0f)
|
||||
{
|
||||
Vector2 currForce = new Vector2((force / 100.0f) * maxForce * (voltage / minVoltage), 0.0f);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition,
|
||||
var bubbles = GameMain.ParticleManager.CreateParticle("bubbles", item.WorldPosition - (Vector2.UnitX * item.Rect.Width/2),
|
||||
-currForce / 5.0f + new Vector2(Rand.Range(-100.0f, 100.0f), Rand.Range(-50f, 50f)),
|
||||
0.0f, item.CurrentHull);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
class Fabricator : ItemComponent
|
||||
class Fabricator : Powered
|
||||
{
|
||||
private List<FabricableItem> fabricableItems;
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private GUIFrame selectedItemFrame;
|
||||
|
||||
GUIProgressBar progressBar;
|
||||
GUIButton activateButton;
|
||||
private GUIProgressBar progressBar;
|
||||
private GUIButton activateButton;
|
||||
|
||||
private FabricableItem fabricatedItem;
|
||||
private float timeUntilReady;
|
||||
@@ -208,6 +208,8 @@ namespace Barotrauma.Items.Components
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
containers[0].Inventory.Locked = true;
|
||||
containers[1].Inventory.Locked = true;
|
||||
|
||||
currPowerConsumption = powerConsumption;
|
||||
}
|
||||
|
||||
private void CancelFabricating()
|
||||
@@ -216,6 +218,8 @@ namespace Barotrauma.Items.Components
|
||||
IsActive = false;
|
||||
fabricatedItem = null;
|
||||
|
||||
currPowerConsumption = 0.0f;
|
||||
|
||||
if (activateButton != null)
|
||||
{
|
||||
activateButton.Text = "Create";
|
||||
@@ -231,13 +235,19 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
timeUntilReady -= deltaTime;
|
||||
|
||||
if (progressBar!=null)
|
||||
{
|
||||
progressBar.BarSize = fabricatedItem == null ? 0.0f : (fabricatedItem.RequiredTime - timeUntilReady) / fabricatedItem.RequiredTime;
|
||||
}
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (powerConsumption == 0) voltage = 1.0f;
|
||||
|
||||
timeUntilReady -= deltaTime*voltage;
|
||||
|
||||
voltage -= deltaTime * 10.0f;
|
||||
|
||||
if (timeUntilReady > 0.0f) return;
|
||||
|
||||
var containers = item.GetComponents<ItemContainer>();
|
||||
|
||||
@@ -406,14 +406,14 @@ namespace Barotrauma.Items.Components
|
||||
//temperature too high/low
|
||||
if (Math.Abs(tempDiff)>500.0f)
|
||||
{
|
||||
autoTemp = false;
|
||||
AutoTemp = false;
|
||||
FissionRate += deltaTime * 100.0f * Math.Sign(tempDiff);
|
||||
CoolingRate -= deltaTime * 100.0f * Math.Sign(tempDiff);
|
||||
}
|
||||
//temperature OK
|
||||
else
|
||||
{
|
||||
autoTemp = true;
|
||||
AutoTemp = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -566,7 +566,7 @@ namespace Barotrauma.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
autoTemp = newAutoTemp;
|
||||
AutoTemp = newAutoTemp;
|
||||
Temperature = newTemperature;
|
||||
ShutDownTemp = newShutDownTemp;
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace Barotrauma.Items.Components
|
||||
pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f));
|
||||
|
||||
//damage the item if voltage is too high
|
||||
if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * 2.0f, 200.0f)) continue;
|
||||
if (-pt.currPowerConsumption < Math.Max(pt.powerLoad * Rand.Range(1.95f,2.05f), 200.0f)) continue;
|
||||
|
||||
|
||||
float prevCondition = pt.item.Condition;
|
||||
pt.item.Condition -= deltaTime * 10.0f;
|
||||
|
||||
@@ -328,8 +328,8 @@ namespace Barotrauma.Items.Components
|
||||
//nodes.Add(newNodePos);
|
||||
}
|
||||
|
||||
if (!editing || !PlayerInput.MouseInsideWindow) return;
|
||||
|
||||
if (!editing || !PlayerInput.MouseInsideWindow || GameMain.EditMapScreen.CharacterMode) return;
|
||||
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
{
|
||||
Vector2 worldPos = Nodes[i];
|
||||
@@ -347,13 +347,13 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
|
||||
MapEntity.DisableSelect = true;
|
||||
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
||||
|
||||
if (selectedNodeIndex == null && draggingWire == null)// && !MapEntity.SelectedAny)
|
||||
{
|
||||
if (PlayerInput.LeftButtonDown() && PlayerInput.GetOldMouseState.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
|
||||
{
|
||||
MapEntity.DisableSelect = true;
|
||||
MapEntity.SelectEntity(item);
|
||||
draggingWire = this;
|
||||
selectedNodeIndex = i;
|
||||
@@ -371,6 +371,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (selectedNodeIndex != null && draggingWire == this)
|
||||
{
|
||||
|
||||
MapEntity.DisableSelect = true;
|
||||
//Nodes[(int)selectedNodeIndex] = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition)-Submarine.HiddenSubPosition+Submarine.Loaded.Position;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user