Merge branch 'master' of https://github.com/Faerdan/Barotrauma into Faerdan-master

Conflicts:
	Barotrauma/BarotraumaClient/Source/Map/MapEntity.cs
	Barotrauma/BarotraumaClient/Source/Screens/GameScreen.cs
	Barotrauma/BarotraumaShared/Source/Characters/Character.cs
	Barotrauma/BarotraumaShared/Source/Items/Item.cs
This commit is contained in:
Joonas Rikkonen
2017-07-05 19:32:34 +03:00
47 changed files with 473 additions and 483 deletions
@@ -134,69 +134,7 @@ namespace Barotrauma
} }
} }
if (!LockHands) DoInteractionUpdate(deltaTime, mouseSimPos);
{
//find the closest item if selectkey has been hit, or if the Character is being
//controlled by the player (in order to highlight it)
if (findClosestTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen)
{
closestCharacter = FindClosestCharacter(mouseSimPos);
if (closestCharacter != null && closestCharacter.info == null)
{
closestCharacter = null;
}
float closestItemDist = 0.0f;
closestItem = FindClosestItem(mouseSimPos, out closestItemDist);
if (closestCharacter != null && closestItem != null)
{
if (Vector2.DistanceSquared(closestCharacter.SimPosition, mouseSimPos) < ConvertUnits.ToSimUnits(closestItemDist) * ConvertUnits.ToSimUnits(closestItemDist))
{
if (selectedConstruction != closestItem) closestItem = null;
}
else
{
closestCharacter = null;
}
}
findClosestTimer = 0.1f;
}
else
{
findClosestTimer -= deltaTime;
}
if (selectedCharacter == null && closestItem != null)
{
closestItem.IsHighlighted = true;
if (!LockHands && closestItem.Pick(this))
{
}
}
if (IsKeyHit(InputType.Select))
{
if (selectedCharacter != null)
{
DeselectCharacter();
}
else if (closestCharacter != null && closestCharacter.IsHumanoid && closestCharacter.CanBeSelected)
{
SelectCharacter(closestCharacter);
}
}
}
else
{
if (selectedCharacter != null) DeselectCharacter();
selectedConstruction = null;
closestItem = null;
closestCharacter = null;
}
DisableControls = false; DisableControls = false;
} }
@@ -182,27 +182,27 @@ namespace Barotrauma
if (cprButton.Visible) cprButton.Draw(spriteBatch); if (cprButton.Visible) cprButton.Draw(spriteBatch);
} }
if (character.ClosestCharacter != null && character.ClosestCharacter.CanBeSelected) if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
{ {
Vector2 startPos = character.DrawPosition + (character.ClosestCharacter.DrawPosition - character.DrawPosition) * 0.7f; Vector2 startPos = character.DrawPosition + (character.FocusedCharacter.DrawPosition - character.DrawPosition) * 0.7f;
startPos = cam.WorldToScreen(startPos); startPos = cam.WorldToScreen(startPos);
Vector2 textPos = startPos; Vector2 textPos = startPos;
textPos -= new Vector2(GUI.Font.MeasureString(character.ClosestCharacter.Info.Name).X / 2, 20); textPos -= new Vector2(GUI.Font.MeasureString(character.FocusedCharacter.Info.Name).X / 2, 20);
GUI.DrawString(spriteBatch, textPos, character.ClosestCharacter.Info.Name, Color.White, Color.Black, 2); GUI.DrawString(spriteBatch, textPos, character.FocusedCharacter.Info.Name, Color.White, Color.Black, 2);
} }
else if (character.SelectedCharacter == null && character.ClosestItem != null && character.SelectedConstruction == null) else if (character.SelectedCharacter == null && character.FocusedItem != null && character.SelectedConstruction == null)
{ {
var hudTexts = character.ClosestItem.GetHUDTexts(character); var hudTexts = character.FocusedItem.GetHUDTexts(character);
Vector2 startPos = new Vector2((int)(GameMain.GraphicsWidth / 2.0f), GameMain.GraphicsHeight); Vector2 startPos = new Vector2((int)(GameMain.GraphicsWidth / 2.0f), GameMain.GraphicsHeight);
startPos.Y -= 50 + hudTexts.Count * 25; startPos.Y -= 50 + hudTexts.Count * 25;
Vector2 textPos = startPos; Vector2 textPos = startPos;
textPos -= new Vector2((int)GUI.Font.MeasureString(character.ClosestItem.Name).X / 2, 20); textPos -= new Vector2((int)GUI.Font.MeasureString(character.FocusedItem.Name).X / 2, 20);
GUI.DrawString(spriteBatch, textPos, character.ClosestItem.Name, Color.White, Color.Black * 0.7f, 2); GUI.DrawString(spriteBatch, textPos, character.FocusedItem.Name, Color.White, Color.Black * 0.7f, 2);
textPos.Y += 30.0f; textPos.Y += 30.0f;
foreach (ColoredText coloredText in hudTexts) foreach (ColoredText coloredText in hudTexts)
@@ -387,7 +387,7 @@ namespace Barotrauma.Tutorials
while (!HasItem("Diving Mask") && !HasItem("Diving Suit")) while (!HasItem("Diving Mask") && !HasItem("Diving Suit"))
{ {
if (!divingMaskSelected && if (!divingMaskSelected &&
Character.Controlled.ClosestItem != null && Character.Controlled.ClosestItem.Name == "Diving Suit") Character.Controlled.FocusedItem != null && Character.Controlled.FocusedItem.Name == "Diving Suit")
{ {
infoBox = CreateInfoFrame("There can only be one item in each inventory slot, so you need to take off " infoBox = CreateInfoFrame("There can only be one item in each inventory slot, so you need to take off "
+ "the jumpsuit if you wish to wear a diving suit."); + "the jumpsuit if you wish to wear a diving suit.");
@@ -14,9 +14,9 @@ namespace Barotrauma.Items.Components
GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
Color.Green * 0.1f, true); Color.Green * 0.1f, true);
if (character.ClosestCharacter == null) return; if (character.FocusedCharacter == null) return;
var target = character.ClosestCharacter; var target = character.FocusedCharacter;
Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.WorldPosition); Vector2 hudPos = GameMain.GameScreen.Cam.WorldToScreen(target.WorldPosition);
hudPos += Vector2.UnitX * 50.0f; hudPos += Vector2.UnitX * 50.0f;
@@ -20,7 +20,6 @@ namespace Barotrauma
get { return prefab.sprite; } get { return prefab.sprite; }
} }
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{ {
if (!Visible) return; if (!Visible) return;
@@ -32,8 +31,7 @@ namespace Barotrauma
if (prefab.sprite != null) if (prefab.sprite != null)
{ {
float depth = Sprite.Depth; float depth = GetDrawDepth();
depth += (ID % 255) * 0.000001f;
if (body == null) if (body == null)
{ {
@@ -163,15 +163,15 @@ namespace Barotrauma.Lights
if (Character.Controlled != null) if (Character.Controlled != null)
{ {
if (Character.Controlled.ClosestItem != null) if (Character.Controlled.FocusedItem != null)
{ {
Character.Controlled.ClosestItem.IsHighlighted = true; Character.Controlled.FocusedItem.IsHighlighted = true;
Character.Controlled.ClosestItem.Draw(spriteBatch, false, true); Character.Controlled.FocusedItem.Draw(spriteBatch, false, true);
Character.Controlled.ClosestItem.IsHighlighted = true; Character.Controlled.FocusedItem.IsHighlighted = true;
} }
else if (Character.Controlled.ClosestCharacter != null) else if (Character.Controlled.FocusedCharacter != null)
{ {
Character.Controlled.ClosestCharacter.Draw(spriteBatch); Character.Controlled.FocusedCharacter.Draw(spriteBatch);
} }
} }
@@ -1071,7 +1071,7 @@ namespace Barotrauma
dummyCharacter.SelectedConstruction.UpdateHUD(cam, dummyCharacter); dummyCharacter.SelectedConstruction.UpdateHUD(cam, dummyCharacter);
} }
if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.ClosestItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null; if (PlayerInput.KeyHit(InputType.Select) && dummyCharacter.FocusedItem != dummyCharacter.SelectedConstruction) dummyCharacter.SelectedConstruction = null;
} }
CharacterHUD.Update((float)deltaTime, dummyCharacter); CharacterHUD.Update((float)deltaTime, dummyCharacter);
@@ -56,21 +56,16 @@ namespace Barotrauma
public override void AddToGUIUpdateList() public override void AddToGUIUpdateList()
{ {
if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null && Character.Controlled.CanInteractWith(Character.Controlled.SelectedConstruction))
{ {
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem) Character.Controlled.SelectedConstruction.AddToGUIUpdateList();
{
Character.Controlled.SelectedConstruction.AddToGUIUpdateList();
}
} }
if (GameMain.GameSession != null) GameMain.GameSession.AddToGUIUpdateList(); if (GameMain.GameSession != null) GameMain.GameSession.AddToGUIUpdateList();
Character.AddAllToGUIUpdateList(); Character.AddAllToGUIUpdateList();
} }
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch)
{ {
cam.UpdateTransform(true); cam.UpdateTransform(true);
@@ -80,12 +75,9 @@ namespace Barotrauma
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable);
if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null && Character.Controlled.CanInteractWith(Character.Controlled.SelectedConstruction))
{ {
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem) Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
{
Character.Controlled.SelectedConstruction.DrawHUD(spriteBatch, cam, Character.Controlled);
}
} }
if (Character.Controlled != null && cam != null) Character.Controlled.DrawHUD(spriteBatch, cam); if (Character.Controlled != null && cam != null) Character.Controlled.DrawHUD(spriteBatch, cam);
@@ -4,7 +4,7 @@
name="Skyholder Artifact" name="Skyholder Artifact"
category="Alien" category="Alien"
Tags="alien" Tags="alien"
pickdistance="150"> >
<Sprite texture="artifact.png" depth="0.7" sourcerect="58,0,60,60"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="58,0,60,60"/>
@@ -26,7 +26,7 @@
name="Thermal Artifact" name="Thermal Artifact"
category="Alien" category="Alien"
Tags="alien" Tags="alien"
pickdistance="150"> >
<Sprite texture="artifact.png" depth="0.7" sourcerect="1,0,57,56"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="1,0,57,56"/>
@@ -50,7 +50,7 @@
name="Faraday Artifact" name="Faraday Artifact"
category="Alien" category="Alien"
Tags="alien" Tags="alien"
pickdistance="150"> >
<Sprite texture="artifact.png" depth="0.7" sourcerect="0,56,60,49"/> <Sprite texture="artifact.png" depth="0.7" sourcerect="0,56,60,49"/>
@@ -92,7 +92,7 @@
<Item <Item
name="Oxygenite Shard" name="Oxygenite Shard"
category="Alien" category="Alien"
pickdistance="150"
tags="alien,smallitem" tags="alien,smallitem"
impacttolerance="8"> impacttolerance="8">
@@ -112,7 +112,7 @@
<Item <Item
name="Sulphurite Shard" name="Sulphurite Shard"
category="Alien" category="Alien"
pickdistance="150"
tags="alien,smallitem" tags="alien,smallitem"
impacttolerance="8" impacttolerance="8"
spritecolor="1.0,0.0,0.0,1.0"> spritecolor="1.0,0.0,0.0,1.0">
@@ -137,7 +137,7 @@
name="Ancient Weapon" name="Ancient Weapon"
category="Alien" category="Alien"
Tags="alien,smallitem" Tags="alien,smallitem"
pickdistance="200"> >
<Deconstruct time="20"> <Deconstruct time="20">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -188,7 +188,7 @@
category="Alien" category="Alien"
Tags="alien" Tags="alien"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture="Content/Map/ruins.png" sourcerect="747,0,260,95" depth="0.8" origin="0.5,0.5"/> <Sprite texture="Content/Map/ruins.png" sourcerect="747,0,260,95" depth="0.8" origin="0.5,0.5"/>
@@ -210,7 +210,7 @@
category="Alien" category="Alien"
linkable="true" linkable="true"
Tags="alien" Tags="alien"
pickdistance="150.0"> >
<Sprite texture="Content/Map/ruins.png" sourcerect="746,101,93,259" depth="0.8" origin="0.5,0.5"/> <Sprite texture="Content/Map/ruins.png" sourcerect="746,101,93,259" depth="0.8" origin="0.5,0.5"/>
@@ -232,7 +232,7 @@
linkable="true" linkable="true"
category="Alien" category="Alien"
Tags="alien" Tags="alien"
pickdistance="150.0"> >
<Sprite texture="Content/Map/ruins.png" sourcerect="55,608,81,103" depth="0.8" origin="0.5,0.5"/> <Sprite texture="Content/Map/ruins.png" sourcerect="55,608,81,103" depth="0.8" origin="0.5,0.5"/>
@@ -249,7 +249,7 @@
linkable="true" linkable="true"
category="Alien" category="Alien"
Tags="alien" Tags="alien"
pickdistance="150.0"> >
<Sprite texture="artifactholder.png" depth="0.8"/> <Sprite texture="artifactholder.png" depth="0.8"/>
@@ -3,7 +3,7 @@
category="Electrical" category="Electrical"
linkable="true" linkable="true"
tags="smallitem" tags="smallitem"
pickdistance="150.0"
price="10"> price="10">
<Sprite texture ="button.png" depth="0.8"/> <Sprite texture ="button.png" depth="0.8"/>
@@ -4,7 +4,7 @@
name="Oxygen Tank" name="Oxygen Tank"
category="Equipment,Misc" category="Equipment,Misc"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
price="50"> price="50">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -26,7 +26,7 @@
name="Diving Mask" name="Diving Mask"
category="Equipment" category="Equipment"
Tags="smallitem,diving" Tags="smallitem,diving"
pickdistance="200"
price="50" price="50"
description="Small enough to carry around in case of need, but won't protect you from the water pressure in the event of a full-blown hull breach."> description="Small enough to carry around in case of need, but won't protect you from the water pressure in the event of a full-blown hull breach.">
@@ -63,7 +63,7 @@
name="Diving Suit" name="Diving Suit"
category="Equipment" category="Equipment"
tags="diving" tags="diving"
pickdistance="200"
price="200" price="200"
fireproof="true" fireproof="true"
description="An atmospheric diving suit capable of withstanding the immense pressure under Europa's crust."> description="An atmospheric diving suit capable of withstanding the immense pressure under Europa's crust.">
@@ -113,7 +113,7 @@
name="Underwater Scooter" name="Underwater Scooter"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="50" price="50"
description="A battery-powered underwater propulsion device."> description="A battery-powered underwater propulsion device.">
@@ -2,7 +2,7 @@
<Item <Item
name="Door" name="Door"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture ="door.png" sourcerect="1,0,48,208" depth="0.01" origin="0.5,0.5"/> <Sprite texture ="door.png" sourcerect="1,0,48,208" depth="0.01" origin="0.5,0.5"/>
@@ -30,7 +30,7 @@
<Item <Item
name="Windowed Door" name="Windowed Door"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture ="door.png" sourcerect="1,0,48,208" depth="0.01" origin="0.5,0.5"/> <Sprite texture ="door.png" sourcerect="1,0,48,208" depth="0.01" origin="0.5,0.5"/>
@@ -58,7 +58,7 @@
<Item <Item
name="Hatch" name="Hatch"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture ="door.png" sourcerect="0,209,128,46" depth="0.01" origin="0.5,0.5"/> <Sprite texture ="door.png" sourcerect="0,209,128,46" depth="0.01" origin="0.5,0.5"/>
@@ -86,7 +86,7 @@
<Item <Item
name="Docking Port" name="Docking Port"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture ="dockingport.png" sourcerect="0,0,112,208" depth="0.94" origin="0.5,0.5"/> <Sprite texture ="dockingport.png" sourcerect="0,0,112,208" depth="0.94" origin="0.5,0.5"/>
@@ -117,7 +117,7 @@
<Item <Item
name="Docking Hatch" name="Docking Hatch"
linkable="true" linkable="true"
pickdistance="150.0"> >
<Sprite texture ="dockingport2.png" sourcerect="0,0,128,112" depth="0.94" origin="0.5,0.5"/> <Sprite texture ="dockingport2.png" sourcerect="0,0,128,112" depth="0.94" origin="0.5,0.5"/>
@@ -6,7 +6,7 @@
name="Lamp" name="Lamp"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"> >
<Sprite texture="lamp.png" sourcerect="0,0,16,32" depth="0.8"/> <Sprite texture="lamp.png" sourcerect="0,0,16,32" depth="0.8"/>
@@ -26,7 +26,7 @@
name="Emergency Light" name="Emergency Light"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"> >
<Sprite texture="lamp.png" sourcerect="0,48,48,16" depth="0.8"/> <Sprite texture="lamp.png" sourcerect="0,48,48,16" depth="0.8"/>
@@ -2,7 +2,7 @@
<Item <Item
name="Monitor" name="Monitor"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture ="monitor.png" depth="0.85"/> <Sprite texture ="monitor.png" depth="0.85"/>
@@ -4,7 +4,7 @@
name="Junction Box" name="Junction Box"
category="Electrical" category="Electrical"
linkable="true" linkable="true"
pickdistance="150"
description="Serves as a hub for power distribution and relaying signals between devices."> description="Serves as a hub for power distribution and relaying signals between devices.">
<Sprite texture="junctionbox.png" depth="0.8" canflipx="false"/> <Sprite texture="junctionbox.png" depth="0.8" canflipx="false"/>
@@ -40,7 +40,7 @@
name="Battery" name="Battery"
category="Electrical" category="Electrical"
linkable="true" linkable="true"
pickdistance="150"
description="Generally used for storing backup power in case of a reactor failure."> description="Generally used for storing backup power in case of a reactor failure.">
<Sprite texture ="battery.png" depth="0.8"/> <Sprite texture ="battery.png" depth="0.8"/>
@@ -68,7 +68,7 @@
name="Supercapacitor" name="Supercapacitor"
category="Electrical" category="Electrical"
linkable="true" linkable="true"
pickdistance="150"
description="Can deliver charge much faster than batteries."> description="Can deliver charge much faster than batteries.">
<Sprite texture ="supercapacitor.png" depth="0.8"/> <Sprite texture ="supercapacitor.png" depth="0.8"/>
@@ -6,7 +6,7 @@
name="Wire" name="Wire"
category="Electrical" category="Electrical"
Tags="smallitem,wire" Tags="smallitem,wire"
pickdistance="150"
linkable="true" linkable="true"
canbepicked="true" canbepicked="true"
price="10"> price="10">
@@ -29,7 +29,7 @@
category="Electrical" category="Electrical"
Tags="smallitem,wire" Tags="smallitem,wire"
spritecolor="1.0,0.0,0.0,1.0" spritecolor="1.0,0.0,0.0,1.0"
pickdistance="150"
linkable="true" linkable="true"
canbepicked="true" canbepicked="true"
price="10"> price="10">
@@ -51,7 +51,7 @@
category="Electrical" category="Electrical"
Tags="smallitem,wire" Tags="smallitem,wire"
spritecolor="0.0,0.6,1.0,1.0" spritecolor="0.0,0.6,1.0,1.0"
pickdistance="150"
linkable="true" linkable="true"
canbepicked="true" canbepicked="true"
price="10"> price="10">
@@ -73,7 +73,7 @@
category="Electrical" category="Electrical"
Tags="smallitem,wire" Tags="smallitem,wire"
spritecolor="1.0,0.5,0.0,1.0" spritecolor="1.0,0.5,0.0,1.0"
pickdistance="150"
linkable="true" linkable="true"
canbepicked="true" canbepicked="true"
price="10"> price="10">
@@ -94,7 +94,7 @@
name="FPGA Circuit" name="FPGA Circuit"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="100" price="100"
description="Field-programmable gate array - a multi-purpose circuit which can be reconfigured for use in a large variety of electrical devices."> description="Field-programmable gate array - a multi-purpose circuit which can be reconfigured for use in a large variety of electrical devices.">
@@ -110,7 +110,7 @@
name="And Component" name="And Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends a signal when both inputs receive a signal within a set period of each other."> description="Sends a signal when both inputs receive a signal within a set period of each other.">
@@ -145,7 +145,7 @@
name="Or Component" name="Or Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends a signal if either of the inputs receive a signal."> description="Sends a signal if either of the inputs receive a signal.">
@@ -179,7 +179,7 @@
name="Not Component" name="Not Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends a signal when the input is NOT receiving a signal."> description="Sends a signal when the input is NOT receiving a signal.">
@@ -211,7 +211,7 @@
name="Relay Component" name="Relay Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="When switched on, forwards all received signals from the input connections to the outputs."> description="When switched on, forwards all received signals from the input connections to the outputs.">
@@ -257,7 +257,7 @@
name="Delay Component" name="Delay Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Delays all received signals for a specific amount of time."> description="Delays all received signals for a specific amount of time.">
@@ -289,7 +289,7 @@
name="Light Component" name="Light Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10"> price="10">
@@ -324,7 +324,7 @@
name="Oxygen Detector" name="Oxygen Detector"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends out a value between 0-100 depending on the quality of the surrounding air."> description="Sends out a value between 0-100 depending on the quality of the surrounding air.">
@@ -355,7 +355,7 @@
name="Water Detector" name="Water Detector"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends out a signal when the detector is submerged."> description="Sends out a signal when the detector is submerged.">
@@ -386,7 +386,7 @@
name="Signal Check Component" name="Signal Check Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends a signal when a signal matching a specific value is received."> description="Sends a signal when a signal matching a specific value is received.">
@@ -420,7 +420,7 @@
name="RegEx Find Component" name="RegEx Find Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10" price="10"
description="Sends a signal if the received signal matches a specific regular expression pattern."> description="Sends a signal if the received signal matches a specific regular expression pattern.">
@@ -452,7 +452,7 @@
name="Wifi Component" name="Wifi Component"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="20" price="20"
description="Allows remote communication between other Wifi Components that are using the same channel."> description="Allows remote communication between other Wifi Components that are using the same channel.">
@@ -484,7 +484,7 @@
name="Emergency Siren" name="Emergency Siren"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10"> price="10">
@@ -517,7 +517,7 @@
name="Alarm Buzzer" name="Alarm Buzzer"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
linkable="true" linkable="true"
price="10"> price="10">
@@ -550,7 +550,7 @@
name="Camera" name="Camera"
category="Electrical" category="Electrical"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
focusonselected="true" focusonselected="true"
offsetonselected="500" offsetonselected="500"
linkable="true" linkable="true"
@@ -6,7 +6,7 @@
linkable="true" linkable="true"
category="Machine" category="Machine"
pickthroughwalls="true" pickthroughwalls="true"
pickdistance="150"> >
<Sprite texture ="engine.png" depth="0.8" sourcerect="0,0,373,113" canflipx="true"/> <Sprite texture ="engine.png" depth="0.8" sourcerect="0,0,373,113" canflipx="true"/>
@@ -34,7 +34,7 @@
linkable="true" linkable="true"
category="Machine" category="Machine"
pickthroughwalls="true" pickthroughwalls="true"
pickdistance="150"> >
<Sprite texture ="engine.png" depth="0.8" sourcerect="0,115,224,73" canflipx="true"/> <Sprite texture ="engine.png" depth="0.8" sourcerect="0,115,224,73" canflipx="true"/>
@@ -60,7 +60,7 @@
name="Navigation Terminal" name="Navigation Terminal"
linkable="true" linkable="true"
category="Machine" category="Machine"
pickdistance="150"> >
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,0,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="0,0,64,128"/>
@@ -96,7 +96,7 @@
name="Sonar Monitor" name="Sonar Monitor"
linkable="true" linkable="true"
category="Machine" category="Machine"
pickdistance="150"> >
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,0,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,0,64,128"/>
@@ -3,7 +3,7 @@
<Item <Item
name="Fabricator" name="Fabricator"
linkable="true" linkable="true"
pickdistance="150"
category="Machine" category="Machine"
description="A machine capable of manufacturing a wide range of items out of basic raw materials."> description="A machine capable of manufacturing a wide range of items out of basic raw materials.">
@@ -84,7 +84,7 @@
<Item <Item
name="Medical Fabricator" name="Medical Fabricator"
linkable="true" linkable="true"
pickdistance="150"
category="Machine" category="Machine"
description="A machine that can be used to manufacture various medicines."> description="A machine that can be used to manufacture various medicines.">
@@ -157,7 +157,7 @@
<Item <Item
name="Deconstructor" name="Deconstructor"
linkable="true" linkable="true"
pickdistance="150"
category="Machine" category="Machine"
description="Disassembles and breaks down items to reusable components and material bars."> description="Disassembles and breaks down items to reusable components and material bars.">
@@ -4,7 +4,7 @@
name="Steel Bar" name="Steel Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
canbepicked="true" canbepicked="true"
price="50"> price="50">
@@ -24,7 +24,7 @@
name="Uranium Bar" name="Uranium Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="0.2,0.35,0.06,1.0" spritecolor="0.2,0.35,0.06,1.0"
canbepicked="true" canbepicked="true"
price="100"> price="100">
@@ -45,7 +45,7 @@
name="Copper Bar" name="Copper Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="0.78,0.55,0.2,1.0" spritecolor="0.78,0.55,0.2,1.0"
canbepicked="true" canbepicked="true"
price="50"> price="50">
@@ -61,7 +61,7 @@
name="Polycarbonate Bar" name="Polycarbonate Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="0.9,0.9,1.0,0.9" spritecolor="0.9,0.9,1.0,0.9"
canbepicked="true" canbepicked="true"
price="50"> price="50">
@@ -77,7 +77,7 @@
name="Incendium Bar" name="Incendium Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0"
canbepicked="true"> canbepicked="true">
@@ -97,7 +97,7 @@
name="Fulgurium Bar" name="Fulgurium Bar"
category="Material" category="Material"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="1.0,0.7,0.05,1.0" spritecolor="1.0,0.7,0.05,1.0"
canbepicked="true"> canbepicked="true">
@@ -2,7 +2,7 @@
<Item <Item
name="Captain's Cap" name="Captain's Cap"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="A token of the Captain's unquestionable authority."> description="A token of the Captain's unquestionable authority.">
@@ -18,7 +18,7 @@
<Item <Item
name="Captain's Jacket" name="Captain's Jacket"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="captainLegs.png" sourcerect="0,49,52,17" depth="0.6"/> <Sprite texture ="captainLegs.png" sourcerect="0,49,52,17" depth="0.6"/>
@@ -39,7 +39,7 @@
<Item <Item
name="Captain's Trousers" name="Captain's Trousers"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="captainLegs.png" sourcerect="0,67,51,13" depth="0.6"/> <Sprite texture ="captainLegs.png" sourcerect="0,67,51,13" depth="0.6"/>
@@ -2,7 +2,7 @@
<Item <Item
name="Health Scanner HUD" name="Health Scanner HUD"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="A heads-up display that displays information of the vital signs and status of nearby humans."> description="A heads-up display that displays information of the vital signs and status of nearby humans.">
@@ -20,7 +20,7 @@
<Item <Item
name="Doctor's Coat" name="Doctor's Coat"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="doctorgear.png" sourcerect="75,0,53,18" depth="0.6"/> <Sprite texture ="doctorgear.png" sourcerect="75,0,53,18" depth="0.6"/>
@@ -45,7 +45,7 @@
<Item <Item
name="Doctor's Trousers" name="Doctor's Trousers"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem"> tags="smallitem">
<Sprite texture ="doctorgear.png" sourcerect="76,19,51,13" depth="0.6"/> <Sprite texture ="doctorgear.png" sourcerect="76,19,51,13" depth="0.6"/>
@@ -2,7 +2,7 @@
<Item <Item
name="Orange Jumpsuit" name="Orange Jumpsuit"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
fireproof="true" fireproof="true"
description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear an engineer might need."> description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear an engineer might need.">
@@ -30,7 +30,7 @@
<Item <Item
name="Blue Jumpsuit" name="Blue Jumpsuit"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
fireproof="true" fireproof="true"
description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear a mechanic might need."> description="The fire-resistant fabric offers some protection against fires. Plenty of pockets for carrying any extra gear a mechanic might need.">
@@ -2,7 +2,7 @@
<Item <Item
name="Headset" name="Headset"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="Allows remote communication between the crew."> description="Allows remote communication between the crew.">
@@ -28,7 +28,7 @@
<Item <Item
name="Clown Mask" name="Clown Mask"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="Praise the honkmother."> description="Praise the honkmother.">
@@ -44,7 +44,7 @@
<Item <Item
name="Clown Costume" name="Clown Costume"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="Praise the honkmother."> description="Praise the honkmother.">
@@ -2,7 +2,7 @@
<Item <Item
name="Body Armor" name="Body Armor"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="While the body armor won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board."> description="While the body armor won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board.">
@@ -20,7 +20,7 @@
<Item <Item
name="Ballistic Helmet" name="Ballistic Helmet"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" tags="smallitem"
description="While the helmet won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board."> description="While the helmet won't offer adequate protection against most of the inhabitants of the subsurface ocean, it can be extremely useful if there are traitors on board.">
@@ -41,7 +41,7 @@
<Item <Item
name="Handcuffs" name="Handcuffs"
category="Equipment" category="Equipment"
pickdistance="150"
tags="smallitem" > tags="smallitem" >
<Sprite texture = "securitygear.png" sourcerect="0,63,32,14" depth="0.6"/> <Sprite texture = "securitygear.png" sourcerect="0,63,32,14" depth="0.6"/>
@@ -4,7 +4,7 @@
name="Medical Syringe" name="Medical Syringe"
category="Equipment" category="Equipment"
Tags="smallitem,medical" Tags="smallitem,medical"
pickdistance="150"
price="50" price="50"
canuseonself="true" canuseonself="true"
description="Injection is often a much more effective method of administering drugs than taking them orally."> description="Injection is often a much more effective method of administering drugs than taking them orally.">
@@ -31,7 +31,7 @@
name="Bandage" name="Bandage"
category="Equipment" category="Equipment"
Tags="smallitem,medical" Tags="smallitem,medical"
pickdistance="150"
canuseonself="true" canuseonself="true"
price="20" price="20"
description="Treated with a hemostatic agent that quickly seals most minor wounds."> description="Treated with a hemostatic agent that quickly seals most minor wounds.">
@@ -51,7 +51,7 @@
name="Iron Powder" name="Iron Powder"
category="Material" category="Material"
Tags="smallitem,chem" Tags="smallitem,chem"
pickdistance="150"
price="5"> price="5">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" color="0.2,0.2,0.2,1.0"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" color="0.2,0.2,0.2,1.0"/>
@@ -66,7 +66,7 @@
category="Material" category="Material"
spritecolor="1.0,1.0,0.7,1.0" spritecolor="1.0,1.0,0.7,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="A mild stimulant which is used as an incredient in the manufacture of various medicines." description="A mild stimulant which is used as an incredient in the manufacture of various medicines."
price="10"> price="10">
@@ -91,7 +91,7 @@
category="Material" category="Material"
spritecolor="0.5,0.5,1.0,1.0" spritecolor="0.5,0.5,1.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true" canuseonself="true"
description="Most commonly used for treating oxygen deprivation." description="Most commonly used for treating oxygen deprivation."
price="50"> price="50">
@@ -112,7 +112,7 @@
category="Material" category="Material"
spritecolor="0.6,0.4,0.2,1.0" spritecolor="0.6,0.4,0.2,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true" canuseonself="true"
description="A hemostatic agent that slows down bleeding." description="A hemostatic agent that slows down bleeding."
price="50"> price="50">
@@ -138,7 +138,7 @@
category="Material" category="Material"
spritecolor="0.8,0.0,0.0,1.0" spritecolor="0.8,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true" canuseonself="true"
description="Highly effective at treating various types of physical trauma." description="Highly effective at treating various types of physical trauma."
price="50"> price="50">
@@ -164,7 +164,7 @@
category="Material" category="Material"
spritecolor="1.0,1.0,0.0,1.0" spritecolor="1.0,1.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="A highly potent corrigodone-based stimulant." description="A highly potent corrigodone-based stimulant."
price="150"> price="150">
@@ -184,7 +184,7 @@
category="Material" category="Material"
spritecolor="1.0,1.0,1.0,0.6" spritecolor="1.0,1.0,1.0,0.6"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="20"> price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -204,7 +204,7 @@
spritecolor="0.0,0.9,0.1,1.0" spritecolor="0.0,0.9,0.1,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
canuseonself="true" canuseonself="true"
pickdistance="150"
price="20"> price="20">
<ItemComponent> <ItemComponent>
@@ -228,7 +228,7 @@
category="Material" category="Material"
spritecolor="0.7,0.7,0.7,1.0" spritecolor="0.7,0.7,0.7,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="20"> price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -247,7 +247,7 @@
category="Material" category="Material"
spritecolor="0.8,0.8,0.8,1.0" spritecolor="0.8,0.8,0.8,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="20"> price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -266,7 +266,7 @@
category="Material" category="Material"
spritecolor="0.1,0.1,0.1,1.0" spritecolor="0.1,0.1,0.1,1.0"
Tags="smallitem,chem,explosive" Tags="smallitem,chem,explosive"
pickdistance="150"
price="50"> price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -287,7 +287,7 @@
category="Material" category="Material"
spritecolor="1.0,1.0,1.0,0.8" spritecolor="1.0,1.0,1.0,0.8"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="20"> price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -306,7 +306,7 @@
category="Material" category="Material"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="20"> price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -325,7 +325,7 @@
category="Material" category="Material"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="50"> price="50">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -344,7 +344,7 @@
category="Material" category="Material"
spritecolor="0.2,0.35,0.06,1.0" spritecolor="0.2,0.35,0.06,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
price="50"> price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -363,7 +363,7 @@
category="Material" category="Material"
spritecolor="0.8,0.3,0.8,1.0" spritecolor="0.8,0.3,0.8,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="A potent muscle stimulant." description="A potent muscle stimulant."
price="50"> price="50">
@@ -383,7 +383,7 @@
category="Material" category="Material"
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="A highly potent neurotoxin." description="A highly potent neurotoxin."
price="200"> price="200">
@@ -403,7 +403,7 @@
category="Material" category="Material"
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'." description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'."
price="200"> price="200">
@@ -423,7 +423,7 @@
category="Material" category="Material"
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
description="An antiparasitic drug used in the treatment of husk parasite infections." description="An antiparasitic drug used in the treatment of husk parasite infections."
price="300"> price="300">
@@ -443,7 +443,7 @@
category="Material" category="Material"
spritecolor="0.6,0.8,1.0,1.0" spritecolor="0.6,0.8,1.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
canuseonself="true" canuseonself="true"
description="A mildy toxic solution that slowly releases oxygen into the bloodstream when injected."> description="A mildy toxic solution that slowly releases oxygen into the bloodstream when injected.">
@@ -3,7 +3,7 @@
aliases="MiniMap" aliases="MiniMap"
category="Machine" category="Machine"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,0,64,128"/> <Sprite texture="Content/Items/machines.png" depth="0.8" sourcerect="64,0,64,128"/>
@@ -3,7 +3,7 @@
name="Pump" name="Pump"
linkable="true" linkable="true"
category="Machine" category="Machine"
pickdistance="200"> >
<Sprite texture ="pump.png" depth="0.8"/> <Sprite texture ="pump.png" depth="0.8"/>
@@ -26,7 +26,7 @@
name="Small Pump" name="Small Pump"
linkable="true" linkable="true"
category="Machine" category="Machine"
pickdistance="150"> >
<Sprite texture ="smallpump.png" depth="0.8" sourcerect="0,0,64,48"/> <Sprite texture ="smallpump.png" depth="0.8" sourcerect="0,0,64,48"/>
@@ -55,7 +55,7 @@
<Item <Item
name="Fuel Rod" name="Fuel Rod"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
price="200"> price="200">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -73,7 +73,7 @@
<Item <Item
name="Incendium Fuel Rod" name="Incendium Fuel Rod"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
spritecolor="0.5,0.0,0.0,1.0"> spritecolor="0.5,0.0,0.0,1.0">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -92,7 +92,7 @@
<Item <Item
name="Heat Absorber" name="Heat Absorber"
Tags="smallitem" Tags="smallitem"
pickdistance="150"> >
<Sprite texture ="heatabsorber.png"/> <Sprite texture ="heatabsorber.png"/>
@@ -4,7 +4,7 @@
name="Welding Tool" name="Welding Tool"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="100" price="100"
description="One of the most crucial tools on board the submarine. Also works underwater."> description="One of the most crucial tools on board the submarine. Also works underwater.">
@@ -60,7 +60,7 @@
name="Plasma Cutter" name="Plasma Cutter"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="100" price="100"
description="Cuts through various materials using a jet of ionized oxygen."> description="Cuts through various materials using a jet of ionized oxygen.">
@@ -105,7 +105,7 @@
name="Welding Fuel Tank" name="Welding Fuel Tank"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
price="50"> price="50">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -127,7 +127,7 @@
name="Fire Extinguisher" name="Fire Extinguisher"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="100" price="100"
description="A handheld carbon dioxide extinguisher."> description="A handheld carbon dioxide extinguisher.">
@@ -156,7 +156,7 @@
name="Screwdriver" name="Screwdriver"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="10"> price="10">
<Sprite texture ="tools.png" sourcerect="0,58,31,6" depth="0.55"/> <Sprite texture ="tools.png" sourcerect="0,58,31,6" depth="0.55"/>
@@ -171,7 +171,7 @@
name="Wrench" name="Wrench"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="10"> price="10">
<Sprite texture ="tools.png" sourcerect="0,50,26,7" depth="0.55"/> <Sprite texture ="tools.png" sourcerect="0,50,26,7" depth="0.55"/>
@@ -188,7 +188,7 @@
name="Handheld Sonar" name="Handheld Sonar"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="10"> price="10">
<Sprite texture ="tools.png" sourcerect="42,0,22,9" depth="0.55"/> <Sprite texture ="tools.png" sourcerect="42,0,22,9" depth="0.55"/>
@@ -218,7 +218,7 @@
name="Flashlight" name="Flashlight"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="200"
price="10"> price="10">
<Deconstruct time="15"> <Deconstruct time="15">
@@ -249,7 +249,7 @@
<Item <Item
name="Flare" name="Flare"
category="Equipment" category="Equipment"
pickdistance="150"
price="5" price="5"
spritecolor="1.0,0.0,0.0,1.0" spritecolor="1.0,0.0,0.0,1.0"
tags="smallitem"> tags="smallitem">
@@ -6,7 +6,7 @@
focusonselected="true" focusonselected="true"
offsetonselected="700" offsetonselected="700"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture ="railgunetc.png" depth="0.01" sourcerect="64,180,47,76"/> <Sprite texture ="railgunetc.png" depth="0.01" sourcerect="64,180,47,76"/>
@@ -24,7 +24,7 @@
name="Depth Charge Loader" name="Depth Charge Loader"
category="Machine" category="Machine"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture="railgunetc.png" depth="0.8" sourcerect="0,160,61,96"/> <Sprite texture="railgunetc.png" depth="0.8" sourcerect="0,160,61,96"/>
@@ -37,7 +37,7 @@
<Item <Item
name="Depth Charge Shell" name="Depth Charge Shell"
category="Misc" category="Misc"
pickdistance="150"
price="200"> price="200">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -65,7 +65,7 @@
<Item <Item
name="Nuclear Depth Charge" name="Nuclear Depth Charge"
category="Misc" category="Misc"
pickdistance="150"
price="500"> price="500">
<Deconstruct time="20"> <Deconstruct time="20">
@@ -4,7 +4,7 @@
name="C-4 Block" name="C-4 Block"
category="Equipment" category="Equipment"
Tags="smallitem,explosive" Tags="smallitem,explosive"
pickdistance="150"
price="100"> price="100">
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/> <Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/>
@@ -22,7 +22,7 @@
name="Compound N" name="Compound N"
category="Equipment" category="Equipment"
Tags="smallitem,explosive" Tags="smallitem,explosive"
pickdistance="150"> >
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/> <Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/>
@@ -40,7 +40,7 @@
name="Volatile Compound N" name="Volatile Compound N"
category="Equipment" category="Equipment"
Tags="smallitem,explosive" Tags="smallitem,explosive"
pickdistance="150"> >
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/> <Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/>
@@ -60,7 +60,7 @@
description="A compound made of C-4 and incendium." description="A compound made of C-4 and incendium."
category="Equipment" category="Equipment"
Tags="smallitem,explosive" Tags="smallitem,explosive"
pickdistance="150"> >
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/> <Sprite texture="weapons.png" depth="0.8" sourcerect="112,0,16,7"/>
@@ -80,7 +80,7 @@
description="A device that detonates any contained explosive when receiving a signal." description="A device that detonates any contained explosive when receiving a signal."
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="150"
price="50"> price="50">
<Sprite texture="weapons.png" depth="0.8" sourcerect="112,7,16,9"/> <Sprite texture="weapons.png" depth="0.8" sourcerect="112,7,16,9"/>
@@ -109,7 +109,7 @@
description="A highly unstable liquid that may explode when subjected to heat or physical shock." description="A highly unstable liquid that may explode when subjected to heat or physical shock."
spritecolor="1.0,1.0,1.0,1.0" spritecolor="1.0,1.0,1.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"
impacttolerance="4"> impacttolerance="4">
<Sprite texture ="Content/Items/Medical/med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="Content/Items/Medical/med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -5,7 +5,7 @@
focusonselected="true" focusonselected="true"
offsetonselected="700" offsetonselected="700"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture ="railgunbase.png" depth = "0.01"/> <Sprite texture ="railgunbase.png" depth = "0.01"/>
@@ -30,7 +30,7 @@
category="Machine" category="Machine"
type="Controller" type="Controller"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture ="railgunetc.png" depth="0.8" sourcerect="182,0,61,97"/> <Sprite texture ="railgunetc.png" depth="0.8" sourcerect="182,0,61,97"/>
@@ -53,7 +53,7 @@
name="Railgun Loader" name="Railgun Loader"
category="Machine" category="Machine"
linkable="true" linkable="true"
pickdistance="150"> >
<Sprite texture ="railgunetc.png" depth="0.8" sourcerect="0,0,177,128"/> <Sprite texture ="railgunetc.png" depth="0.8" sourcerect="0,0,177,128"/>
@@ -67,7 +67,7 @@
<Item <Item
name="Railgun Shell" name="Railgun Shell"
category="Misc" category="Misc"
pickdistance="200"
price="200"> price="200">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -98,7 +98,7 @@
<Item <Item
name="Nuclear Shell" name="Nuclear Shell"
category="Misc" category="Misc"
pickdistance="200"
price="500"> price="500">
<Deconstruct time="10"> <Deconstruct time="10">
@@ -4,7 +4,7 @@
<Item <Item
name="Spear" name="Spear"
category="Equipment" category="Equipment"
pickdistance="200"
pickthroughwalls="true" pickthroughwalls="true"
price="50"> price="50">
@@ -25,7 +25,7 @@
<Item <Item
name="Harpoon Gun" name="Harpoon Gun"
category="Equipment" category="Equipment"
pickdistance="200"
price="500" price="500"
tags="weapon"> tags="weapon">
@@ -57,7 +57,7 @@
<Item <Item
name="Stun Grenade" name="Stun Grenade"
category="Equipment" category="Equipment"
pickdistance="200"
price="200" price="200"
tags="smallitem,weapon"> tags="smallitem,weapon">
@@ -75,7 +75,7 @@
<Item <Item
name="Incendium Grenade" name="Incendium Grenade"
category="Equipment" category="Equipment"
pickdistance="200"
tags="smallitem,weapon"> tags="smallitem,weapon">
<Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.55"/> <Sprite texture="weapons.png" sourcerect="98,0,11,24" depth="0.55"/>
@@ -94,7 +94,7 @@
name="Stun Baton" name="Stun Baton"
category="Equipment" category="Equipment"
Tags="smallitem,weapon" Tags="smallitem,weapon"
pickdistance="150"
price="100" price="100"
description="If verbal orders are insufficient, a high-voltage shock from a Stun Baton may be enough to beat an unruly crew member into submission."> description="If verbal orders are insufficient, a high-voltage shock from a Stun Baton may be enough to beat an unruly crew member into submission.">
@@ -129,7 +129,7 @@
<Item <Item
name="Battery Cell" name="Battery Cell"
category="Equipment,Electrical" category="Equipment,Electrical"
pickdistance="150"
tags="smallitem,loadable" tags="smallitem,loadable"
price="50" price="50"
description="Used as a power source for various handheld devices. Most submarines have several stationary backup batteries with recharge docks for battery cells."> description="Used as a power source for various handheld devices. Most submarines have several stationary backup batteries with recharge docks for battery cells.">
@@ -150,7 +150,7 @@
<Item <Item
name="Fulgurium Battery Cell" name="Fulgurium Battery Cell"
category="Equipment,Electrical" category="Equipment,Electrical"
pickdistance="150"
tags="smallitem,loadable" tags="smallitem,loadable"
description="A battery cell contructed of the rare and poorly understood compound Fulgurium."> description="A battery cell contructed of the rare and poorly understood compound Fulgurium.">
@@ -170,7 +170,7 @@
<Item <Item
name="Bike Horn" name="Bike Horn"
category="Equipment" category="Equipment"
pickdistance="200"
tags="weapon,smallitem" tags="weapon,smallitem"
description="HONK"> description="HONK">
@@ -4,7 +4,7 @@
name="ID Card" name="ID Card"
category="Equipment" category="Equipment"
Tags="smallitem" Tags="smallitem"
pickdistance="150"> >
<Sprite texture ="idcard.png" depth="0.8"/> <Sprite texture ="idcard.png" depth="0.8"/>
@@ -141,7 +141,7 @@ namespace Barotrauma
{ {
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item && currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition)) if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item && currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
{ {
currentPath.CurrentNode.Ladders.Item.Pick(character, false, true); currentPath.CurrentNode.Ladders.Item.TryInteract(character, false, true);
} }
} }
@@ -239,7 +239,7 @@ namespace Barotrauma
foreach (Controller controller in buttons) foreach (Controller controller in buttons)
{ {
float dist = Vector2.Distance(controller.Item.WorldPosition, character.WorldPosition); float dist = Vector2.Distance(controller.Item.WorldPosition, character.WorldPosition);
if (dist > controller.Item.PickDistance * 2.0f) continue; if (dist > controller.Item.InteractDistance * 2.0f) continue;
if (dist < closestDist || closestButton == null) if (dist < closestDist || closestButton == null)
{ {
@@ -256,7 +256,7 @@ namespace Barotrauma
return; return;
} }
closestButton.Item.Pick(character, false, true); closestButton.Item.TryInteract(character, false, true);
break; break;
} }
} }
@@ -61,7 +61,7 @@ namespace Barotrauma
} }
else else
{ {
if (Vector2.Distance(character.Position, container.Item.Position) > container.Item.PickDistance if (Vector2.Distance(character.Position, container.Item.Position) > container.Item.InteractDistance
&& !container.Item.IsInsideTrigger(character.Position)) && !container.Item.IsInsideTrigger(character.Position))
{ {
AddSubObjective(new AIObjectiveGoTo(container.Item, character)); AddSubObjective(new AIObjectiveGoTo(container.Item, character));
@@ -55,7 +55,7 @@ namespace Barotrauma
FindTargetItem(); FindTargetItem();
if (targetItem == null || moveToTarget == null) return; if (targetItem == null || moveToTarget == null) return;
if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.PickDistance*2.0f) if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.InteractDistance*2.0f)
{ {
int targetSlot = -1; int targetSlot = -1;
if (equip) if (equip)
@@ -91,7 +91,7 @@ namespace Barotrauma
} }
} }
targetItem.Pick(character, false, true); targetItem.TryInteract(character, false, true);
if (targetSlot > -1 && character.Inventory.IsInLimbSlot(targetItem, InvSlotType.Any)) if (targetSlot > -1 && character.Inventory.IsInLimbSlot(targetItem, InvSlotType.Any))
{ {
@@ -126,7 +126,7 @@ namespace Barotrauma
if (item != null) if (item != null)
{ {
allowedDistance = Math.Max(ConvertUnits.ToSimUnits(item.PickDistance), allowedDistance); allowedDistance = Math.Max(ConvertUnits.ToSimUnits(item.InteractDistance), allowedDistance);
if (item.IsInsideTrigger(character.WorldPosition)) completed = true; if (item.IsInsideTrigger(character.WorldPosition)) completed = true;
} }
@@ -50,12 +50,12 @@ namespace Barotrauma
if (target.CanBeSelected) if (target.CanBeSelected)
{ {
if (Vector2.Distance(character.Position, target.Item.Position) < target.Item.PickDistance if (Vector2.Distance(character.Position, target.Item.Position) < target.Item.InteractDistance
|| target.Item.IsInsideTrigger(character.WorldPosition)) || target.Item.IsInsideTrigger(character.WorldPosition))
{ {
if (character.SelectedConstruction != target.Item && target.CanBeSelected) if (character.SelectedConstruction != target.Item && target.CanBeSelected)
{ {
target.Item.Pick(character, false, true); target.Item.TryInteract(character, false, true);
} }
if (component.AIOperate(deltaTime, character, this)) isCompleted = true; if (component.AIOperate(deltaTime, character, this)) isCompleted = true;
@@ -1213,7 +1213,7 @@ namespace Barotrauma
var newSelectedConstruction = (Item)character.MemState[0].Interact; var newSelectedConstruction = (Item)character.MemState[0].Interact;
if (newSelectedConstruction != null && character.SelectedConstruction != newSelectedConstruction) if (newSelectedConstruction != null && character.SelectedConstruction != newSelectedConstruction)
{ {
newSelectedConstruction.Pick(character, true, true); newSelectedConstruction.TryInteract(character, true, true);
} }
character.SelectedConstruction = newSelectedConstruction; character.SelectedConstruction = newSelectedConstruction;
} }
@@ -1305,7 +1305,7 @@ namespace Barotrauma
var newSelectedConstruction = (Item)serverPos.Interact; var newSelectedConstruction = (Item)serverPos.Interact;
if (newSelectedConstruction != null && character.SelectedConstruction != newSelectedConstruction) if (newSelectedConstruction != null && character.SelectedConstruction != newSelectedConstruction)
{ {
newSelectedConstruction.Pick(character, true, true); newSelectedConstruction.TryInteract(character, true, true);
} }
character.SelectedConstruction = newSelectedConstruction; character.SelectedConstruction = newSelectedConstruction;
} }
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using Barotrauma.Items.Components;
namespace Barotrauma namespace Barotrauma
{ {
@@ -71,8 +72,8 @@ namespace Barotrauma
private float health, lastSentHealth; private float health, lastSentHealth;
protected float minHealth, maxHealth; protected float minHealth, maxHealth;
protected Item closestItem; protected Item focusedItem;
private Character closestCharacter, selectedCharacter; private Character focusedCharacter, selectedCharacter;
private bool isDead; private bool isDead;
private CauseOfDeath lastAttackCauseOfDeath; private CauseOfDeath lastAttackCauseOfDeath;
@@ -154,6 +155,11 @@ namespace Barotrauma
get { return !IsUnconscious && Stun <= 0.0f && !isDead; } get { return !IsUnconscious && Stun <= 0.0f && !isDead; }
} }
public bool CanInteract
{
get { return AllowInput && !LockHands; }
}
public Vector2 CursorPosition public Vector2 CursorPosition
{ {
get { return cursorPosition; } get { return cursorPosition; }
@@ -169,9 +175,9 @@ namespace Barotrauma
get { return Submarine == null ? cursorPosition : cursorPosition + Submarine.Position; } get { return Submarine == null ? cursorPosition : cursorPosition + Submarine.Position; }
} }
public Character ClosestCharacter public Character FocusedCharacter
{ {
get { return closestCharacter; } get { return focusedCharacter; }
} }
public Character SelectedCharacter public Character SelectedCharacter
@@ -386,9 +392,9 @@ namespace Barotrauma
set { selectedConstruction = value; } set { selectedConstruction = value; }
} }
public Item ClosestItem public Item FocusedItem
{ {
get { return closestItem; } get { return focusedItem; }
} }
public virtual AIController AIController public virtual AIController AIController
@@ -569,7 +575,7 @@ namespace Barotrauma
System.Diagnostics.Debug.Assert(item != null); System.Diagnostics.Debug.Assert(item != null);
if (item == null) continue; if (item == null) continue;
item.Pick(this, true, true, true); item.TryInteract(this, true, true, true);
inventory.TryPutItem(item, i, false, false); inventory.TryPutItem(item, i, false, false);
} }
} }
@@ -713,7 +719,7 @@ namespace Barotrauma
return (Info==null || Info.Job==null) ? 0 : Info.Job.GetSkillLevel(skillName); return (Info==null || Info.Job==null) ? 0 : Info.Job.GetSkillLevel(skillName);
} }
float findClosestTimer; float findFocusedTimer;
public Vector2 GetTargetMovement() public Vector2 GetTargetMovement()
{ {
@@ -950,7 +956,7 @@ namespace Barotrauma
public bool CanAccessInventory(Inventory inventory) public bool CanAccessInventory(Inventory inventory)
{ {
if (!AllowInput || LockHands) return false; if (!CanInteract) return false;
//the inventory belongs to some other character //the inventory belongs to some other character
if (inventory.Owner is Character && inventory.Owner != this) if (inventory.Owner is Character && inventory.Owner != this)
@@ -958,14 +964,13 @@ namespace Barotrauma
var owner = (Character)inventory.Owner; var owner = (Character)inventory.Owner;
//can only be accessed if the character is incapacitated and has been selected //can only be accessed if the character is incapacitated and has been selected
return selectedCharacter == owner && return selectedCharacter == owner && (!owner.CanInteract);
(owner.isDead || owner.IsUnconscious || owner.Stun > 0.0f || owner.LockHands);
} }
if (inventory.Owner is Item) if (inventory.Owner is Item)
{ {
var owner = (Item)inventory.Owner; var owner = (Item)inventory.Owner;
if (!CanAccessItem(owner)) if (!CanInteractWith(owner))
{ {
return false; return false;
} }
@@ -973,53 +978,162 @@ namespace Barotrauma
return true; return true;
} }
public bool CanAccessItem(Item item) public bool CanInteractWith(Item item)
{ {
if (!AllowInput || LockHands) return false; float distanceToItem;
return CanInteractWith(item, out distanceToItem);
}
public bool CanInteractWith(Item item, out float distanceToItem)
{
distanceToItem = -1.0f;
if (!CanInteract) return false;
if (item.ParentInventory != null) if (item.ParentInventory != null)
{ {
return CanAccessInventory(item.ParentInventory); return CanAccessInventory(item.ParentInventory);
} }
float maxDist = item.PickDistance * 1.2f; if (item.InteractDistance == 0.0f && !item.Prefab.Triggers.Any()) return false;
if (maxDist <= 0.01f)
{
maxDist = 150.0f;
}
if (Vector2.DistanceSquared(WorldPosition, item.WorldPosition) < maxDist*maxDist || Pickable pickableComponent = item.GetComponent<Pickable>();
item.IsInsideTrigger(WorldPosition)) if (pickableComponent != null && (pickableComponent.Picker != null && !pickableComponent.Picker.IsDead)) return false;
{
return true; Vector2 characterDirection = Vector2.Transform(Vector2.UnitY, Matrix.CreateFromAxisAngle(Vector3.UnitZ, AnimController.Collider.Rotation));
}
return item.GetComponent<Items.Components.Ladder>() != null; Vector2 upperBodyPosition = Position + (characterDirection * 20.0f);
} Vector2 lowerBodyPosition = Position - (characterDirection * 60.0f);
private Item FindClosestItem(Vector2 mouseSimPos, out float distance)
{
distance = 0.0f;
Limb torso = AnimController.GetLimb(LimbType.Torso);
if (torso == null) return null;
Vector2 pos = (torso.body.TargetPosition != null) ? (Vector2)torso.body.TargetPosition : torso.SimPosition;
Vector2 pickPos = mouseSimPos;
if (Submarine != null) if (Submarine != null)
{ {
pos += Submarine.SimPosition; upperBodyPosition += Submarine.Position;
pickPos += Submarine.SimPosition; lowerBodyPosition += Submarine.Position;
} }
if (selectedConstruction != null) pickPos = ConvertUnits.ToSimUnits(selectedConstruction.WorldPosition); Vector2 playerDistanceCheckPosition;
Rectangle itemDisplayRect;
return Item.FindPickable(pos, pickPos, AnimController.CurrentHull, selectedItems, out distance); bool insideTrigger = false;
if (item.Prefab.Triggers.Any())
{
foreach (Rectangle trigger in item.Prefab.Triggers)
{
Rectangle transformedTrigger = new Rectangle(
item.WorldRect.X + trigger.X,
(item.WorldRect.Y + trigger.Y) - ((trigger.Height == 0) ? item.Rect.Height : trigger.Height),
(trigger.Width == 0) ? item.Rect.Width : trigger.Width,
(trigger.Height == 0) ? item.Rect.Height : trigger.Height);
// Get the point along the line between lowerBodyPosition and upperBodyPosition which is closest to the center of itemDisplayRect
playerDistanceCheckPosition = Vector2.Clamp(transformedTrigger.Center.ToVector2(), lowerBodyPosition, upperBodyPosition);
if (!transformedTrigger.Contains(upperBodyPosition)) return false;
insideTrigger = true;
}
if (!insideTrigger) return false;
}
itemDisplayRect = new Rectangle(item.InteractionRect.X, item.InteractionRect.Y - item.InteractionRect.Height, item.InteractionRect.Width, item.InteractionRect.Height);
// Get the point along the line between lowerBodyPosition and upperBodyPosition which is closest to the center of itemDisplayRect
playerDistanceCheckPosition = Vector2.Clamp(itemDisplayRect.Center.ToVector2(), lowerBodyPosition, upperBodyPosition);
// Here we get the point on the itemDisplayRect which is closest to playerDistanceCheckPosition
Vector2 rectIntersectionPoint = new Vector2(Math.Max(itemDisplayRect.X, Math.Min(itemDisplayRect.X + itemDisplayRect.Width, playerDistanceCheckPosition.X)), Math.Max(itemDisplayRect.Y, Math.Min(itemDisplayRect.Y + itemDisplayRect.Height, playerDistanceCheckPosition.Y)));
// If playerDistanceCheckPosition is inside the itemDisplayRect then we consider the character to within 0 distance of the item
if (!itemDisplayRect.Contains(playerDistanceCheckPosition))
{
distanceToItem = Vector2.Distance(rectIntersectionPoint, playerDistanceCheckPosition);
}
if (distanceToItem > item.InteractDistance && item.InteractDistance > 0.0f) return false;
if (!item.Prefab.InteractThroughWalls && Screen.Selected != GameMain.EditMapScreen && !insideTrigger)
{
Vector2 itemPosition = item.SimPosition;
if (Submarine == null && item.Submarine != null)
{
//character is outside, item inside
itemPosition += item.Submarine.SimPosition;
}
else if (Submarine != null && item.Submarine == null)
{
//character is inside, item outside
itemPosition -= Submarine.SimPosition;
}
else if (Submarine != item.Submarine)
{
//character and the item are inside different subs
itemPosition += item.Submarine.SimPosition;
itemPosition -= Submarine.SimPosition;
}
var body = Submarine.CheckVisibility(SimPosition, itemPosition, true);
if (body != null && body.UserData as Item != item) return false;
}
return true;
} }
private Character FindClosestCharacter(Vector2 mouseSimPos, float maxDist = 150.0f) /// <summary>
/// Finds the front (lowest depth) interactable item at a position. "Interactable" in this case means that the character can "reach" the item.
/// </summary>
/// <param name="character">The Character who is looking for the interactable item, only items that are close enough to this character are returned</param>
/// <param name="simPosition">The item at the simPosition, with the lowest depth, is returned</param>
/// <param name="allowFindingNearestItem">If this is true and an item cannot be found at simPosition then a nearest item will be returned if possible</param>
/// <param name="hull">If a hull is specified, only items within that hull are returned</param>
public Item FindItemAtPosition(Vector2 simPosition, float aimAssistModifier = 0.0f, Hull hull = null, Item[] ignoredItems = null)
{
if (Submarine != null)
{
simPosition += Submarine.SimPosition;
}
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(simPosition);
Item highestPriorityItemAtPosition = null;
Item closestItem = null;
float closestItemDistance = 0.0f;
foreach (Item item in Item.ItemList)
{
if (ignoredItems != null && ignoredItems.Contains(item)) continue;
if (item.body != null && !item.body.Enabled) continue;
if (CanInteractWith(item))
{
if (item.IsMouseOn(displayPosition))
{
Console.WriteLine("Name: " + item.Name + " Priority:" + item.InteractPriority);
}
if (item.IsMouseOn(displayPosition) && (highestPriorityItemAtPosition == null ||
((highestPriorityItemAtPosition.InteractPriority < item.InteractPriority) ||
(highestPriorityItemAtPosition.InteractPriority == item.InteractPriority && highestPriorityItemAtPosition.GetDrawDepth() > item.GetDrawDepth()))))
{
highestPriorityItemAtPosition = item;
}
else if (aimAssistModifier > 0.0f)
{
float distanceToItem = Vector2.Distance(item.WorldPosition, displayPosition);
if (distanceToItem < (100.0f * aimAssistModifier) && (closestItem == null || distanceToItem < closestItemDistance))
{
closestItem = item;
closestItemDistance = distanceToItem;
}
}
}
}
if (highestPriorityItemAtPosition == null)
{
return closestItem;
}
return highestPriorityItemAtPosition;
}
private Character FindCharacterAtPosition(Vector2 mouseSimPos, float maxDist = 150.0f)
{ {
Character closestCharacter = null; Character closestCharacter = null;
float closestDist = 0.0f; float closestDist = 0.0f;
@@ -1028,17 +1142,25 @@ namespace Barotrauma
foreach (Character c in CharacterList) foreach (Character c in CharacterList)
{ {
if (c == this || !c.enabled) continue; if (c == this || !c.enabled || c.info == null || !c.IsHumanoid || !c.CanBeSelected) continue;
if (Vector2.DistanceSquared(SimPosition, c.SimPosition) > maxDist*maxDist) continue;
float dist = Vector2.DistanceSquared(mouseSimPos, c.SimPosition); float dist = Vector2.DistanceSquared(mouseSimPos, c.SimPosition);
if (dist < maxDist*maxDist && (closestCharacter==null || dist<closestDist)) if (dist < maxDist*maxDist && (closestCharacter == null || dist < closestDist))
{ {
closestCharacter = c; closestCharacter = c;
closestDist = dist; closestDist = dist;
continue;
} }
/*FarseerPhysics.Common.Transform transform;
c.AnimController.Collider.FarseerBody.GetTransform(out transform);
for (int i = 0; i < c.AnimController.Collider.FarseerBody.FixtureList.Count; i++)
{
if (c.AnimController.Collider.FarseerBody.FixtureList[i].Shape.TestPoint(ref transform, ref mouseSimPos))
{
Console.WriteLine("Hit: " + i);
closestCharacter = c;
}
}*/
} }
return closestCharacter; return closestCharacter;
@@ -1086,7 +1208,66 @@ namespace Barotrauma
selectedCharacter = null; selectedCharacter = null;
} }
public void DoInteractionUpdate(float deltaTime, Vector2 mouseSimPos)
{
bool isLocalPlayer = (controlled == this);
if (!isLocalPlayer && (this is AICharacter || !IsRemotePlayer))
{
return;
}
if (!AllowInput || LockHands)
{
if (selectedCharacter != null)
{
DeselectCharacter();
}
selectedConstruction = null;
focusedItem = null;
focusedCharacter = null;
return;
}
if ((!isLocalPlayer && IsKeyHit(InputType.Select) && GameMain.Server == null) || (isLocalPlayer && (findFocusedTimer <= 0.0f || Screen.Selected == GameMain.EditMapScreen)))
{
focusedCharacter = FindCharacterAtPosition(mouseSimPos);
if (focusedCharacter != null)
{
focusedItem = null; // We can only focus one thing at a time
}
else
{
focusedItem = FindItemAtPosition(mouseSimPos, AnimController.InWater ? 0.5f : 0.25f);
}
findFocusedTimer = 0.05f;
}
else
{
findFocusedTimer -= deltaTime;
}
if (focusedCharacter != null && IsKeyHit(InputType.Select))
{
if (selectedCharacter != null)
{
DeselectCharacter();
}
else
{
SelectCharacter(focusedCharacter);
}
}
else if (focusedItem != null)
{
focusedItem.IsHighlighted = true;
focusedItem.TryInteract(this);
}
else if (IsKeyHit(InputType.Select) && selectedConstruction != null)
{
selectedConstruction = null;
}
}
public static void UpdateAnimAll(float deltaTime) public static void UpdateAnimAll(float deltaTime)
{ {
foreach (Character c in CharacterList) foreach (Character c in CharacterList)
@@ -1194,7 +1375,7 @@ namespace Barotrauma
} }
} }
UpdateControlled(deltaTime,cam); UpdateControlled(deltaTime, cam);
if (Stun > 0.0f) if (Stun > 0.0f)
{ {
@@ -1211,77 +1392,17 @@ namespace Barotrauma
UpdateUnconscious(deltaTime); UpdateUnconscious(deltaTime);
return; return;
} }
Control(deltaTime, cam);
if (selectedConstruction != null && !selectedConstruction.IsInPickRange(WorldPosition))
{
selectedConstruction = null;
}
Control(deltaTime, cam);
if (controlled != this && (!(this is AICharacter) || IsRemotePlayer)) if (controlled != this && (!(this is AICharacter) || IsRemotePlayer))
{ {
if (!LockHands) Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition);
{ DoInteractionUpdate(deltaTime, mouseSimPos);
Vector2 mouseSimPos = ConvertUnits.ToSimUnits(cursorPosition); }
if (IsKeyHit(InputType.Select) && GameMain.Server==null) if (selectedConstruction != null && !CanInteractWith(selectedConstruction))
{ {
closestCharacter = FindClosestCharacter(mouseSimPos); selectedConstruction = null;
if (closestCharacter != null && closestCharacter.info == null)
{
closestCharacter = null;
}
float closestItemDist = 0.0f;
closestItem = FindClosestItem(mouseSimPos, out closestItemDist);
if (closestCharacter != null && closestItem != null)
{
if (closestItem != null) closestItemDist = (closestItem.Position - AnimController.Collider.Position).Length();
if (Vector2.Distance(closestCharacter.SimPosition, mouseSimPos) < ConvertUnits.ToSimUnits(closestItemDist))
{
if (selectedConstruction != closestItem) closestItem = null;
}
else
{
closestCharacter = null;
}
}
}
if (selectedCharacter == null && closestItem != null)
{
//DebugConsole.NewMessage(closestItem.ToString(), Color.Yellow);
//closestItem.IsHighlighted = true;
if (!LockHands && closestItem.Pick(this))
{
if (AnimController.Anim == AnimController.Animation.Climbing)
{
//DebugConsole.NewMessage("ladder woo",Color.Lime);
}
}
}
if (IsKeyHit(InputType.Select))
{
if (selectedCharacter != null)
{
DeselectCharacter();
}
else if (closestCharacter != null && closestCharacter.IsHumanoid && closestCharacter.CanBeSelected)
{
SelectCharacter(closestCharacter);
}
}
}
else
{
if (selectedCharacter != null) DeselectCharacter();
selectedConstruction = null;
closestItem = null;
closestCharacter = null;
}
} }
if (selectedCharacter != null && AnimController.Anim == AnimController.Animation.CPR) if (selectedCharacter != null && AnimController.Anim == AnimController.Animation.CPR)
@@ -1304,7 +1425,7 @@ namespace Barotrauma
if (!IsDead) LockHands = false; if (!IsDead) LockHands = false;
} }
partial void UpdateControlled(float deltaTime,Camera cam); partial void UpdateControlled(float deltaTime, Camera cam);
private void UpdateOxygen(float deltaTime) private void UpdateOxygen(float deltaTime)
{ {
@@ -1355,7 +1476,7 @@ namespace Barotrauma
speechBubbleTimer = Math.Max(speechBubbleTimer, duration); speechBubbleTimer = Math.Max(speechBubbleTimer, duration);
speechBubbleColor = color; speechBubbleColor = color;
} }
public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker) public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
{ {
Health = health-amount; Health = health-amount;
@@ -1616,7 +1737,7 @@ namespace Barotrauma
foreach (Character c in CharacterList) foreach (Character c in CharacterList)
{ {
if (c.closestCharacter == this) c.closestCharacter = null; if (c.focusedCharacter == this) c.focusedCharacter = null;
if (c.selectedCharacter == this) c.selectedCharacter = null; if (c.selectedCharacter == this) c.selectedCharacter = null;
} }
} }
@@ -147,13 +147,13 @@ namespace Barotrauma
var closestEntity = Entity.FindEntityByID(memInput[memInput.Count - 1].interact); var closestEntity = Entity.FindEntityByID(memInput[memInput.Count - 1].interact);
if (closestEntity is Item) if (closestEntity is Item)
{ {
closestItem = (Item)closestEntity; focusedItem = (Item)closestEntity;
closestCharacter = null; focusedCharacter = null;
} }
else if (closestEntity is Character) else if (closestEntity is Character)
{ {
closestCharacter = (Character)closestEntity; focusedCharacter = (Character)closestEntity;
closestItem = null; focusedItem = null;
} }
memInput.RemoveAt(memInput.Count - 1); memInput.RemoveAt(memInput.Count - 1);
@@ -205,13 +205,13 @@ namespace Barotrauma
NetInputMem newMem = new NetInputMem(); NetInputMem newMem = new NetInputMem();
newMem.states = newInput; newMem.states = newInput;
newMem.intAim = intAngle; newMem.intAim = intAngle;
if (closestItem != null) if (focusedItem != null)
{ {
newMem.interact = closestItem.ID; newMem.interact = focusedItem.ID;
} }
else if (closestCharacter != null) else if (focusedCharacter != null)
{ {
newMem.interact = closestCharacter.ID; newMem.interact = focusedCharacter.ID;
} }
memInput.Insert(0, newMem); memInput.Insert(0, newMem);
@@ -101,9 +101,7 @@ namespace Barotrauma.Items.Components
pickTimer = 0.0f; pickTimer = 0.0f;
while (pickTimer < requiredTime && Screen.Selected != GameMain.EditMapScreen) while (pickTimer < requiredTime && Screen.Selected != GameMain.EditMapScreen)
{ {
if (picker.IsKeyDown(InputType.Aim) || if (picker.IsKeyDown(InputType.Aim) || !picker.CanInteractWith(item))
!item.IsInPickRange(picker.WorldPosition) ||
picker.Stun > 0.0f || picker.IsDead)
{ {
StopPicking(picker); StopPicking(picker);
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
@@ -76,10 +76,8 @@ namespace Barotrauma.Items.Components
this.cam = cam; this.cam = cam;
if (character == null if (character == null
|| character.IsDead
|| character.Stun > 0.0f
|| character.SelectedConstruction != item || character.SelectedConstruction != item
|| Vector2.Distance(character.Position, item.Position) > item.PickDistance * 2.0f) || !character.CanInteractWith(item))
{ {
if (character != null) if (character != null)
{ {
@@ -149,7 +147,7 @@ namespace Barotrauma.Items.Components
public override bool Use(float deltaTime, Character activator = null) public override bool Use(float deltaTime, Character activator = null)
{ {
if (character == null || activator != character || character.SelectedConstruction != item) if (character == null || activator != character || character.SelectedConstruction != item || !character.CanInteractWith(item))
{ {
character = null; character = null;
return false; return false;
@@ -164,7 +162,7 @@ namespace Barotrauma.Items.Components
public override void SecondaryUse(float deltaTime, Character character = null) public override void SecondaryUse(float deltaTime, Character character = null)
{ {
if (this.character == null || this.character != character || this.character.SelectedConstruction != item) if (this.character == null || this.character != character || this.character.SelectedConstruction != item || !character.CanInteractWith(item))
{ {
character = null; character = null;
return; return;
@@ -128,19 +128,33 @@ namespace Barotrauma
{ {
get { return prefab.ImpactTolerance; } get { return prefab.ImpactTolerance; }
} }
public float PickDistance public float InteractDistance
{ {
get { return prefab.PickDistance; } get { return prefab.InteractDistance; }
}
public float InteractPriority
{
get { return prefab.InteractPriority; }
} }
public override Vector2 SimPosition public override Vector2 SimPosition
{ {
get get
{ {
return (body==null) ? base.SimPosition : body.SimPosition; return (body == null) ? base.SimPosition : body.SimPosition;
} }
} }
public Rectangle InteractionRect
{
get
{
return WorldRect;
}
}
public bool NeedsPositionUpdate public bool NeedsPositionUpdate
{ {
get get
@@ -910,7 +924,7 @@ namespace Barotrauma
{ {
return drawableComponents.Count > 0 || body == null || body.Enabled; return drawableComponents.Count > 0 || body == null || body.Enabled;
} }
public List<T> GetConnectedComponents<T>(bool recursive = false) public List<T> GetConnectedComponents<T>(bool recursive = false)
{ {
List<T> connectedComponents = new List<T>(); List<T> connectedComponents = new List<T>();
@@ -999,77 +1013,11 @@ namespace Barotrauma
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
} }
public static Item FindPickable(Vector2 position, Vector2 pickPosition, Hull hull = null, Item[] ignoredItems = null) public float GetDrawDepth()
{ {
float dist; return Sprite.Depth + ((ID % 255) * 0.000001f);
return FindPickable(position, pickPosition, hull, ignoredItems, out dist);
} }
/// <param name="position">Position of the Character doing the pick, only items that are close enough to this are checked</param>
/// <param name="pickPosition">the item closest to pickPosition is returned</param>
/// <param name="hull">If a hull is specified, only items within that hull are checked</param>
public static Item FindPickable(Vector2 position, Vector2 pickPosition, Hull hull, Item[] ignoredItems, out float distance)
{
float closestDist = 0.0f, dist;
Item closest = null;
Vector2 displayPos = ConvertUnits.ToDisplayUnits(position);
Vector2 displayPickPos = ConvertUnits.ToDisplayUnits(pickPosition);
distance = 1000.0f;
foreach (Item item in ItemList)
{
if (ignoredItems != null && ignoredItems.Contains(item)) continue;
if (item.body != null && !item.body.Enabled) continue;
if (item.PickDistance == 0.0f && !item.prefab.Triggers.Any()) continue;
Pickable pickableComponent = item.GetComponent<Pickable>();
if (pickableComponent != null && (pickableComponent.Picker != null && !pickableComponent.Picker.IsDead)) continue;
float pickDist = Vector2.Distance(item.WorldPosition, displayPickPos);
bool insideTrigger = false;
foreach (Rectangle trigger in item.prefab.Triggers)
{
Rectangle transformedTrigger = item.TransformTrigger(trigger, true);
if (!Submarine.RectContains(transformedTrigger, displayPos)) continue;
insideTrigger = true;
Vector2 triggerCenter = new Vector2(transformedTrigger.Center.X, transformedTrigger.Y - transformedTrigger.Height / 2);
pickDist = Math.Min(Math.Abs(triggerCenter.X - displayPickPos.X), Math.Abs(triggerCenter.Y - displayPickPos.Y));
}
if (!insideTrigger && item.prefab.Triggers.Any()) continue;
if (pickDist > item.PickDistance && item.PickDistance > 0.0f) continue;
dist = item.Sprite.Depth * 10.0f + pickDist;
if (item.IsMouseOn(displayPickPos)) dist = dist * 0.1f;
if (closest == null || dist < closestDist)
{
if (item.PickDistance > 0.0f && Vector2.Distance(displayPos, item.WorldPosition) > item.prefab.PickDistance) continue;
if (!item.prefab.PickThroughWalls && Screen.Selected != GameMain.EditMapScreen && !insideTrigger)
{
Body body = Submarine.CheckVisibility(item.Submarine == null ? position : position - item.Submarine.SimPosition, item.SimPosition, true);
if (body != null && body.UserData as Item != item) continue;
}
closestDist = dist;
closest = item;
distance = pickDist;
}
}
return closest;
}
public bool IsInsideTrigger(Vector2 worldPosition) public bool IsInsideTrigger(Vector2 worldPosition)
{ {
foreach (Rectangle trigger in prefab.Triggers) foreach (Rectangle trigger in prefab.Triggers)
@@ -1082,26 +1030,19 @@ namespace Barotrauma
return false; return false;
} }
public bool IsInPickRange(Vector2 worldPosition)
{
if (IsInsideTrigger(worldPosition)) return true;
return Vector2.Distance(WorldPosition, worldPosition) < PickDistance;
}
public bool CanClientAccess(Client c) public bool CanClientAccess(Client c)
{ {
return c != null && c.Character != null && c.Character.CanAccessItem(this); return c != null && c.Character != null && c.Character.CanInteractWith(this);
} }
public bool Pick(Character picker, bool ignoreRequiredItems=false, bool forceSelectKey=false, bool forceActionKey=false) public bool TryInteract(Character picker, bool ignoreRequiredItems=false, bool forceSelectKey=false, bool forceActionKey=false)
{ {
bool hasRequiredSkills = true; bool hasRequiredSkills = true;
bool picked = false, selected = false; bool picked = false, selected = false;
Skill requiredSkill = null; Skill requiredSkill = null;
foreach (ItemComponent ic in components) foreach (ItemComponent ic in components)
{ {
bool pickHit = false, selectHit = false; bool pickHit = false, selectHit = false;
@@ -1129,7 +1070,6 @@ namespace Barotrauma
} }
} }
if (!pickHit && !selectHit) continue; if (!pickHit && !selectHit) continue;
Skill tempRequiredSkill; Skill tempRequiredSkill;
@@ -1139,7 +1079,7 @@ namespace Barotrauma
bool showUiMsg = picker == Character.Controlled && Screen.Selected != GameMain.EditMapScreen; bool showUiMsg = picker == Character.Controlled && Screen.Selected != GameMain.EditMapScreen;
if (!ignoreRequiredItems && !ic.HasRequiredItems(picker, showUiMsg)) continue; if (!ignoreRequiredItems && !ic.HasRequiredItems(picker, showUiMsg)) continue;
if ((ic.CanBePicked && pickHit && ic.Pick(picker)) || if ((ic.CanBePicked && pickHit && ic.Pick(picker)) ||
(ic.CanBeSelected && selectHit && ic.Select(picker))) (ic.CanBeSelected && selectHit && ic.Select(picker)))
{ {
picked = true; picked = true;
@@ -1164,24 +1104,24 @@ namespace Barotrauma
if (picker.IsKeyHit(InputType.Select) || forceSelectKey) picker.SelectedConstruction = null; if (picker.IsKeyHit(InputType.Select) || forceSelectKey) picker.SelectedConstruction = null;
} }
else if (selected) else if (selected)
{ {
picker.SelectedConstruction = this; picker.SelectedConstruction = this;
} }
#if CLIENT #if CLIENT
if (!hasRequiredSkills && Character.Controlled==picker && Screen.Selected != GameMain.EditMapScreen) if (!hasRequiredSkills && Character.Controlled == picker && Screen.Selected != GameMain.EditMapScreen)
{ {
GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f); GUI.AddMessage("Your skills may be insufficient to use the item!", Color.Red, 5.0f);
if (requiredSkill != null) if (requiredSkill != null)
{ {
GUI.AddMessage("("+requiredSkill.Name+" level "+requiredSkill.Level+" required)", Color.Red, 5.0f); GUI.AddMessage("(" + requiredSkill.Name + " level " + requiredSkill.Level + " required)", Color.Red, 5.0f);
} }
} }
#endif #endif
if (Container!=null) Container.RemoveContained(this); if (Container != null) Container.RemoveContained(this);
return true; return true;
} }
@@ -1366,7 +1306,7 @@ namespace Barotrauma
int requirementIndex = FixRequirements.Count == 1 ? int requirementIndex = FixRequirements.Count == 1 ?
0 : msg.ReadRangedInteger(0, FixRequirements.Count - 1); 0 : msg.ReadRangedInteger(0, FixRequirements.Count - 1);
if (c.Character == null || !c.Character.CanAccessItem(this)) return; if (c.Character == null || !c.Character.CanInteractWith(this)) return;
if (!FixRequirements[requirementIndex].CanBeFixed(c.Character)) return; if (!FixRequirements[requirementIndex].CanBeFixed(c.Character)) return;
FixRequirements[requirementIndex].Fixed = true; FixRequirements[requirementIndex].Fixed = true;
@@ -1379,7 +1319,7 @@ namespace Barotrauma
break; break;
case NetEntityEvent.Type.ApplyStatusEffect: case NetEntityEvent.Type.ApplyStatusEffect:
if (c.Character == null || !c.Character.CanAccessItem(this)) return; if (c.Character == null || !c.Character.CanInteractWith(this)) return;
ApplyStatusEffects(ActionType.OnUse, (float)Timing.Step, c.Character); ApplyStatusEffects(ActionType.OnUse, (float)Timing.Step, c.Character);
@@ -33,9 +33,11 @@ namespace Barotrauma
protected Vector2 size; protected Vector2 size;
//how close the Character has to be to the item to pick it up //how close the Character has to be to the item to pick it up
private float pickDistance; private float interactDistance;
// this can be used to allow items which are behind other items tp
private float interactPriority;
private bool pickThroughWalls; private bool interactThroughWalls;
//an area next to the construction //an area next to the construction
//the construction can be Activated() by a Character inside the area //the construction can be Activated() by a Character inside the area
@@ -78,14 +80,19 @@ namespace Barotrauma
private set; private set;
} }
public float PickDistance public float InteractDistance
{ {
get { return pickDistance; } get { return interactDistance; }
} }
public bool PickThroughWalls public float InteractPriority
{ {
get { return pickThroughWalls; } get { return interactPriority; }
}
public bool InteractThroughWalls
{
get { return interactThroughWalls; }
} }
public override bool IsLinkable public override bool IsLinkable
@@ -238,9 +245,10 @@ namespace Barotrauma
Description = ToolBox.GetAttributeString(element, "description", ""); Description = ToolBox.GetAttributeString(element, "description", "");
pickThroughWalls = ToolBox.GetAttributeBool(element, "pickthroughwalls", false); interactThroughWalls = ToolBox.GetAttributeBool(element, "interactthroughwalls", false);
pickDistance = ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f); interactDistance = ToolBox.GetAttributeFloat(element, "interactdistance", 120.0f); // Default to 120 as the new item picking method is tuned to this number
interactPriority = ToolBox.GetAttributeFloat(element, "interactpriority", 0.0f);
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false); isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
resizeHorizontal = ToolBox.GetAttributeBool(element, "resizehorizontal", false); resizeHorizontal = ToolBox.GetAttributeBool(element, "resizehorizontal", false);
@@ -91,12 +91,9 @@ namespace Barotrauma
if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime); if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime);
#if CLIENT #if CLIENT
if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null) if (Character.Controlled != null && Character.Controlled.SelectedConstruction != null && Character.Controlled.CanInteractWith(Character.Controlled.SelectedConstruction))
{ {
if (Character.Controlled.SelectedConstruction == Character.Controlled.ClosestItem) Character.Controlled.SelectedConstruction.UpdateHUD(cam, Character.Controlled);
{
Character.Controlled.SelectedConstruction.UpdateHUD(cam, Character.Controlled);
}
} }
#endif #endif