Merge branch 'master' into new-netcode

Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Items/Components/DockingPort.cs
	Subsurface/Source/Items/Components/Signal/Wire.cs
	Subsurface/Source/Items/Item.cs
This commit is contained in:
Regalis
2016-12-29 22:18:27 +02:00
134 changed files with 1799 additions and 683 deletions
+28 -13
View File
@@ -202,6 +202,10 @@ namespace Launcher2
} }
} }
GUIComponent.ClearUpdateList();
guiRoot.AddToGUIUpdateList();
GUIComponent.UpdateMouseOn();
guiRoot.Update(deltaTime); guiRoot.Update(deltaTime);
} }
@@ -296,24 +300,30 @@ namespace Launcher2
{ {
updateInfoBox.ClearChildren(); updateInfoBox.ClearChildren();
//string wrappedText = ToolBox.WrapText(text, updateInfoBox.Rect.Width, GUI.SmallFont);
//int lineHeight = (int)GUI.SmallFont.MeasureString(" ").Y;
string[] lines = text.Split('\n'); string[] lines = text.Split('\n');
foreach (string line in lines) foreach (string line in lines)
{ {
if (string.IsNullOrWhiteSpace(line)) continue; int indent = 10;
int heigth = 0;
if (!string.IsNullOrWhiteSpace(line))
{
if (line[0] == '-')
indent = 20;
}
else
{
heigth = 5;
}
GUITextBlock textBlock = new GUITextBlock( GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0,0,0,0), new Rectangle(indent, 0, 0, heigth),
line, GUI.Style, line, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft, Alignment.TopLeft, Alignment.TopLeft,
updateInfoBox, true, GUI.SmallFont); updateInfoBox, true, GUI.SmallFont);
textBlock.Padding = new Vector4(indent, 0, 0, 0);
textBlock.TextColor = indent > 10 ? Color.LightGray : Color.White;
textBlock.CanBeFocused = false; textBlock.CanBeFocused = false;
} }
} }
private bool CheckForUpdates() private bool CheckForUpdates()
@@ -410,7 +420,7 @@ namespace Launcher2
if (currentVersion.CompareTo(latestVersion) >= 0) if (currentVersion.CompareTo(latestVersion) >= 0)
{ {
updateInfoText.Text = "Game is up to date!"; updateInfoText.Text = "Your game is up to date!";
return false; return false;
} }
@@ -439,9 +449,14 @@ namespace Launcher2
string innerText = ToolBox.ElementInnerText(patchNote); string innerText = ToolBox.ElementInnerText(patchNote);
innerText = innerText.Replace("\r\n", "\n"); innerText = innerText.Replace("\r\n", "\n");
sb.Append(innerText+"\n"); innerText = innerText.Replace("\t", "");
sb.AppendLine("================================");
sb.AppendLine(patchNumber);
sb.AppendLine("================================\n");
sb.AppendLine(innerText);
sb.AppendLine("----------------------------\n");
} }
SetUpdateInfoBox(sb.ToString()); SetUpdateInfoBox(sb.ToString());
@@ -577,7 +592,7 @@ namespace Launcher2
private void Completed(object sender, AsyncCompletedEventArgs e) private void Completed(object sender, AsyncCompletedEventArgs e)
{ {
if (e.Error!=null) if (e.Error != null)
{ {
string errorMsg = "Error while downloading: " + e.Error; string errorMsg = "Error while downloading: " + e.Error;
+164
View File
@@ -92,6 +92,7 @@
<Compile Include="Source\Characters\CharacterHUD.cs" /> <Compile Include="Source\Characters\CharacterHUD.cs" />
<Compile Include="Source\Characters\CharacterInfo.cs" /> <Compile Include="Source\Characters\CharacterInfo.cs" />
<Compile Include="Source\Characters\AI\ISteerable.cs" /> <Compile Include="Source\Characters\AI\ISteerable.cs" />
<Compile Include="Source\Characters\CharacterSound.cs" />
<Compile Include="Source\Characters\DelayedEffect.cs" /> <Compile Include="Source\Characters\DelayedEffect.cs" />
<Compile Include="Source\Characters\HUDProgressBar.cs" /> <Compile Include="Source\Characters\HUDProgressBar.cs" />
<Compile Include="Source\Characters\HuskInfection.cs" /> <Compile Include="Source\Characters\HuskInfection.cs" />
@@ -367,6 +368,13 @@
<Content Include="Content\BackgroundSprites\vegetation5.png"> <Content Include="Content\BackgroundSprites\vegetation5.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Characters\Carrier\carrier.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Carrier\carrier.xml">
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Characters\Charybdis\charybdis.png"> <Content Include="Content\Characters\Charybdis\charybdis.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -1092,9 +1100,33 @@
<None Include="Content\blurshader.xnb"> <None Include="Content\blurshader.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Carrier\alarm1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Carrier\carrier1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Carrier\carrier2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Carrier\carrier3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Carrier\ping.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Charybdis\charybdisattack.ogg"> <None Include="Content\Characters\Charybdis\charybdisattack.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Coelanth\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Coelanth\idle1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Coelanth\idle2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Crawler\attack1.ogg"> <None Include="Content\Characters\Crawler\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1116,6 +1148,12 @@
<None Include="Content\Characters\Endworm\endwormidle.ogg"> <None Include="Content\Characters\Endworm\endwormidle.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Fractalguardian\Die1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Fractalguardian\Die2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Fractalguardian\guardian1.ogg"> <None Include="Content\Characters\Fractalguardian\guardian1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1131,6 +1169,21 @@
<None Include="Content\Characters\Husk\Husk3.ogg"> <None Include="Content\Characters\Husk\Husk3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Mantis\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Mantis\attack2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Mantis\idle1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Mantis\idle2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Mantis\idle3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Moloch\attack1.ogg"> <None Include="Content\Characters\Moloch\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1152,6 +1205,33 @@
<None Include="Content\Characters\Scorpion\scorpionidle2.ogg"> <None Include="Content\Characters\Scorpion\scorpionidle2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Characters\Watcher\attack1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\attack2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\attack3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch4.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch5.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Characters\Watcher\watch6.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Content.mgcb"> <None Include="Content\Content.mgcb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1284,6 +1364,57 @@
<None Include="Content\SmallFont.xnb"> <None Include="Content\SmallFont.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Sounds\Ambient\Ambient1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient10.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient11.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient12.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient13.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient4.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient5.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient6.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient7.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient8.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\Ambient9.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\DistantPod1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\DistantPod2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\DistantPod3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Ambient\GlacialMovement.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\creak1.ogg"> <None Include="Content\Sounds\Damage\creak1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1332,6 +1463,24 @@
<None Include="Content\Sounds\firelarge.ogg"> <None Include="Content\Sounds\firelarge.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Sounds\Damage\GlassBreak1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\GlassBreak2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\GlassBreak3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\GlassImpact1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\GlassImpact2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Damage\GlassImpact3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\amb_JD_drone_clattering_machine.ogg"> <None Include="Content\Sounds\Music\amb_JD_drone_clattering_machine.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1383,6 +1532,21 @@
<None Include="Content\Sounds\UI\UImsg.ogg"> <None Include="Content\Sounds\UI\UImsg.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Sounds\Water\Drown1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Water\Drown2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Water\Drown3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Water\Drown4.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Water\DrownLoop.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Water\FlowLarge.ogg"> <None Include="Content\Sounds\Water\FlowLarge.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 597 KiB

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name="carrier" humanoid="false" health="1000" doesbleed="false">
<sound file="Content/Characters/Carrier/alarm1.ogg" state="Attack" range="2000"/>
<sound file="Content/Characters/Carrier/carrier1.ogg" state="Attack" range="2000"/>
<sound file="Content/Characters/Carrier/carrier2.ogg" state="None" range="3000"/>
<sound file="Content/Characters/Carrier/carrier3.ogg" state="None" range="4000"/>
<sound file="Content/Characters/Carrier/ping.ogg" state="Die" range="3000"/>
<ragdoll waveamplitude="0.0" swimspeed="4.0" mirror="true" rotatetowardsmovement="false" headangle="-90" canentersubmarine="false">
<collider radius ="230"/>
<!-- head -->
<limb id = "0" width="300" height="673" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="0,0,393,778" depth="0.02" origin ="0.5,0.45"/>
<lightsource range="400.0" color="0.7,0.8,1.0,1.0">
<lighttexture texture="Content/Characters/Carrier/carrier.png" sourcerect="392,0,307,778" origin="0.5, 0.45"/>
</lightsource>
<attack range="400" duration="0.08" damage="100" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb>
<limb id = "1" width="50" height="240" flip="true">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="786,0,54,242" depth="0.025" origin="0.5,0.5"/>
</limb>
<limb id = "2" width="50" height="240" flip="true">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="786,0,54,242" depth="0.025" origin="0.5,0.5"/>
</limb>
<limb id = "3" width="120" height="340" flip="true">
<sprite texture="Content/Characters/Carrier/carrier.png" sourcerect="863,0,150,390" depth="0.025" origin="0.5,0.5"/>
</limb>
<limb id = "4" width="10" height="10" flip="true">
<lightsource range="400.0" color="0.7,0.8,1.0,1.0">
<lighttexture texture="Content/Lights/lightcone.png" origin="0.0, 0.5" size="2.0,1.0"/>
</lightsource>
</limb>
<joint limb1="0" limb1anchor="92,-200" limb2="1" limb2anchor="0,-100" lowerlimit="180" upperlimit="210"/>
<joint limb1="0" limb1anchor="64,-264" limb2="2" limb2anchor="0,-100" lowerlimit="180" upperlimit="210"/>
<joint limb1="0" limb1anchor="-100,100" limb2="3" limb2anchor="38,0" lowerlimit="-50" upperlimit="5"/>
<joint limb1="0" limb1anchor="140,268" limb2="4" limb2anchor="0,0" lowerlimit="87" upperlimit="93"/>
</ragdoll>
<ai attackhumans="100.0" attackrooms="50.0"
attackweaker="50.0" attackstronger="-30.0"
attackcooldown="15.0"
sight="0.5" hearing="1.0"/>
</Character>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Character name ="coelanth" humanoid="false" health="100.0"> <Character name ="coelanth" humanoid="false" health="100.0">
<sound file="Content/Characters/Scorpion/scorpionattack1.ogg" state="Attack" /> <sound file="Content/Characters/Coelanth/attack1.ogg" state="Attack" />
<sound file="Content/Characters/Scorpion/scorpionidle1.ogg" state="None" /> <sound file="Content/Characters/Coelanth/idle1.ogg" state="None" />
<sound file="Content/Characters/Scorpion/scorpionidle2.ogg" state="None" /> <sound file="Content/Characters/Coelanth/idle2.ogg" state="None" />
<ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="5.0" walkspeed="3.5" canentersubmarine="false"> <ragdoll waveamplitude="50.0" wavelength="2500" swimspeed="5.0" walkspeed="3.5" canentersubmarine="false">
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,8 @@
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" /> <sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" /> <sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/Die1.ogg" state="Die" range="3000" />
<sound file="Content/Characters/Fractalguardian/Die2.ogg" state="Die" range="3000" />
<ragdoll waveamplitude="50.0" wavelength="500" swimspeed="3.0" walkspeed="0.3" flip="false" canentersubmarine="false"> <ragdoll waveamplitude="50.0" wavelength="500" swimspeed="3.0" walkspeed="0.3" flip="false" canentersubmarine="false">
@@ -3,6 +3,8 @@
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" /> <sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" /> <sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
<sound file="Content/Characters/Fractalguardian/Die1.ogg" state="Die" range="3000" />
<sound file="Content/Characters/Fractalguardian/Die2.ogg" state="Die" range="3000" />
<ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false"> <ragdoll waveamplitude="0.0" swimspeed="1.0" walkspeed="0.3" flip="false" canentersubmarine="false" rotatetowardsmovement="false">
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Character name ="mantis" humanoid="false" health="200" doesbleed="false"> <Character name ="mantis" humanoid="false" health="200" doesbleed="false">
<sound file="Content/Characters/Crawler/attack1.ogg" state="Attack" range="500"/> <sound file="Content/Characters/Mantis/attack1.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Crawler/attack2.ogg" state="Attack" range="500"/> <sound file="Content/Characters/Mantis/attack2.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Crawler/idle1.ogg" state="None" range="500"/>
<sound file="Content/Characters/Crawler/idle2.ogg" state="None" range="500"/>
<sound file="Content/Characters/Mantis/idle1.ogg" state="None" range="500"/>
<sound file="Content/Characters/Mantis/idle2.ogg" state="None" range="500"/>
<sound file="Content/Characters/Mantis/idle3.ogg" state="None" range="500"/>
<ragdoll headposition="120" headangle="-90" <ragdoll headposition="120" headangle="-90"
waveamplitude="50.0" wavelength="2500" waveamplitude="50.0" wavelength="2500"
swimspeed="2.0" walkspeed="3.0" swimspeed="2.0" walkspeed="3.0"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Character name ="watcher" humanoid="false" health ="1000"> <Character name ="watcher" humanoid="false" health ="1000">
<sound file="Content/Characters/Watcher/attack1.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Watcher/attack2.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Watcher/attack3.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Watcher/watch1.ogg" state="None" range="500"/>
<sound file="Content/Characters/Watcher/watch2.ogg" state="None" range="500"/>
<sound file="Content/Characters/Watcher/watch3.ogg" state="None" range="500"/>
<sound file="Content/Characters/Watcher/watch4.ogg" state="None" range="500"/>
<sound file="Content/Characters/Watcher/watch5.ogg" state="None" range="500"/>
<sound file="Content/Characters/Watcher/watch6.ogg" state="None" range="500"/>
<ragdoll waveamplitude="0.0" swimspeed="0.5" walkspeed="0.3" mirror="true" rotatetowardsmovement="false" headangle="-90"> <ragdoll waveamplitude="0.0" swimspeed="0.5" walkspeed="0.3" mirror="true" rotatetowardsmovement="false" headangle="-90">
<collider radius="100"/> <collider radius="100"/>
@@ -227,11 +227,9 @@
</Containable> </Containable>
</ItemContainer> </ItemContainer>
<LightComponent lightcolor="0.6,0.8,1.0,1.0" range="800.0" IsOn="true"/> <LightComponent lightcolor="0.6,0.8,1.0,1.0" canbeselected="false" range="800.0" IsOn="true"/>
<PowerContainer capacity="20000.0" maxrechargespeed="10000.0" maxoutput="10000.0"> <PowerContainer capacity="20000.0" canbeselected="false" maxrechargespeed="10000.0" maxoutput="10000.0"/>
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
</PowerContainer>
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/> <requireditem name="Screwdriver,Wire" type="Equipped"/>
+1 -1
View File
@@ -15,7 +15,7 @@
<Body width="32" height="32" density="40"/> <Body width="32" height="32" density="40"/>
<Controller userpos="0" direction ="None" canbepicked = "true" msg="Open [E]"> <Controller direction ="None" canbepicked = "true" msg="Open [E]">
<RequiredItem name="ID Card" type="Picked" msg="UNAUTHORIZED ACCESS"/> <RequiredItem name="ID Card" type="Picked" msg="UNAUTHORIZED ACCESS"/>
<sound file="beep.ogg" type="OnUse" range="500.0"/> <sound file="beep.ogg" type="OnUse" range="500.0"/>
</Controller> </Controller>
@@ -50,7 +50,7 @@
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/> <StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
</PowerContainer> </PowerContainer>
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="Action" canbeselected="true" msg="Rewire [Screwdriver]">
<StatusEffect type="OnFailure" target="Character"> <StatusEffect type="OnFailure" target="Character">
<Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/> <Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/>
</StatusEffect> </StatusEffect>
@@ -59,7 +59,7 @@
<input name="power_in"/> <input name="power_in"/>
</ConnectionPanel> </ConnectionPanel>
<ItemContainer capacity="3" hideitems="true"> <ItemContainer capacity="3" canbeselected="true" hideitems="true">
<Containable name="loadable"/> <Containable name="loadable"/>
</ItemContainer> </ItemContainer>
</Item> </Item>
+1 -1
View File
@@ -39,7 +39,7 @@
<input name="shutdown"/> <input name="shutdown"/>
</ConnectionPanel> </ConnectionPanel>
<ItemContainer capacity="5"> <ItemContainer capacity="5" canbeselected="true">
<Containable name="Fuel Rod"> <Containable name="Fuel Rod">
<StatusEffect type="OnContaining" target="This" AvailableFuel="2000.0" disabledeltatime="true"/> <StatusEffect type="OnContaining" target="This" AvailableFuel="2000.0" disabledeltatime="true"/>
</Containable> </Containable>
@@ -45,7 +45,7 @@
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
</Deconstruct> </Deconstruct>
<Sprite texture="railgunetc.png" sourcerect="114,210,68,47" depth ="0.5"/> <Sprite texture="railgunetc.png" sourcerect="114,210,68,47" depth ="0.55"/>
<Body width="68" height="47" density="30"/> <Body width="68" height="47" density="30"/>
@@ -91,7 +91,7 @@
<requireditem name="Wrench" type="Equipped"/> <requireditem name="Wrench" type="Equipped"/>
</Holdable> </Holdable>
<ItemContainer capacity="1" itempos="0,0" hideitems="false"> <ItemContainer canbeselected="true" capacity="1" itempos="0,0" hideitems="false">
<Containable name="explosive"/> <Containable name="explosive"/>
</ItemContainer> </ItemContainer>
Binary file not shown.
+4 -3
View File
@@ -34,8 +34,9 @@
<Sprite texture ="railgunetc.png" depth="0.8" sourcerect="182,0,61,97"/> <Sprite texture ="railgunetc.png" depth="0.8" sourcerect="182,0,61,97"/>
<Controller UserPos="-1.0" direction ="Right" canbeselected = "true"> <Controller UserPos="-35.0, -50.0" direction ="Right" canbeselected = "true">
<limbposition limb="Head" position="-5,-62"/> <limbposition limb="Head" position="-5,-62"/>
<limbposition limb="Torso" position="-5,-108"/>
<limbposition limb="LeftHand" position="43,-85"/> <limbposition limb="LeftHand" position="43,-85"/>
<limbposition limb="RightHand" position="43,-85"/> <limbposition limb="RightHand" position="43,-85"/>
</Controller> </Controller>
@@ -74,7 +75,7 @@
<Item name="Polycarbonate Bar"/> <Item name="Polycarbonate Bar"/>
</Deconstruct> </Deconstruct>
<Sprite texture="weapons.png" sourcerect="0,58,88,20" depth ="0.5"/> <Sprite texture="weapons.png" sourcerect="0,58,88,20" depth ="0.55"/>
<Body width="87" height="18" density="30"/> <Body width="87" height="18" density="30"/>
@@ -106,7 +107,7 @@
<Item name="Polycarbonate Bar"/> <Item name="Polycarbonate Bar"/>
</Deconstruct> </Deconstruct>
<Sprite texture="weapons.png" sourcerect="0,77,88,20" depth ="0.5"/> <Sprite texture="weapons.png" sourcerect="0,77,88,20" depth ="0.55"/>
<Body width="87" height="18" density="35"/> <Body width="87" height="18" density="35"/>
Binary file not shown.
+4 -4
View File
@@ -108,22 +108,22 @@
<sprite texture="Content/Map/testroom.png" sourcerect="550,804,24,96" depth = "0.85" /> <sprite texture="Content/Map/testroom.png" sourcerect="550,804,24,96" depth = "0.85" />
</CableHolderVertical> </CableHolderVertical>
<topwindow width="128" height="49" body="true" health="100"> <topwindow width="128" height="49" body="true" health="100" tags="glass">
<sprite texture="Content/Map/testroom.png" sourcerect="208,848,128,80" depth ="0.05"/> <sprite texture="Content/Map/testroom.png" sourcerect="208,848,128,80" depth ="0.05"/>
<backgroundsprite texture="Content/Map/testroom.png" sourcerect="344,848,128,80" depth ="0.85"/> <backgroundsprite texture="Content/Map/testroom.png" sourcerect="344,848,128,80" depth ="0.85"/>
</topwindow> </topwindow>
<verticalwindow width="128" height ="224" body="true" health="100"> <verticalwindow width="128" height ="224" body="true" health="100" tags="glass">
<sprite texture="Content/Map/testroom.png" sourcerect="368,544,128,224" depth ="0.05"/> <sprite texture="Content/Map/testroom.png" sourcerect="368,544,128,224" depth ="0.05"/>
<backgroundsprite texture="Content/Map/testroom.png" sourcerect="239,544,128,224" depth ="0.85"/> <backgroundsprite texture="Content/Map/testroom.png" sourcerect="239,544,128,224" depth ="0.85"/>
</verticalwindow> </verticalwindow>
<horizontalresizablewindow width="128" height ="64" body="true" health="100" resizehorizontal="true"> <horizontalresizablewindow width="128" height ="64" body="true" health="100" tags="glass" resizehorizontal="true">
<sprite texture="Content/Map/testroom.png" sourcerect="207,771,128,64" depth ="0.06"/> <sprite texture="Content/Map/testroom.png" sourcerect="207,771,128,64" depth ="0.06"/>
<backgroundsprite texture="Content/Map/testroom.png" sourcerect="337,771,128,64" depth ="0.85"/> <backgroundsprite texture="Content/Map/testroom.png" sourcerect="337,771,128,64" depth ="0.85"/>
</horizontalresizablewindow> </horizontalresizablewindow>
<verticalresizablewindow width = "64" height ="128" body="true" health="100" resizevertical="true"> <verticalresizablewindow width = "64" height ="128" body="true" health="100" tags="glass" resizevertical="true">
<sprite texture="Content/Map/testroom.png" sourcerect="896,80,64,128" depth ="0.06"/> <sprite texture="Content/Map/testroom.png" sourcerect="896,80,64,128" depth ="0.06"/>
<backgroundsprite texture="Content/Map/testroom.png" sourcerect="961,80,64,128" depth ="0.85"/> <backgroundsprite texture="Content/Map/testroom.png" sourcerect="961,80,64,128" depth ="0.85"/>
</verticalresizablewindow> </verticalresizablewindow>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 KiB

After

Width:  |  Height:  |  Size: 769 KiB

+11
View File
@@ -68,6 +68,17 @@
successmessage="It turns out the signal was emitted by a Moloch. The researchers of [location1] have agreed to pay you the reward nevertheless for getting rid of the Moloch." successmessage="It turns out the signal was emitted by a Moloch. The researchers of [location1] have agreed to pay you the reward nevertheless for getting rid of the Moloch."
monsterfile="Content/Characters/Moloch/moloch.xml"> monsterfile="Content/Characters/Moloch/moloch.xml">
</MonsterMission> </MonsterMission>
<MonsterMission
name="Salvaging a Derelict"
description="A small cargo vessel went missing approximately two months ago when transporting xenomaterials from [location1] to [location2]. The vessel was presumed to be taken by the abyss, but now its emergency beacon seems to have been activated near [location2]. Find the vessel and recover the cargo."
commonness="10"
reward="1000"
radarlabel="Emergency Signal"
successmessage="The researchers of [location2] are eager to know all the details of the encounter, but seem hesitant to answer any questions regarding the vessel. They do however offer you 1000 credits as &quot;reimbursement for your troubles&quot;."
monsterfile="Content/Characters/Carrier/carrier.xml">
<message header="Target destroyed" text="The missing vessel appears to have been taken over by some sort of parasitic growth, but it seems to be incapacitated now. You should report the incident to [location2]."/>
</MonsterMission>
<CargoMission <CargoMission
name="Explosive cargo" name="Explosive cargo"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+34 -5
View File
@@ -10,7 +10,14 @@
<damagesound file="Content/Sounds/Damage/StructureBlunt8.ogg" damagerange="60.0,90.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt8.ogg" damagerange="60.0,90.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt9.ogg" damagerange="80.0,100.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt9.ogg" damagerange="80.0,100.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/StructureBlunt10.ogg" damagerange="80.0,100.0" damagesoundtype="StructureBlunt"/> <damagesound file="Content/Sounds/Damage/StructureBlunt10.ogg" damagerange="80.0,100.0" damagesoundtype="StructureBlunt"/>
<damagesound file="Content/Sounds/Damage/GlassImpact1.ogg" damagerange="0.0,10.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/GlassImpact2.ogg" damagerange="5.0,15.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/GlassImpact3.ogg" damagerange="10.0,20.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="20.0,50.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="25.0,80.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="50.0,100.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
<damagesound file="Content/Sounds/Damage/StructureCrunch1.ogg" damagerange="0.0,40.0" damagesoundtype="StructureSlash"/> <damagesound file="Content/Sounds/Damage/StructureCrunch1.ogg" damagerange="0.0,40.0" damagesoundtype="StructureSlash"/>
<damagesound file="Content/Sounds/Damage/StructureCrunch2.ogg" damagerange="5.0,70.0" damagesoundtype="StructureSlash"/> <damagesound file="Content/Sounds/Damage/StructureCrunch2.ogg" damagerange="5.0,70.0" damagesoundtype="StructureSlash"/>
@@ -30,16 +37,38 @@
<damagesound file="Content/Sounds/Damage/HitArmor1.ogg" damagerange="5.0,80.0" damagesoundtype="LimbArmor"/> <damagesound file="Content/Sounds/Damage/HitArmor1.ogg" damagerange="5.0,80.0" damagesoundtype="LimbArmor"/>
<damagesound file="Content/Sounds/Damage/HitArmor2.ogg" damagerange="5.0,80.0" damagesoundtype="LimbArmor"/> <damagesound file="Content/Sounds/Damage/HitArmor2.ogg" damagerange="5.0,80.0" damagesoundtype="LimbArmor"/>
<damagesound file="Content/Sounds/Damage/HitArmor3.ogg" damagerange="40.0,100.0" damagesoundtype="LimbArmor"/> <damagesound file="Content/Sounds/Damage/HitArmor3.ogg" damagerange="40.0,100.0" damagesoundtype="LimbArmor"/>
<damagesound file="Content/Sounds/Damage/implode.ogg" damagerange="0.0,100.0" damagesoundtype="Implode"/>
<damagesound file="Content/Sounds/Damage/creak1.ogg" damagesoundtype="Pressure"/> <damagesound file="Content/Sounds/Damage/creak1.ogg" damagesoundtype="Pressure"/>
<damagesound file="Content/Sounds/Damage/creak2.ogg" damagesoundtype="Pressure"/> <damagesound file="Content/Sounds/Damage/creak2.ogg" damagesoundtype="Pressure"/>
<damagesound file="Content/Sounds/Damage/creak3.ogg" damagesoundtype="Pressure"/> <damagesound file="Content/Sounds/Damage/creak3.ogg" damagesoundtype="Pressure"/>
<damagesound file="Content/Sounds/Damage/creak4.ogg" damagesoundtype="Pressure"/> <damagesound file="Content/Sounds/Damage/creak4.ogg" damagesoundtype="Pressure"/>
<damagesound file="Content/Sounds/Damage/creak5.ogg" damagesoundtype="Pressure"/> <damagesound file="Content/Sounds/Damage/creak5.ogg" damagesoundtype="Pressure"/>
<implode file="Content/Sounds/Damage/implode.ogg"/>
<drown file="Content/Sounds/Water/Drown1.ogg"/>
<drown file="Content/Sounds/Water/Drown2.ogg"/>
<drown file="Content/Sounds/Water/Drown3.ogg"/>
<drown file="Content/Sounds/Water/Drown4.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient1.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient2.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient3.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient4.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient5.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient6.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient7.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient8.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient9.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient10.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient11.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient12.ogg"/>
<ambient file="Content/Sounds/Ambient/Ambient13.ogg"/>
<ambient file="Content/Sounds/Ambient/DistantPod1.ogg"/>
<ambient file="Content/Sounds/Ambient/DistantPod2.ogg"/>
<ambient file="Content/Sounds/Ambient/DistantPod3.ogg"/>
<ambient file="Content/Sounds/Ambient/GlacialMovement.ogg"/>
<music file="Content/Sounds/Music/Simplex.ogg" type="default"/> <music file="Content/Sounds/Music/Simplex.ogg" type="default"/>
<music file="Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg" type="default"/> <music file="Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg" type="default"/>
+10 -7
View File
@@ -165,7 +165,7 @@ namespace Barotrauma
} }
} }
public void MoveCamera(float deltaTime) public void MoveCamera(float deltaTime, bool allowMove = true, bool allowZoom = true)
{ {
prevPosition = position; prevPosition = position;
prevZoom = zoom; prevZoom = zoom;
@@ -175,7 +175,7 @@ namespace Barotrauma
Vector2 moveCam = Vector2.Zero; Vector2 moveCam = Vector2.Zero;
if (targetPos == Vector2.Zero) if (targetPos == Vector2.Zero)
{ {
if (GUIComponent.KeyboardDispatcher.Subscriber == null) if (allowMove && GUIComponent.KeyboardDispatcher.Subscriber == null)
{ {
if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f; if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f;
if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f; if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f;
@@ -197,11 +197,14 @@ namespace Barotrauma
moveCam = moveCam * deltaTime * 60.0f; moveCam = moveCam * deltaTime * 60.0f;
Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition); if (allowZoom)
Vector2 diffViewCenter; {
diffViewCenter = ((mouseInWorld - Position) * Zoom); Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition);
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f); Vector2 diffViewCenter;
if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom); diffViewCenter = ((mouseInWorld - Position) * Zoom);
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f);
if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom);
}
} }
else else
{ {
+9 -1
View File
@@ -57,7 +57,15 @@ namespace Barotrauma
} }
else else
{ {
PlaySound((aiController == null) ? AIController.AiState.None : aiController.State); switch (aiController.State)
{
case AIController.AiState.Attack:
PlaySound(CharacterSound.SoundType.Attack);
break;
default:
PlaySound(CharacterSound.SoundType.Idle);
break;
}
soundTimer = soundInterval; soundTimer = soundInterval;
} }
@@ -205,15 +205,15 @@ namespace Barotrauma
if (Limbs[i].SteerForce <= 0.0f) continue; if (Limbs[i].SteerForce <= 0.0f) continue;
Vector2 pullPos = Limbs[i].pullJoint == null ? Limbs[i].SimPosition : Limbs[i].pullJoint.WorldAnchorA; Vector2 pullPos = Limbs[i].pullJoint == null ? Limbs[i].SimPosition : Limbs[i].pullJoint.WorldAnchorA;
Limbs[i].body.ApplyForce(movement * Limbs[i].SteerForce * Limbs[i].Mass, pullPos); Limbs[i].body.ApplyForce(movement * Limbs[i].SteerForce * Limbs[i].Mass, pullPos);
if (Limbs[i] == MainLimb) continue; /*if (Limbs[i] == MainLimb) continue;
float dist = (MainLimb.SimPosition - Limbs[i].SimPosition).Length(); float dist = (MainLimb.SimPosition - Limbs[i].SimPosition).Length();
Vector2 limbPos = MainLimb.SimPosition - Vector2.Normalize(movement) * dist; Vector2 limbPos = MainLimb.SimPosition - Vector2.Normalize(movement) * dist;
Limbs[i].body.ApplyForce(((limbPos - Limbs[i].SimPosition) * 3.0f - Limbs[i].LinearVelocity * 3.0f) * Limbs[i].Mass); Limbs[i].body.ApplyForce(((limbPos - Limbs[i].SimPosition) * 3.0f - Limbs[i].LinearVelocity * 3.0f) * Limbs[i].Mass);*/
} }
Collider.LinearVelocity = Vector2.Lerp(Collider.LinearVelocity, movement, 0.5f); Collider.LinearVelocity = Vector2.Lerp(Collider.LinearVelocity, movement, 0.5f);
@@ -173,12 +173,10 @@ namespace Barotrauma
levitatingCollider = false; levitatingCollider = false;
UpdateClimbing(); UpdateClimbing();
break; break;
case Animation.UsingConstruction:
UpdateStanding();
break;
case Animation.CPR: case Animation.CPR:
UpdateCPR(deltaTime); UpdateCPR(deltaTime);
break; break;
case Animation.UsingConstruction:
default: default:
if (character.SelectedCharacter != null) DragCharacter(character.SelectedCharacter); if (character.SelectedCharacter != null) DragCharacter(character.SelectedCharacter);
@@ -260,9 +258,9 @@ namespace Barotrauma
float slowdownAmount = 0.0f; float slowdownAmount = 0.0f;
if (currentHull != null) if (currentHull != null)
{ {
//full slowdown (1.0f) when water is up to the torso //full slowdown (1.5f) when water is up to the torso
surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface); surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface);
slowdownAmount = MathHelper.Clamp((surfaceY - colliderPos.Y) / torsoPosition, 0.0f, 1.0f); slowdownAmount = MathHelper.Clamp((surfaceY - colliderPos.Y) / torsoPosition, 0.0f, 1.0f) * 1.5f;
} }
float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f); float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f);
@@ -272,7 +270,7 @@ namespace Barotrauma
float walkPosX = (float)Math.Cos(walkPos); float walkPosX = (float)Math.Cos(walkPos);
float walkPosY = (float)Math.Sin(walkPos); float walkPosY = (float)Math.Sin(walkPos);
float runningModifier = (float)Math.Max(Math.Min(Math.Abs(TargetMovement.X), 3.0f) / 1.5f, 1.0); float runningModifier = (float)Math.Max(Math.Min(Math.Abs(TargetMovement.X), 3.0f) / 1.5f, 1.0);
Vector2 stepSize = new Vector2( Vector2 stepSize = new Vector2(
this.stepSize.X * walkPosX * runningModifier, this.stepSize.X * walkPosX * runningModifier,
this.stepSize.Y * walkPosY * runningModifier * runningModifier); this.stepSize.Y * walkPosY * runningModifier * runningModifier);
@@ -567,7 +565,7 @@ namespace Barotrauma
rotation = MathHelper.ToDegrees(rotation); rotation = MathHelper.ToDegrees(rotation);
if (rotation < 0.0f) rotation += 360; if (rotation < 0.0f) rotation += 360;
if (!character.IsRemotePlayer && !aiming) if (!character.IsRemotePlayer && !aiming && Anim != Animation.UsingConstruction)
{ {
if (rotation > 20 && rotation < 170) if (rotation > 20 && rotation < 170)
TargetDir = Direction.Left; TargetDir = Direction.Left;
@@ -751,9 +749,9 @@ namespace Barotrauma
ladderSimPos += character.SelectedConstruction.Submarine.SimPosition - currentHull.Submarine.SimPosition; ladderSimPos += character.SelectedConstruction.Submarine.SimPosition - currentHull.Submarine.SimPosition;
} }
MoveLimb(head, new Vector2(ladderSimPos.X - 0.27f * Dir, Collider.SimPosition.Y + 0.7f - colliderHeightFromFloor), 10.5f); MoveLimb(head, new Vector2(ladderSimPos.X - 0.27f * Dir, Collider.SimPosition.Y + 0.9f - colliderHeightFromFloor), 10.5f);
MoveLimb(torso, new Vector2(ladderSimPos.X - 0.27f * Dir, Collider.SimPosition.Y + 0.5f - colliderHeightFromFloor), 10.5f); MoveLimb(torso, new Vector2(ladderSimPos.X - 0.27f * Dir, Collider.SimPosition.Y + 0.7f - colliderHeightFromFloor), 10.5f);
MoveLimb(waist, new Vector2(ladderSimPos.X - 0.35f * Dir, Collider.SimPosition.Y + 0.4f - colliderHeightFromFloor), 10.5f); MoveLimb(waist, new Vector2(ladderSimPos.X - 0.35f * Dir, Collider.SimPosition.Y + 0.6f - colliderHeightFromFloor), 10.5f);
Collider.MoveToPos(new Vector2(ladderSimPos.X - 0.2f * Dir, Collider.SimPosition.Y), 10.5f); Collider.MoveToPos(new Vector2(ladderSimPos.X - 0.2f * Dir, Collider.SimPosition.Y), 10.5f);
@@ -761,9 +759,9 @@ namespace Barotrauma
Vector2 handPos = new Vector2( Vector2 handPos = new Vector2(
ladderSimPos.X, ladderSimPos.X,
Collider.SimPosition.Y + 0.6f + movement.Y * 0.1f - ladderSimPos.Y); Collider.SimPosition.Y + 0.8f + movement.Y * 0.1f - ladderSimPos.Y);
handPos.Y = Math.Min(-0.5f, handPos.Y) - colliderHeightFromFloor; handPos.Y = Math.Min(-0.2f, handPos.Y) - colliderHeightFromFloor;
MoveLimb(leftHand, MoveLimb(leftHand,
new Vector2(handPos.X, new Vector2(handPos.X,
@@ -780,7 +778,7 @@ namespace Barotrauma
Vector2 footPos = new Vector2( Vector2 footPos = new Vector2(
handPos.X - Dir * 0.05f, handPos.X - Dir * 0.05f,
Collider.SimPosition.Y + 0.7f - colliderHeightFromFloor - stepHeight * 2.7f - ladderSimPos.Y - 0.7f); Collider.SimPosition.Y + 0.9f - colliderHeightFromFloor - stepHeight * 2.7f - ladderSimPos.Y - 0.7f);
//if (movement.Y < 0) footPos.Y += 0.05f; //if (movement.Y < 0) footPos.Y += 0.05f;
@@ -372,7 +372,8 @@ namespace Barotrauma
foreach (Limb limb in Limbs) foreach (Limb limb in Limbs)
{ {
limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.0001f; if (limb.sprite != null)
limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.0001f;
} }
Limb torso = GetLimb(LimbType.Torso); Limb torso = GetLimb(LimbType.Torso);
@@ -638,27 +639,31 @@ namespace Barotrauma
} }
for (int i = 0; i < Limbs.Length; i++) foreach (Limb limb in Limbs)
{ {
if (Limbs[i] == null) continue; if (limb == null) continue;
Vector2 spriteOrigin = Limbs[i].sprite.Origin; if (limb.sprite != null)
spriteOrigin.X = Limbs[i].sprite.SourceRect.Width - spriteOrigin.X;
Limbs[i].sprite.Origin = spriteOrigin;
Limbs[i].Dir = Dir;
if (Limbs[i].LightSource != null)
{ {
Limbs[i].LightSource.SpriteEffect = (dir == Direction.Left) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Vector2 spriteOrigin = limb.sprite.Origin;
spriteOrigin.X = limb.sprite.SourceRect.Width - spriteOrigin.X;
limb.sprite.Origin = spriteOrigin;
} }
if (Limbs[i].pullJoint == null) continue; limb.Dir = Dir;
Limbs[i].pullJoint.LocalAnchorA = if (limb.LightSource != null)
new Vector2( {
-Limbs[i].pullJoint.LocalAnchorA.X, limb.LightSource.FlipX();
Limbs[i].pullJoint.LocalAnchorA.Y); }
if (limb.pullJoint != null)
{
limb.pullJoint.LocalAnchorA =
new Vector2(
-limb.pullJoint.LocalAnchorA.X,
limb.pullJoint.LocalAnchorA.Y);
}
} }
} }
@@ -864,6 +869,7 @@ namespace Barotrauma
{ {
//limb isn't in any room -> it's in the water //limb isn't in any room -> it's in the water
limb.inWater = true; limb.inWater = true;
if (limb.type == LimbType.Head) headInWater = true;
} }
else if (limbHull.Volume > 0.0f && Submarine.RectContains(limbHull.Rect, limb.Position)) else if (limbHull.Volume > 0.0f && Submarine.RectContains(limbHull.Rect, limb.Position))
{ {
+25 -46
View File
@@ -144,10 +144,7 @@ namespace Barotrauma
private float bleeding; private float bleeding;
private Sound[] sounds; private List<CharacterSound> sounds;
private float[] soundRange;
//which AIstate each sound is for
private AIController.AiState[] soundStates;
private float attackCoolDown; private float attackCoolDown;
@@ -603,28 +600,13 @@ namespace Barotrauma
soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f); soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f);
var soundElements = doc.Root.Elements("sound").ToList(); var soundElements = doc.Root.Elements("sound").ToList();
if (soundElements.Any())
sounds = new List<CharacterSound>();
foreach (XElement soundElement in soundElements)
{ {
sounds = new Sound[soundElements.Count]; sounds.Add(new CharacterSound(soundElement));
soundStates = new AIController.AiState[soundElements.Count];
soundRange = new float[soundElements.Count];
int i = 0;
foreach (XElement soundElement in soundElements)
{
sounds[i] = Sound.Load(soundElement.Attribute("file").Value);
soundRange[i] = ToolBox.GetAttributeFloat(soundElement, "range", 1000.0f);
if (soundElement.Attribute("state") == null)
{
soundStates[i] = AIController.AiState.None;
}
else
{
soundStates[i] = (AIController.AiState)Enum.Parse(
typeof(AIController.AiState), soundElement.Attribute("state").Value, true);
}
i++;
}
} }
if (file == humanConfigFile) if (file == humanConfigFile)
{ {
@@ -1536,8 +1518,14 @@ namespace Barotrauma
private void UpdateOxygen(float deltaTime) private void UpdateOxygen(float deltaTime)
{ {
float prevOxygen = oxygen;
Oxygen += deltaTime * (oxygenAvailable < 30.0f ? -5.0f : 10.0f); Oxygen += deltaTime * (oxygenAvailable < 30.0f ? -5.0f : 10.0f);
if (prevOxygen > 0.0f && Oxygen <= 0.0f && controlled == this)
{
SoundPlayer.PlaySound("drown");
}
PressureProtection -= deltaTime * 100.0f; PressureProtection -= deltaTime * 100.0f;
float hullAvailableOxygen = 0.0f; float hullAvailableOxygen = 0.0f;
@@ -1678,6 +1666,8 @@ namespace Barotrauma
/// </summary> /// </summary>
public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor) public HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor)
{ {
if (controlled != this) return null;
HUDProgressBar progressBar = null; HUDProgressBar progressBar = null;
if (!hudProgressBars.TryGetValue(linkedObject, out progressBar)) if (!hudProgressBars.TryGetValue(linkedObject, out progressBar))
{ {
@@ -1692,24 +1682,15 @@ namespace Barotrauma
return progressBar; return progressBar;
} }
public void PlaySound(AIController.AiState state) public void PlaySound(CharacterSound.SoundType soundType)
{ {
if (sounds == null || !sounds.Any()) return; if (sounds == null || sounds.Count == 0) return;
var matchingSoundStates = soundStates.Where(x => x == state).ToList();
int selectedSound = Rand.Int(matchingSoundStates.Count); var matchingSounds = sounds.FindAll(s => s.Type == soundType);
if (matchingSounds.Count == 0) return;
int n = 0; var selectedSound = matchingSounds[Rand.Int(matchingSounds.Count)];
for (int i = 0; i < sounds.Length; i++) selectedSound.Sound.Play(1.0f, selectedSound.Range, AnimController.WorldPosition);
{
if (soundStates[i] != state) continue;
if (n == selectedSound && sounds[i]!=null)
{
sounds[i].Play(1.0f, soundRange[i], AnimController.Limbs[0].WorldPosition);
return;
}
n++;
}
} }
public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker) public virtual void AddDamage(CauseOfDeath causeOfDeath, float amount, IDamageable attacker)
@@ -1810,7 +1791,7 @@ namespace Barotrauma
// limb.Damage = 100.0f; // limb.Damage = 100.0f;
} }
SoundPlayer.PlayDamageSound(DamageSoundType.Implode, 50.0f, AnimController.Collider); SoundPlayer.PlaySound("implode", 1.0f, 150.0f, WorldPosition);
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
@@ -1861,11 +1842,9 @@ namespace Barotrauma
GameServer.Log(Name+" has died (Cause of death: "+causeOfDeath+")", Color.Red); GameServer.Log(Name+" has died (Cause of death: "+causeOfDeath+")", Color.Red);
if (OnDeath != null) OnDeath(this, causeOfDeath); if (OnDeath != null) OnDeath(this, causeOfDeath);
//CoroutineManager.StartCoroutine(DeathAnim(GameMain.GameScreen.Cam)); PlaySound(CharacterSound.SoundType.Die);
//health = 0.0f;
isDead = true; isDead = true;
this.causeOfDeath = causeOfDeath; this.causeOfDeath = causeOfDeath;
AnimController.movement = Vector2.Zero; AnimController.movement = Vector2.Zero;
@@ -1876,7 +1855,7 @@ namespace Barotrauma
if (selectedItems[i] != null) selectedItems[i].Drop(this); if (selectedItems[i] != null) selectedItems[i].Drop(this);
} }
if (aiTarget!=null) if (aiTarget != null)
{ {
aiTarget.Remove(); aiTarget.Remove();
aiTarget = null; aiTarget = null;
@@ -138,6 +138,7 @@ namespace Barotrauma
{ {
if (character.Inventory != null && !character.LockHands && character.Stun >= -0.1f) if (character.Inventory != null && !character.LockHands && character.Stun >= -0.1f)
{ {
character.Inventory.DrawOffset = Vector2.Zero;
character.Inventory.DrawOwn(spriteBatch); character.Inventory.DrawOwn(spriteBatch);
} }
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Barotrauma
{
class CharacterSound
{
public enum SoundType
{
Idle, Attack, Die
}
public readonly Sound Sound;
public readonly SoundType Type;
public readonly float Range;
public CharacterSound(XElement element)
{
Sound = Sound.Load(element.Attribute("file").Value);
Range = ToolBox.GetAttributeFloat(element, "range", 1000.0f);
Enum.TryParse<SoundType>(ToolBox.GetAttributeString(element, "state", "Idle"), true, out Type);
}
}
}
+19 -13
View File
@@ -423,7 +423,6 @@ namespace Barotrauma
if (LightSource != null) if (LightSource != null)
{ {
LightSource.ParentSub = body.Submarine; LightSource.ParentSub = body.Submarine;
LightSource.Position = Position;
} }
if (!character.IsDead) damage = Math.Max(0.0f, damage-deltaTime*0.1f); if (!character.IsDead) damage = Math.Max(0.0f, damage-deltaTime*0.1f);
@@ -504,6 +503,12 @@ namespace Barotrauma
body.UpdateDrawPosition(); body.UpdateDrawPosition();
} }
if (LightSource != null)
{
LightSource.Position = body.DrawPosition;
LightSource.Rotation = body.DrawRotation;
}
foreach (WearableSprite wearable in wearingItems) foreach (WearableSprite wearable in wearingItems)
{ {
SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
@@ -528,36 +533,37 @@ namespace Barotrauma
-body.DrawRotation, -body.DrawRotation,
scale, spriteEffect, depth); scale, spriteEffect, depth);
} }
if (damage>0.0f && damagedSprite!=null && !hideLimb) if (damage > 0.0f && damagedSprite != null && !hideLimb)
{ {
SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally; SpriteEffects spriteEffect = (dir == Direction.Right) ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
float depth = sprite.Depth - 0.0000015f; float depth = sprite.Depth - 0.0000015f;
damagedSprite.Draw(spriteBatch, damagedSprite.Draw(spriteBatch,
new Vector2(body.DrawPosition.X, -body.DrawPosition.Y), new Vector2(body.DrawPosition.X, -body.DrawPosition.Y),
color*Math.Min(damage/50.0f,1.0f), sprite.Origin, color * Math.Min(damage / 50.0f, 1.0f), sprite.Origin,
-body.DrawRotation, -body.DrawRotation,
1.0f, spriteEffect, depth); 1.0f, spriteEffect, depth);
} }
if (!GameMain.DebugDraw) return; if (!GameMain.DebugDraw) return;
if (pullJoint!=null) if (pullJoint != null)
{ {
Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB); Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true); GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true);
} }
} }
public void Remove() public void Remove()
{ {
sprite.Remove(); if (sprite != null)
sprite = null; {
sprite.Remove();
sprite = null;
}
if (LightSource != null) if (LightSource != null)
{ {
+9
View File
@@ -95,6 +95,7 @@ namespace Barotrauma
if (isOpen) if (isOpen)
{ {
textBox.Select(); textBox.Select();
AddToGUIUpdateList();
} }
else else
{ {
@@ -426,6 +427,14 @@ namespace Barotrauma
case "mainmenuscreen": case "mainmenuscreen":
case "mainmenu": case "mainmenu":
case "menu": case "menu":
GameMain.GameSession = null;
List<Character> characters = new List<Character>(Character.CharacterList);
foreach (Character c in characters)
{
c.Remove();
}
GameMain.MainMenuScreen.Select(); GameMain.MainMenuScreen.Select();
break; break;
case "gamescreen": case "gamescreen":
@@ -54,6 +54,24 @@ namespace Barotrauma
item = new Item(itemPrefab, position, null); item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true; item.MoveWithLevel = true;
item.body.FarseerBody.IsKinematic = true; item.body.FarseerBody.IsKinematic = true;
if (item.HasTag("alien"))
{
//try to find a nearby artifact holder (or any alien itemcontainer) and place the artifact inside it
foreach (Item it in Item.ItemList)
{
if (it.Submarine != null || !it.HasTag("alien")) continue;
if (Math.Abs(item.WorldPosition.X - it.WorldPosition.X) > 2000.0f) continue;
if (Math.Abs(item.WorldPosition.Y - it.WorldPosition.Y) > 2000.0f) continue;
var itemContainer = it.GetComponent<Items.Components.ItemContainer>();
if (itemContainer == null) continue;
itemContainer.Combine(item);
break;
}
}
} }
public override void Update(float deltaTime) public override void Update(float deltaTime)
+7
View File
@@ -33,6 +33,13 @@ namespace Barotrauma
public static void ClearUpdateList() public static void ClearUpdateList()
{ {
if (keyboardDispatcher != null &&
KeyboardDispatcher.Subscriber is GUIComponent &&
!ComponentsToUpdate.Contains((GUIComponent)KeyboardDispatcher.Subscriber))
{
KeyboardDispatcher.Subscriber = null;
}
ComponentsToUpdate.Clear(); ComponentsToUpdate.Clear();
} }
+4 -7
View File
@@ -103,14 +103,11 @@ namespace Barotrauma
{ {
GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, GUI.Style, listBox); GUITextBlock textBlock = new GUITextBlock(new Rectangle(0,0,0,20), text, GUI.Style, listBox);
textBlock.UserData = userData; textBlock.UserData = userData;
}
//int totalHeight = 0; public override void ClearChildren()
//foreach (GUIComponent child in listBox.children) {
//{ listBox.ClearChildren();
// totalHeight += child.Rect.Height;
//}
//listBox.Rect = new Rectangle(listBox.Rect.X,listBox.Rect.Y,listBox.Rect.Width,totalHeight);
} }
public List<GUIComponent> GetChildren() public List<GUIComponent> GetChildren()
+2 -1
View File
@@ -147,7 +147,8 @@ namespace Barotrauma
scrollBar = new GUIScrollBar( scrollBar = new GUIScrollBar(
new Rectangle(this.rect.Right - 20, this.rect.Y, 20, this.rect.Height), null, 1.0f, GUI.Style); new Rectangle(this.rect.Right - 20, this.rect.Y, 20, this.rect.Height), null, 1.0f, GUI.Style);
} }
scrollBar.IsHorizontal = isHorizontal;
frame = new GUIFrame(Rectangle.Empty, style, this); frame = new GUIFrame(Rectangle.Empty, style, this);
if (style != null) style.Apply(frame, this); if (style != null) style.Apply(frame, this);
+6
View File
@@ -25,6 +25,12 @@ namespace Barotrauma
public bool IsHorizontal public bool IsHorizontal
{ {
get { return isHorizontal; } get { return isHorizontal; }
set
{
if (isHorizontal == value) return;
isHorizontal = value;
UpdateRect();
}
} }
public bool Enabled public bool Enabled
+1 -1
View File
@@ -250,7 +250,7 @@ namespace Barotrauma
GameModePreset.Init(); GameModePreset.Init();
Submarine.Preload(); Submarine.RefreshSavedSubs();
TitleScreen.LoadState = 80.0f; TitleScreen.LoadState = 80.0f;
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
@@ -283,7 +283,7 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern."); infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
while (Submarine.MainSub.WorldPosition.Y > 36500.0f) while (Submarine.MainSub.WorldPosition.Y > 40000.0f)
{ {
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} }
@@ -293,7 +293,7 @@ namespace Barotrauma.Tutorials
"Content/Characters/Moloch/moloch.xml", "Content/Characters/Moloch/moloch.xml",
steering.Item.WorldPosition + new Vector2(3000.0f, -500.0f)); steering.Item.WorldPosition + new Vector2(3000.0f, -500.0f));
moloch.PlaySound(AIController.AiState.Attack); moloch.PlaySound(CharacterSound.SoundType.Attack);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f);
@@ -349,7 +349,7 @@ namespace Barotrauma.Tutorials
if (isWindow) if (isWindow)
{ {
//decrease window damage to slow down the leaking //decrease window damage to slow down the leaking
w.AddDamage(i, -w.SectionDamage(i) * 0.495f); w.AddDamage(i, -w.SectionDamage(i) * 0.48f);
} }
else else
{ {
@@ -39,7 +39,7 @@ namespace Barotrauma.Tutorials
GameMain.GameSession = new GameSession(Submarine.MainSub, "", GameModePreset.list.Find(gm => gm.Name.ToLowerInvariant() == "tutorial")); GameMain.GameSession = new GameSession(Submarine.MainSub, "", GameModePreset.list.Find(gm => gm.Name.ToLowerInvariant() == "tutorial"));
(GameMain.GameSession.gameMode as TutorialMode).tutorialType = this; (GameMain.GameSession.gameMode as TutorialMode).tutorialType = this;
GameMain.GameSession.StartShift("tuto2"); GameMain.GameSession.StartShift("tuto");
GameMain.GameSession.TaskManager.Tasks.Clear(); GameMain.GameSession.TaskManager.Tasks.Clear();
+1 -1
View File
@@ -202,7 +202,7 @@ namespace Barotrauma
{ {
level.Generate(); level.Generate();
submarine.SetPosition(level.StartPosition - new Vector2(0.0f, 2000.0f)); submarine.SetPosition(submarine.FindSpawnPos(level.StartPosition - new Vector2(0.0f, 2000.0f)));
//secondSub.SetPosition(level.EndPosition - new Vector2(0.0f, 2000.0f)); //secondSub.SetPosition(level.EndPosition - new Vector2(0.0f, 2000.0f));
@@ -44,6 +44,12 @@ namespace Barotrauma.Items.Components
private bool docked; private bool docked;
public int DockingDir
{
get { return dockingDir; }
set { dockingDir = value; }
}
[HasDefaultValue("32.0,32.0", false)] [HasDefaultValue("32.0,32.0", false)]
public string DistanceTolerance public string DistanceTolerance
{ {
@@ -150,7 +156,8 @@ namespace Barotrauma.Items.Components
if (target.item.Submarine == item.Submarine) if (target.item.Submarine == item.Submarine)
{ {
DebugConsole.ThrowError("Error - tried to a submarine to itself"); DebugConsole.ThrowError("Error - tried to dock a submarine to itself");
dockingTarget = null;
return; return;
} }
@@ -176,8 +183,9 @@ namespace Barotrauma.Items.Components
dockingDir = IsHorizontal ? dockingDir = IsHorizontal ?
Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) : Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) :
Math.Sign(item.WorldPosition.Y - dockingTarget.item.WorldPosition.Y); Math.Sign(dockingTarget.item.WorldPosition.Y - item.WorldPosition.Y);
dockingTarget.dockingDir = -dockingDir; dockingTarget.dockingDir = -dockingDir;
foreach (WayPoint wp in WayPoint.WayPointList) foreach (WayPoint wp in WayPoint.WayPointList)
{ {
@@ -199,12 +207,46 @@ namespace Barotrauma.Items.Components
CreateJoint(false); CreateJoint(false);
} }
public void Lock()
{
if (dockingTarget==null)
{
DebugConsole.ThrowError("Error - attempted to lock a docking port that's not connected to anything");
return;
}
else if (joint is WeldJoint)
{
DebugConsole.ThrowError("Error - attempted to lock a docking port that's already locked");
return;
}
dockingDir = IsHorizontal ?
Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) :
Math.Sign(dockingTarget.item.WorldPosition.Y - item.WorldPosition.Y);
dockingTarget.dockingDir = -dockingDir;
GameMain.World.RemoveJoint(joint);
PlaySound(ActionType.OnSecondaryUse, item.WorldPosition);
ConnectWireBetweenPorts();
CreateJoint(true);
if (!item.linkedTo.Any(e => e is Hull) && !dockingTarget.item.linkedTo.Any(e => e is Hull))
{
CreateHull();
//item.NewComponentEvent(this, false, true);
}
}
private void CreateJoint(bool useWeldJoint) private void CreateJoint(bool useWeldJoint)
{ {
Vector2 offset = (IsHorizontal ? Vector2 offset = (IsHorizontal ?
Vector2.UnitX * Math.Sign(dockingTarget.item.WorldPosition.X - item.WorldPosition.X) : Vector2.UnitX * dockingDir :
Vector2.UnitY * Math.Sign(dockingTarget.item.WorldPosition.Y - item.WorldPosition.Y)); Vector2.UnitY * dockingDir);
offset *= DockedDistance * 0.5f; offset *= DockedDistance * 0.5f;
Vector2 pos1 = item.WorldPosition + offset; Vector2 pos1 = item.WorldPosition + offset;
@@ -491,28 +533,18 @@ namespace Barotrauma.Items.Components
if (!docked) if (!docked)
{ {
Dock(dockingTarget); Dock(dockingTarget);
if (dockingTarget == null) return;
} }
if (joint is DistanceJoint) if (joint is DistanceJoint)
{ {
item.SendSignal(0, "0", "state_out"); item.SendSignal(0, "0", "state_out");
dockingState = MathHelper.Lerp(dockingState, 0.5f, deltaTime * 10.0f);
if (Vector2.Distance(joint.WorldAnchorA, joint.WorldAnchorB) < 0.05f) if (Vector2.Distance(joint.WorldAnchorA, joint.WorldAnchorB) < 0.05f)
{ {
GameMain.World.RemoveJoint(joint); Lock();
PlaySound(ActionType.OnSecondaryUse, item.WorldPosition);
ConnectWireBetweenPorts();
CreateJoint(true);
if (!item.linkedTo.Any(e => e is Hull) && !dockingTarget.item.linkedTo.Any(e => e is Hull))
{
CreateHull();
}
} }
dockingState = MathHelper.Lerp(dockingState, 0.5f, deltaTime * 10.0f);
} }
else else
{ {
@@ -606,12 +638,14 @@ namespace Barotrauma.Items.Components
if (!item.linkedTo.Any()) return; if (!item.linkedTo.Any()) return;
foreach (MapEntity entity in item.linkedTo) List<MapEntity> linked = new List<MapEntity>(item.linkedTo);
foreach (MapEntity entity in linked)
{ {
var hull = entity as Hull; var hull = entity as Hull;
if (hull != null) if (hull != null)
{ {
hull.Remove(); hull.Remove();
item.linkedTo.Remove(hull);
continue; continue;
} }
@@ -619,6 +653,7 @@ namespace Barotrauma.Items.Components
if (gap != null) if (gap != null)
{ {
gap.Remove(); gap.Remove();
gap.linkedTo.Remove(hull);
continue; continue;
} }
@@ -626,10 +661,11 @@ namespace Barotrauma.Items.Components
if (linkedItem == null) continue; if (linkedItem == null) continue;
var dockingPort = linkedItem.GetComponent<DockingPort>(); var dockingPort = linkedItem.GetComponent<DockingPort>();
if (dockingPort != null) dockingTarget = dockingPort; if (dockingPort != null)
{
Dock(dockingPort);
}
} }
item.linkedTo.Clear();
} }
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power = 0.0f) public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power = 0.0f)
@@ -177,7 +177,7 @@ namespace Barotrauma.Items.Components
Item targetItem; Item targetItem;
if ((targetStructure = (targetBody.UserData as Structure)) != null) if ((targetStructure = (targetBody.UserData as Structure)) != null)
{ {
if (!fixableEntities.Contains(targetStructure.Name)) return; if (!fixableEntities.Contains("structure") && !fixableEntities.Contains(targetStructure.Name)) return;
if (targetStructure.IsPlatform) return; if (targetStructure.IsPlatform) return;
int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition)); int sectionIndex = targetStructure.FindSectionIndex(ConvertUnits.ToDisplayUnits(pickedPosition));
@@ -195,7 +195,7 @@ namespace Barotrauma.Items.Components
1.0f - targetStructure.SectionDamage(sectionIndex) / targetStructure.Health, 1.0f - targetStructure.SectionDamage(sectionIndex) / targetStructure.Health,
Color.Red, Color.Green); Color.Red, Color.Green);
progressBar.Size = new Vector2(60.0f, 20.0f); if (progressBar != null) progressBar.Size = new Vector2(60.0f, 20.0f);
targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess); targetStructure.AddDamage(sectionIndex, -StructureFixAmount * degreeOfSuccess);
@@ -544,11 +544,28 @@ namespace Barotrauma.Items.Components
RemoveComponentSpecific(); RemoveComponentSpecific();
} }
protected virtual void RemoveComponentSpecific() /// <summary>
/// Remove the component so that it doesn't appear to exist in the game world (stop sounds, remove bodies etc)
/// but don't reset anything that's required for cloning the item
/// </summary>
public void ShallowRemove()
{ {
if (loopingSound != null)
{
Sounds.SoundManager.Stop(loopingSoundIndex);
}
ShallowRemoveComponentSpecific();
} }
protected virtual void ShallowRemoveComponentSpecific()
{
RemoveComponentSpecific();
}
protected virtual void RemoveComponentSpecific()
{ }
public bool HasRequiredSkills(Character character) public bool HasRequiredSkills(Character character)
{ {
Skill temp; Skill temp;
@@ -26,15 +26,15 @@ namespace Barotrauma.Items.Components
private Direction dir; private Direction dir;
//the x-position where the user walks to when using the controller //the position where the user walks to when using the controller
private float userPos; //(relative to the position of the item)
private Vector2 userPos;
private Camera cam; private Camera cam;
private Character character; private Character character;
[HasDefaultValue(0.0f, false)] public Vector2 UserPos
public float UserPos
{ {
get { return userPos; } get { return userPos; }
set { userPos = value; } set { userPos = value; }
@@ -45,13 +45,16 @@ namespace Barotrauma.Items.Components
{ {
limbPositions = new List<LimbPos>(); limbPositions = new List<LimbPos>();
dir = (Direction)Enum.Parse(typeof(Direction), ToolBox.GetAttributeString(element, "direction", "None"), true); userPos = ToolBox.GetAttributeVector2(element, "UserPos", Vector2.Zero);
Enum.TryParse<Direction>(ToolBox.GetAttributeString(element, "direction", "None"), out dir);
foreach (XElement el in element.Elements()) foreach (XElement el in element.Elements())
{ {
if (el.Name != "limbposition") continue; if (el.Name != "limbposition") continue;
LimbPos lp = new LimbPos(); LimbPos lp = new LimbPos();
try try
{ {
lp.limbType = (LimbType)Enum.Parse(typeof(LimbType), el.Attribute("limb").Value, true); lp.limbType = (LimbType)Enum.Parse(typeof(LimbType), el.Attribute("limb").Value, true);
@@ -90,23 +93,34 @@ namespace Barotrauma.Items.Components
character.AnimController.Anim = AnimController.Animation.UsingConstruction; character.AnimController.Anim = AnimController.Animation.UsingConstruction;
if (userPos != 0.0f) if (userPos != Vector2.Zero)
{ {
float torsoX = character.Position.X; float torsoX = character.Position.X;
Vector2 diff = new Vector2(item.Rect.X + UserPos - torsoX, 0.0f); Vector2 diff = (item.WorldPosition + userPos) - character.WorldPosition;
if (diff!= Vector2.Zero && diff.Length() > 10.0f) if (character.AnimController.InWater)
{ {
//character.AnimController.Anim = AnimController.Animation.None; if (diff.Length() > 30.0f)
{
character.AnimController.TargetMovement = new Vector2(Math.Sign(diff.X), 0.0f); character.AnimController.TargetMovement = Vector2.Clamp(diff*0.01f, -Vector2.One, Vector2.One);
character.AnimController.TargetDir = (Math.Sign(diff.X) == 1) ? Direction.Right : Direction.Left; character.AnimController.TargetDir = diff.X > 0.0f ? Direction.Right : Direction.Left;
return; }
else
{
character.AnimController.TargetMovement = Vector2.Zero;
}
} }
else else
{ {
character.AnimController.TargetMovement = Vector2.Zero; diff.Y = 0.0f;
if (diff != Vector2.Zero && diff.Length() > 10.0f)
{
character.AnimController.TargetMovement = Vector2.Normalize(diff);
character.AnimController.TargetDir = diff.X > 0.0f ? Direction.Right : Direction.Left;
return;
}
character.AnimController.TargetMovement = Vector2.Zero;
} }
} }
@@ -115,6 +129,7 @@ namespace Barotrauma.Items.Components
if (limbPositions.Count == 0) return; if (limbPositions.Count == 0) return;
character.AnimController.Anim = AnimController.Animation.UsingConstruction; character.AnimController.Anim = AnimController.Animation.UsingConstruction;
character.AnimController.ResetPullJoints(); character.AnimController.ResetPullJoints();
if (dir != 0) character.AnimController.TargetDir = dir; if (dir != 0) character.AnimController.TargetDir = dir;
@@ -256,10 +271,10 @@ namespace Barotrauma.Items.Components
dir = dir == Direction.Left ? Direction.Right : Direction.Left; dir = dir == Direction.Left ? Direction.Right : Direction.Left;
} }
if (userPos != 0.0f) if (userPos.X != 0.0f)
{ {
float diff = (item.Rect.X + UserPos) - item.Rect.Center.X; float diff = (item.Rect.X + UserPos.X) - item.Rect.Center.X;
userPos = item.Rect.Center.X - diff - item.Rect.X; userPos.X = item.Rect.Center.X - diff - item.Rect.X;
} }
for (int i = 0; i < limbPositions.Count; i++) for (int i = 0; i < limbPositions.Count; i++)
@@ -125,6 +125,8 @@ namespace Barotrauma.Items.Components
Item it = recipient.Item; Item it = recipient.Item;
if (it == null) continue; if (it == null) continue;
if (it.Condition <= 0.0f) continue;
Powered powered = it.GetComponent<Powered>(); Powered powered = it.GetComponent<Powered>();
if (powered == null || !powered.IsActive) continue; if (powered == null || !powered.IsActive) continue;
@@ -21,7 +21,7 @@ namespace Barotrauma.Items.Components
public Wire[] Wires; public Wire[] Wires;
private Item item; private Item item;
public readonly bool IsOutput; public readonly bool IsOutput;
@@ -30,7 +30,7 @@ namespace Barotrauma.Items.Components
private List<StatusEffect> effects; private List<StatusEffect> effects;
public readonly ushort[] wireId; public readonly ushort[] wireId;
public bool IsPower public bool IsPower
{ {
get; get;
@@ -64,17 +64,17 @@ namespace Barotrauma.Items.Components
{ {
panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png"); panelTexture = Sprite.LoadTexture("Content/Items/connectionpanel.png");
connector = new Sprite(panelTexture, new Rectangle(470, 102, 19,43), Vector2.Zero, 0.0f); connector = new Sprite(panelTexture, new Rectangle(470, 102, 19, 43), Vector2.Zero, 0.0f);
connector.Origin = new Vector2(9.5f, 10.0f); connector.Origin = new Vector2(9.5f, 10.0f);
wireVertical = new Sprite(panelTexture, new Rectangle(408, 1, 11, 102), Vector2.Zero, 0.0f); wireVertical = new Sprite(panelTexture, new Rectangle(408, 1, 11, 102), Vector2.Zero, 0.0f);
} }
this.item = item; this.item = item;
//recipient = new Connection[MaxLinked]; //recipient = new Connection[MaxLinked];
Wires = new Wire[MaxLinked]; Wires = new Wire[MaxLinked];
IsOutput = (element.Name.ToString() == "output"); IsOutput = (element.Name.ToString() == "output");
Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input"); Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input");
@@ -92,12 +92,12 @@ namespace Barotrauma.Items.Components
int index = -1; int index = -1;
for (int i = 0; i < MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (wireId[i]<1) index = i; if (wireId[i] < 1) index = i;
} }
if (index == -1) break; if (index == -1) break;
int id = ToolBox.GetAttributeInt(subElement, "w", 0); int id = ToolBox.GetAttributeInt(subElement, "w", 0);
if (id<0) id = 0; if (id < 0) id = 0;
wireId[index] = (ushort)id; wireId[index] = (ushort)id;
break; break;
@@ -113,7 +113,7 @@ namespace Barotrauma.Items.Components
{ {
for (int i = 0; i < MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (Wires[i]==null) return i; if (Wires[i] == null) return i;
} }
return -1; return -1;
} }
@@ -150,7 +150,7 @@ namespace Barotrauma.Items.Components
} }
} }
} }
public void AddLink(int index, Wire wire) public void AddLink(int index, Wire wire)
{ {
Wires[index] = wire; Wires[index] = wire;
@@ -164,9 +164,9 @@ namespace Barotrauma.Items.Components
public void SendSignal(int stepsTaken, string signal, Item sender, float power) public void SendSignal(int stepsTaken, string signal, Item sender, float power)
{ {
for (int i = 0; i<MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (Wires[i]==null) continue; if (Wires[i] == null) continue;
Connection recipient = Wires[i].OtherConnection(this); Connection recipient = Wires[i].OtherConnection(this);
if (recipient == null) continue; if (recipient == null) continue;
@@ -188,13 +188,13 @@ namespace Barotrauma.Items.Components
public void ClearConnections() public void ClearConnections()
{ {
for (int i = 0; i<MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (Wires[i] == null) continue; if (Wires[i] == null) continue;
Wires[i].RemoveConnection(this); Wires[i].RemoveConnection(this);
Wires[i] = null; Wires[i] = null;
} }
} }
@@ -235,12 +235,12 @@ namespace Barotrauma.Items.Components
Vector2 rightPos = new Vector2(x + width - 130, y + 50); Vector2 rightPos = new Vector2(x + width - 130, y + 50);
Vector2 leftPos = new Vector2(x + 130, y + 50); Vector2 leftPos = new Vector2(x + 130, y + 50);
Vector2 rightWirePos = new Vector2(x + width-5, y + 30); Vector2 rightWirePos = new Vector2(x + width - 5, y + 30);
Vector2 leftWirePos = new Vector2(x+5, y + 30); Vector2 leftWirePos = new Vector2(x + 5, y + 30);
int wireInterval = (height - 20) / Math.Max(totalWireCount, 1);
int wireInterval = (height - 20) / Math.Max(totalWireCount,1);
foreach (Connection c in panel.Connections) foreach (Connection c in panel.Connections)
{ {
//if dragging a wire, let the Inventory know so that the wire can be //if dragging a wire, let the Inventory know so that the wire can be
@@ -248,7 +248,7 @@ namespace Barotrauma.Items.Components
if (draggingConnected != null) if (draggingConnected != null)
{ {
int linkIndex = c.FindWireIndex(draggingConnected.Item); int linkIndex = c.FindWireIndex(draggingConnected.Item);
if (linkIndex>-1) if (linkIndex > -1)
{ {
Inventory.draggingItem = c.Wires[linkIndex].Item; Inventory.draggingItem = c.Wires[linkIndex].Item;
} }
@@ -257,21 +257,21 @@ namespace Barotrauma.Items.Components
//outputs are drawn at the right side of the panel, inputs at the left //outputs are drawn at the right side of the panel, inputs at the left
if (c.IsOutput) if (c.IsOutput)
{ {
c.Draw(spriteBatch, panel.Item, rightPos, c.Draw(spriteBatch, panel.Item, rightPos,
new Vector2(rightPos.X - GUI.SmallFont.MeasureString(c.Name).X - 20, rightPos.Y+3), new Vector2(rightPos.X - GUI.SmallFont.MeasureString(c.Name).X - 20, rightPos.Y + 3),
rightWirePos, rightWirePos,
mouseInRect, equippedWire != null, mouseInRect, equippedWire,
wireInterval); wireInterval);
rightPos.Y += 30; rightPos.Y += 30;
rightWirePos.Y += c.Wires.Count(w => w!=null) * wireInterval; rightWirePos.Y += c.Wires.Count(w => w != null) * wireInterval;
} }
else else
{ {
c.Draw(spriteBatch, panel.Item, leftPos, c.Draw(spriteBatch, panel.Item, leftPos,
new Vector2(leftPos.X + 20, leftPos.Y-12), new Vector2(leftPos.X + 20, leftPos.Y - 12),
leftWirePos, leftWirePos,
mouseInRect, equippedWire != null, mouseInRect, equippedWire,
wireInterval); wireInterval);
leftPos.Y += 30; leftPos.Y += 30;
@@ -279,14 +279,14 @@ namespace Barotrauma.Items.Components
//leftWireX -= wireInterval; //leftWireX -= wireInterval;
} }
} }
if (draggingConnected != null) if (draggingConnected != null)
{ {
DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false); DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, null);
if (!PlayerInput.LeftButtonHeld()) if (!PlayerInput.LeftButtonHeld())
{ {
//panel.Item.CreateServerEvent(panel, true, true); //panel.Item.NewComponentEvent(panel, true, true);
//draggingConnected.Drop(Character); //draggingConnected.Drop(Character);
draggingConnected = null; draggingConnected = null;
} }
@@ -294,61 +294,49 @@ namespace Barotrauma.Items.Components
//if the Character using the panel has a wire item equipped //if the Character using the panel has a wire item equipped
//and the wire hasn't been connected yet, draw it on the panel //and the wire hasn't been connected yet, draw it on the panel
if (equippedWire!=null) if (equippedWire != null)
{ {
if (panel.Connections.Find(c => c.Wires.Contains(equippedWire)) == null) if (panel.Connections.Find(c => c.Wires.Contains(equippedWire)) == null)
{ {
DrawWire(spriteBatch, equippedWire, equippedWire.Item, DrawWire(spriteBatch, equippedWire, equippedWire.Item,
new Vector2(x + width / 2, y + height - 100), new Vector2(x + width / 2, y + height - 100),
new Vector2(x + width / 2, y + height), mouseInRect, false); new Vector2(x + width / 2, y + height), mouseInRect, null);
if (draggingConnected == equippedWire) Inventory.draggingItem = equippedWire.Item; if (draggingConnected == equippedWire) Inventory.draggingItem = equippedWire.Item;
//break;
} }
} }
//stop dragging a wire item if cursor is outside the panel //stop dragging a wire item if cursor is outside the panel
if (mouseInRect) Inventory.draggingItem = null; if (mouseInRect) Inventory.draggingItem = null;
if (draggingConnected != null)
{
DrawWire(spriteBatch, draggingConnected, draggingConnected.Item, PlayerInput.MousePosition, new Vector2(x + width / 2, y + height), mouseInRect, false);
if (!PlayerInput.LeftButtonHeld())
{
//draggingConnected.Drop(Character);
draggingConnected = null;
}
}
spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 0, width, height), Color.White); spriteBatch.Draw(panelTexture, panelRect, new Rectangle(0, 0, width, height), Color.White);
} }
private void Draw(SpriteBatch spriteBatch, Item item, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, bool wireEquipped, float wireInterval) private void Draw(SpriteBatch spriteBatch, Item item, Vector2 position, Vector2 labelPos, Vector2 wirePosition, bool mouseIn, Wire equippedWire, float wireInterval)
{ {
//spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White); //spriteBatch.DrawString(GUI.SmallFont, Name, new Vector2(labelPos.X, labelPos.Y-10), Color.White);
GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black,0, GUI.SmallFont); GUI.DrawString(spriteBatch, labelPos, Name, IsPower ? Color.Red : Color.White, Color.Black, 0, GUI.SmallFont);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)position.X-10, (int)position.Y-10, 20, 20), Color.White); GUI.DrawRectangle(spriteBatch, new Rectangle((int)position.X - 10, (int)position.Y - 10, 20, 20), Color.White);
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(64, 256, 32, 32), Color.White); spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(64, 256, 32, 32), Color.White);
for (int i = 0; i<MaxLinked; i++) for (int i = 0; i < MaxLinked; i++)
{ {
if (Wires[i]==null || Wires[i].Hidden || draggingConnected == Wires[i]) continue; if (Wires[i] == null || Wires[i].Hidden || draggingConnected == Wires[i]) continue;
Connection recipient = Wires[i].OtherConnection(this); Connection recipient = Wires[i].OtherConnection(this);
DrawWire(spriteBatch, Wires[i], (recipient == null) ? Wires[i].Item : recipient.item, position, wirePosition, mouseIn, wireEquipped); DrawWire(spriteBatch, Wires[i], (recipient == null) ? Wires[i].Item : recipient.item, position, wirePosition, mouseIn, equippedWire);
wirePosition.Y += wireInterval; wirePosition.Y += wireInterval;
} }
if (draggingConnected != null && Vector2.Distance(position, PlayerInput.MousePosition) < 13.0f) if (draggingConnected != null && Vector2.Distance(position, PlayerInput.MousePosition) < 13.0f)
{ {
spriteBatch.Draw(panelTexture, position - new Vector2(21.5f, 21.5f), new Rectangle(106, 250, 43, 43), Color.White); spriteBatch.Draw(panelTexture, position - new Vector2(21.5f, 21.5f), new Rectangle(106, 250, 43, 43), Color.White);
if (!PlayerInput.LeftButtonHeld()) if (!PlayerInput.LeftButtonHeld())
{ {
//find an empty cell for the new connection //find an empty cell for the new connection
@@ -369,18 +357,18 @@ namespace Barotrauma.Items.Components
if (Wires.Any(w => w != null && w != draggingConnected)) if (Wires.Any(w => w != null && w != draggingConnected))
{ {
spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(screwIndex*32, 256, 32, 32), Color.White); spriteBatch.Draw(panelTexture, position - new Vector2(16.0f, 16.0f), new Rectangle(screwIndex * 32, 256, 32, 32), Color.White);
} }
} }
private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Item item, Vector2 end, Vector2 start, bool mouseIn, bool wireEquipped) private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Item item, Vector2 end, Vector2 start, bool mouseIn, Wire equippedWire)
{ {
if (draggingConnected == wire) if (draggingConnected == wire)
{ {
if (!mouseIn) return; if (!mouseIn) return;
end = PlayerInput.MousePosition; end = PlayerInput.MousePosition;
start.X = (start.X+end.X)/2.0f; start.X = (start.X + end.X) / 2.0f;
} }
int textX = (int)start.X; int textX = (int)start.X;
@@ -389,28 +377,30 @@ namespace Barotrauma.Items.Components
else else
textX += 10; textX += 10;
float alpha = wireEquipped ? 0.5f : 1.0f; bool canDrag = equippedWire == null || equippedWire == wire;
bool mouseOn = float alpha = canDrag ? 1.0f : 0.5f;
!wireEquipped &&
bool mouseOn =
canDrag &&
((PlayerInput.MousePosition.X > Math.Min(start.X, end.X) && ((PlayerInput.MousePosition.X > Math.Min(start.X, end.X) &&
PlayerInput.MousePosition.X < Math.Max(start.X, end.X) && PlayerInput.MousePosition.X < Math.Max(start.X, end.X) &&
MathUtils.LineToPointDistance(start, end, PlayerInput.MousePosition) < 6) || MathUtils.LineToPointDistance(start, end, PlayerInput.MousePosition) < 6) ||
Vector2.Distance(end, PlayerInput.MousePosition)<20.0f || Vector2.Distance(end, PlayerInput.MousePosition) < 20.0f ||
new Rectangle((start.X < end.X) ? textX-100 : textX, (int)start.Y-5, 100, 14).Contains(PlayerInput.MousePosition)); new Rectangle((start.X < end.X) ? textX - 100 : textX, (int)start.Y - 5, 100, 14).Contains(PlayerInput.MousePosition));
string label = wire.Locked ? item.Name +"\n(Locked)" : item.Name; string label = wire.Locked ? item.Name + "\n(Locked)" : item.Name;
GUI.DrawString(spriteBatch, GUI.DrawString(spriteBatch,
new Vector2(start.X < end.X ? textX-GUI.SmallFont.MeasureString(label).X : textX,start.Y -5.0f), new Vector2(start.X < end.X ? textX - GUI.SmallFont.MeasureString(label).X : textX, start.Y - 5.0f),
label, label,
(mouseOn ? Color.Gold : Color.White) * (wire.Locked ? 0.6f : 1.0f), Color.Black * 0.8f, (mouseOn ? Color.Gold : Color.White) * (wire.Locked ? 0.6f : 1.0f), Color.Black * 0.8f,
3, GUI.SmallFont); 3, GUI.SmallFont);
var wireEnd = end + Vector2.Normalize(start - end) * 30.0f; var wireEnd = end + Vector2.Normalize(start - end) * 30.0f;
float dist = Vector2.Distance(start, wireEnd); float dist = Vector2.Distance(start, wireEnd);
if (mouseOn) if (mouseOn)
{ {
spriteBatch.Draw(wireVertical.Texture, new Rectangle(wireEnd.ToPoint(), new Point(18, (int)dist)), wireVertical.SourceRect, spriteBatch.Draw(wireVertical.Texture, new Rectangle(wireEnd.ToPoint(), new Point(18, (int)dist)), wireVertical.SourceRect,
@@ -427,9 +417,9 @@ namespace Barotrauma.Items.Components
SpriteEffects.None, SpriteEffects.None,
0.0f); 0.0f);
connector.Draw(spriteBatch, end, Color.White, new Vector2(10.0f, 10.0f), MathUtils.VectorToAngle(end - start)+MathHelper.PiOver2); connector.Draw(spriteBatch, end, Color.White, new Vector2(10.0f, 10.0f), MathUtils.VectorToAngle(end - start) + MathHelper.PiOver2);
if (draggingConnected == null && !wireEquipped) if (draggingConnected == null && canDrag)
{ {
if (mouseOn) if (mouseOn)
{ {
@@ -438,9 +428,8 @@ namespace Barotrauma.Items.Components
if (!wire.Locked) if (!wire.Locked)
{ {
//start dragging the wire //start dragging the wire
if (PlayerInput.LeftButtonHeld()) draggingConnected = wire; if (PlayerInput.LeftButtonHeld()) draggingConnected = wire;
} }
} }
} }
} }
@@ -449,25 +438,25 @@ namespace Barotrauma.Items.Components
{ {
XElement newElement = new XElement(IsOutput ? "output" : "input", new XAttribute("name", Name)); XElement newElement = new XElement(IsOutput ? "output" : "input", new XAttribute("name", Name));
Array.Sort(Wires, delegate(Wire wire1, Wire wire2) Array.Sort(Wires, delegate(Wire wire1, Wire wire2)
{ {
if (wire1 == null) return 1; if (wire1 == null) return 1;
if (wire2 == null) return -1; if (wire2 == null) return -1;
return wire1.Item.ID.CompareTo(wire2.Item.ID); return wire1.Item.ID.CompareTo(wire2.Item.ID);
}); });
for (int i = 0; i < MaxLinked; i++ ) for (int i = 0; i < MaxLinked; i++)
{ {
if (Wires[i] == null) continue; if (Wires[i] == null) continue;
//Connection recipient = wires[i].OtherConnection(this); //Connection recipient = wires[i].OtherConnection(this);
//int connectionIndex = recipient.item.Connections.FindIndex(x => x == recipient); //int connectionIndex = recipient.item.Connections.FindIndex(x => x == recipient);
newElement.Add(new XElement("link", newElement.Add(new XElement("link",
new XAttribute("w", Wires[i].Item.ID.ToString()))); new XAttribute("w", Wires[i].Item.ID.ToString())));
} }
parentElement.Add(newElement); parentElement.Add(newElement);
} }
@@ -486,7 +475,7 @@ namespace Barotrauma.Items.Components
if (wireItem == null) continue; if (wireItem == null) continue;
Wires[i] = wireItem.GetComponent<Wire>(); Wires[i] = wireItem.GetComponent<Wire>();
if (Wires[i]!=null) if (Wires[i] != null)
{ {
if (Wires[i].Item.body != null) Wires[i].Item.body.Enabled = false; if (Wires[i].Item.body != null) Wires[i].Item.body.Enabled = false;
Wires[i].Connect(this, false, true); Wires[i].Connect(this, false, true);
@@ -499,4 +488,4 @@ namespace Barotrauma.Items.Components
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More