diff --git a/Subsurface/Content/Items/Medical/medical.xml b/Subsurface/Content/Items/Medical/medical.xml
index 38232c220..e49e0e638 100644
--- a/Subsurface/Content/Items/Medical/medical.xml
+++ b/Subsurface/Content/Items/Medical/medical.xml
@@ -7,7 +7,7 @@
pickdistance="150"
price="50"
canuseonself="true"
- description="A syringe filled with a potent general-purpose medical compound.">
+ description="Injection is often a much more effective method of administering drugs than taking them orally.">
diff --git a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
index 9d07a29df..c39220035 100644
--- a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
+++ b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
@@ -1151,12 +1151,13 @@ namespace Barotrauma
case LimbType.RightThigh:
case LimbType.RightLeg:
case LimbType.RightFoot:
- mirror = true;
- flipAngle = true;
- wrapAngle = true;
+ mirror = Crouching && !inWater;
+ flipAngle = (limb.DoesFlip || Crouching) && !inWater;
+ wrapAngle = !inWater;
break;
default:
- flipAngle = limb.DoesFlip;
+ flipAngle = limb.DoesFlip && !inWater;
+ wrapAngle = !inWater;
break;
}
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index 791927577..ada88dab6 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -429,6 +429,13 @@ namespace Barotrauma
case "showaitargets":
AITarget.ShowAITargets = !AITarget.ShowAITargets;
break;
+ case "killmonsters":
+ foreach (Character c in Character.CharacterList)
+ {
+ if (!(c.AIController is EnemyAIController)) continue;
+ c.AddDamage(CauseOfDeath.Damage, 10000.0f, null);
+ }
+ break;
case "sendrandomdata":
int messageCount = 1;
diff --git a/Subsurface/Source/Items/Components/Holdable/Pickable.cs b/Subsurface/Source/Items/Components/Holdable/Pickable.cs
index c288f88e8..84857cabc 100644
--- a/Subsurface/Source/Items/Components/Holdable/Pickable.cs
+++ b/Subsurface/Source/Items/Components/Holdable/Pickable.cs
@@ -100,12 +100,7 @@ namespace Barotrauma.Items.Components
DropConnectedWires(picker);
ApplyStatusEffects(ActionType.OnPicked, 1.0f, picker);
-
- //foreach (StatusEffect effect in item.Prefab.statusEffects)
- //{
- // effect.OnPicked(picker, null);
- //}
-
+
return true;
}
diff --git a/Subsurface/Source/Items/Components/Holdable/RepairTool.cs b/Subsurface/Source/Items/Components/Holdable/RepairTool.cs
index 3bd0927ea..2402a3ff2 100644
--- a/Subsurface/Source/Items/Components/Holdable/RepairTool.cs
+++ b/Subsurface/Source/Items/Components/Holdable/RepairTool.cs
@@ -189,10 +189,7 @@ namespace Barotrauma.Items.Components
{
targetItem.IsHighlighted = true;
- foreach (StatusEffect effect in statusEffects)
- {
- effect.Apply(ActionType.OnUse, deltaTime, item, targetItem.AllPropertyObjects);
- }
+ ApplyStatusEffects(ActionType.OnUse, targetItem.AllPropertyObjects, deltaTime);
}
return true;
diff --git a/Subsurface/Source/Items/Components/ItemComponent.cs b/Subsurface/Source/Items/Components/ItemComponent.cs
index 38e91c605..5b70eaa0c 100644
--- a/Subsurface/Source/Items/Components/ItemComponent.cs
+++ b/Subsurface/Source/Items/Components/ItemComponent.cs
@@ -53,7 +53,7 @@ namespace Barotrauma.Items.Components
public bool WasUsed;
- public List statusEffects;
+ public readonly Dictionary> statusEffectLists;
protected bool updated;
@@ -184,8 +184,6 @@ namespace Barotrauma.Items.Components
sounds = new Dictionary>();
- statusEffects = new List();
-
SelectKey = InputType.Select;
try
@@ -230,7 +228,19 @@ namespace Barotrauma.Items.Components
requiredSkills.Add(new Skill(skillName, ToolBox.GetAttributeInt(subElement, "level", 0)));
break;
case "statuseffect":
- statusEffects.Add(StatusEffect.Load(subElement));
+ var statusEffect = StatusEffect.Load(subElement);
+
+ if (statusEffectLists == null) statusEffectLists = new Dictionary>();
+
+ List effectList;
+ if (!statusEffectLists.TryGetValue(statusEffect.type, out effectList))
+ {
+ effectList = new List();
+ statusEffectLists.Add(statusEffect.type, effectList);
+ }
+
+ effectList.Add(statusEffect);
+
break;
case "guiframe":
string rectStr = ToolBox.GetAttributeString(subElement, "rect", "0.0,0.0,0.5,0.5");
@@ -597,19 +607,27 @@ namespace Barotrauma.Items.Components
public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null)
{
+ if (statusEffectLists == null) return;
+
+ List statusEffects;
+ if (!statusEffectLists.TryGetValue(type, out statusEffects)) return;
+
foreach (StatusEffect effect in statusEffects)
{
- if (effect.type != type) continue;
item.ApplyStatusEffect(effect, type, deltaTime, character);
}
}
- public void ApplyStatusEffects(ActionType type, float deltaTime, IPropertyObject target)
+ public void ApplyStatusEffects(ActionType type, List targets, float deltaTime)
{
+ if (statusEffectLists == null) return;
+
+ List statusEffects;
+ if (!statusEffectLists.TryGetValue(type, out statusEffects)) return;
+
foreach (StatusEffect effect in statusEffects)
{
- if (effect.type != type) continue;
- effect.Apply(type, deltaTime, item, target);
+ effect.Apply(type, deltaTime, item, targets);
}
}
diff --git a/Subsurface/Source/Items/Components/Machines/Fabricator.cs b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
index 714145741..80e4b7b79 100644
--- a/Subsurface/Source/Items/Components/Machines/Fabricator.cs
+++ b/Subsurface/Source/Items/Components/Machines/Fabricator.cs
@@ -115,15 +115,19 @@ namespace Barotrauma.Items.Components
foreach (FabricableItem fi in fabricableItems)
{
Color color = ((itemList.CountChildren % 2) == 0) ? Color.Transparent : Color.Black*0.3f;
-
- GUITextBlock textBlock = new GUITextBlock(
- new Rectangle(0, 0, 0, 25), fi.TargetItem.Name,
+
+ new GUITextBlock(
+ new Rectangle(0, 0, 0, 25), fi.TargetItem.Name,
color, Color.White,
- Alignment.Left, Alignment.Left, null, itemList);
- textBlock.UserData = fi;
- textBlock.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
- textBlock.HoverColor = Color.Gold * 0.2f;
- textBlock.SelectedColor = Color.Gold * 0.5f;
+ Alignment.Left, Alignment.Left, null, itemList)
+ {
+ UserData = fi,
+ Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f),
+ HoverColor = Color.Gold * 0.2f,
+ SelectedColor = Color.Gold * 0.5f,
+ ToolTip = fi.TargetItem.Description
+ };
+
}
}
@@ -135,7 +139,7 @@ namespace Barotrauma.Items.Components
if (selectedItemFrame != null) GuiFrame.RemoveChild(selectedItemFrame);
//int width = 200, height = 150;
- selectedItemFrame = new GUIFrame(new Rectangle(0,0,(int)(GuiFrame.Rect.Width*0.4f),250), Color.Black*0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
+ selectedItemFrame = new GUIFrame(new Rectangle(0, 0, (int)(GuiFrame.Rect.Width * 0.4f), 250), Color.Black * 0.8f, Alignment.CenterY | Alignment.Right, null, GuiFrame);
selectedItemFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
@@ -170,7 +174,7 @@ namespace Barotrauma.Items.Components
if (!inadequateSkills.Any())
{
text = "Required items:\n";
- foreach (Tuple ip in targetItem.RequiredItems)
+ foreach (Tuple ip in targetItem.RequiredItems)
{
text += " - " + ip.Item1.Name + " x"+ip.Item2+"\n";
}
@@ -204,6 +208,16 @@ namespace Barotrauma.Items.Components
return true;
}
+ public override bool Select(Character character)
+ {
+ if (itemList.Selected != null)
+ {
+ SelectItem(itemList.Selected, itemList.Selected.UserData);
+ }
+
+ return base.Select(character);
+ }
+
public override bool Pick(Character picker)
{
return (picker != null);
@@ -224,16 +238,6 @@ namespace Barotrauma.Items.Components
item.NewComponentEvent(this, true, true);
}
- //listElement.Color = Color.Green;
- //itemList.Enabled = false;
-
- //activateButton.Text = "Cancel";
-
- //fabricatedItem = obj as FabricableItem;
- //IsActive = true;
-
- //timeUntilReady = fabricatedItem.RequiredTime;
-
return true;
}
diff --git a/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs b/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
index d519fc762..79619b91d 100644
--- a/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
+++ b/Subsurface/Source/Items/Components/Machines/OxygenGenerator.cs
@@ -18,6 +18,8 @@ namespace Barotrauma.Items.Components
List ventList;
+ private float totalHullVolume;
+
public bool IsRunning()
{
return (running && item.Condition>0.0f);
@@ -98,18 +100,27 @@ namespace Barotrauma.Items.Components
if (linkedItem == null) continue;
Vent vent = linkedItem.GetComponent();
- if (vent != null) ventList.Add(vent);
+ if (vent == null) continue;
+
+ ventList.Add(vent);
+ if (linkedItem.CurrentHull!=null) totalHullVolume += linkedItem.CurrentHull.FullVolume;
}
}
+
+ public override void OnMapLoaded()
+ {
+ GetVents();
+ }
private void UpdateVents(float deltaOxygen)
{
- if (!ventList.Any()) return;
+ if (!ventList.Any() || totalHullVolume == 0.0f) return;
- deltaOxygen = deltaOxygen / ventList.Count;
foreach (Vent v in ventList)
{
- v.OxygenFlow = deltaOxygen;
+ if (v.Item.CurrentHull == null) continue;
+
+ v.OxygenFlow = deltaOxygen * (v.Item.CurrentHull.FullVolume / totalHullVolume);
v.IsActive = true;
}
}
diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs
index 434dce042..d2dbacb29 100644
--- a/Subsurface/Source/Items/Item.cs
+++ b/Subsurface/Source/Items/Item.cs
@@ -46,6 +46,9 @@ namespace Barotrauma
private Inventory parentInventory;
+ //a dictionary containing lists of the status effects in all the components of the item
+ private Dictionary> statusEffectLists;
+
public readonly Dictionary properties;
public Dictionary ObjectProperties
{
@@ -350,7 +353,31 @@ namespace Barotrauma
if (ic == null) break;
components.Add(ic);
- //if (!string.IsNullOrWhiteSpace(ic.Msg)) highlightText.Add(ic.Msg);
+
+ if (ic.statusEffectLists == null) continue;
+
+ if (statusEffectLists == null)
+ statusEffectLists = new Dictionary>();
+
+ //go through all the status effects of the component
+ //and add them to the corresponding statuseffect list
+ foreach (List componentEffectList in ic.statusEffectLists.Values)
+ {
+
+ ActionType actionType = componentEffectList.First().type;
+
+ List statusEffectList;
+ if (!statusEffectLists.TryGetValue(actionType, out statusEffectList))
+ {
+ statusEffectList = new List();
+ statusEffectLists.Add(actionType, statusEffectList);
+ }
+
+ foreach (StatusEffect effect in componentEffectList)
+ {
+ statusEffectList.Add(effect);
+ }
+ }
break;
}
@@ -496,12 +523,14 @@ namespace Barotrauma
public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null)
{
- foreach (ItemComponent ic in components)
+ if (statusEffectLists == null) return;
+
+ List statusEffects;
+ if (!statusEffectLists.TryGetValue(type, out statusEffects)) return;
+
+ foreach (StatusEffect effect in statusEffects)
{
- foreach (StatusEffect effect in ic.statusEffects)
- {
- ApplyStatusEffect(effect, type, deltaTime, character);
- }
+ ApplyStatusEffect(effect, type, deltaTime, character);
}
}
diff --git a/Subsurface/Source/Map/Gap.cs b/Subsurface/Source/Map/Gap.cs
index 354ba8993..bd11fe244 100644
--- a/Subsurface/Source/Map/Gap.cs
+++ b/Subsurface/Source/Map/Gap.cs
@@ -245,28 +245,33 @@ namespace Barotrauma
if (isHorizontal)
{
pos.X += Math.Sign(flowForce.X);
- pos.Y = MathHelper.Clamp((higherSurface+lowerSurface)/2.0f, rect.Y - rect.Height, rect.Y);
-
+ pos.Y = MathHelper.Clamp((higherSurface + lowerSurface) / 2.0f, rect.Y - rect.Height, rect.Y);
+
Vector2 velocity = new Vector2(
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f),
flowForce.Y * Rand.Range(0.5f, 0.7f));
var particle = GameMain.ParticleManager.CreateParticle(
"watersplash",
- (Submarine.Loaded==null ? pos : pos + Submarine.Loaded.Position) - Vector2.UnitY * Rand.Range(0.0f, 10.0f),
+ (Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position) - Vector2.UnitY * Rand.Range(0.0f, 10.0f),
velocity);
if (particle != null)
{
- particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f),5.0f);
+ particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f), 5.0f);
}
- pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
- GameMain.ParticleManager.CreateParticle(
- "bubbles",
- Submarine.Loaded==null ? pos : pos + Submarine.Loaded.Position,
- flowForce / 200.0f);
+ if (Math.Abs(flowForce.X) > 300.0f)
+ {
+ pos.X += Math.Sign(flowForce.X) * 10.0f;
+ pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
+
+ GameMain.ParticleManager.CreateParticle(
+ "bubbles",
+ Submarine.Loaded == null ? pos : pos + Submarine.Loaded.Position,
+ flowForce / 10.0f);
+ }
}
else
{