(052ab6307) Use MonoKickstart on Linux so installing Mono is not required, fixed division by zero if the width of the server console window is 0
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# MonoKickstart Shell Script
|
||||||
|
# Written by Ethan "flibitijibibo" Lee
|
||||||
|
|
||||||
|
# Move to script's directory
|
||||||
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
|
# Get the system architecture
|
||||||
|
UNAME=`uname`
|
||||||
|
ARCH=`uname -m`
|
||||||
|
|
||||||
|
# MonoKickstart picks the right libfolder, so just execute the right binary.
|
||||||
|
if [ "$UNAME" == "Darwin" ]; then
|
||||||
|
# ... Except on OSX.
|
||||||
|
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/
|
||||||
|
|
||||||
|
# El Capitan is a total idiot and wipes this variable out, making the
|
||||||
|
# Steam overlay disappear. This sidesteps "System Integrity Protection"
|
||||||
|
# and resets the variable with Valve's own variable (they provided this
|
||||||
|
# fix by the way, thanks Valve!). Note that you will need to update your
|
||||||
|
# launch configuration to the script location, NOT just the app location
|
||||||
|
# (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app).
|
||||||
|
# -flibit
|
||||||
|
if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
|
||||||
|
export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
./Barotrauma.bin.osx $@
|
||||||
|
else
|
||||||
|
if [ "$ARCH" == "x86_64" ]; then
|
||||||
|
./Barotrauma.bin.x86_64 $@
|
||||||
|
else
|
||||||
|
./Barotrauma.bin.x86 $@
|
||||||
|
fi
|
||||||
|
fi
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -193,6 +193,60 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
<None Include="Barotrauma">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Barotrauma.bin.x86">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Barotrauma.bin.x86_64">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Mono.Posix.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Mono.Security.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="monoconfig">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="monomachineconfig">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="mscorlib.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Configuration.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Core.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Data.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Drawing.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Numerics.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Runtime.Serialization.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Security.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Xml.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="System.Xml.Linq.dll">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -393,7 +393,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true)
|
partial void SeverLimbJointProjSpecific(LimbJoint limbJoint)
|
||||||
{
|
{
|
||||||
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
|
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
|
||||||
{
|
{
|
||||||
@@ -411,11 +411,6 @@ namespace Barotrauma
|
|||||||
character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f));
|
character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playSound)
|
|
||||||
{
|
|
||||||
SoundPlayer.PlayDamageSound("Gore", 1.0f, limbJoint.LimbA.body);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Draw(SpriteBatch spriteBatch, Camera cam)
|
public virtual void Draw(SpriteBatch spriteBatch, Camera cam)
|
||||||
|
|||||||
@@ -96,11 +96,6 @@ namespace Barotrauma
|
|||||||
private const float UpdateDisplayedAfflictionsInterval = 0.5f;
|
private const float UpdateDisplayedAfflictionsInterval = 0.5f;
|
||||||
private List<Affliction> currentDisplayedAfflictions = new List<Affliction>();
|
private List<Affliction> currentDisplayedAfflictions = new List<Affliction>();
|
||||||
|
|
||||||
public bool MouseOnElement
|
|
||||||
{
|
|
||||||
get { return highlightedLimbIndex > -1 || GUI.MouseOn == dropItemArea; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CharacterHealth openHealthWindow;
|
private static CharacterHealth openHealthWindow;
|
||||||
public static CharacterHealth OpenHealthWindow
|
public static CharacterHealth OpenHealthWindow
|
||||||
{
|
{
|
||||||
@@ -177,16 +172,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
|
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
|
||||||
|
|
||||||
lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.08f), paddedInfoFrame.RectTransform), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
|
||||||
TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.TopRight, font: GUI.SmallFont, wrap: true)
|
lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.08f) },
|
||||||
|
TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.Center, font: GUI.SmallFont, wrap: true)
|
||||||
{
|
{
|
||||||
Visible = false
|
Visible = false
|
||||||
};
|
};
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }, TextManager.Get("SuitableTreatments"), textAlignment: Alignment.BottomRight);
|
recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) })
|
||||||
|
{
|
||||||
recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) });
|
Spacing = 10
|
||||||
|
};
|
||||||
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
|
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
|
||||||
{ RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
|
{ RelativeOffset = new Vector2(0.0f, 0.0f) }, style: null)
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("HealthItemUseTip")
|
ToolTip = TextManager.Get("HealthItemUseTip")
|
||||||
};
|
};
|
||||||
@@ -587,18 +584,9 @@ namespace Barotrauma
|
|||||||
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
|
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
|
||||||
.OrderByDescending(a => a.DamagePerSecond)
|
.OrderByDescending(a => a.DamagePerSecond)
|
||||||
.ThenByDescending(a => a.Strength).FirstOrDefault();
|
.ThenByDescending(a => a.Strength).FirstOrDefault();
|
||||||
if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
|
var limbHealth = GetMathingLimbHealth(affliction);
|
||||||
|
if (limbHealth != null)
|
||||||
{
|
{
|
||||||
var limbHealth = GetMathingLimbHealth(affliction);
|
|
||||||
if (limbHealth != null)
|
|
||||||
{
|
|
||||||
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If no affliction is critical, select the limb which has most damage.
|
|
||||||
var limbHealth = limbHealths.OrderByDescending(l => l.TotalDamage).FirstOrDefault();
|
|
||||||
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
|
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -940,7 +928,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
afflictionInfoContainer.Content.ClearChildren();
|
afflictionInfoContainer.Content.ClearChildren();
|
||||||
recommendedTreatmentContainer.Content.ClearChildren();
|
recommendedTreatmentContainer.Content.ClearChildren();
|
||||||
|
|
||||||
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical");
|
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical");
|
||||||
|
|
||||||
//random variance is 200% when the skill is 0
|
//random variance is 200% when the skill is 0
|
||||||
@@ -1035,15 +1023,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ItemPrefab item = MapEntityPrefab.Find(name: null, identifier: treatment.Key, showErrorMessages: false) as ItemPrefab;
|
ItemPrefab item = MapEntityPrefab.Find(name: null, identifier: treatment.Key, showErrorMessages: false) as ItemPrefab;
|
||||||
if (item == null) continue;
|
if (item == null) continue;
|
||||||
int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.5f);
|
int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.8f);
|
||||||
|
|
||||||
var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
|
var itemSlot = new GUIButton(new RectTransform(new Point(slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
|
||||||
style: "InnerGlow")
|
text: "", style: "InventorySlotSmall")
|
||||||
{
|
{
|
||||||
UserData = item,
|
UserData = item
|
||||||
CanBeFocused = false
|
|
||||||
};
|
};
|
||||||
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
|
itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.White, Color.LightGreen);
|
||||||
|
|
||||||
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
|
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
|
||||||
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
|
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
|
||||||
|
|||||||
@@ -292,10 +292,10 @@ namespace Barotrauma
|
|||||||
if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound))
|
if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound))
|
||||||
{
|
{
|
||||||
damageSoundType = damageModifier.DamageSound;
|
damageSoundType = damageModifier.DamageSound;
|
||||||
|
SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always spawn damage particles
|
// Always spawn damage particles
|
||||||
|
|||||||
@@ -555,37 +555,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("resetselected", "Reset selected items and structures to prefabs. Only applicable in the subeditor.", args =>
|
|
||||||
{
|
|
||||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
|
||||||
{
|
|
||||||
foreach (MapEntity entity in MapEntity.SelectedList)
|
|
||||||
{
|
|
||||||
if (entity is Item item)
|
|
||||||
{
|
|
||||||
item.Reset();
|
|
||||||
}
|
|
||||||
else if (entity is Structure structure)
|
|
||||||
{
|
|
||||||
structure.Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (MapEntity entity in MapEntity.SelectedList)
|
|
||||||
{
|
|
||||||
if (entity is Item item)
|
|
||||||
{
|
|
||||||
item.CreateEditingHUD();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (entity is Structure structure)
|
|
||||||
{
|
|
||||||
structure.CreateEditingHUD();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
|
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
|
||||||
{
|
{
|
||||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
@@ -1082,6 +1051,212 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
|
||||||
|
{
|
||||||
|
string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
|
||||||
|
List<string> lines = new List<string>();
|
||||||
|
foreach (MapEntityPrefab me in MapEntityPrefab.List)
|
||||||
|
{
|
||||||
|
lines.Add("<EntityName." + me.Identifier + ">" + me.Name + "</" + me.Identifier + ".Name>");
|
||||||
|
lines.Add("<EntityDescription." + me.Identifier + ">" + me.Description + "</" + me.Identifier + ".Description>");
|
||||||
|
}
|
||||||
|
File.WriteAllLines(filePath, lines);
|
||||||
|
}));
|
||||||
|
#if DEBUG
|
||||||
|
commands.Add(new Command("checkduplicates", "Checks the given language for duplicate translation keys and writes to file.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length != 1) return;
|
||||||
|
TextManager.CheckForDuplicates(args[0]);
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("writetocsv", "Writes the default language (English) to a .csv file.", (string[] args) =>
|
||||||
|
{
|
||||||
|
TextManager.WriteToCSV();
|
||||||
|
NPCConversation.WriteToCSV();
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("csvtoxml", "csvtoxml [language] -> Converts .csv localization files in Content/NPCConversations & Content/Texts to .xml for use in-game.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length == 0) return;
|
||||||
|
LocalizationCSVtoXML.Convert(args[0]);
|
||||||
|
}));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
commands.Add(new Command("cleanbuild", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
GameMain.Config.MusicVolume = 0.5f;
|
||||||
|
GameMain.Config.SoundVolume = 0.5f;
|
||||||
|
NewMessage("Music and sound volume set to 0.5", Color.Green);
|
||||||
|
|
||||||
|
commands.Add(new Command("camerasettings", "camerasettings [defaultzoom] [zoomsmoothness] [movesmoothness] [minzoom] [maxzoom]: debug command for testing camera settings. The values default to 1.1, 8.0, 8.0, 0.1 and 2.0.", (string[] args) =>
|
||||||
|
{
|
||||||
|
float defaultZoom = Screen.Selected.Cam.DefaultZoom;
|
||||||
|
if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out defaultZoom);
|
||||||
|
|
||||||
|
float zoomSmoothness = Screen.Selected.Cam.ZoomSmoothness;
|
||||||
|
if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out zoomSmoothness);
|
||||||
|
float moveSmoothness = Screen.Selected.Cam.MoveSmoothness;
|
||||||
|
if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out moveSmoothness);
|
||||||
|
|
||||||
|
float minZoom = Screen.Selected.Cam.MinZoom;
|
||||||
|
if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out minZoom);
|
||||||
|
float maxZoom = Screen.Selected.Cam.MaxZoom;
|
||||||
|
if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out maxZoom);
|
||||||
|
|
||||||
|
Screen.Selected.Cam.DefaultZoom = defaultZoom;
|
||||||
|
Screen.Selected.Cam.ZoomSmoothness = zoomSmoothness;
|
||||||
|
Screen.Selected.Cam.MoveSmoothness = moveSmoothness;
|
||||||
|
Screen.Selected.Cam.MinZoom = minZoom;
|
||||||
|
Screen.Selected.Cam.MaxZoom = maxZoom;
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("waterparams", "waterparams [distortionscalex] [distortionscaley] [distortionstrengthx] [distortionstrengthy] [bluramount]: default 0.5 0.5 0.5 0.5 1", (string[] args) =>
|
||||||
|
{
|
||||||
|
float distortScaleX = 0.5f, distortScaleY = 0.5f;
|
||||||
|
float distortStrengthX = 0.5f, distortStrengthY = 0.5f;
|
||||||
|
float blurAmount = 0.0f;
|
||||||
|
if (args.Length > 0) float.TryParse(args[0], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleX);
|
||||||
|
if (args.Length > 1) float.TryParse(args[1], NumberStyles.Number, CultureInfo.InvariantCulture, out distortScaleY);
|
||||||
|
if (args.Length > 2) float.TryParse(args[2], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthX);
|
||||||
|
if (args.Length > 3) float.TryParse(args[3], NumberStyles.Number, CultureInfo.InvariantCulture, out distortStrengthY);
|
||||||
|
if (args.Length > 4) float.TryParse(args[4], NumberStyles.Number, CultureInfo.InvariantCulture, out blurAmount);
|
||||||
|
WaterRenderer.DistortionScale = new Vector2(distortScaleX, distortScaleY);
|
||||||
|
WaterRenderer.DistortionStrength = new Vector2(distortStrengthX, distortStrengthY);
|
||||||
|
WaterRenderer.BlurAmount = blurAmount;
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
commands.Add(new Command("refreshrect", "Updates the dimensions of the selected items to match the ones defined in the prefab. Applied only in the subeditor.", (string[] args) =>
|
||||||
|
{
|
||||||
|
//TODO: maybe do this automatically during loading when possible?
|
||||||
|
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||||
|
{
|
||||||
|
if (!MapEntity.SelectedAny)
|
||||||
|
{
|
||||||
|
ThrowError("You have to select item(s) first!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var mapEntity in MapEntity.SelectedList)
|
||||||
|
{
|
||||||
|
if (mapEntity is Item item)
|
||||||
|
{
|
||||||
|
item.Rect = new Rectangle(item.Rect.X, item.Rect.Y,
|
||||||
|
(int)(item.Prefab.sprite.size.X * item.Prefab.Scale),
|
||||||
|
(int)(item.Prefab.sprite.size.Y * item.Prefab.Scale));
|
||||||
|
}
|
||||||
|
else if (mapEntity is Structure structure)
|
||||||
|
{
|
||||||
|
if (!structure.ResizeHorizontal)
|
||||||
|
{
|
||||||
|
structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
|
||||||
|
(int)structure.Prefab.ScaledSize.X,
|
||||||
|
structure.Rect.Height);
|
||||||
|
}
|
||||||
|
if (!structure.ResizeVertical)
|
||||||
|
{
|
||||||
|
structure.Rect = new Rectangle(structure.Rect.X, structure.Rect.Y,
|
||||||
|
structure.Rect.Width,
|
||||||
|
(int)structure.Prefab.ScaledSize.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, isCheat: false));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GameMain.Config.SaveNewPlayerConfig();
|
||||||
|
|
||||||
|
var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder);
|
||||||
|
|
||||||
|
foreach (string saveFile in saveFiles)
|
||||||
|
{
|
||||||
|
lines.Add(element.ElementInnerText());
|
||||||
|
}
|
||||||
|
File.WriteAllLines(Path.GetFileNameWithoutExtension(filePath) + ".txt", lines);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
TextManager.GetTextFiles().Where(f => Path.GetExtension(f)==".xml").ToArray()
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("loadtexts", "loadtexts [sourcefile] [destinationfile]: Loads all lines of text from a given .txt file and inserts them sequientially into the elements of an xml file. If the file paths are omitted, EnglishVanilla.txt and EnglishVanilla.xml are used.", (string[] args) =>
|
||||||
|
{
|
||||||
|
string sourcePath = args.Length > 0 ? args[0] : "Content/Texts/EnglishVanilla.txt";
|
||||||
|
string destinationPath = args.Length > 1 ? args[1] : "Content/Texts/EnglishVanilla.xml";
|
||||||
|
|
||||||
|
string[] lines;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lines = File.ReadAllLines(sourcePath);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ThrowError("Reading the file \"" + sourcePath + "\" failed.", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var doc = XMLExtensions.TryLoadXml(destinationPath);
|
||||||
|
int i = 0;
|
||||||
|
foreach (XElement element in doc.Root.Elements())
|
||||||
|
{
|
||||||
|
if (i >= lines.Length)
|
||||||
|
{
|
||||||
|
ThrowError("Error while loading texts to the xml file. The xml has more elements than the number of lines in the text file.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
element.Value = lines[i];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
doc.Save(destinationPath);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var files = TextManager.GetTextFiles().Select(f => f.Replace("\\", "/"));
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
files.Where(f => Path.GetExtension(f)==".txt").ToArray(),
|
||||||
|
files.Where(f => Path.GetExtension(f)==".xml").ToArray()
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
commands.Add(new Command("updatetextfile", "updatetextfile [sourcefile] [destinationfile]: Inserts all the xml elements that are only present in the source file into the destination file. Can be used to update outdated translation files more easily.", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (args.Length < 2) return;
|
||||||
|
string sourcePath = args[0];
|
||||||
|
string destinationPath = args[1];
|
||||||
|
|
||||||
|
var sourceDoc = XMLExtensions.TryLoadXml(sourcePath);
|
||||||
|
var destinationDoc = XMLExtensions.TryLoadXml(destinationPath);
|
||||||
|
|
||||||
|
XElement destinationElement = destinationDoc.Root.Elements().First();
|
||||||
|
foreach (XElement element in sourceDoc.Root.Elements())
|
||||||
|
{
|
||||||
|
if (destinationDoc.Root.Element(element.Name) == null)
|
||||||
|
{
|
||||||
|
element.Value = "!!!!!!!!!!!!!" + element.Value;
|
||||||
|
destinationElement.AddAfterSelf(element);
|
||||||
|
}
|
||||||
|
XNode nextNode = destinationElement.NextNode;
|
||||||
|
while ((!(nextNode is XElement) || nextNode == element) && nextNode != null) nextNode = nextNode.NextNode;
|
||||||
|
destinationElement = nextNode as XElement;
|
||||||
|
}
|
||||||
|
destinationDoc.Save(destinationPath);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
var files = TextManager.GetTextFiles().Where(f => Path.GetExtension(f) == ".xml").Select(f => f.Replace("\\", "/")).ToArray();
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
files,
|
||||||
|
files
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
|
commands.Add(new Command("dumpentitytexts", "dumpentitytexts [filepath]: gets the names and descriptions of all entity prefabs and writes them into a file along with xml tags that can be used in translation files. If the filepath is omitted, the file is written to Content/Texts/EntityTexts.txt", (string[] args) =>
|
||||||
{
|
{
|
||||||
string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
|
string filePath = args.Length > 0 ? args[0] : "Content/Texts/EntityTexts.txt";
|
||||||
@@ -1519,7 +1694,7 @@ namespace Barotrauma
|
|||||||
character.AnimController.ResetRagdoll();
|
character.AnimController.ResetRagdoll();
|
||||||
}, isCheat: true));
|
}, isCheat: true));
|
||||||
|
|
||||||
commands.Add(new Command("reloadwearables", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
|
commands.Add(new Command("reloadwearables|reloadlimbs", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
|
||||||
{
|
{
|
||||||
var character = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, true);
|
var character = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, true);
|
||||||
if (character == null)
|
if (character == null)
|
||||||
@@ -1530,26 +1705,6 @@ namespace Barotrauma
|
|||||||
ReloadWearables(character);
|
ReloadWearables(character);
|
||||||
}, isCheat: true));
|
}, isCheat: true));
|
||||||
|
|
||||||
commands.Add(new Command("loadwearable", "Force select certain variant for the selected character.", args =>
|
|
||||||
{
|
|
||||||
var character = Character.Controlled;
|
|
||||||
if (character == null)
|
|
||||||
{
|
|
||||||
ThrowError("Not controlling any character.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (args.Length == 0)
|
|
||||||
{
|
|
||||||
ThrowError("No arguments provided! Give an index number for the variant starting from 1.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (int.TryParse(args[0], out int variant))
|
|
||||||
{
|
|
||||||
ReloadWearables(character, variant);
|
|
||||||
}
|
|
||||||
|
|
||||||
}, isCheat: true));
|
|
||||||
|
|
||||||
commands.Add(new Command("reloadsprite|reloadsprites", "Reloads the sprites of the selected item(s)/structure(s) (hovering over or selecting in the subeditor) or the controlled character. Can also reload sprites by entity id or by the name attribute (sprite element). Example 1: reloadsprite id itemid. Example 2: reloadsprite name \"Sprite name\"", args =>
|
commands.Add(new Command("reloadsprite|reloadsprites", "Reloads the sprites of the selected item(s)/structure(s) (hovering over or selecting in the subeditor) or the controlled character. Can also reload sprites by entity id or by the name attribute (sprite element). Example 1: reloadsprite id itemid. Example 2: reloadsprite name \"Sprite name\"", args =>
|
||||||
{
|
{
|
||||||
if (Screen.Selected is SpriteEditorScreen)
|
if (Screen.Selected is SpriteEditorScreen)
|
||||||
@@ -1697,7 +1852,7 @@ namespace Barotrauma
|
|||||||
}, isCheat: true));
|
}, isCheat: true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ReloadWearables(Character character, int variant = 0)
|
private static void ReloadWearables(Character character)
|
||||||
{
|
{
|
||||||
foreach (var limb in character.AnimController.Limbs)
|
foreach (var limb in character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
@@ -1706,17 +1861,11 @@ namespace Barotrauma
|
|||||||
limb.DeformSprite?.Sprite.ReloadTexture();
|
limb.DeformSprite?.Sprite.ReloadTexture();
|
||||||
foreach (var wearable in limb.WearingItems)
|
foreach (var wearable in limb.WearingItems)
|
||||||
{
|
{
|
||||||
if (variant > 0 && wearable.Variant > 0)
|
|
||||||
{
|
|
||||||
wearable.Variant = variant;
|
|
||||||
}
|
|
||||||
wearable.RefreshPath();
|
|
||||||
wearable.Sprite.ReloadXML();
|
wearable.Sprite.ReloadXML();
|
||||||
wearable.Sprite.ReloadTexture();
|
wearable.Sprite.ReloadTexture();
|
||||||
}
|
}
|
||||||
foreach (var wearable in limb.OtherWearables)
|
foreach (var wearable in limb.OtherWearables)
|
||||||
{
|
{
|
||||||
wearable.RefreshPath();
|
|
||||||
wearable.Sprite.ReloadXML();
|
wearable.Sprite.ReloadXML();
|
||||||
wearable.Sprite.ReloadTexture();
|
wearable.Sprite.ReloadTexture();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,21 +26,7 @@ namespace Barotrauma
|
|||||||
private bool isSinglePlayer;
|
private bool isSinglePlayer;
|
||||||
public bool IsSinglePlayer => isSinglePlayer;
|
public bool IsSinglePlayer => isSinglePlayer;
|
||||||
|
|
||||||
private bool _toggleOpen = true;
|
private bool toggleOpen = true;
|
||||||
public bool ToggleOpen
|
|
||||||
{
|
|
||||||
get { return _toggleOpen; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_toggleOpen == value) { return; }
|
|
||||||
_toggleOpen = GameMain.Config.ChatOpen = value;
|
|
||||||
foreach (GUIComponent child in ToggleButton.Children)
|
|
||||||
{
|
|
||||||
child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
|
|
||||||
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private float openState;
|
private float openState;
|
||||||
|
|
||||||
private float prevUIScale;
|
private float prevUIScale;
|
||||||
@@ -95,7 +81,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
{
|
{
|
||||||
ToggleOpen = !ToggleOpen;
|
toggleOpen = !toggleOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
|
{
|
||||||
|
child.SpriteEffects = toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
|
||||||
|
SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,8 +124,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ToggleOpen = GameMain.Config.ChatOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TypingChatMessage(GUITextBox textBox, string text)
|
public bool TypingChatMessage(GUITextBox textBox, string text)
|
||||||
@@ -239,7 +228,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
chatBox.UpdateScrollBarSize();
|
chatBox.UpdateScrollBarSize();
|
||||||
|
|
||||||
if (!ToggleOpen)
|
if (!toggleOpen)
|
||||||
{
|
{
|
||||||
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, guiFrame.RectTransform), style: "GUIToolTip")
|
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, guiFrame.RectTransform), style: "GUIToolTip")
|
||||||
{
|
{
|
||||||
@@ -324,7 +313,9 @@ namespace Barotrauma
|
|||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ToggleOpen || (inputBox != null && inputBox.Selected))
|
|
||||||
|
|
||||||
|
if (toggleOpen || (inputBox != null && inputBox.Selected))
|
||||||
{
|
{
|
||||||
openState += deltaTime * 5.0f;
|
openState += deltaTime * 5.0f;
|
||||||
//delete all popup messages when the chatbox is open
|
//delete all popup messages when the chatbox is open
|
||||||
|
|||||||
@@ -1568,7 +1568,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages. TODO: Allow to show messages at the middle of the screen (instead of the top center).
|
/// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void AddMessage(string message, Color color, float? lifeTime = null, bool playSound = true, ScalableFont font = null)
|
public static void AddMessage(string message, Color color, float? lifeTime = null, bool playSound = true, ScalableFont font = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -318,16 +318,8 @@ namespace Barotrauma
|
|||||||
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
|
SoundManager.SetCategoryGainMultiplier("voip", Config.VoiceChatVolume);
|
||||||
if (Config.EnableSplashScreen)
|
if (Config.EnableSplashScreen)
|
||||||
{
|
{
|
||||||
try
|
(TitleScreen as LoadingScreen).SplashScreen = new Video(base.GraphicsDevice, SoundManager, "Content/splashscreen.mp4", 1280, 720);
|
||||||
{
|
}
|
||||||
(TitleScreen as LoadingScreen).SplashScreen = new Video(base.GraphicsDevice, SoundManager, "Content/splashscreen.mp4", 1280, 720);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Config.EnableSplashScreen = false;
|
|
||||||
DebugConsole.ThrowError("Playing the splash screen failed.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
|
GUI.Init(Window, Config.SelectedContentPackages, GraphicsDevice);
|
||||||
DebugConsole.Init();
|
DebugConsole.Init();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Barotrauma.Networking;
|
|||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -40,10 +41,7 @@ namespace Barotrauma
|
|||||||
private bool toggleCrewAreaOpen = true;
|
private bool toggleCrewAreaOpen = true;
|
||||||
private int characterInfoWidth;
|
private int characterInfoWidth;
|
||||||
|
|
||||||
/// <summary>
|
private ChatBox chatBox;
|
||||||
/// Present only in single player games. In multiplayer. The chatbox is found from GameSession.Client.
|
|
||||||
/// </summary>
|
|
||||||
public ChatBox ChatBox { get; private set; }
|
|
||||||
|
|
||||||
private float prevUIScale;
|
private float prevUIScale;
|
||||||
|
|
||||||
@@ -52,15 +50,7 @@ namespace Barotrauma
|
|||||||
public bool ToggleCrewAreaOpen
|
public bool ToggleCrewAreaOpen
|
||||||
{
|
{
|
||||||
get { return toggleCrewAreaOpen; }
|
get { return toggleCrewAreaOpen; }
|
||||||
set
|
set { toggleCrewAreaOpen = value; }
|
||||||
{
|
|
||||||
if (toggleCrewAreaOpen == value) { return; }
|
|
||||||
toggleCrewAreaOpen = GameMain.Config.CrewMenuOpen = value;
|
|
||||||
foreach (GUIComponent child in toggleCrewButton.Children)
|
|
||||||
{
|
|
||||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -103,7 +93,11 @@ namespace Barotrauma
|
|||||||
"", style: "UIToggleButton");
|
"", style: "UIToggleButton");
|
||||||
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
{
|
{
|
||||||
ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
|
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||||
|
foreach (GUIComponent child in btn.Children)
|
||||||
|
{
|
||||||
|
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,7 +125,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (isSinglePlayer)
|
if (isSinglePlayer)
|
||||||
{
|
{
|
||||||
ChatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
||||||
{
|
{
|
||||||
OnEnterMessage = (textbox, text) =>
|
OnEnterMessage = (textbox, text) =>
|
||||||
{
|
{
|
||||||
@@ -164,7 +158,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ChatBox.InputBox.OnTextChanged += ChatBox.TypingChatMessage;
|
chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
||||||
@@ -214,8 +208,6 @@ namespace Barotrauma
|
|||||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
|
||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
|
|
||||||
ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -279,6 +271,7 @@ namespace Barotrauma
|
|||||||
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
|
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
}
|
}
|
||||||
@@ -654,7 +647,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(text)) { return; }
|
if (string.IsNullOrEmpty(text)) { return; }
|
||||||
|
|
||||||
ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
chatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
||||||
}
|
}
|
||||||
|
|
||||||
private WifiComponent GetHeadset(Character character, bool requireEquipped)
|
private WifiComponent GetHeadset(Character character, bool requireEquipped)
|
||||||
@@ -730,7 +723,7 @@ namespace Barotrauma
|
|||||||
if (IsSinglePlayer)
|
if (IsSinglePlayer)
|
||||||
{
|
{
|
||||||
orderGiver.Speak(
|
orderGiver.Speak(
|
||||||
order.GetChatMessage("", orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
|
order.GetChatMessage("", orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -747,7 +740,7 @@ namespace Barotrauma
|
|||||||
if (IsSinglePlayer)
|
if (IsSinglePlayer)
|
||||||
{
|
{
|
||||||
orderGiver?.Speak(
|
orderGiver?.Speak(
|
||||||
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
||||||
}
|
}
|
||||||
else if (orderGiver != null)
|
else if (orderGiver != null)
|
||||||
{
|
{
|
||||||
@@ -1064,24 +1057,24 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
|
if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
|
||||||
if (ChatBox != null)
|
if (chatBox != null)
|
||||||
{
|
{
|
||||||
ChatBox.Update(deltaTime);
|
chatBox.Update(deltaTime);
|
||||||
ChatBox.InputBox.Visible = Character.Controlled != null;
|
chatBox.InputBox.Visible = Character.Controlled != null;
|
||||||
|
|
||||||
if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible)
|
if (!DebugConsole.IsOpen && chatBox.InputBox.Visible)
|
||||||
{
|
{
|
||||||
if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected)
|
if (PlayerInput.KeyHit(InputType.Chat) && !chatBox.InputBox.Selected)
|
||||||
{
|
{
|
||||||
ChatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
|
chatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
|
||||||
ChatBox.InputBox.Select();
|
chatBox.InputBox.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerInput.KeyHit(InputType.RadioChat) && !ChatBox.InputBox.Selected)
|
if (PlayerInput.KeyHit(InputType.RadioChat) && !chatBox.InputBox.Selected)
|
||||||
{
|
{
|
||||||
ChatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
|
chatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
|
||||||
ChatBox.InputBox.Select();
|
chatBox.InputBox.Select();
|
||||||
ChatBox.InputBox.Text = "r; ";
|
chatBox.InputBox.Text = "r; ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1151,7 +1144,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
crewArea.RectTransform.AbsoluteOffset =
|
crewArea.RectTransform.AbsoluteOffset =
|
||||||
Vector2.SmoothStep(new Vector2(-crewArea.Rect.Width, 0), new Vector2(toggleCrewButton.Rect.Width, 0), crewAreaOpenState).ToPoint();
|
Vector2.SmoothStep(new Vector2(-crewArea.Rect.Width, 0), new Vector2(toggleCrewButton.Rect.Width, 0), crewAreaOpenState).ToPoint();
|
||||||
crewAreaOpenState = ToggleCrewAreaOpen ?
|
crewAreaOpenState = toggleCrewAreaOpen ?
|
||||||
Math.Min(crewAreaOpenState + deltaTime * 2.0f, 1.0f) :
|
Math.Min(crewAreaOpenState + deltaTime * 2.0f, 1.0f) :
|
||||||
Math.Max(crewAreaOpenState - deltaTime * 2.0f, 0.0f);
|
Math.Max(crewAreaOpenState - deltaTime * 2.0f, 0.0f);
|
||||||
|
|
||||||
@@ -1164,7 +1157,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Character.Controlled.SelectedConstruction = null;
|
Character.Controlled.SelectedConstruction = null;
|
||||||
}
|
}
|
||||||
ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
|
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateReports(deltaTime);
|
UpdateReports(deltaTime);
|
||||||
@@ -1292,7 +1285,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
reportButtonFrame.Visible = true;
|
reportButtonFrame.Visible = true;
|
||||||
|
|
||||||
var reportButtonParent = ChatBox ?? GameMain.Client.ChatBox;
|
var reportButtonParent = chatBox ?? GameMain.Client.ChatBox;
|
||||||
reportButtonFrame.RectTransform.AbsoluteOffset = new Point(
|
reportButtonFrame.RectTransform.AbsoluteOffset = new Point(
|
||||||
Math.Min(reportButtonParent.GUIFrame.Rect.X, reportButtonParent.ToggleButton.Rect.X) - reportButtonFrame.Rect.Width - (int)(10 * GUI.Scale),
|
Math.Min(reportButtonParent.GUIFrame.Rect.X, reportButtonParent.ToggleButton.Rect.X) - reportButtonFrame.Rect.Width - (int)(10 * GUI.Scale),
|
||||||
reportButtonParent.GUIFrame.Rect.Y);
|
reportButtonParent.GUIFrame.Rect.Y);
|
||||||
|
|||||||
@@ -135,8 +135,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
msg.Write(map.SelectedLocationIndex == -1 ? UInt16.MaxValue : (UInt16)map.SelectedLocationIndex);
|
msg.Write(map.SelectedLocationIndex == -1 ? UInt16.MaxValue : (UInt16)map.SelectedLocationIndex);
|
||||||
msg.Write(map.SelectedMissionIndex == -1 ? byte.MaxValue : (byte)map.SelectedMissionIndex);
|
msg.Write(map.SelectedMissionIndex == -1 ? byte.MaxValue : (byte)map.SelectedMissionIndex);
|
||||||
msg.Write(PurchasedHullRepairs);
|
|
||||||
msg.Write(PurchasedItemRepairs);
|
|
||||||
|
|
||||||
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
|
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
|
||||||
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
|
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
|
||||||
|
|||||||
@@ -81,8 +81,7 @@ namespace Barotrauma
|
|||||||
var leftPanel = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), settingsFramePadding.RectTransform, Anchor.TopLeft));
|
var leftPanel = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), settingsFramePadding.RectTransform, Anchor.TopLeft));
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftPanel.RectTransform),
|
||||||
TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont)
|
TextManager.Get("Settings"), textAlignment: Alignment.TopLeft, font: GUI.LargeFont);
|
||||||
{ ForceUpperCase = true };
|
|
||||||
|
|
||||||
var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft));
|
var generalLayoutGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), leftPanel.RectTransform, Anchor.TopLeft));
|
||||||
|
|
||||||
@@ -439,17 +438,6 @@ namespace Barotrauma
|
|||||||
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
|
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUITickBox directionalVoiceChat = new GUITickBox(new RectTransform(new Point(32, 32), audioSliders.RectTransform), TextManager.Get("DirectionalVoiceChat"));
|
|
||||||
directionalVoiceChat.Selected = UseDirectionalVoiceChat;
|
|
||||||
directionalVoiceChat.ToolTip = TextManager.Get("DirectionalVoiceChatToolTip");
|
|
||||||
directionalVoiceChat.OnSelected = (tickBox) =>
|
|
||||||
{
|
|
||||||
UseDirectionalVoiceChat = tickBox.Selected;
|
|
||||||
UnsavedSettings = true;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
|
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
|
||||||
#if (!OSX)
|
#if (!OSX)
|
||||||
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
|
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Barotrauma
|
|||||||
Right,
|
Right,
|
||||||
Center
|
Center
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum QuickUseAction
|
private enum QuickUseAction
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
@@ -34,8 +34,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<InvSlotType, Sprite> limbSlotIcons;
|
private static Dictionary<InvSlotType, Sprite> limbSlotIcons;
|
||||||
|
|
||||||
const InvSlotType PersonalSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.OuterClothes | InvSlotType.Head;
|
|
||||||
|
|
||||||
private Point screenResolution;
|
private Point screenResolution;
|
||||||
|
|
||||||
@@ -53,42 +51,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool Hidden { get; set; }
|
public bool Hidden { get; set; }
|
||||||
|
|
||||||
private bool hidePersonalSlots;
|
|
||||||
private float hidePersonalSlotsState;
|
|
||||||
private GUIButton hideButton;
|
|
||||||
private Rectangle personalSlotArea;
|
|
||||||
|
|
||||||
public bool HidePersonalSlots
|
|
||||||
{
|
|
||||||
get { return hidePersonalSlots; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Rectangle PersonalSlotArea
|
|
||||||
{
|
|
||||||
get { return personalSlotArea; }
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void InitProjSpecific(XElement element)
|
partial void InitProjSpecific(XElement element)
|
||||||
{
|
{
|
||||||
Hidden = true;
|
Hidden = true;
|
||||||
|
|
||||||
hideButton = new GUIButton(new RectTransform(new Point((int)(30 * GUI.Scale), (int)(60 * GUI.Scale)), GUI.Canvas)
|
|
||||||
{ AbsoluteOffset = HUDLayoutSettings.CrewArea.Location },
|
|
||||||
"", style: "UIToggleButton");
|
|
||||||
hideButton.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipHorizontally);
|
|
||||||
hideButton.OnClicked += (GUIButton btn, object userdata) =>
|
|
||||||
{
|
|
||||||
hidePersonalSlots = !hidePersonalSlots;
|
|
||||||
foreach (GUIComponent child in btn.Children)
|
|
||||||
{
|
|
||||||
child.SpriteEffects = hidePersonalSlots ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
hidePersonalSlots = false;
|
|
||||||
|
|
||||||
if (limbSlotIcons == null)
|
if (limbSlotIcons == null)
|
||||||
{
|
{
|
||||||
limbSlotIcons = new Dictionary<InvSlotType, Sprite>();
|
limbSlotIcons = new Dictionary<InvSlotType, Sprite>();
|
||||||
@@ -101,11 +68,12 @@ namespace Barotrauma
|
|||||||
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
||||||
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SlotPositions = new Vector2[SlotTypes.Length];
|
SlotPositions = new Vector2[SlotTypes.Length];
|
||||||
CurrentLayout = Layout.Default;
|
CurrentLayout = Layout.Default;
|
||||||
SetSlotPositions(layout);
|
SetSlotPositions(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PutItem(Item item, int i, Character user, bool removeItem = true, bool createNetworkEvent = true)
|
protected override void PutItem(Item item, int i, Character user, bool removeItem = true, bool createNetworkEvent = true)
|
||||||
{
|
{
|
||||||
base.PutItem(item, i, user, removeItem, createNetworkEvent);
|
base.PutItem(item, i, user, removeItem, createNetworkEvent);
|
||||||
@@ -191,11 +159,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (slots[i].Disabled || (hideEmptySlot[i] && Items[i] == null)) return true;
|
if (slots[i].Disabled || (hideEmptySlot[i] && Items[i] == null)) return true;
|
||||||
|
|
||||||
if (layout == Layout.Default)
|
|
||||||
{
|
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i]) && !personalSlotArea.Contains(slots[i].Rect.Center + slots[i].DrawOffset.ToPoint())) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//no need to draw the right hand slot if the item is in both hands
|
//no need to draw the right hand slot if the item is in both hands
|
||||||
if (Items[i] != null && SlotTypes[i] == InvSlotType.RightHand && IsInLimbSlot(Items[i], InvSlotType.LeftHand))
|
if (Items[i] != null && SlotTypes[i] == InvSlotType.RightHand && IsInLimbSlot(Items[i], InvSlotType.LeftHand))
|
||||||
{
|
{
|
||||||
@@ -213,6 +176,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetSlotPositions(Layout layout)
|
private void SetSlotPositions(Layout layout)
|
||||||
{
|
{
|
||||||
int spacing = (int)(10 * UIScale);
|
int spacing = (int)(10 * UIScale);
|
||||||
@@ -221,32 +185,27 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (slots == null) CreateSlots();
|
if (slots == null) CreateSlots();
|
||||||
|
|
||||||
hideButton.Visible = false;
|
var upperSlots = InvSlotType.Card | InvSlotType.Headset | InvSlotType.InnerClothes | InvSlotType.Head;
|
||||||
|
|
||||||
switch (layout)
|
switch (layout)
|
||||||
{
|
{
|
||||||
case Layout.Default:
|
case Layout.Default:
|
||||||
{
|
{
|
||||||
int personalSlotCount = SlotTypes.Count(s => PersonalSlots.HasFlag(s));
|
int personalSlotCount = SlotTypes.Count(s => upperSlots.HasFlag(s));
|
||||||
int normalSlotCount = SlotTypes.Count(s => !PersonalSlots.HasFlag(s));
|
int normalSlotCount = SlotTypes.Count(s => !upperSlots.HasFlag(s));
|
||||||
|
|
||||||
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2;
|
int x = GameMain.GraphicsWidth / 2 - normalSlotCount * (slotSize.X + spacing) / 2;
|
||||||
int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X * 2;
|
int upperX = HUDLayoutSettings.PortraitArea.X - slotSize.X;
|
||||||
|
|
||||||
//make sure the rightmost normal slot doesn't overlap with the personal slots
|
//make sure the rightmost normal slot doesn't overlap with the personal slots
|
||||||
x -= Math.Max((x + normalSlotCount * (slotSize.X + spacing)) - (upperX - personalSlotCount * (slotSize.X + spacing)), 0);
|
x -= Math.Max((x + normalSlotCount * (slotSize.X + spacing)) - (upperX - personalSlotCount * (slotSize.X + spacing)), 0);
|
||||||
|
|
||||||
int hideButtonSlotIndex = -1;
|
|
||||||
for (int i = 0; i < SlotPositions.Length; i++)
|
for (int i = 0; i < SlotPositions.Length; i++)
|
||||||
{
|
{
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
if (upperSlots.HasFlag(SlotTypes[i]))
|
||||||
{
|
{
|
||||||
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset);
|
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset);
|
||||||
upperX -= slotSize.X + spacing;
|
upperX -= slotSize.X + spacing;
|
||||||
personalSlotArea = (hideButtonSlotIndex == -1) ?
|
|
||||||
new Rectangle(SlotPositions[i].ToPoint(), slotSize) :
|
|
||||||
Rectangle.Union(personalSlotArea, new Rectangle(SlotPositions[i].ToPoint(), slotSize));
|
|
||||||
hideButtonSlotIndex = i;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -254,29 +213,19 @@ namespace Barotrauma
|
|||||||
x += slotSize.X + spacing;
|
x += slotSize.X + spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideButtonSlotIndex > -1)
|
|
||||||
{
|
|
||||||
hideButton.RectTransform.SetPosition(Anchor.TopLeft, Pivot.TopLeft);
|
|
||||||
hideButton.RectTransform.NonScaledSize = new Point(slotSize.X / 2, slotSize.Y + slots[hideButtonSlotIndex].EquipButtonRect.Height);
|
|
||||||
hideButton.RectTransform.AbsoluteOffset = new Point(
|
|
||||||
personalSlotArea.Right + spacing,
|
|
||||||
personalSlotArea.Y - slots[hideButtonSlotIndex].EquipButtonRect.Height);
|
|
||||||
hideButton.Visible = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Layout.Right:
|
case Layout.Right:
|
||||||
{
|
{
|
||||||
int extraOffset = 0;
|
int extraOffset = 0;
|
||||||
int x = HUDLayoutSettings.InventoryAreaLower.Right;
|
int x = HUDLayoutSettings.InventoryAreaLower.Right;
|
||||||
int personalSlotX = HUDLayoutSettings.InventoryAreaLower.Right - slotSize.X - spacing;
|
int upperX = HUDLayoutSettings.InventoryAreaLower.Right;
|
||||||
for (int i = 0; i < slots.Length; i++)
|
for (int i = 0; i < slots.Length; i++)
|
||||||
{
|
{
|
||||||
if (HideSlot(i)) continue;
|
if (HideSlot(i)) continue;
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
if (upperSlots.HasFlag(SlotTypes[i]))
|
||||||
{
|
{
|
||||||
//upperX -= slotSize.X + spacing;
|
upperX -= slotSize.X + spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -288,10 +237,10 @@ namespace Barotrauma
|
|||||||
for (int i = 0; i < SlotPositions.Length; i++)
|
for (int i = 0; i < SlotPositions.Length; i++)
|
||||||
{
|
{
|
||||||
if (HideSlot(i)) continue;
|
if (HideSlot(i)) continue;
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
if (upperSlots.HasFlag(SlotTypes[i]))
|
||||||
{
|
{
|
||||||
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2);
|
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - extraOffset - spacing * 2);
|
||||||
personalSlotX -= slots[i].Rect.Width + spacing;
|
upperX += slots[i].Rect.Width + spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -312,14 +261,14 @@ namespace Barotrauma
|
|||||||
case Layout.Left:
|
case Layout.Left:
|
||||||
{
|
{
|
||||||
int x = HUDLayoutSettings.InventoryAreaLower.X;
|
int x = HUDLayoutSettings.InventoryAreaLower.X;
|
||||||
int personalSlotX = x;
|
int upperX = x;
|
||||||
for (int i = 0; i < SlotPositions.Length; i++)
|
for (int i = 0; i < SlotPositions.Length; i++)
|
||||||
{
|
{
|
||||||
if (HideSlot(i)) continue;
|
if (HideSlot(i)) continue;
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i]))
|
if (upperSlots.HasFlag(SlotTypes[i]))
|
||||||
{
|
{
|
||||||
SlotPositions[i] = new Vector2(personalSlotX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
|
SlotPositions[i] = new Vector2(upperX, GameMain.GraphicsHeight - bottomOffset * 2 - spacing * 2);
|
||||||
personalSlotX += slots[i].Rect.Width + spacing;
|
upperX += slots[i].Rect.Width + spacing;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -405,27 +354,6 @@ namespace Barotrauma
|
|||||||
((selectedSlot != null && selectedSlot.IsSubSlot) || (draggingItem != null && (draggingSlot == null || !draggingSlot.MouseOn())));
|
((selectedSlot != null && selectedSlot.IsSubSlot) || (draggingItem != null && (draggingSlot == null || !draggingSlot.MouseOn())));
|
||||||
if (CharacterHealth.OpenHealthWindow != null) hoverOnInventory = true;
|
if (CharacterHealth.OpenHealthWindow != null) hoverOnInventory = true;
|
||||||
|
|
||||||
if (layout == Layout.Default && hideButton.Visible)
|
|
||||||
{
|
|
||||||
hideButton.AddToGUIUpdateList();
|
|
||||||
hideButton.UpdateManually(deltaTime, alsoChildren: true);
|
|
||||||
|
|
||||||
hidePersonalSlotsState = hidePersonalSlots ?
|
|
||||||
Math.Min(hidePersonalSlotsState + deltaTime * 5.0f, 1.0f) :
|
|
||||||
Math.Max(hidePersonalSlotsState - deltaTime * 5.0f, 0.0f);
|
|
||||||
|
|
||||||
for (int i = 0; i < slots.Length; i++)
|
|
||||||
{
|
|
||||||
if (!PersonalSlots.HasFlag(SlotTypes[i])) { continue; }
|
|
||||||
if (HidePersonalSlots)
|
|
||||||
{
|
|
||||||
if (selectedSlot?.Slot == slots[i]) { selectedSlot = null; }
|
|
||||||
highlightedSubInventorySlots.RemoveWhere(s => s.Slot == slots[i]);
|
|
||||||
}
|
|
||||||
slots[i].DrawOffset = Vector2.Lerp(Vector2.Zero, new Vector2(personalSlotArea.Width, 0.0f), hidePersonalSlotsState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hoverOnInventory) HideTimer = 0.5f;
|
if (hoverOnInventory) HideTimer = 0.5f;
|
||||||
if (HideTimer > 0.0f) HideTimer -= deltaTime;
|
if (HideTimer > 0.0f) HideTimer -= deltaTime;
|
||||||
|
|
||||||
@@ -438,24 +366,7 @@ namespace Barotrauma
|
|||||||
QuickUseItem(Items[i], true, false, true);
|
QuickUseItem(Items[i], true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//force personal slots open if an item is running out of battery/fuel/oxygen/etc
|
|
||||||
if (hidePersonalSlots)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < slots.Length; i++)
|
|
||||||
{
|
|
||||||
if (Items[i]?.OwnInventory != null && Items[i].OwnInventory.Capacity == 1 && PersonalSlots.HasFlag(SlotTypes[i]))
|
|
||||||
{
|
|
||||||
if (Items[i].OwnInventory.Items[0].Condition > 0.0f &&
|
|
||||||
Items[i].OwnInventory.Items[0].Condition / Items[i].OwnInventory.Items[0].MaxCondition < 0.15f)
|
|
||||||
{
|
|
||||||
hidePersonalSlots = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<SlotReference> hideSubInventories = new List<SlotReference>();
|
List<SlotReference> hideSubInventories = new List<SlotReference>();
|
||||||
foreach (var highlightedSubInventorySlot in highlightedSubInventorySlots)
|
foreach (var highlightedSubInventorySlot in highlightedSubInventorySlots)
|
||||||
{
|
{
|
||||||
@@ -793,12 +704,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
if (hideButton != null && hideButton.Visible)
|
|
||||||
{
|
|
||||||
hideButton.DrawManually(spriteBatch, alsoChildren: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
InventorySlot highlightedQuickUseSlot = null;
|
InventorySlot highlightedQuickUseSlot = null;
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
@@ -812,7 +718,7 @@ namespace Barotrauma
|
|||||||
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
|
if (limbSlotIcons.ContainsKey(SlotTypes[i]))
|
||||||
{
|
{
|
||||||
var icon = limbSlotIcons[SlotTypes[i]];
|
var icon = limbSlotIcons[SlotTypes[i]];
|
||||||
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2() + slots[i].DrawOffset, Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
icon.Draw(spriteBatch, slots[i].Rect.Center.ToVector2(), Color.White * 0.3f, origin: icon.size / 2, scale: slots[i].Rect.Width / icon.size.X);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -822,12 +728,12 @@ namespace Barotrauma
|
|||||||
if (IsInLimbSlot(Items[i], InvSlotType.LeftHand))
|
if (IsInLimbSlot(Items[i], InvSlotType.LeftHand))
|
||||||
{
|
{
|
||||||
var icon = limbSlotIcons[InvSlotType.LeftHand];
|
var icon = limbSlotIcons[InvSlotType.LeftHand];
|
||||||
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
|
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.X, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.35f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
|
||||||
}
|
}
|
||||||
if (IsInLimbSlot(Items[i], InvSlotType.RightHand))
|
if (IsInLimbSlot(Items[i], InvSlotType.RightHand))
|
||||||
{
|
{
|
||||||
var icon = limbSlotIcons[InvSlotType.RightHand];
|
var icon = limbSlotIcons[InvSlotType.RightHand];
|
||||||
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom) + slots[i].DrawOffset, Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
|
icon.Draw(spriteBatch, new Vector2(slots[i].Rect.Right, slots[i].Rect.Bottom), Color.White * 0.6f, origin: new Vector2(icon.size.X * 0.65f, icon.size.Y * 0.75f), scale: slots[i].Rect.Width / icon.size.X * 0.7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = slots[i].EquipButtonState == GUIComponent.ComponentState.Pressed ? Color.Gray : Color.White * 0.8f;
|
Color color = slots[i].EquipButtonState == GUIComponent.ComponentState.Pressed ? Color.Gray : Color.White * 0.8f;
|
||||||
|
|||||||
@@ -377,13 +377,9 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public virtual void UpdateHUD(Character character, float deltaTime, Camera cam) { }
|
public virtual void UpdateHUD(Character character, float deltaTime, Camera cam) { }
|
||||||
|
|
||||||
public virtual void CreateEditingHUD(SerializableEntityEditor editor)
|
public ItemComponent GetLinkUIToComponent()
|
||||||
{
|
{
|
||||||
}
|
if (string.IsNullOrEmpty(LinkUIToComponent))
|
||||||
|
|
||||||
private bool LoadElemProjSpecific(XElement subElement)
|
|
||||||
{
|
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
|
||||||
{
|
{
|
||||||
case "guiframe":
|
case "guiframe":
|
||||||
if (subElement.Attribute("rect") != null)
|
if (subElement.Attribute("rect") != null)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string text;
|
private string text;
|
||||||
[Serialize("", true, translationTextTag: "Label."), Editable(100)]
|
[Serialize("", true), Editable(100)]
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
get { return text; }
|
get { return text; }
|
||||||
@@ -40,10 +40,9 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
textBlock = null;
|
textBlock = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = value;
|
text = value;
|
||||||
DisplayText = TextManager.Get(text, returnNull: true) ?? value;
|
TextBlock.Text = value;
|
||||||
TextBlock.Text = DisplayText;
|
|
||||||
SetScrollingText();
|
SetScrollingText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,7 +121,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (!scrollable) return;
|
if (!scrollable) return;
|
||||||
|
|
||||||
float totalWidth = textBlock.Font.MeasureString(DisplayText).X;
|
float totalWidth = textBlock.Font.MeasureString(text).X;
|
||||||
float textAreaWidth = Math.Max(textBlock.Rect.Width - textBlock.Padding.X - textBlock.Padding.Z, 0);
|
float textAreaWidth = Math.Max(textBlock.Rect.Width - textBlock.Padding.X - textBlock.Padding.Z, 0);
|
||||||
if (totalWidth >= textAreaWidth)
|
if (totalWidth >= textAreaWidth)
|
||||||
{
|
{
|
||||||
@@ -130,13 +129,13 @@ namespace Barotrauma.Items.Components
|
|||||||
//(so the text can scroll entirely out of view before we reset it back to start)
|
//(so the text can scroll entirely out of view before we reset it back to start)
|
||||||
needsScrolling = true;
|
needsScrolling = true;
|
||||||
float spaceWidth = textBlock.Font.MeasureChar(' ').X;
|
float spaceWidth = textBlock.Font.MeasureChar(' ').X;
|
||||||
scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + DisplayText;
|
scrollingText = new string(' ', (int)Math.Ceiling(textAreaWidth / spaceWidth)) + text;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//whole text can fit in the textblock, no need to scroll
|
//whole text can fit in the textblock, no need to scroll
|
||||||
needsScrolling = false;
|
needsScrolling = false;
|
||||||
scrollingText = DisplayText;
|
scrollingText = text;
|
||||||
scrollAmount = 0.0f;
|
scrollAmount = 0.0f;
|
||||||
scrollIndex = 0;
|
scrollIndex = 0;
|
||||||
return;
|
return;
|
||||||
@@ -152,7 +151,7 @@ namespace Barotrauma.Items.Components
|
|||||||
charWidths[i] = charWidth;
|
charWidths[i] = charWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollIndex = MathHelper.Clamp(scrollIndex, 0, DisplayText.Length);
|
scrollIndex = MathHelper.Clamp(scrollIndex, 0, text.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center;
|
hullInfoFrame.RectTransform.ScreenSpaceOffset = hullFrame.Rect.Center;
|
||||||
hullInfoFrame.Visible = true;
|
hullInfoFrame.Visible = true;
|
||||||
hullNameText.Text = hull.DisplayName;
|
hullNameText.Text = hull.RoomName;
|
||||||
|
|
||||||
foreach (Hull linkedHull in hullData.LinkedHulls)
|
foreach (Hull linkedHull in hullData.LinkedHulls)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -785,32 +785,15 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
foreach (Character c in Character.CharacterList)
|
foreach (Character c in Character.CharacterList)
|
||||||
{
|
{
|
||||||
if (c.AnimController.CurrentHull != null || !c.Enabled) { continue; }
|
if (c.AnimController.CurrentHull != null || !c.Enabled) continue;
|
||||||
if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) { continue; }
|
if (DetectSubmarineWalls && c.AnimController.CurrentHull == null && item.CurrentHull != null) continue;
|
||||||
|
|
||||||
if (c.AnimController.SimplePhysicsEnabled)
|
|
||||||
{
|
|
||||||
float pointDist = ((c.WorldPosition - pingSource) * displayScale).LengthSquared();
|
|
||||||
if (pointDist > DisplayRadius * DisplayRadius) { continue; }
|
|
||||||
|
|
||||||
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
|
||||||
{
|
|
||||||
var blip = new SonarBlip(
|
|
||||||
c.WorldPosition,
|
|
||||||
MathHelper.Clamp(c.Mass, 0.1f, pingStrength),
|
|
||||||
MathHelper.Clamp(c.Mass * 0.03f, 0.1f, 2.0f));
|
|
||||||
if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
|
|
||||||
sonarBlips.Add(blip);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Limb limb in c.AnimController.Limbs)
|
foreach (Limb limb in c.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
if (!limb.body.Enabled) { continue; }
|
if (!limb.body.Enabled) { continue; }
|
||||||
|
|
||||||
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
|
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
|
||||||
if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) { continue; }
|
if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) continue;
|
||||||
|
|
||||||
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
||||||
{
|
{
|
||||||
@@ -818,13 +801,13 @@ namespace Barotrauma.Items.Components
|
|||||||
limb.WorldPosition + Rand.Vector(limb.Mass / 10.0f),
|
limb.WorldPosition + Rand.Vector(limb.Mass / 10.0f),
|
||||||
MathHelper.Clamp(limb.Mass, 0.1f, pingStrength),
|
MathHelper.Clamp(limb.Mass, 0.1f, pingStrength),
|
||||||
MathHelper.Clamp(limb.Mass * 0.1f, 0.1f, 2.0f));
|
MathHelper.Clamp(limb.Mass * 0.1f, 0.1f, 2.0f));
|
||||||
if (!passive && !CheckBlipVisibility(blip, transducerPos)) { continue; }
|
if (!passive && !CheckBlipVisibility(blip, transducerPos)) continue;
|
||||||
sonarBlips.Add(blip);
|
sonarBlips.Add(blip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateBlipsForLine(Vector2 point1, Vector2 point2, Vector2 pingSource, Vector2 transducerPos, float pingRadius, float prevPingRadius,
|
private void CreateBlipsForLine(Vector2 point1, Vector2 point2, Vector2 pingSource, Vector2 transducerPos, float pingRadius, float prevPingRadius,
|
||||||
float lineStep, float zStep, float range, float pingStrength, bool passive)
|
float lineStep, float zStep, float range, float pingStrength, bool passive)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using Lidgren.Network;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
@@ -17,22 +16,16 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
uiElements.Clear();
|
uiElements.Clear();
|
||||||
|
|
||||||
var visibleElements = customInterfaceElementList.Where(ciElement => !string.IsNullOrEmpty(ciElement.Label));
|
|
||||||
|
|
||||||
GUILayoutGroup paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center),
|
GUILayoutGroup paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center),
|
||||||
childAnchor: customInterfaceElementList.Count > 1 ? Anchor.TopCenter : Anchor.Center)
|
childAnchor: customInterfaceElementList.Count > 1 ? Anchor.TopCenter : Anchor.Center)
|
||||||
{
|
{ RelativeSpacing = 0.05f };
|
||||||
RelativeSpacing = 0.05f,
|
|
||||||
Stretch = visibleElements.Count() > 2
|
|
||||||
};
|
|
||||||
|
|
||||||
float elementSize = Math.Min(1.0f / visibleElements.Count(), 0.5f);
|
float elementSize = Math.Min(1.0f / customInterfaceElementList.Count, 0.5f);
|
||||||
foreach (CustomInterfaceElement ciElement in visibleElements)
|
foreach (CustomInterfaceElement ciElement in customInterfaceElementList)
|
||||||
{
|
{
|
||||||
if (ciElement.ContinuousSignal)
|
if (ciElement.ContinuousSignal)
|
||||||
{
|
{
|
||||||
var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform),
|
var tickBox = new GUITickBox(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label)
|
||||||
TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label)
|
|
||||||
{
|
{
|
||||||
UserData = ciElement
|
UserData = ciElement
|
||||||
};
|
};
|
||||||
@@ -52,8 +45,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform),
|
var btn = new GUIButton(new RectTransform(new Vector2(1.0f, elementSize), paddedFrame.RectTransform), ciElement.Label, style: "GUIButtonLarge")
|
||||||
TextManager.Get(ciElement.Label, returnNull: true) ?? ciElement.Label, style: "GUIButtonLarge")
|
|
||||||
{
|
{
|
||||||
UserData = ciElement
|
UserData = ciElement
|
||||||
};
|
};
|
||||||
@@ -74,24 +66,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void CreateEditingHUD(SerializableEntityEditor editor)
|
|
||||||
{
|
|
||||||
base.CreateEditingHUD(editor);
|
|
||||||
|
|
||||||
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(customInterfaceElementList[0]);
|
|
||||||
PropertyDescriptor labelProperty = properties.Find("Label", false);
|
|
||||||
PropertyDescriptor signalProperty = properties.Find("Signal", false);
|
|
||||||
for (int i = 0; i< customInterfaceElementList.Count; i++)
|
|
||||||
{
|
|
||||||
editor.CreateStringField(customInterfaceElementList[i],
|
|
||||||
new SerializableProperty(labelProperty, customInterfaceElementList[i]),
|
|
||||||
customInterfaceElementList[i].Label, "Label #" + (i + 1), "");
|
|
||||||
editor.CreateStringField(customInterfaceElementList[i],
|
|
||||||
new SerializableProperty(signalProperty, customInterfaceElementList[i]),
|
|
||||||
customInterfaceElementList[i].Signal, "Signal #" + (i + 1), "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void UpdateLabelsProjSpecific()
|
partial void UpdateLabelsProjSpecific()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < labels.Length && i < uiElements.Count; i++)
|
for (int i = 0; i < labels.Length && i < uiElements.Count; i++)
|
||||||
|
|||||||
@@ -154,6 +154,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public SlotReference(Inventory parentInventory, InventorySlot slot, int slotIndex, bool isSubSlot, Inventory subInventory = null)
|
public SlotReference(Inventory parentInventory, InventorySlot slot, int slotIndex, bool isSubSlot, Inventory subInventory = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
ParentInventory = parentInventory;
|
ParentInventory = parentInventory;
|
||||||
Slot = slot;
|
Slot = slot;
|
||||||
SlotIndex = slotIndex;
|
SlotIndex = slotIndex;
|
||||||
@@ -712,15 +714,12 @@ namespace Barotrauma
|
|||||||
float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f);
|
float scale = Math.Min(Math.Min(iconSize / sprite.size.X, iconSize / sprite.size.Y), 1.5f);
|
||||||
Vector2 itemPos = PlayerInput.MousePosition;
|
Vector2 itemPos = PlayerInput.MousePosition;
|
||||||
|
|
||||||
bool mouseOnHealthInterface = CharacterHealth.OpenHealthWindow != null && CharacterHealth.OpenHealthWindow.MouseOnElement;
|
if (GUI.MouseOn == null && selectedSlot == null)
|
||||||
|
|
||||||
if ((GUI.MouseOn == null || mouseOnHealthInterface) && selectedSlot == null)
|
|
||||||
{
|
{
|
||||||
var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0];
|
var shadowSprite = GUI.Style.GetComponentStyle("OuterGlow").Sprites[GUIComponent.ComponentState.None][0];
|
||||||
string toolTip = mouseOnHealthInterface ? TextManager.Get("QuickUseAction.UseTreatment") :
|
string toolTip = Character.Controlled.FocusedItem != null ?
|
||||||
Character.Controlled.FocusedItem != null ?
|
TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) :
|
||||||
TextManager.Get("PutItemIn").Replace("[itemname]", Character.Controlled.FocusedItem.Name) :
|
TextManager.Get("DropItem");
|
||||||
TextManager.Get("DropItem");
|
|
||||||
int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X);
|
int textWidth = (int)Math.Max(GUI.Font.MeasureString(draggingItem.Name).X, GUI.SmallFont.MeasureString(toolTip).X);
|
||||||
int textSpacing = (int)(15 * GUI.Scale);
|
int textSpacing = (int)(15 * GUI.Scale);
|
||||||
Point shadowBorders = (new Point(40, 10)).Multiply(GUI.Scale);
|
Point shadowBorders = (new Point(40, 10)).Multiply(GUI.Scale);
|
||||||
@@ -728,7 +727,7 @@ namespace Barotrauma
|
|||||||
new Rectangle(itemPos.ToPoint() - new Point(iconSize / 2) - shadowBorders, new Point(iconSize + textWidth + textSpacing, iconSize) + shadowBorders.Multiply(2)), Color.Black * 0.8f);
|
new Rectangle(itemPos.ToPoint() - new Point(iconSize / 2) - shadowBorders, new Point(iconSize + textWidth + textSpacing, iconSize) + shadowBorders.Multiply(2)), Color.Black * 0.8f);
|
||||||
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y - iconSize / 2), draggingItem.Name, Color.White);
|
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y - iconSize / 2), draggingItem.Name, Color.White);
|
||||||
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y), toolTip,
|
GUI.DrawString(spriteBatch, new Vector2(itemPos.X + iconSize / 2 + textSpacing, itemPos.Y), toolTip,
|
||||||
color: Character.Controlled.FocusedItem == null && !mouseOnHealthInterface ? Color.Red : Color.LightGreen,
|
color: Character.Controlled.FocusedItem == null ? Color.Red : Color.LightGreen,
|
||||||
font: GUI.SmallFont);
|
font: GUI.SmallFont);
|
||||||
}
|
}
|
||||||
sprite.Draw(spriteBatch, itemPos + Vector2.One * 2, Color.Black, scale: scale);
|
sprite.Draw(spriteBatch, itemPos + Vector2.One * 2, Color.Black, scale: scale);
|
||||||
@@ -854,7 +853,7 @@ namespace Barotrauma
|
|||||||
if (itemContainer.ContainedStateIndicator?.Texture == null)
|
if (itemContainer.ContainedStateIndicator?.Texture == null)
|
||||||
{
|
{
|
||||||
containedIndicatorArea.Inflate(0, -2);
|
containedIndicatorArea.Inflate(0, -2);
|
||||||
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.9f, true);
|
GUI.DrawRectangle(spriteBatch, containedIndicatorArea, Color.DarkGray * 0.8f, true);
|
||||||
GUI.DrawRectangle(spriteBatch,
|
GUI.DrawRectangle(spriteBatch,
|
||||||
new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height),
|
new Rectangle(containedIndicatorArea.X, containedIndicatorArea.Y, (int)(containedIndicatorArea.Width * containedState), containedIndicatorArea.Height),
|
||||||
Color.Lerp(Color.Red, Color.Green, containedState) * 0.8f, true);
|
Color.Lerp(Color.Red, Color.Green, containedState) * 0.8f, true);
|
||||||
@@ -868,11 +867,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (containedState > 0.0f && containedState < 0.25f)
|
if (containedState > 0.0f && containedState < 0.25f)
|
||||||
{
|
{
|
||||||
indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.25f;
|
indicatorScale += ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) * 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
||||||
Color.DarkGray * 0.9f,
|
Color.DarkGray * 0.6f,
|
||||||
origin: indicatorSprite.size / 2,
|
origin: indicatorSprite.size / 2,
|
||||||
rotate: 0.0f,
|
rotate: 0.0f,
|
||||||
scale: indicatorScale);
|
scale: indicatorScale);
|
||||||
|
|||||||
@@ -41,6 +41,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get { return activeSprite; }
|
get { return activeSprite; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float SpriteRotation;
|
||||||
|
|
||||||
private GUITextBlock itemInUseWarning;
|
private GUITextBlock itemInUseWarning;
|
||||||
private GUITextBlock ItemInUseWarning
|
private GUITextBlock ItemInUseWarning
|
||||||
@@ -101,22 +103,9 @@ namespace Barotrauma
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void SetActiveSpriteProjSpecific()
|
partial void SetActiveSprite()
|
||||||
{
|
{
|
||||||
activeSprite = prefab.sprite;
|
activeSprite = prefab.sprite;
|
||||||
Holdable holdable = GetComponent<Holdable>();
|
|
||||||
if (holdable != null && holdable.Attached)
|
|
||||||
{
|
|
||||||
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
|
|
||||||
{
|
|
||||||
if (containedSprite.UseWhenAttached)
|
|
||||||
{
|
|
||||||
activeSprite = containedSprite.Sprite;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Container != null)
|
if (Container != null)
|
||||||
{
|
{
|
||||||
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
|
foreach (ContainedItemSprite containedSprite in Prefab.ContainedSprites)
|
||||||
@@ -186,7 +175,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
|
Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
|
||||||
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
|
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
|
||||||
|
|
||||||
|
Sprite activeSprite = prefab.sprite;
|
||||||
BrokenItemSprite fadeInBrokenSprite = null;
|
BrokenItemSprite fadeInBrokenSprite = null;
|
||||||
float fadeInBrokenSpriteAlpha = 0.0f;
|
float fadeInBrokenSpriteAlpha = 0.0f;
|
||||||
if (condition < Prefab.Health)
|
if (condition < Prefab.Health)
|
||||||
@@ -577,13 +567,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame);
|
var componentEditor = new SerializableEntityEditor(listBox.Content.RectTransform, ic, inGame, showName: !inGame);
|
||||||
|
|
||||||
if (inGame)
|
if (inGame) continue;
|
||||||
{
|
|
||||||
ic.CreateEditingHUD(componentEditor);
|
|
||||||
componentEditor.Recalculate();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var kvp in ic.requiredItems)
|
foreach (var kvp in ic.requiredItems)
|
||||||
{
|
{
|
||||||
@@ -617,10 +602,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ic.CreateEditingHUD(componentEditor);
|
|
||||||
componentEditor.Recalculate();
|
|
||||||
}
|
|
||||||
|
|
||||||
PositionEditingHUD();
|
PositionEditingHUD();
|
||||||
SetHUDLayout();
|
SetHUDLayout();
|
||||||
|
|
||||||
@@ -803,7 +784,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!ic.CanBeSelected) { continue; }
|
if (!ic.CanBeSelected) { continue; }
|
||||||
|
|
||||||
bool useAlternativeLayout = activeHUDs.Count > 1;
|
bool useAlternativeLayout = ic.Item != this;
|
||||||
bool wasUsingAlternativeLayout = ic.UseAlternativeLayout;
|
bool wasUsingAlternativeLayout = ic.UseAlternativeLayout;
|
||||||
ic.UseAlternativeLayout = useAlternativeLayout;
|
ic.UseAlternativeLayout = useAlternativeLayout;
|
||||||
needsLayoutUpdate |= ic.UseAlternativeLayout != wasUsingAlternativeLayout;
|
needsLayoutUpdate |= ic.UseAlternativeLayout != wasUsingAlternativeLayout;
|
||||||
@@ -837,28 +818,14 @@ namespace Barotrauma
|
|||||||
case NetEntityEvent.Type.ComponentState:
|
case NetEntityEvent.Type.ComponentState:
|
||||||
{
|
{
|
||||||
int componentIndex = msg.ReadRangedInteger(0, components.Count - 1);
|
int componentIndex = msg.ReadRangedInteger(0, components.Count - 1);
|
||||||
if (components[componentIndex] is IServerSerializable serverSerializable)
|
(components[componentIndex] as IServerSerializable).ClientRead(type, msg, sendingTime);
|
||||||
{
|
|
||||||
serverSerializable.ClientRead(type, msg, sendingTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("Failed to read component state - " + components[componentIndex].GetType() + " is not IServerSerializable.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NetEntityEvent.Type.InventoryState:
|
case NetEntityEvent.Type.InventoryState:
|
||||||
{
|
{
|
||||||
int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
|
int containerIndex = msg.ReadRangedInteger(0, components.Count - 1);
|
||||||
if (components[containerIndex] is ItemContainer container)
|
(components[containerIndex] as ItemContainer).Inventory.ClientRead(type, msg, sendingTime);
|
||||||
{
|
|
||||||
container.Inventory.ClientRead(type, msg, sendingTime);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("Failed to read inventory state - " + components[containerIndex].GetType() + " is not an ItemContainer.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NetEntityEvent.Type.Status:
|
case NetEntityEvent.Type.Status:
|
||||||
|
|||||||
@@ -25,14 +25,12 @@ namespace Barotrauma
|
|||||||
class ContainedItemSprite
|
class ContainedItemSprite
|
||||||
{
|
{
|
||||||
public readonly Sprite Sprite;
|
public readonly Sprite Sprite;
|
||||||
public readonly bool UseWhenAttached;
|
|
||||||
public readonly string[] AllowedContainerIdentifiers;
|
public readonly string[] AllowedContainerIdentifiers;
|
||||||
public readonly string[] AllowedContainerTags;
|
public readonly string[] AllowedContainerTags;
|
||||||
|
|
||||||
public ContainedItemSprite(XElement element, string path = "", bool lazyLoad = false)
|
public ContainedItemSprite(XElement element, string path = "", bool lazyLoad = false)
|
||||||
{
|
{
|
||||||
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
|
Sprite = new Sprite(element, path, lazyLoad: lazyLoad);
|
||||||
UseWhenAttached = element.GetAttributeBool("usewhenattached", false);
|
|
||||||
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
|
AllowedContainerIdentifiers = element.GetAttributeStringArray("allowedcontaineridentifiers", new string[0], convertToLowerInvariant: true);
|
||||||
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
|
AllowedContainerTags = element.GetAttributeStringArray("allowedcontainertags", new string[0], convertToLowerInvariant: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
SamplerState.LinearClamp, DepthStencilState.DepthRead, null, null,
|
SamplerState.LinearClamp, DepthStencilState.Default, null, null,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawObjects(spriteBatch, cam, drawFront: true);
|
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawObjects(spriteBatch, cam, drawFront: true);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|||||||
@@ -291,6 +291,11 @@ namespace Barotrauma.Lights
|
|||||||
spriteBatch.Draw(HighlightMap, Vector2.Zero, Color.White);
|
spriteBatch.Draw(HighlightMap, Vector2.Zero, Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
GameMain.ParticleManager.Draw(spriteBatch, true, null, Particles.ParticleBlendState.Additive);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
|
//draw a black rectangle on hulls to hide background lights behind subs
|
||||||
|
//---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
//draw characters to obstruct the highlighted items/characters and light sprites
|
//draw characters to obstruct the highlighted items/characters and light sprites
|
||||||
//---------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------
|
||||||
@@ -495,8 +500,6 @@ namespace Barotrauma.Lights
|
|||||||
spriteBatch.Draw(backgroundObstructor, new Rectangle(0, 0,
|
spriteBatch.Draw(backgroundObstructor, new Rectangle(0, 0,
|
||||||
(int)(GameMain.GraphicsWidth * currLightMapScale), (int)(GameMain.GraphicsHeight * currLightMapScale)), Color.White);
|
(int)(GameMain.GraphicsWidth * currLightMapScale), (int)(GameMain.GraphicsHeight * currLightMapScale)), Color.White);
|
||||||
}
|
}
|
||||||
spriteBatch.End();
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
|
|
||||||
foreach (Character c in Character.CharacterList)
|
foreach (Character c in Character.CharacterList)
|
||||||
{
|
{
|
||||||
if (c.Enabled) { c.Draw(spriteBatch, cam); }
|
if (c.Enabled) { c.Draw(spriteBatch, cam); }
|
||||||
|
|||||||
@@ -215,24 +215,23 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Prefab.BackgroundSprite != null)
|
if (Prefab.BackgroundSprite != null)
|
||||||
{
|
{
|
||||||
|
bool drawDropShadow = Submarine != null && HasBody;
|
||||||
Vector2 dropShadowOffset = Vector2.Zero;
|
Vector2 dropShadowOffset = Vector2.Zero;
|
||||||
if (UseDropShadow)
|
if (drawDropShadow)
|
||||||
{
|
{
|
||||||
dropShadowOffset = DropShadowOffset;
|
dropShadowOffset = Submarine.HiddenSubPosition - Position;
|
||||||
if (dropShadowOffset == Vector2.Zero)
|
if (dropShadowOffset != Vector2.Zero)
|
||||||
{
|
{
|
||||||
if (Submarine == null)
|
if (IsHorizontal)
|
||||||
{
|
{
|
||||||
dropShadowOffset = Vector2.UnitY * 10.0f;
|
dropShadowOffset = new Vector2(0.0f, Math.Sign(dropShadowOffset.Y) * 10.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dropShadowOffset = IsHorizontal ?
|
dropShadowOffset = new Vector2(Math.Sign(dropShadowOffset.X) * 10.0f, 0.0f);
|
||||||
new Vector2(0.0f, Math.Sign(Submarine.HiddenSubPosition.Y - Position.Y) * 10.0f) :
|
|
||||||
new Vector2(Math.Sign(Submarine.HiddenSubPosition.X - Position.X) * 10.0f, 0.0f);
|
|
||||||
}
|
}
|
||||||
|
dropShadowOffset.Y = -dropShadowOffset.Y;
|
||||||
}
|
}
|
||||||
dropShadowOffset.Y = -dropShadowOffset.Y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DrawTiled)
|
if (DrawTiled)
|
||||||
@@ -252,7 +251,7 @@ namespace Barotrauma
|
|||||||
textureScale: TextureScale * Scale,
|
textureScale: TextureScale * Scale,
|
||||||
startOffset: backGroundOffset);
|
startOffset: backGroundOffset);
|
||||||
|
|
||||||
if (UseDropShadow)
|
if (drawDropShadow)
|
||||||
{
|
{
|
||||||
Prefab.BackgroundSprite.DrawTiled(
|
Prefab.BackgroundSprite.DrawTiled(
|
||||||
spriteBatch,
|
spriteBatch,
|
||||||
@@ -277,7 +276,7 @@ namespace Barotrauma
|
|||||||
rotate: 0,
|
rotate: 0,
|
||||||
spriteEffect: SpriteEffects);
|
spriteEffect: SpriteEffects);
|
||||||
|
|
||||||
if (UseDropShadow)
|
if (drawDropShadow)
|
||||||
{
|
{
|
||||||
Prefab.BackgroundSprite.Draw(
|
Prefab.BackgroundSprite.Draw(
|
||||||
spriteBatch,
|
spriteBatch,
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
orderOption = order.Options[optionIndex];
|
orderOption = order.Options[optionIndex];
|
||||||
}
|
}
|
||||||
txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.DisplayName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption);
|
txt = order.GetChatMessage(targetCharacter?.Name, senderCharacter?.CurrentHull?.RoomName, givingOrderToSelf: targetCharacter == senderCharacter, orderOption: orderOption);
|
||||||
|
|
||||||
if (order.TargetAllCharacters)
|
if (order.TargetAllCharacters)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,33 +39,25 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public void UpdateSoundPosition()
|
public void UpdateSoundPosition()
|
||||||
{
|
{
|
||||||
if (VoipSound == null) { return; }
|
if (VoipSound != null)
|
||||||
|
|
||||||
if (!VoipSound.IsPlaying)
|
|
||||||
{
|
{
|
||||||
DebugConsole.Log("Destroying voipsound");
|
if (!VoipSound.IsPlaying)
|
||||||
VoipSound.Dispose();
|
{
|
||||||
VoipSound = null;
|
DebugConsole.Log("Destroying voipsound");
|
||||||
return;
|
VoipSound.Dispose();
|
||||||
}
|
VoipSound = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (character != null)
|
if (character != null)
|
||||||
{
|
|
||||||
if (GameMain.Config.UseDirectionalVoiceChat)
|
|
||||||
{
|
{
|
||||||
VoipSound.SetPosition(new Vector3(character.WorldPosition.X, character.WorldPosition.Y, 0.0f));
|
VoipSound.SetPosition(new Vector3(character.WorldPosition.X, character.WorldPosition.Y, 0.0f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VoipSound.SetPosition(null);
|
VoipSound.SetPosition(null);
|
||||||
float dist = Vector3.Distance(new Vector3(character.WorldPosition, 0.0f), GameMain.SoundManager.ListenerPosition);
|
|
||||||
VoipSound.Gain = 1.0f - MathUtils.InverseLerp(VoipSound.Near, VoipSound.Far, dist);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
VoipSound.SetPosition(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void InitProjSpecific()
|
partial void InitProjSpecific()
|
||||||
|
|||||||
@@ -1114,9 +1114,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (campaign == null)
|
if (campaign == null)
|
||||||
{
|
{
|
||||||
GameMain.GameSession = missionIndex < 0 ?
|
GameMain.GameSession = new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, missionIndex < 0 ? null : MissionPrefab.List[missionIndex]);
|
||||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionType.None) :
|
|
||||||
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionPrefab.List[missionIndex]);
|
|
||||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1128,18 +1126,6 @@ namespace Barotrauma.Networking
|
|||||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
|
||||||
{
|
|
||||||
if (!loadSecondSub && i > 0) { break; }
|
|
||||||
|
|
||||||
var teamID = i == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
|
|
||||||
Submarine.MainSubs[i].TeamID = teamID;
|
|
||||||
foreach (Submarine sub in Submarine.MainSubs[i].DockedTo)
|
|
||||||
{
|
|
||||||
sub.TeamID = teamID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||||
{
|
{
|
||||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed " + Level.Loaded.Seed + ").";
|
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed " + Level.Loaded.Seed + ").";
|
||||||
@@ -2260,47 +2246,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
public virtual void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
|
if (!gameStarted || Screen.Selected != GameMain.GameScreen || GUI.DisableHUD || GUI.DisableUpperHUD) return;
|
||||||
|
|
||||||
if (fileReceiver != null && fileReceiver.ActiveTransfers.Count > 0)
|
|
||||||
{
|
|
||||||
Vector2 downloadBarSize = new Vector2(250, 35) * GUI.Scale;
|
|
||||||
Vector2 pos = new Vector2(GameMain.NetLobbyScreen.InfoFrame.Rect.X, GameMain.GraphicsHeight - downloadBarSize.Y - 5);
|
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle(
|
|
||||||
(int)pos.X,
|
|
||||||
(int)pos.Y,
|
|
||||||
(int)(fileReceiver.ActiveTransfers.Count * (downloadBarSize.X + 10)),
|
|
||||||
(int)downloadBarSize.Y),
|
|
||||||
Color.Black * 0.8f, true);
|
|
||||||
|
|
||||||
for (int i = 0; i < fileReceiver.ActiveTransfers.Count; i++)
|
|
||||||
{
|
|
||||||
var transfer = fileReceiver.ActiveTransfers[i];
|
|
||||||
|
|
||||||
GUI.DrawString(spriteBatch,
|
|
||||||
pos,
|
|
||||||
ToolBox.LimitString(TextManager.Get("DownloadingFile").Replace("[filename]", transfer.FileName), GUI.SmallFont, (int)downloadBarSize.X),
|
|
||||||
Color.White, null, 0, GUI.SmallFont);
|
|
||||||
GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - downloadBarSize.Y / 2), new Vector2(downloadBarSize.X * 0.7f, downloadBarSize.Y / 2), transfer.Progress, Color.Green);
|
|
||||||
GUI.DrawString(spriteBatch, pos + new Vector2(5, downloadBarSize.Y / 2),
|
|
||||||
MathUtils.GetBytesReadable((long)transfer.Received) + " / " + MathUtils.GetBytesReadable((long)transfer.FileSize),
|
|
||||||
Color.White, null, 0, GUI.SmallFont);
|
|
||||||
|
|
||||||
if (GUI.DrawButton(spriteBatch, new Rectangle(
|
|
||||||
(int)(pos.X + downloadBarSize.X * 0.7f), (int)(pos.Y + downloadBarSize.Y / 2),
|
|
||||||
(int)(downloadBarSize.X * 0.3f), (int)(downloadBarSize.Y / 2)),
|
|
||||||
TextManager.Get("Cancel"), new Color(0.47f, 0.13f, 0.15f, 0.08f)))
|
|
||||||
{
|
|
||||||
CancelFileTransfer(transfer);
|
|
||||||
fileReceiver.StopTransfer(transfer);
|
|
||||||
}
|
|
||||||
|
|
||||||
pos.X += (downloadBarSize.X + 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gameStarted || Screen.Selected != GameMain.GameScreen) return;
|
|
||||||
|
|
||||||
inGameHUD.DrawManually(spriteBatch);
|
inGameHUD.DrawManually(spriteBatch);
|
||||||
|
|
||||||
@@ -2351,6 +2297,40 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileReceiver != null && fileReceiver.ActiveTransfers.Count > 0)
|
||||||
|
{
|
||||||
|
Vector2 pos = new Vector2(GameMain.NetLobbyScreen.InfoFrame.Rect.X, GameMain.GraphicsHeight - 35);
|
||||||
|
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Rectangle(
|
||||||
|
(int)pos.X,
|
||||||
|
(int)pos.Y,
|
||||||
|
fileReceiver.ActiveTransfers.Count * 210 + 10,
|
||||||
|
32),
|
||||||
|
Color.Black * 0.8f, true);
|
||||||
|
|
||||||
|
for (int i = 0; i < fileReceiver.ActiveTransfers.Count; i++)
|
||||||
|
{
|
||||||
|
var transfer = fileReceiver.ActiveTransfers[i];
|
||||||
|
|
||||||
|
GUI.DrawString(spriteBatch,
|
||||||
|
pos,
|
||||||
|
ToolBox.LimitString(TextManager.Get("DownloadingFile").Replace("[filename]", transfer.FileName), GUI.SmallFont, 200),
|
||||||
|
Color.White, null, 0, GUI.SmallFont);
|
||||||
|
GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - 15), new Vector2(135, 15), transfer.Progress, Color.Green);
|
||||||
|
GUI.DrawString(spriteBatch, pos + new Vector2(5, 15),
|
||||||
|
MathUtils.GetBytesReadable((long)transfer.Received) + " / " + MathUtils.GetBytesReadable((long)transfer.FileSize),
|
||||||
|
Color.White, null, 0, GUI.SmallFont);
|
||||||
|
|
||||||
|
if (GUI.DrawButton(spriteBatch, new Rectangle((int)pos.X + 140, (int)pos.Y + 18, 60, 15), TextManager.Get("Cancel"), new Color(0.47f, 0.13f, 0.15f, 0.08f)))
|
||||||
|
{
|
||||||
|
CancelFileTransfer(transfer);
|
||||||
|
fileReceiver.StopTransfer(transfer);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos.X += 210;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ShowNetStats) return;
|
if (!ShowNetStats) return;
|
||||||
|
|
||||||
netStats.Draw(spriteBatch, new Rectangle(300, 10, 300, 150));
|
netStats.Draw(spriteBatch, new Rectangle(300, 10, 300, 150));
|
||||||
|
|||||||
@@ -59,32 +59,17 @@ namespace Barotrauma.Networking
|
|||||||
return contentPackageHashes.SetEquals(myContentPackageHashes);
|
return contentPackageHashes.SetEquals(myContentPackageHashes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreatePreviewWindow(GUIListBox listBox)
|
public void CreatePreviewWindow(GUIMessageBox messageBox)
|
||||||
{
|
{
|
||||||
listBox.ClearChildren();
|
var title = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), messageBox.Content.RectTransform), ServerName, textAlignment: Alignment.Center, font: GUI.LargeFont, wrap: true);
|
||||||
|
|
||||||
if (listBox == null) return;
|
var serverMsg = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.2f), messageBox.Content.RectTransform));
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, wrap: true);
|
||||||
|
|
||||||
var previewContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), listBox.Content.RectTransform, Anchor.Center))
|
var columnContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), messageBox.Content.RectTransform), isHorizontal: true)
|
||||||
{
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var titleHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.97f, 0.07f), previewContainer.RectTransform))
|
|
||||||
{
|
|
||||||
IsHorizontal = true,
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var title = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), titleHolder.RectTransform), ServerName, font: GUI.LargeFont, wrap: true);
|
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, title.RectTransform),
|
|
||||||
TextManager.Get("ServerListVersion") + ": " + (string.IsNullOrEmpty(GameVersion) ? TextManager.Get("Unknown") : GameVersion), textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
var columnContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), previewContainer.RectTransform), isHorizontal: true)
|
|
||||||
{
|
{
|
||||||
Stretch = true,
|
Stretch = true,
|
||||||
RelativeSpacing = 0.005f
|
RelativeSpacing = 0.05f
|
||||||
};
|
};
|
||||||
|
|
||||||
var columnLeft = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), columnContainer.RectTransform))
|
var columnLeft = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 1.0f), columnContainer.RectTransform))
|
||||||
@@ -103,72 +88,12 @@ namespace Barotrauma.Networking
|
|||||||
// left column -----------------------------------------------------------------------------
|
// left column -----------------------------------------------------------------------------
|
||||||
|
|
||||||
//new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnLeft.RectTransform), IP + ":" + Port);
|
//new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnLeft.RectTransform), IP + ":" + Port);
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnLeft.RectTransform),
|
||||||
var serverMsg = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), columnLeft.RectTransform)) { ScrollBarVisible = true };
|
TextManager.Get("ServerListVersion") + ": " + (string.IsNullOrEmpty(GameVersion) ? TextManager.Get("Unknown") : GameVersion));
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), serverMsg.Content.RectTransform), ServerMessage, wrap: true) { CanBeFocused = false };
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), columnLeft.RectTransform),
|
||||||
|
|
||||||
// right column -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*var playerCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListPlayers"));
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, playerCount.RectTransform), PlayerCount + "/" + MaxPlayers, textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
|
|
||||||
new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Round running")
|
|
||||||
{
|
|
||||||
Selected = GameStarted,
|
|
||||||
CanBeFocused = false
|
|
||||||
};*/
|
|
||||||
|
|
||||||
var gameMode = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("GameMode"));
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, gameMode.RectTransform), TextManager.Get(string.IsNullOrEmpty(GameMode) ? "Unknown" : GameMode), textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
var traitors = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("Traitors"));
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, traitors.RectTransform), TextManager.Get(!TraitorsEnabled.HasValue ? "Unknown" : TraitorsEnabled.Value.ToString()), textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
|
|
||||||
var subSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListSubSelection"));
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, subSelection.RectTransform), TextManager.Get(!SubSelectionMode.HasValue ? "Unknown" : SubSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
var modeSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListModeSelection"));
|
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, modeSelection.RectTransform), TextManager.Get(!ModeSelectionMode.HasValue ? "Unknown" : ModeSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
|
|
||||||
|
|
||||||
var allowSpectating = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListAllowSpectating"))
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
if (!AllowSpectating.HasValue)
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowSpectating.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
|
||||||
else
|
|
||||||
allowSpectating.Selected = AllowSpectating.Value;
|
|
||||||
|
|
||||||
var allowRespawn = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerSettingsAllowRespawning"))
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
if (!AllowRespawn.HasValue)
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowRespawn.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
|
||||||
else
|
|
||||||
allowRespawn.Selected = AllowRespawn.Value;
|
|
||||||
|
|
||||||
/*new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListHasPassword"))
|
|
||||||
{
|
|
||||||
Selected = HasPassword,
|
|
||||||
CanBeFocused = false
|
|
||||||
};*/
|
|
||||||
|
|
||||||
var usingWhiteList = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListUsingWhitelist"))
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
if (!UsingWhiteList.HasValue)
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), usingWhiteList.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
|
||||||
else
|
|
||||||
usingWhiteList.Selected = UsingWhiteList.Value;
|
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), columnRight.RectTransform),
|
|
||||||
TextManager.Get("ServerListContentPackages"));
|
TextManager.Get("ServerListContentPackages"));
|
||||||
|
|
||||||
var contentPackageList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.3f), columnRight.RectTransform));
|
var contentPackageList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.7f), columnLeft.RectTransform));
|
||||||
if (ContentPackageNames.Count == 0)
|
if (ContentPackageNames.Count == 0)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new RectTransform(Vector2.One, contentPackageList.Content.RectTransform), TextManager.Get("Unknown"), textAlignment: Alignment.Center)
|
new GUITextBlock(new RectTransform(Vector2.One, contentPackageList.Content.RectTransform), TextManager.Get("Unknown"), textAlignment: Alignment.Center)
|
||||||
@@ -218,7 +143,7 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (availableWorkshopUrls.Count > 0)
|
if (availableWorkshopUrls.Count > 0 )
|
||||||
{
|
{
|
||||||
var workshopBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.15f), columnLeft.RectTransform), TextManager.Get("ServerListSubscribeMissingPackages"))
|
var workshopBtn = new GUIButton(new RectTransform(new Vector2(1.0f, 0.15f), columnLeft.RectTransform), TextManager.Get("ServerListSubscribeMissingPackages"))
|
||||||
{
|
{
|
||||||
@@ -234,6 +159,64 @@ namespace Barotrauma.Networking
|
|||||||
workshopBtn.TextBlock.AutoScale = true;
|
workshopBtn.TextBlock.AutoScale = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// right column -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var playerCount = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListPlayers"));
|
||||||
|
new GUITextBlock(new RectTransform(Vector2.One, playerCount.RectTransform), PlayerCount + "/" + MaxPlayers, textAlignment: Alignment.Right);
|
||||||
|
|
||||||
|
|
||||||
|
new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Round running")
|
||||||
|
{
|
||||||
|
Selected = GameStarted,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
var gameMode = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("GameMode"));
|
||||||
|
new GUITextBlock(new RectTransform(Vector2.One, gameMode.RectTransform), string.IsNullOrEmpty(GameMode) ? "Unknown" : GameMode, textAlignment: Alignment.Right);
|
||||||
|
|
||||||
|
var traitors = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("Traitors"));
|
||||||
|
new GUITextBlock(new RectTransform(Vector2.One, traitors.RectTransform), !TraitorsEnabled.HasValue ? "Unknown" : TraitorsEnabled.Value.ToString(), textAlignment: Alignment.Right);
|
||||||
|
|
||||||
|
|
||||||
|
var subSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListSubSelection"));
|
||||||
|
new GUITextBlock(new RectTransform(Vector2.One, subSelection.RectTransform), !SubSelectionMode.HasValue ? "Unknown" : SubSelectionMode.Value.ToString(), textAlignment: Alignment.Right);
|
||||||
|
|
||||||
|
var modeSelection = new GUITextBlock(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListModeSelection"));
|
||||||
|
new GUITextBlock(new RectTransform(Vector2.One, modeSelection.RectTransform), (!ModeSelectionMode.HasValue ? "Unknown" : ModeSelectionMode.Value.ToString()), textAlignment: Alignment.Right);
|
||||||
|
|
||||||
|
var allowSpectating = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListAllowSpectating"))
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
if (!AllowSpectating.HasValue)
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowSpectating.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
||||||
|
else
|
||||||
|
allowSpectating.Selected = AllowSpectating.Value;
|
||||||
|
|
||||||
|
var allowRespawn = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), "Allow respawn")
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
if (!AllowRespawn.HasValue)
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), allowRespawn.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
||||||
|
else
|
||||||
|
allowRespawn.Selected = AllowRespawn.Value;
|
||||||
|
|
||||||
|
new GUITickBox(new RectTransform(new Vector2(1.0f, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListHasPassword"))
|
||||||
|
{
|
||||||
|
Selected = HasPassword,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
|
var usingWhiteList = new GUITickBox(new RectTransform(new Vector2(1, elementHeight), columnRight.RectTransform), TextManager.Get("ServerListUsingWhitelist"))
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
if (!UsingWhiteList.HasValue)
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.8f), usingWhiteList.Box.RectTransform, Anchor.Center), "?", textAlignment: Alignment.Center);
|
||||||
|
else
|
||||||
|
usingWhiteList.Selected = UsingWhiteList.Value;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -107,56 +107,6 @@ namespace Barotrauma.Steam
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool GetFavouriteServers(Action<Networking.ServerInfo> onServerFound, Action<Networking.ServerInfo> onServerRulesReceived, Action onFinished)
|
|
||||||
{
|
|
||||||
if (instance == null || !instance.isInitialized)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter = new ServerList.Filter
|
|
||||||
{
|
|
||||||
{ "appid", AppID.ToString() },
|
|
||||||
{ "gamedir", "Barotrauma" },
|
|
||||||
{ "secure", "1" }
|
|
||||||
};
|
|
||||||
|
|
||||||
//include unresponsive servers in the server list
|
|
||||||
|
|
||||||
//the response is queried using the server's query port, not the game port,
|
|
||||||
//so it may be possible to play on the server even if it doesn't respond to server list queries
|
|
||||||
var query = instance.client.ServerList.Favourites(filter);
|
|
||||||
query.OnUpdate += () => { UpdateServerQuery(query, onServerFound, onServerRulesReceived, includeUnresponsive: true); };
|
|
||||||
query.OnFinished = onFinished;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool GetServersFromHistory(Action<Networking.ServerInfo> onServerFound, Action<Networking.ServerInfo> onServerRulesReceived, Action onFinished)
|
|
||||||
{
|
|
||||||
if (instance == null || !instance.isInitialized)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filter = new ServerList.Filter
|
|
||||||
{
|
|
||||||
{ "appid", AppID.ToString() },
|
|
||||||
{ "gamedir", "Barotrauma" },
|
|
||||||
{ "secure", "1" }
|
|
||||||
};
|
|
||||||
|
|
||||||
//include unresponsive servers in the server list
|
|
||||||
|
|
||||||
//the response is queried using the server's query port, not the game port,
|
|
||||||
//so it may be possible to play on the server even if it doesn't respond to server list queries
|
|
||||||
var query = instance.client.ServerList.History(filter);
|
|
||||||
query.OnUpdate += () => { UpdateServerQuery(query, onServerFound, onServerRulesReceived, includeUnresponsive: true); };
|
|
||||||
query.OnFinished = onFinished;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UpdateServerQuery(ServerList.Request query, Action<Networking.ServerInfo> onServerFound, Action<Networking.ServerInfo> onServerRulesReceived, bool includeUnresponsive)
|
private static void UpdateServerQuery(ServerList.Request query, Action<Networking.ServerInfo> onServerFound, Action<Networking.ServerInfo> onServerRulesReceived, bool includeUnresponsive)
|
||||||
{
|
{
|
||||||
IEnumerable<ServerList.Server> servers = includeUnresponsive ?
|
IEnumerable<ServerList.Server> servers = includeUnresponsive ?
|
||||||
@@ -598,8 +548,6 @@ namespace Barotrauma.Steam
|
|||||||
|
|
||||||
if (!allowFileOverwrite)
|
if (!allowFileOverwrite)
|
||||||
{
|
{
|
||||||
// TODO: If you create a new mod via the workshop interface and enable it, it will show the error msg, but still allows you to enable the content.
|
|
||||||
|
|
||||||
if (File.Exists(newContentPackagePath))
|
if (File.Exists(newContentPackagePath))
|
||||||
{
|
{
|
||||||
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
||||||
|
|||||||
@@ -9,9 +9,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class CampaignUI
|
class CampaignUI
|
||||||
{
|
{
|
||||||
public enum Tab { Map, Crew, Store, Repair }
|
public enum Tab { Map, Crew, Store }
|
||||||
private Tab selectedTab;
|
private Tab selectedTab;
|
||||||
private GUIFrame[] tabs;
|
private GUIFrame[] tabs;
|
||||||
|
|
||||||
|
private GUIButton startButton;
|
||||||
|
|
||||||
private GUIFrame topPanel;
|
private GUIFrame topPanel;
|
||||||
|
|
||||||
private GUIListBox characterList;
|
private GUIListBox characterList;
|
||||||
@@ -23,8 +26,6 @@ namespace Barotrauma
|
|||||||
private GUIComponent selectedLocationInfo;
|
private GUIComponent selectedLocationInfo;
|
||||||
private GUIListBox selectedMissionInfo;
|
private GUIListBox selectedMissionInfo;
|
||||||
|
|
||||||
private GUIButton repairHullsButton, repairItemsButton;
|
|
||||||
|
|
||||||
private GUIFrame characterPreviewFrame;
|
private GUIFrame characterPreviewFrame;
|
||||||
|
|
||||||
private List<GUIButton> tabButtons = new List<GUIButton>();
|
private List<GUIButton> tabButtons = new List<GUIButton>();
|
||||||
@@ -38,7 +39,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public GUIComponent MapContainer { get; private set; }
|
public GUIComponent MapContainer { get; private set; }
|
||||||
|
|
||||||
public GUIButton StartButton { get; private set; }
|
public GUIButton StartButton
|
||||||
|
{
|
||||||
|
get { return startButton; }
|
||||||
|
}
|
||||||
|
|
||||||
public CampaignMode Campaign { get; }
|
public CampaignMode Campaign { get; }
|
||||||
|
|
||||||
@@ -108,7 +112,7 @@ namespace Barotrauma
|
|||||||
tabs[(int)Tab.Crew] = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.7f), container.RectTransform, Anchor.TopLeft)
|
tabs[(int)Tab.Crew] = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.7f), container.RectTransform, Anchor.TopLeft)
|
||||||
{
|
{
|
||||||
RelativeOffset = new Vector2(0.0f, topPanel.RectTransform.RelativeSize.Y)
|
RelativeOffset = new Vector2(0.0f, topPanel.RectTransform.RelativeSize.Y)
|
||||||
}, color: Color.Black * 0.9f);
|
}, color: Color.Black * 0.7f);
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Crew].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Crew].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
@@ -153,7 +157,7 @@ namespace Barotrauma
|
|||||||
tabs[(int)Tab.Store] = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.7f), container.RectTransform, Anchor.TopLeft)
|
tabs[(int)Tab.Store] = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.7f), container.RectTransform, Anchor.TopLeft)
|
||||||
{
|
{
|
||||||
RelativeOffset = new Vector2(0.1f, topPanel.RectTransform.RelativeSize.Y)
|
RelativeOffset = new Vector2(0.1f, topPanel.RectTransform.RelativeSize.Y)
|
||||||
}, color: Color.Black * 0.9f);
|
}, color: Color.Black * 0.7f);
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Store].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Store].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
@@ -214,97 +218,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
SelectItemCategory(MapEntityCategory.Equipment);
|
SelectItemCategory(MapEntityCategory.Equipment);
|
||||||
|
|
||||||
// repair tab -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
tabs[(int)Tab.Repair] = new GUIFrame(new RectTransform(new Vector2(0.35f, 0.5f), container.RectTransform, Anchor.TopLeft)
|
|
||||||
{
|
|
||||||
RelativeOffset = new Vector2(0.02f, topPanel.RectTransform.RelativeSize.Y)
|
|
||||||
}, color: Color.Black * 0.9f);
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.25f, 1.25f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center), style: "OuterGlow", color: Color.Black * 0.7f)
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
var repairContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), tabs[(int)Tab.Repair].RectTransform, Anchor.Center))
|
|
||||||
{
|
|
||||||
RelativeSpacing = 0.05f,
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), crewContent.RectTransform), "", font: GUI.LargeFont)
|
|
||||||
{
|
|
||||||
TextGetter = GetMoney
|
|
||||||
};
|
|
||||||
|
|
||||||
var repairHullsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
|
|
||||||
{
|
|
||||||
RelativeSpacing = 0.05f,
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairHullsHolder.RectTransform, Anchor.CenterLeft), "RepairHullButton")
|
|
||||||
{
|
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("RepairAllWalls"), textAlignment: Alignment.Right, font: GUI.LargeFont)
|
|
||||||
{
|
|
||||||
ForceUpperCase = true
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairHullsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
|
|
||||||
repairHullsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairHullsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = (btn, userdata) =>
|
|
||||||
{
|
|
||||||
if (campaign.Money >= CampaignMode.HullRepairCost)
|
|
||||||
{
|
|
||||||
campaign.Money -= CampaignMode.HullRepairCost;
|
|
||||||
campaign.PurchasedHullRepairs = true;
|
|
||||||
GameMain.Client?.SendCampaignState();
|
|
||||||
btn.GetChild<GUITickBox>().Selected = true;
|
|
||||||
}
|
|
||||||
btn.Enabled = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new GUITickBox(new RectTransform(new Vector2(0.65f), repairHullsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "")
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
var repairItemsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), repairContent.RectTransform), childAnchor: Anchor.TopRight)
|
|
||||||
{
|
|
||||||
RelativeSpacing = 0.05f,
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
new GUIImage(new RectTransform(new Vector2(0.3f, 1.0f), repairItemsHolder.RectTransform, Anchor.CenterLeft), "RepairItemsButton")
|
|
||||||
{
|
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("RepairAllItems"), textAlignment: Alignment.Right, font: GUI.LargeFont)
|
|
||||||
{
|
|
||||||
ForceUpperCase = true
|
|
||||||
};
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), repairItemsHolder.RectTransform), "500", textAlignment: Alignment.Right, font: GUI.LargeFont);
|
|
||||||
repairItemsButton = new GUIButton(new RectTransform(new Vector2(0.4f, 0.3f), repairItemsHolder.RectTransform), TextManager.Get("Repair"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = (btn, userdata) =>
|
|
||||||
{
|
|
||||||
if (campaign.Money >= CampaignMode.ItemRepairCost)
|
|
||||||
{
|
|
||||||
campaign.Money -= CampaignMode.ItemRepairCost;
|
|
||||||
campaign.PurchasedItemRepairs = true;
|
|
||||||
GameMain.Client?.SendCampaignState();
|
|
||||||
btn.GetChild<GUITickBox>().Selected = true;
|
|
||||||
}
|
|
||||||
btn.Enabled = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new GUITickBox(new RectTransform(new Vector2(0.65f), repairItemsButton.RectTransform, Anchor.CenterLeft) { AbsoluteOffset = new Point(10, 0) }, "")
|
|
||||||
{
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
// mission info -------------------------------------------------------------------------
|
// mission info -------------------------------------------------------------------------
|
||||||
|
|
||||||
missionPanel = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.5f), container.RectTransform, Anchor.TopRight)
|
missionPanel = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.5f), container.RectTransform, Anchor.TopRight)
|
||||||
@@ -417,7 +330,8 @@ namespace Barotrauma
|
|||||||
bool purchaseableItemsFound = false;
|
bool purchaseableItemsFound = false;
|
||||||
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
|
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
|
||||||
{
|
{
|
||||||
if (!(mapEntityPrefab is ItemPrefab itemPrefab)) { continue; }
|
var itemPrefab = mapEntityPrefab as ItemPrefab;
|
||||||
|
if (itemPrefab == null) { continue; }
|
||||||
|
|
||||||
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
|
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
|
||||||
if (priceInfo != null) { purchaseableItemsFound = true; break; }
|
if (priceInfo != null) { purchaseableItemsFound = true; break; }
|
||||||
@@ -435,7 +349,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
//refresh store view
|
//refresh store view
|
||||||
SelectItemCategory(MapEntityCategory.Equipment);
|
SelectItemCategory(MapEntityCategory.Equipment);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer)
|
private void DrawMap(SpriteBatch spriteBatch, GUICustomComponent mapContainer)
|
||||||
@@ -537,7 +452,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
RefreshMissionTab(selectedMission);
|
RefreshMissionTab(selectedMission);
|
||||||
|
|
||||||
StartButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight),
|
startButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.7f), missionContent.RectTransform, Anchor.CenterRight),
|
||||||
TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
|
TextManager.Get("StartCampaignButton"), style: "GUIButtonLarge")
|
||||||
{
|
{
|
||||||
IgnoreLayoutGroups = true,
|
IgnoreLayoutGroups = true,
|
||||||
@@ -546,7 +461,7 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
if (GameMain.Client != null)
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
StartButton.Visible = !GameMain.Client.GameStarted &&
|
startButton.Visible = !GameMain.Client.GameStarted &&
|
||||||
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||||
}
|
}
|
||||||
@@ -593,10 +508,10 @@ namespace Barotrauma
|
|||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (StartButton != null)
|
if (startButton != null)
|
||||||
{
|
{
|
||||||
StartButton.Enabled = true;
|
startButton.Enabled = true;
|
||||||
StartButton.Visible = GameMain.Client == null ||
|
startButton.Visible = GameMain.Client == null ||
|
||||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign);
|
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign);
|
||||||
}
|
}
|
||||||
@@ -682,7 +597,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool BuyItem(GUIComponent component, object obj)
|
private bool BuyItem(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false;
|
PurchasedItem pi = obj as PurchasedItem;
|
||||||
|
if (pi == null || pi.ItemPrefab == null) return false;
|
||||||
|
|
||||||
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
|
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
|
||||||
{
|
{
|
||||||
@@ -700,7 +616,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool SellItem(GUIComponent component, object obj)
|
private bool SellItem(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (!(obj is PurchasedItem pi) || pi.ItemPrefab == null) return false;
|
PurchasedItem pi = obj as PurchasedItem;
|
||||||
|
if (pi == null || pi.ItemPrefab == null) return false;
|
||||||
|
|
||||||
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
|
if (GameMain.Client != null && !GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign))
|
||||||
{
|
{
|
||||||
@@ -742,20 +659,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
button.Selected = (Tab)button.UserData == tab;
|
button.Selected = (Tab)button.UserData == tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (selectedTab)
|
|
||||||
{
|
|
||||||
case Tab.Repair:
|
|
||||||
repairHullsButton.Enabled =
|
|
||||||
!Campaign.PurchasedHullRepairs && Campaign.Money >= CampaignMode.HullRepairCost &&
|
|
||||||
(GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
|
||||||
repairHullsButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedHullRepairs;
|
|
||||||
repairItemsButton.Enabled =
|
|
||||||
!Campaign.PurchasedItemRepairs && Campaign.Money >= CampaignMode.ItemRepairCost &&
|
|
||||||
(GameMain.Client == null || GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
|
||||||
repairItemsButton.GetChild<GUITickBox>().Selected = Campaign.PurchasedItemRepairs;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectItemCategory(MapEntityCategory category)
|
private bool SelectItemCategory(MapEntityCategory category)
|
||||||
@@ -765,7 +668,8 @@ namespace Barotrauma
|
|||||||
int width = storeItemList.Rect.Width;
|
int width = storeItemList.Rect.Width;
|
||||||
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
|
foreach (MapEntityPrefab mapEntityPrefab in MapEntityPrefab.List)
|
||||||
{
|
{
|
||||||
if (!(mapEntityPrefab is ItemPrefab itemPrefab) || !itemPrefab.Category.HasFlag(category)) continue;
|
var itemPrefab = mapEntityPrefab as ItemPrefab;
|
||||||
|
if (itemPrefab == null || !itemPrefab.Category.HasFlag(category)) continue;
|
||||||
|
|
||||||
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
|
PriceInfo priceInfo = itemPrefab.GetPrice(Campaign.Map.CurrentLocation);
|
||||||
if (priceInfo == null) continue;
|
if (priceInfo == null) continue;
|
||||||
@@ -803,8 +707,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prevInfoFrame != null) { tabs[(int)selectedTab].RemoveChild(prevInfoFrame); }
|
if (prevInfoFrame != null) { tabs[(int)selectedTab].RemoveChild(prevInfoFrame); }
|
||||||
|
|
||||||
if (!(selection is CharacterInfo characterInfo)) { return false; }
|
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||||
|
if (characterInfo == null) { return false; }
|
||||||
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) { return false; }
|
if (Character.Controlled != null && characterInfo == Character.Controlled.Info) { return false; }
|
||||||
|
|
||||||
if (characterPreviewFrame == null || characterPreviewFrame.UserData != characterInfo)
|
if (characterPreviewFrame == null || characterPreviewFrame.UserData != characterInfo)
|
||||||
@@ -856,9 +761,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool HireCharacter(GUIButton button, object selection)
|
private bool HireCharacter(GUIButton button, object selection)
|
||||||
{
|
{
|
||||||
if (!(selection is CharacterInfo characterInfo)) { return false; }
|
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||||
|
if (characterInfo == null) { return false; }
|
||||||
|
|
||||||
if (!(Campaign is SinglePlayerCampaign spCampaign))
|
SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign;
|
||||||
|
if (spCampaign == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Characters can only be hired in the single player campaign.\n" + Environment.StackTrace);
|
DebugConsole.ThrowError("Characters can only be hired in the single player campaign.\n" + Environment.StackTrace);
|
||||||
return false;
|
return false;
|
||||||
@@ -877,9 +784,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool FireCharacter(GUIButton button, object selection)
|
private bool FireCharacter(GUIButton button, object selection)
|
||||||
{
|
{
|
||||||
if (!(selection is CharacterInfo characterInfo)) return false;
|
CharacterInfo characterInfo = selection as CharacterInfo;
|
||||||
|
if (characterInfo == null) return false;
|
||||||
|
|
||||||
if (!(Campaign is SinglePlayerCampaign spCampaign))
|
SinglePlayerCampaign spCampaign = Campaign as SinglePlayerCampaign;
|
||||||
|
if (spCampaign == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Characters can only be fired in the single player campaign.\n" + Environment.StackTrace);
|
DebugConsole.ThrowError("Characters can only be fired in the single player campaign.\n" + Environment.StackTrace);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ namespace Barotrauma
|
|||||||
private bool showParamsEditor;
|
private bool showParamsEditor;
|
||||||
private bool showSpritesheet;
|
private bool showSpritesheet;
|
||||||
private bool isFreezed;
|
private bool isFreezed;
|
||||||
private bool autoFreeze;
|
private bool autoFreeze = true;
|
||||||
private bool limbPairEditing;
|
private bool limbPairEditing = true;
|
||||||
private bool uniformScaling;
|
private bool uniformScaling = true;
|
||||||
private bool lockSpriteOrigin;
|
private bool lockSpriteOrigin = true;
|
||||||
private bool lockSpritePosition;
|
private bool lockSpritePosition;
|
||||||
private bool lockSpriteSize;
|
private bool lockSpriteSize;
|
||||||
private bool recalculateCollider;
|
private bool recalculateCollider;
|
||||||
private bool copyJointSettings;
|
private bool copyJointSettings;
|
||||||
private bool displayColliders;
|
private bool displayColliders;
|
||||||
private bool displayWearables;
|
private bool displayWearables = true;
|
||||||
private bool displayBackgroundColor;
|
private bool displayBackgroundColor;
|
||||||
private bool ragdollResetRequiresForceLoading;
|
private bool ragdollResetRequiresForceLoading;
|
||||||
private bool animationResetRequiresForceLoading;
|
private bool animationResetRequiresForceLoading;
|
||||||
@@ -89,17 +89,10 @@ namespace Barotrauma
|
|||||||
public override void Select()
|
public override void Select()
|
||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
|
|
||||||
SoundPlayer.OverrideMusicType = "none";
|
|
||||||
SoundPlayer.OverrideMusicDuration = null;
|
|
||||||
GameMain.SoundManager.SetCategoryGainMultiplier("default", 0.0f);
|
|
||||||
GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", 0.0f);
|
|
||||||
|
|
||||||
GUI.ForceMouseOn(null);
|
GUI.ForceMouseOn(null);
|
||||||
CalculateSpritesheetPosition();
|
CalculateSpritesheetPosition();
|
||||||
if (Submarine.MainSub == null)
|
if (Submarine.MainSub == null)
|
||||||
{
|
{
|
||||||
ResetVariables();
|
|
||||||
Submarine.MainSub = new Submarine("Content/AnimEditor.sub");
|
Submarine.MainSub = new Submarine("Content/AnimEditor.sub");
|
||||||
Submarine.MainSub.Load(unloadPrevious: false, showWarningMessages: false);
|
Submarine.MainSub.Load(unloadPrevious: false, showWarningMessages: false);
|
||||||
originalWall = new WallGroup(new List<Structure>(Structure.WallList));
|
originalWall = new WallGroup(new List<Structure>(Structure.WallList));
|
||||||
@@ -108,10 +101,6 @@ namespace Barotrauma
|
|||||||
isEndlessRunner = true;
|
isEndlessRunner = true;
|
||||||
GameMain.LightManager.LightingEnabled = false;
|
GameMain.LightManager.LightingEnabled = false;
|
||||||
}
|
}
|
||||||
else if (instance == null)
|
|
||||||
{
|
|
||||||
ResetVariables();
|
|
||||||
}
|
|
||||||
Submarine.MainSub.GodMode = true;
|
Submarine.MainSub.GodMode = true;
|
||||||
if (Character.Controlled == null)
|
if (Character.Controlled == null)
|
||||||
{
|
{
|
||||||
@@ -129,65 +118,31 @@ namespace Barotrauma
|
|||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetVariables()
|
|
||||||
{
|
|
||||||
editAnimations = false;
|
|
||||||
editLimbs = false;
|
|
||||||
editJoints = false;
|
|
||||||
editIK = false;
|
|
||||||
showRagdoll = false;
|
|
||||||
showParamsEditor = false;
|
|
||||||
showSpritesheet = false;
|
|
||||||
isFreezed = false;
|
|
||||||
autoFreeze = true;
|
|
||||||
limbPairEditing = true;
|
|
||||||
uniformScaling = true;
|
|
||||||
lockSpriteOrigin = false;
|
|
||||||
lockSpritePosition = false;
|
|
||||||
lockSpriteSize = false;
|
|
||||||
recalculateCollider = false;
|
|
||||||
copyJointSettings = false;
|
|
||||||
displayColliders = false;
|
|
||||||
displayWearables = true;
|
|
||||||
displayBackgroundColor = false;
|
|
||||||
ragdollResetRequiresForceLoading = false;
|
|
||||||
animationResetRequiresForceLoading = false;
|
|
||||||
isExtrudingJoint = false;
|
|
||||||
isDrawingJoint = false;
|
|
||||||
Wizard.instance = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Reset()
|
private void Reset()
|
||||||
{
|
{
|
||||||
ResetVariables();
|
AnimParams.ForEach(a => a.Reset(true));
|
||||||
if (character != null)
|
RagdollParams.Reset(true);
|
||||||
|
RagdollParams.ClearHistory();
|
||||||
|
CurrentAnimation.ClearHistory();
|
||||||
|
if (!character.Removed)
|
||||||
{
|
{
|
||||||
AnimParams.ForEach(a => a.Reset(true));
|
character.Remove();
|
||||||
RagdollParams.Reset(true);
|
|
||||||
RagdollParams.ClearHistory();
|
|
||||||
CurrentAnimation.ClearHistory();
|
|
||||||
if (!character.Removed)
|
|
||||||
{
|
|
||||||
character.Remove();
|
|
||||||
}
|
|
||||||
character = null;
|
|
||||||
}
|
}
|
||||||
|
character = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Deselect()
|
public override void Deselect()
|
||||||
{
|
{
|
||||||
base.Deselect();
|
base.Deselect();
|
||||||
|
|
||||||
SoundPlayer.OverrideMusicType = null;
|
|
||||||
GameMain.SoundManager.SetCategoryGainMultiplier("default", GameMain.Config.SoundVolume);
|
|
||||||
GameMain.SoundManager.SetCategoryGainMultiplier("waterambience", GameMain.Config.SoundVolume);
|
|
||||||
|
|
||||||
GUI.ForceMouseOn(null);
|
GUI.ForceMouseOn(null);
|
||||||
if (isEndlessRunner)
|
if (isEndlessRunner)
|
||||||
{
|
{
|
||||||
Submarine.MainSub.Remove();
|
Submarine.MainSub.Remove();
|
||||||
isEndlessRunner = false;
|
isEndlessRunner = false;
|
||||||
Reset();
|
if (character != null)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
GameMain.World.ProcessChanges();
|
GameMain.World.ProcessChanges();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -220,7 +175,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
//base.AddToGUIUpdateList();
|
//base.AddToGUIUpdateList();
|
||||||
rightPanel.AddToGUIUpdateList();
|
rightPanel.AddToGUIUpdateList();
|
||||||
Wizard.instance?.AddToGUIUpdateList();
|
Wizard.Instance.AddToGUIUpdateList();
|
||||||
if (displayBackgroundColor)
|
if (displayBackgroundColor)
|
||||||
{
|
{
|
||||||
backgroundColorPanel.AddToGUIUpdateList();
|
backgroundColorPanel.AddToGUIUpdateList();
|
||||||
@@ -252,7 +207,7 @@ namespace Barotrauma
|
|||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
spriteSheetRect = CalculateSpritesheetRectangle();
|
spriteSheetRect = CalculateSpritesheetRectangle();
|
||||||
// Handle shortcut keys
|
// Handle shortcut keys
|
||||||
if (GUI.KeyboardDispatcher.Subscriber == null && Wizard.instance == null)
|
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||||
{
|
{
|
||||||
if (PlayerInput.KeyDown(Keys.LeftControl))
|
if (PlayerInput.KeyDown(Keys.LeftControl))
|
||||||
{
|
{
|
||||||
@@ -441,7 +396,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isFreezed && Wizard.instance == null)
|
if (!isFreezed)
|
||||||
{
|
{
|
||||||
if (character.AnimController.Invalid)
|
if (character.AnimController.Invalid)
|
||||||
{
|
{
|
||||||
@@ -1176,22 +1131,7 @@ namespace Barotrauma
|
|||||||
character = Character.Create(configFile, spawnPosition, ToolBox.RandomSeed(8), hasAi: false, ragdoll: ragdoll);
|
character = Character.Create(configFile, spawnPosition, ToolBox.RandomSeed(8), hasAi: false, ragdoll: ragdoll);
|
||||||
selectedJob = null;
|
selectedJob = null;
|
||||||
}
|
}
|
||||||
if (character != null)
|
character.dontFollowCursor = dontFollowCursor;
|
||||||
{
|
|
||||||
character.dontFollowCursor = dontFollowCursor;
|
|
||||||
}
|
|
||||||
if (character == null)
|
|
||||||
{
|
|
||||||
if (currentCharacterConfig == configFile)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Respawn the current character;
|
|
||||||
SpawnCharacter(currentCharacterConfig);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OnPostSpawn();
|
OnPostSpawn();
|
||||||
return character;
|
return character;
|
||||||
}
|
}
|
||||||
@@ -1307,33 +1247,27 @@ namespace Barotrauma
|
|||||||
string speciesName = name;
|
string speciesName = name;
|
||||||
// Config file
|
// Config file
|
||||||
string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/");
|
string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/");
|
||||||
if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).Any(path => path.Contains(speciesName)))
|
if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).None(path => path.Contains(speciesName)))
|
||||||
{
|
{
|
||||||
GUI.AddMessage(GetCharacterEditorTranslation("ExistingCharacterFound"), Color.Red, font: GUI.LargeFont);
|
// Create the config file
|
||||||
// TODO: add a prompt: "Do you want to replace it?" + functionality
|
XElement mainElement = new XElement("Character",
|
||||||
return false;
|
new XAttribute("name", speciesName),
|
||||||
|
new XAttribute("humanoid", isHumanoid),
|
||||||
|
new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
|
||||||
|
new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
|
||||||
|
new XElement("health"),
|
||||||
|
new XElement("ai"));
|
||||||
|
XDocument doc = new XDocument(mainElement);
|
||||||
|
if (!Directory.Exists(mainFolder))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(mainFolder);
|
||||||
|
}
|
||||||
|
doc.Save(configFilePath);
|
||||||
|
// Add to the selected content package
|
||||||
|
contentPackage.AddFile(configFilePath, ContentType.Character);
|
||||||
|
contentPackage.Save(contentPackage.Path);
|
||||||
|
DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the config file
|
|
||||||
XElement mainElement = new XElement("Character",
|
|
||||||
new XAttribute("name", speciesName),
|
|
||||||
new XAttribute("humanoid", isHumanoid),
|
|
||||||
new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
|
|
||||||
new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
|
|
||||||
new XElement("health"),
|
|
||||||
new XElement("ai"));
|
|
||||||
|
|
||||||
XDocument doc = new XDocument(mainElement);
|
|
||||||
if (!Directory.Exists(mainFolder))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(mainFolder);
|
|
||||||
}
|
|
||||||
doc.Save(configFilePath);
|
|
||||||
// Add to the selected content package
|
|
||||||
contentPackage.AddFile(configFilePath, ContentType.Character);
|
|
||||||
contentPackage.Save(contentPackage.Path);
|
|
||||||
DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
|
|
||||||
|
|
||||||
// Ragdoll
|
// Ragdoll
|
||||||
string ragdollFolder = RagdollParams.GetFolder(speciesName);
|
string ragdollFolder = RagdollParams.GetFolder(speciesName);
|
||||||
string ragdollPath = RagdollParams.GetDefaultFile(speciesName);
|
string ragdollPath = RagdollParams.GetDefaultFile(speciesName);
|
||||||
@@ -1344,20 +1278,12 @@ namespace Barotrauma
|
|||||||
string animFolder = AnimationParams.GetFolder(speciesName);
|
string animFolder = AnimationParams.GetFolder(speciesName);
|
||||||
foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType)))
|
foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType)))
|
||||||
{
|
{
|
||||||
switch (animType)
|
if (animType != AnimationType.NotDefined)
|
||||||
{
|
{
|
||||||
case AnimationType.Walk:
|
Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid);
|
||||||
case AnimationType.Run:
|
string fullPath = AnimationParams.GetDefaultFile(speciesName, animType);
|
||||||
if (!ragdollParams.CanEnterSubmarine) { continue; }
|
AnimationParams.Create(fullPath, speciesName, animType, type);
|
||||||
break;
|
|
||||||
case AnimationType.SwimSlow:
|
|
||||||
case AnimationType.SwimFast:
|
|
||||||
break;
|
|
||||||
default: continue;
|
|
||||||
}
|
}
|
||||||
Type type = AnimationParams.GetParamTypeFromAnimType(animType, isHumanoid);
|
|
||||||
string fullPath = AnimationParams.GetDefaultFile(speciesName, animType);
|
|
||||||
AnimationParams.Create(fullPath, speciesName, animType, type);
|
|
||||||
}
|
}
|
||||||
if (!AllFiles.Contains(configFilePath))
|
if (!AllFiles.Contains(configFilePath))
|
||||||
{
|
{
|
||||||
@@ -3838,7 +3764,7 @@ namespace Barotrauma
|
|||||||
void RecalculateCollider(Limb l)
|
void RecalculateCollider(Limb l)
|
||||||
{
|
{
|
||||||
// We want the collider to be slightly smaller than the source rect, because the source rect is usually a bit bigger than the graphic.
|
// We want the collider to be slightly smaller than the source rect, because the source rect is usually a bit bigger than the graphic.
|
||||||
float multiplier = 0.85f;
|
float multiplier = 0.75f;
|
||||||
l.body.SetSize(new Vector2(ConvertUnits.ToSimUnits(width), ConvertUnits.ToSimUnits(height)) * RagdollParams.LimbScale * RagdollParams.TextureScale * multiplier);
|
l.body.SetSize(new Vector2(ConvertUnits.ToSimUnits(width), ConvertUnits.ToSimUnits(height)) * RagdollParams.LimbScale * RagdollParams.TextureScale * multiplier);
|
||||||
TryUpdateLimbParam(l, "radius", ConvertUnits.ToDisplayUnits(l.body.radius / RagdollParams.LimbScale / RagdollParams.TextureScale));
|
TryUpdateLimbParam(l, "radius", ConvertUnits.ToDisplayUnits(l.body.radius / RagdollParams.LimbScale / RagdollParams.TextureScale));
|
||||||
TryUpdateLimbParam(l, "width", ConvertUnits.ToDisplayUnits(l.body.width / RagdollParams.LimbScale / RagdollParams.TextureScale));
|
TryUpdateLimbParam(l, "width", ConvertUnits.ToDisplayUnits(l.body.width / RagdollParams.LimbScale / RagdollParams.TextureScale));
|
||||||
@@ -4357,7 +4283,7 @@ namespace Barotrauma
|
|||||||
private List<XElement> jointXElements = new List<XElement>();
|
private List<XElement> jointXElements = new List<XElement>();
|
||||||
private List<GUIComponent> jointGUIElements = new List<GUIComponent>();
|
private List<GUIComponent> jointGUIElements = new List<GUIComponent>();
|
||||||
|
|
||||||
public static Wizard instance;
|
private static Wizard instance;
|
||||||
public static Wizard Instance
|
public static Wizard Instance
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -4388,6 +4314,7 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
case Tab.None:
|
case Tab.None:
|
||||||
default:
|
default:
|
||||||
|
//activeView = null;
|
||||||
instance = null;
|
instance = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -4416,7 +4343,7 @@ namespace Barotrauma
|
|||||||
GUITextBox xmlPathElement = null;
|
GUITextBox xmlPathElement = null;
|
||||||
void UpdatePaths()
|
void UpdatePaths()
|
||||||
{
|
{
|
||||||
string pathBase = $"Mods/Characters/{Name}/{Name}";
|
string pathBase = $"Content/Characters/{Name}/{Name}";
|
||||||
XMLPath = $"{pathBase}.xml";
|
XMLPath = $"{pathBase}.xml";
|
||||||
TexturePath = $"{pathBase}.png";
|
TexturePath = $"{pathBase}.png";
|
||||||
texturePathElement.Text = TexturePath;
|
texturePathElement.Text = TexturePath;
|
||||||
@@ -4495,7 +4422,7 @@ namespace Barotrauma
|
|||||||
// Cancel
|
// Cancel
|
||||||
box.Buttons[0].OnClicked += (b, d) =>
|
box.Buttons[0].OnClicked += (b, d) =>
|
||||||
{
|
{
|
||||||
Wizard.Instance.SelectTab(Tab.None);
|
Instance.SelectTab(Tab.None);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
// Next
|
// Next
|
||||||
@@ -4507,7 +4434,7 @@ namespace Barotrauma
|
|||||||
texturePathElement.Flash(Color.Red);
|
texturePathElement.Flash(Color.Red);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Wizard.Instance.SelectTab(Tab.Ragdoll);
|
Instance.SelectTab(Tab.Ragdoll);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return box;
|
return box;
|
||||||
@@ -4648,7 +4575,7 @@ namespace Barotrauma
|
|||||||
// Previous
|
// Previous
|
||||||
box.Buttons[0].OnClicked += (b, d) =>
|
box.Buttons[0].OnClicked += (b, d) =>
|
||||||
{
|
{
|
||||||
Wizard.Instance.SelectTab(Tab.Character);
|
Instance.SelectTab(Tab.Character);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
// Parse and create
|
// Parse and create
|
||||||
@@ -4739,7 +4666,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
|
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
|
||||||
}
|
}
|
||||||
Wizard.Instance.SelectTab(Tab.None);
|
Instance.SelectTab(Tab.None);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return box;
|
return box;
|
||||||
@@ -4919,27 +4846,23 @@ namespace Barotrauma
|
|||||||
int width = rectInputs[2].IntValue;
|
int width = rectInputs[2].IntValue;
|
||||||
int height = rectInputs[3].IntValue;
|
int height = rectInputs[3].IntValue;
|
||||||
var colliderAttributes = new List<XAttribute>();
|
var colliderAttributes = new List<XAttribute>();
|
||||||
// Capsules/Circles
|
if (width == height)
|
||||||
//if (width == height)
|
{
|
||||||
//{
|
colliderAttributes.Add(new XAttribute("radius", width / 2));
|
||||||
// colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f)));
|
}
|
||||||
//}
|
else
|
||||||
//else
|
{
|
||||||
//{
|
if (height > width)
|
||||||
// if (height > width)
|
{
|
||||||
// {
|
colliderAttributes.Add(new XAttribute("radius", width / 2));
|
||||||
// colliderAttributes.Add(new XAttribute("radius", (int)(width / 2 * 0.85f)));
|
colliderAttributes.Add(new XAttribute("height", height - width));
|
||||||
// colliderAttributes.Add(new XAttribute("height",(int) (height - width * 0.85f)));
|
}
|
||||||
// }
|
else
|
||||||
// else
|
{
|
||||||
// {
|
colliderAttributes.Add(new XAttribute("radius", height / 2));
|
||||||
// colliderAttributes.Add(new XAttribute("radius", (int)(height / 2 * 0.85f)));
|
colliderAttributes.Add(new XAttribute("width", width - height));
|
||||||
// colliderAttributes.Add(new XAttribute("width", (int)(width - height * 0.85f)));
|
}
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
// Rectangles
|
|
||||||
colliderAttributes.Add(new XAttribute("height", (int)(height * 0.85f)));
|
|
||||||
colliderAttributes.Add(new XAttribute("width", (int)(width * 0.85f)));
|
|
||||||
idToCodeName.TryGetValue(id, out string notes);
|
idToCodeName.TryGetValue(id, out string notes);
|
||||||
LimbXElements.Add(id.ToString(), new XElement("limb",
|
LimbXElements.Add(id.ToString(), new XElement("limb",
|
||||||
new XAttribute("id", id),
|
new XAttribute("id", id),
|
||||||
|
|||||||
@@ -626,21 +626,21 @@ namespace Barotrauma
|
|||||||
" -ownerkey " + ownerKey.ToString();
|
" -ownerkey " + ownerKey.ToString();
|
||||||
|
|
||||||
string filename = "DedicatedServer.exe";
|
string filename = "DedicatedServer.exe";
|
||||||
#if LINUX || OSX
|
#if LINUX
|
||||||
|
filename = "./DedicatedServer";
|
||||||
|
#elif OSX
|
||||||
filename = "mono";
|
filename = "mono";
|
||||||
arguments = "./DedicatedServer.exe " + arguments;
|
arguments = "./DedicatedServer.exe " + arguments;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var processInfo = new ProcessStartInfo
|
var processInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = filename,
|
FileName = filename,
|
||||||
Arguments = arguments,
|
Arguments = arguments
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
WindowStyle = ProcessWindowStyle.Hidden
|
WindowStyle = ProcessWindowStyle.Hidden
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
GameMain.ServerChildProcess = Process.Start(processInfo);
|
GameMain.ServerChildProcess = Process.Start(processInfo);
|
||||||
|
|
||||||
Thread.Sleep(1000); //wait until the server is ready before connecting
|
Thread.Sleep(1000); //wait until the server is ready before connecting
|
||||||
|
|
||||||
GameMain.Client = new GameClient(name, "127.0.0.1:" + port.ToString(),ownerKey);
|
GameMain.Client = new GameClient(name, "127.0.0.1:" + port.ToString(),ownerKey);
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public NetLobbyScreen()
|
public NetLobbyScreen()
|
||||||
{
|
{
|
||||||
defaultModeContainer = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), Frame.RectTransform, Anchor.Center) { MaxSize = new Point(int.MaxValue, GameMain.GraphicsHeight - 100) }, style: null);
|
defaultModeContainer = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), Frame.RectTransform, Anchor.Center), style: null);
|
||||||
campaignContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.75f), Frame.RectTransform, Anchor.TopCenter), style: null)
|
campaignContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.75f), Frame.RectTransform, Anchor.TopCenter), style: null)
|
||||||
{
|
{
|
||||||
Visible = false
|
Visible = false
|
||||||
@@ -737,15 +737,11 @@ namespace Barotrauma
|
|||||||
spectateButton.Visible = GameMain.Client.GameStarted;
|
spectateButton.Visible = GameMain.Client.GameStarted;
|
||||||
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
|
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
|
||||||
ReadyToStartBox.Selected = false;
|
ReadyToStartBox.Selected = false;
|
||||||
if (campaignUI != null)
|
if (campaignUI?.StartButton != null)
|
||||||
{
|
{
|
||||||
//SelectTab(Tab.Map);
|
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||||
if (campaignUI.StartButton != null)
|
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||||
{
|
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
|
||||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
|
||||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GameMain.Client.SetReadyToStart(ReadyToStartBox);
|
GameMain.Client.SetReadyToStart(ReadyToStartBox);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,20 +57,32 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var leftColumn = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), paddedFrame.RectTransform, Anchor.CenterLeft)) { Stretch = true, RelativeSpacing = 0.5f };
|
var leftColumn = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 1.0f), paddedFrame.RectTransform, Anchor.CenterLeft)) { Stretch = true, RelativeSpacing = 0.5f };
|
||||||
|
|
||||||
var infoHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
menu = new GUIFrame(new RectTransform(new Point(width, height), GUI.Canvas, Anchor.Center));
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), infoHolder.RectTransform, Anchor.Center), TextManager.Get("JoinServer"), font: GUI.LargeFont)
|
new GUITextBlock(new RectTransform(new Vector2(0.95f, 0.133f), menu.RectTransform, Anchor.TopCenter),
|
||||||
{ ForceUpperCase = true };
|
TextManager.Get("JoinServer"), textAlignment: Alignment.Left, font: GUI.LargeFont) { ForceUpperCase = true };
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("YourName"));
|
var paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.95f), menu.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, 0.03f) }, style: null);
|
||||||
clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "")
|
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
//left column
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var leftColumn = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 0.92f), paddedFrame.RectTransform, Anchor.TopLeft));
|
||||||
|
|
||||||
|
//spacing
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), leftColumn.RectTransform), style: null);
|
||||||
|
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("YourName"));
|
||||||
|
clientNameBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.045f), leftColumn.RectTransform), "")
|
||||||
{
|
{
|
||||||
Text = GameMain.Config.DefaultPlayerName
|
Text = GameMain.Config.DefaultPlayerName
|
||||||
};
|
};
|
||||||
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
clientNameBox.OnTextChanged += RefreshJoinButtonState;
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoHolder.RectTransform), TextManager.Get("ServerIP"));
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("ServerIP"));
|
||||||
ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), infoHolder.RectTransform), "");
|
// TODO: Show IP on server info window
|
||||||
|
ipBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.045f), leftColumn.RectTransform), "");
|
||||||
ipBox.OnTextChanged += RefreshJoinButtonState;
|
ipBox.OnTextChanged += RefreshJoinButtonState;
|
||||||
ipBox.OnSelected += (sender, key) =>
|
ipBox.OnSelected += (sender, key) =>
|
||||||
{
|
{
|
||||||
@@ -80,53 +92,43 @@ namespace Barotrauma
|
|||||||
sender.UserData = null;
|
sender.UserData = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//spacing
|
||||||
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.45f), leftColumn.RectTransform), style: null);
|
||||||
|
|
||||||
var filterHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), leftColumn.RectTransform)) { RelativeSpacing = 0.05f };
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterServers"));
|
||||||
|
searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), "");
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), filterHolder.RectTransform), TextManager.Get("FilterServers"));
|
//spacing
|
||||||
searchBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.13f), filterHolder.RectTransform), "");
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.03f), leftColumn.RectTransform), style: null);
|
||||||
|
|
||||||
var tickBoxHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), filterHolder.RectTransform));
|
|
||||||
|
|
||||||
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
||||||
filterPassword = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterPassword"));
|
filterPassword = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterPassword"));
|
||||||
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
filterIncompatible = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterIncompatibleServers"));
|
filterIncompatible = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterIncompatibleServers"));
|
||||||
filterIncompatible.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterIncompatible.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
|
|
||||||
filterFull = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterFullServers"));
|
filterFull = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterFullServers"));
|
||||||
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
filterEmpty = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.27f), tickBoxHolder.RectTransform), TextManager.Get("FilterEmptyServers"));
|
filterEmpty = new GUITickBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), TextManager.Get("FilterEmptyServers"));
|
||||||
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
//right column
|
//right column
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 1.0f),
|
var rightColumn = new GUILayoutGroup(new RectTransform(new Vector2(1.0f - leftColumn.RectTransform.RelativeSize.X - 0.017f, 0.97f),
|
||||||
paddedFrame.RectTransform, Anchor.CenterRight))
|
paddedFrame.RectTransform, Anchor.TopRight))
|
||||||
{
|
{
|
||||||
RelativeSpacing = 0.02f,
|
RelativeSpacing = 0.02f,
|
||||||
Stretch = true
|
Stretch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
var serverListHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 1.0f), rightColumn.RectTransform)) { Stretch = true, RelativeSpacing = 0.02f };
|
serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.85f), rightColumn.RectTransform, Anchor.Center))
|
||||||
|
|
||||||
serverList = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center))
|
|
||||||
{
|
{
|
||||||
OnSelected = (btn, obj) => {
|
OnSelected = SelectServer
|
||||||
ServerInfo serverInfo = (ServerInfo)obj;
|
|
||||||
|
|
||||||
serverInfo.CreatePreviewWindow(serverPreview);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
serverList.OnSelected += SelectServer;
|
|
||||||
|
|
||||||
serverPreview = new GUIListBox(new RectTransform(new Vector2(1.0f, 1.0f), serverListHolder.RectTransform, Anchor.Center));
|
|
||||||
|
|
||||||
columnRelativeWidth = new float[] { 0.04f, 0.02f, 0.044f, 0.77f, 0.02f, 0.075f, 0.06f };
|
columnRelativeWidth = new float[] { 0.04f, 0.02f, 0.044f, 0.77f, 0.02f, 0.075f, 0.06f };
|
||||||
|
|
||||||
var buttonContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.075f), rightColumn.RectTransform), style: null);
|
var buttonContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.075f), rightColumn.RectTransform), style: null);
|
||||||
@@ -358,7 +360,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void AddToServerList(ServerInfo serverInfo)
|
private void AddToServerList(ServerInfo serverInfo)
|
||||||
{
|
{
|
||||||
var serverFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.06f), serverList.Content.RectTransform) { MinSize = new Point(0, 35) },
|
var serverFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.06f), serverList.Content.RectTransform) { MinSize = new Point(0, 20) },
|
||||||
style: "InnerFrame", color: Color.White * 0.5f)
|
style: "InnerFrame", color: Color.White * 0.5f)
|
||||||
{
|
{
|
||||||
UserData = serverInfo
|
UserData = serverInfo
|
||||||
@@ -396,6 +398,19 @@ namespace Barotrauma
|
|||||||
UserData = "password"
|
UserData = "password"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
new GUIButton(new RectTransform(new Vector2(columnRelativeWidth[2], 0.8f), serverContent.RectTransform, Anchor.Center), style: "GUIButtonServerListInfo") {
|
||||||
|
ToolTip = TextManager.Get("ServerListInfo"),
|
||||||
|
OnClicked = (btn, obj) => {
|
||||||
|
SelectServer(null, serverInfo);
|
||||||
|
var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel"), TextManager.Get("ServerListJoin") }, 550, 400);
|
||||||
|
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||||
|
msgBox.Buttons[1].OnClicked += JoinServer;
|
||||||
|
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||||
|
serverInfo.CreatePreviewWindow(msgBox);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var serverName = new GUITextBlock(new RectTransform(new Vector2(columnRelativeWidth[3], 1.0f), serverContent.RectTransform), serverInfo.ServerName, style: "GUIServerListTextBox");
|
var serverName = new GUITextBlock(new RectTransform(new Vector2(columnRelativeWidth[3], 1.0f), serverContent.RectTransform), serverInfo.ServerName, style: "GUIServerListTextBox");
|
||||||
|
|
||||||
var gameStartedBox = new GUITickBox(new RectTransform(new Vector2(columnRelativeWidth[4], 0.4f), serverContent.RectTransform, Anchor.Center),
|
var gameStartedBox = new GUITickBox(new RectTransform(new Vector2(columnRelativeWidth[4], 0.4f), serverContent.RectTransform, Anchor.Center),
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private ContentPackage itemContentPackage;
|
private ContentPackage itemContentPackage;
|
||||||
private Facepunch.Steamworks.Workshop.Editor itemEditor;
|
private Facepunch.Steamworks.Workshop.Editor itemEditor;
|
||||||
//private Facepunch.Steamworks.Overlay overlay;
|
|
||||||
|
|
||||||
public SteamWorkshopScreen()
|
public SteamWorkshopScreen()
|
||||||
{
|
{
|
||||||
@@ -638,12 +637,6 @@ namespace Barotrauma
|
|||||||
OutlineColor = new Color(72, 124, 77, 255),
|
OutlineColor = new Color(72, 124, 77, 255),
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
// Failed attempt, might have to be activated before accessing because as of now it just throws a null for overlay
|
|
||||||
/*if (overlay.Enabled)
|
|
||||||
{
|
|
||||||
overlay.OpenUrl("steam://url/CommunityFilePage/" + item.Id);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
System.Diagnostics.Process.Start("steam://url/CommunityFilePage/" + item.Id);
|
System.Diagnostics.Process.Start("steam://url/CommunityFilePage/" + item.Id);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,12 +310,6 @@ namespace Barotrauma
|
|||||||
RelativeSpacing = 0.01f,
|
RelativeSpacing = 0.01f,
|
||||||
Stretch = true
|
Stretch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
|
||||||
{
|
|
||||||
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||||
{
|
{
|
||||||
entityCategoryButtons.Add(new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform),
|
entityCategoryButtons.Add(new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform),
|
||||||
@@ -1017,7 +1011,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var previewImageButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), isHorizontal: true) { Stretch = true, RelativeSpacing = 0.05f };
|
var previewImageButtonHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), isHorizontal: true) { Stretch = true, RelativeSpacing = 0.05f };
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageCreate"))
|
new GUIButton(new RectTransform(new Vector2(0.5f, 1.0f), previewImageButtonHolder.RectTransform), TextManager.Get("SubPreviewImageGenerate"))
|
||||||
{
|
{
|
||||||
OnClicked = (btn, userdata) =>
|
OnClicked = (btn, userdata) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -277,17 +277,13 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
component.RectTransform.Parent = layoutGroup.RectTransform;
|
component.RectTransform.Parent = layoutGroup.RectTransform;
|
||||||
component.RectTransform.RepositionChildInHierarchy(childIndex);
|
component.RectTransform.RepositionChildInHierarchy(childIndex);
|
||||||
Recalculate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Recalculate()
|
|
||||||
{
|
|
||||||
int contentHeight = ContentHeight;
|
int contentHeight = ContentHeight;
|
||||||
RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.X, contentHeight);
|
RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.X, contentHeight);
|
||||||
layoutGroup.RectTransform.NonScaledSize = new Point(layoutGroup.RectTransform.NonScaledSize.X, contentHeight);
|
layoutGroup.RectTransform.NonScaledSize = new Point(layoutGroup.RectTransform.NonScaledSize.X, contentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity)
|
private GUIComponent CreateNewField(SerializableProperty property, ISerializableEntity entity)
|
||||||
{
|
{
|
||||||
object value = property.GetValue(entity);
|
object value = property.GetValue(entity);
|
||||||
if (property.PropertyType == typeof(string) && value == null)
|
if (property.PropertyType == typeof(string) && value == null)
|
||||||
@@ -355,7 +351,7 @@ namespace Barotrauma
|
|||||||
return propertyField;
|
return propertyField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip)
|
private GUIComponent CreateBoolField(ISerializableEntity entity, SerializableProperty property, bool value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
GUITickBox propertyTickBox = new GUITickBox(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), displayName)
|
GUITickBox propertyTickBox = new GUITickBox(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), displayName)
|
||||||
{
|
{
|
||||||
@@ -371,11 +367,11 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyTickBox }); }
|
Fields.Add(property.Name, new GUIComponent[] { propertyTickBox });
|
||||||
return propertyTickBox;
|
return propertyTickBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip)
|
private GUIComponent CreateIntField(ISerializableEntity entity, SerializableProperty property, int value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -399,11 +395,11 @@ namespace Barotrauma
|
|||||||
TrySendNetworkUpdate(entity, property);
|
TrySendNetworkUpdate(entity, property);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); }
|
Fields.Add(property.Name, new GUIComponent[] { numberInput });
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip)
|
private GUIComponent CreateFloatField(ISerializableEntity entity, SerializableProperty property, float value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -429,11 +425,11 @@ namespace Barotrauma
|
|||||||
TrySendNetworkUpdate(entity, property);
|
TrySendNetworkUpdate(entity, property);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { numberInput }); }
|
Fields.Add(property.Name, new GUIComponent[] { numberInput });
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
private GUIComponent CreateEnumField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -458,11 +454,11 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
enumDropDown.SelectItem(value);
|
enumDropDown.SelectItem(value);
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
|
Fields.Add(property.Name, new GUIComponent[] { enumDropDown });
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
private GUIComponent CreateEnumFlagField(ISerializableEntity entity, SerializableProperty property, object value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -491,21 +487,18 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { enumDropDown }); }
|
Fields.Add(property.Name, new GUIComponent[] { enumDropDown });
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip)
|
private GUIComponent CreateStringField(ISerializableEntity entity, SerializableProperty property, string value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUILayoutGroup(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), isHorizontal: true)
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, elementHeight), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
{
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont, textAlignment: Alignment.Left)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont, textAlignment: Alignment.Left)
|
||||||
{
|
{
|
||||||
ToolTip = toolTip
|
ToolTip = toolTip
|
||||||
};
|
};
|
||||||
GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform))
|
GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 1), frame.RectTransform, Anchor.TopRight))
|
||||||
{
|
{
|
||||||
ToolTip = toolTip,
|
ToolTip = toolTip,
|
||||||
Font = GUI.SmallFont,
|
Font = GUI.SmallFont,
|
||||||
@@ -521,36 +514,11 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
string translationTextTag = property.GetAttribute<Serialize>()?.translationTextTag;
|
Fields.Add(property.Name, new GUIComponent[] { propertyBox });
|
||||||
if (translationTextTag != null)
|
|
||||||
{
|
|
||||||
new GUIButton(new RectTransform(new Vector2(0.1f, 1), frame.RectTransform, Anchor.TopRight), "...")
|
|
||||||
{
|
|
||||||
OnClicked = (bt, userData) => { CreateTextPicker(translationTextTag, entity, property, propertyBox); return true; }
|
|
||||||
};
|
|
||||||
propertyBox.OnTextChanged += (tb, text) =>
|
|
||||||
{
|
|
||||||
string translatedText = TextManager.Get(text, returnNull: true);
|
|
||||||
if (translatedText == null)
|
|
||||||
{
|
|
||||||
propertyBox.TextColor = Color.Gray;
|
|
||||||
propertyBox.ToolTip = TextManager.Get("StringPropertyCannotTranslate").Replace("[tag]", text ?? "");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
propertyBox.TextColor = Color.LightGreen;
|
|
||||||
propertyBox.ToolTip = TextManager.Get("StringPropertyTranslate").Replace("[translation]", translatedText);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
propertyBox.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, new GUIComponent[] { propertyBox }); }
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip)
|
private GUIComponent CreatePointField(ISerializableEntity entity, SerializableProperty property, Point value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -598,11 +566,11 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip)
|
private GUIComponent CreateVector2Field(ISerializableEntity entity, SerializableProperty property, Vector2 value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.4f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -652,11 +620,11 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip)
|
private GUIComponent CreateVector3Field(ISerializableEntity entity, SerializableProperty property, Vector3 value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.3f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -710,11 +678,11 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip)
|
private GUIComponent CreateVector4Field(ISerializableEntity entity, SerializableProperty property, Vector4 value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -772,14 +740,14 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip)
|
private GUIComponent CreateColorField(ISerializableEntity entity, SerializableProperty property, Color value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26) }, displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform) { MinSize = new Point(80, 26)}, displayName, font: GUI.SmallFont)
|
||||||
{
|
{
|
||||||
ToolTip = toolTip
|
ToolTip = toolTip
|
||||||
};
|
};
|
||||||
@@ -839,11 +807,11 @@ namespace Barotrauma
|
|||||||
colorBox.Color = (Color)property.GetValue(entity);
|
colorBox.Color = (Color)property.GetValue(entity);
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip)
|
private GUIComponent CreateRectangleField(ISerializableEntity entity, SerializableProperty property, Rectangle value, string displayName, string toolTip)
|
||||||
{
|
{
|
||||||
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
var frame = new GUIFrame(new RectTransform(new Point(Rect.Width, Math.Max(elementHeight, 26)), layoutGroup.RectTransform), color: Color.Transparent);
|
||||||
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
var label = new GUITextBlock(new RectTransform(new Vector2(0.2f, 1), frame.RectTransform), displayName, font: GUI.SmallFont)
|
||||||
@@ -899,43 +867,9 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
fields[i] = numberInput;
|
fields[i] = numberInput;
|
||||||
}
|
}
|
||||||
if (!Fields.ContainsKey(property.Name)) { Fields.Add(property.Name, fields); }
|
Fields.Add(property.Name, fields);
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateTextPicker(string textTag, ISerializableEntity entity, SerializableProperty property, GUITextBox textBox)
|
|
||||||
{
|
|
||||||
var msgBox = new GUIMessageBox("", "", new string[] { TextManager.Get("Cancel") }, width: 300, height: 400);
|
|
||||||
msgBox.Buttons[0].OnClicked = msgBox.Close;
|
|
||||||
|
|
||||||
var textList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.8f), msgBox.Content.RectTransform, Anchor.TopCenter))
|
|
||||||
{
|
|
||||||
OnSelected = (component, userData) =>
|
|
||||||
{
|
|
||||||
string text = userData as string ?? "";
|
|
||||||
|
|
||||||
if (property.TrySetValue(entity, text))
|
|
||||||
{
|
|
||||||
TrySendNetworkUpdate(entity, property);
|
|
||||||
textBox.Text = (string)property.GetValue(entity);
|
|
||||||
textBox.Deselect();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
textTag = textTag.ToLowerInvariant();
|
|
||||||
var tagTextPairs = TextManager.GetAllTagTextPairs();
|
|
||||||
foreach (KeyValuePair<string, string> tagTextPair in tagTextPairs)
|
|
||||||
{
|
|
||||||
if (!tagTextPair.Key.StartsWith(textTag)) { continue; }
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), textList.Content.RectTransform) { MinSize = new Point(0, 20) },
|
|
||||||
ToolBox.LimitString(tagTextPair.Value, GUI.Font, textList.Content.Rect.Width))
|
|
||||||
{
|
|
||||||
UserData = tagTextPair.Key
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TrySendNetworkUpdate(ISerializableEntity entity, SerializableProperty property)
|
private void TrySendNetworkUpdate(ISerializableEntity entity, SerializableProperty property)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -372,6 +372,167 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdateFireSounds(float deltaTime)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < fireVolumeLeft.Length; i++)
|
||||||
|
{
|
||||||
|
fireVolumeLeft[i] = 0.0f;
|
||||||
|
fireVolumeRight[i] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y);
|
||||||
|
foreach (Hull hull in Hull.hullList)
|
||||||
|
{
|
||||||
|
foreach (FireSource fs in hull.FireSources)
|
||||||
|
{
|
||||||
|
Vector2 diff = fs.WorldPosition + fs.Size / 2 - listenerPos;
|
||||||
|
if (Math.Abs(diff.X) < FireSoundRange && Math.Abs(diff.Y) < FireSoundRange)
|
||||||
|
{
|
||||||
|
Vector2 diffLeft = (fs.WorldPosition + new Vector2(fs.Size.X, fs.Size.Y / 2)) - listenerPos;
|
||||||
|
if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f;
|
||||||
|
if (diffLeft.X <= 0)
|
||||||
|
{
|
||||||
|
float distFallOffLeft = diffLeft.Length() / FireSoundRange;
|
||||||
|
if (distFallOffLeft < 0.99f)
|
||||||
|
{
|
||||||
|
fireVolumeLeft[0] += (1.0f - distFallOffLeft) * (fs.Size.X / FireSoundLargeLimit);
|
||||||
|
if (fs.Size.X > FireSoundLargeLimit) fireVolumeLeft[1] += (1.0f - distFallOffLeft) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector2 diffRight = (fs.WorldPosition + new Vector2(0.0f, fs.Size.Y / 2)) - listenerPos;
|
||||||
|
if (diff.X < fs.Size.X / 2.0f) diff.X = 0.0f;
|
||||||
|
if (diffRight.X >= 0)
|
||||||
|
{
|
||||||
|
float distFallOffRight = diffRight.Length() / FireSoundRange;
|
||||||
|
if (distFallOffRight < 0.99f)
|
||||||
|
{
|
||||||
|
fireVolumeRight[0] += 1.0f - distFallOffRight;
|
||||||
|
if (fs.Size.X > FireSoundLargeLimit) fireVolumeRight[1] += (1.0f - distFallOffRight) * ((fs.Size.X - FireSoundLargeLimit) / FireSoundLargeLimit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < fireVolumeLeft.Length; i++)
|
||||||
|
{
|
||||||
|
if (fireVolumeLeft[i] < 0.05f && fireVolumeRight[i] < 0.05f)
|
||||||
|
{
|
||||||
|
if (fireSoundChannels[i] != null)
|
||||||
|
{
|
||||||
|
fireSoundChannels[i].FadeOutAndDispose();
|
||||||
|
fireSoundChannels[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (fireVolumeRight[i] - fireVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y);
|
||||||
|
if (fireSoundChannels[i] == null || !fireSoundChannels[i].IsPlaying)
|
||||||
|
{
|
||||||
|
fireSoundChannels[i] = GetSound(i == 0 ? "fire" : "firelarge").Play(1.0f, FlowSoundRange, soundPos);
|
||||||
|
fireSoundChannels[i].Looping = true;
|
||||||
|
}
|
||||||
|
fireSoundChannels[i].Gain = Math.Max(fireVolumeRight[i], fireVolumeLeft[i]);
|
||||||
|
fireSoundChannels[i].Position = new Vector3(soundPos, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (waterAmbiences.Count > 1)
|
||||||
|
{
|
||||||
|
if (waterAmbienceChannels[0] == null || !waterAmbienceChannels[0].IsPlaying)
|
||||||
|
{
|
||||||
|
waterAmbienceChannels[0] = waterAmbiences[0].Play(ambienceVolume * (1.0f - movementSoundVolume),"waterambience");
|
||||||
|
//waterAmbiences[0].Loop(waterAmbienceIndexes[0], ambienceVolume * (1.0f - movementSoundVolume));
|
||||||
|
waterAmbienceChannels[0].Looping = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waterAmbienceChannels[0].Gain = ambienceVolume * (1.0f - movementSoundVolume);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (waterAmbienceChannels[1] == null || !waterAmbienceChannels[1].IsPlaying)
|
||||||
|
{
|
||||||
|
waterAmbienceChannels[1] = waterAmbiences[1].Play(ambienceVolume * movementSoundVolume, "waterambience");
|
||||||
|
//waterAmbienceIndexes[1] = waterAmbiences[1].Loop(waterAmbienceIndexes[1], ambienceVolume * movementSoundVolume);
|
||||||
|
waterAmbienceChannels[1].Looping = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
waterAmbienceChannels[1].Gain = ambienceVolume * movementSoundVolume;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateWaterFlowSounds(float deltaTime)
|
||||||
|
{
|
||||||
|
if (FlowSounds.Count == 0) { return; }
|
||||||
|
|
||||||
|
float[] targetFlowLeft = new float[FlowSounds.Count];
|
||||||
|
float[] targetFlowRight = new float[FlowSounds.Count];
|
||||||
|
|
||||||
|
Vector2 listenerPos = new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y);
|
||||||
|
foreach (Gap gap in Gap.GapList)
|
||||||
|
{
|
||||||
|
if (gap.Open < 0.01f) continue;
|
||||||
|
float gapFlow = Math.Abs(gap.LerpedFlowForce.X) + Math.Abs(gap.LerpedFlowForce.Y) * 2.5f;
|
||||||
|
|
||||||
|
if (gapFlow < 10.0f) continue;
|
||||||
|
|
||||||
|
int flowSoundIndex = (int)Math.Floor(MathHelper.Clamp(gapFlow / MaxFlowStrength, 0, FlowSounds.Count));
|
||||||
|
flowSoundIndex = Math.Min(flowSoundIndex, FlowSounds.Count - 1);
|
||||||
|
|
||||||
|
Vector2 diff = gap.WorldPosition - listenerPos;
|
||||||
|
if (Math.Abs(diff.X) < FlowSoundRange && Math.Abs(diff.Y) < FlowSoundRange)
|
||||||
|
{
|
||||||
|
float dist = diff.Length();
|
||||||
|
float distFallOff = dist / FlowSoundRange;
|
||||||
|
if (distFallOff >= 0.99f) continue;
|
||||||
|
|
||||||
|
//flow at the left side
|
||||||
|
if (diff.X < 0)
|
||||||
|
{
|
||||||
|
targetFlowLeft[flowSoundIndex] = 1.0f - distFallOff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetFlowRight[flowSoundIndex] = 1.0f - distFallOff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < FlowSounds.Count; i++)
|
||||||
|
{
|
||||||
|
flowVolumeLeft[i] = (targetFlowLeft[i] < flowVolumeLeft[i]) ?
|
||||||
|
Math.Max(targetFlowLeft[i], flowVolumeLeft[i] - deltaTime) :
|
||||||
|
Math.Min(targetFlowLeft[i], flowVolumeLeft[i] + deltaTime);
|
||||||
|
flowVolumeRight[i] = (targetFlowRight[i] < flowVolumeRight[i]) ?
|
||||||
|
Math.Max(targetFlowRight[i], flowVolumeRight[i] - deltaTime) :
|
||||||
|
Math.Min(targetFlowRight[i], flowVolumeRight[i] + deltaTime);
|
||||||
|
|
||||||
|
if (flowVolumeLeft[i] < 0.05f && flowVolumeRight[i] < 0.05f)
|
||||||
|
{
|
||||||
|
if (flowSoundChannels[i] != null)
|
||||||
|
{
|
||||||
|
flowSoundChannels[i].Dispose();
|
||||||
|
flowSoundChannels[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Vector2 soundPos = new Vector2(GameMain.SoundManager.ListenerPosition.X + (flowVolumeRight[i] - flowVolumeLeft[i]) * 100, GameMain.SoundManager.ListenerPosition.Y);
|
||||||
|
if (flowSoundChannels[i] == null || !flowSoundChannels[i].IsPlaying)
|
||||||
|
{
|
||||||
|
flowSoundChannels[i] = FlowSounds[i].Play(1.0f, FlowSoundRange, soundPos);
|
||||||
|
flowSoundChannels[i].Looping = true;
|
||||||
|
}
|
||||||
|
flowSoundChannels[i].Gain = Math.Max(flowVolumeRight[i], flowVolumeLeft[i]);
|
||||||
|
flowSoundChannels[i].Position = new Vector3(soundPos, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void UpdateFireSounds(float deltaTime)
|
private static void UpdateFireSounds(float deltaTime)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < fireVolumeLeft.Length; i++)
|
for (int i = 0; i < fireVolumeLeft.Length; i++)
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ namespace Barotrauma.Sounds
|
|||||||
public bool UseRadioFilter;
|
public bool UseRadioFilter;
|
||||||
public bool UseMuffleFilter;
|
public bool UseMuffleFilter;
|
||||||
|
|
||||||
public float Near { get; private set; }
|
|
||||||
public float Far { get; private set; }
|
|
||||||
|
|
||||||
private static BiQuad[] muffleFilters = new BiQuad[]
|
private static BiQuad[] muffleFilters = new BiQuad[]
|
||||||
{
|
{
|
||||||
new LowpassFilter(VoipConfig.FREQUENCY, 800)
|
new LowpassFilter(VoipConfig.FREQUENCY, 800)
|
||||||
@@ -44,16 +41,6 @@ namespace Barotrauma.Sounds
|
|||||||
new BandpassFilter(VoipConfig.FREQUENCY, 2000)
|
new BandpassFilter(VoipConfig.FREQUENCY, 2000)
|
||||||
};
|
};
|
||||||
|
|
||||||
public float Gain
|
|
||||||
{
|
|
||||||
get { return soundChannel == null ? 0.0f : soundChannel.Gain; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (soundChannel == null) { return; }
|
|
||||||
soundChannel.Gain = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public VoipSound(SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
public VoipSound(SoundManager owner, VoipQueue q) : base(owner, "voip", true, true)
|
||||||
{
|
{
|
||||||
VoipConfig.SetupEncoding();
|
VoipConfig.SetupEncoding();
|
||||||
@@ -77,8 +64,8 @@ namespace Barotrauma.Sounds
|
|||||||
|
|
||||||
public void SetRange(float near, float far)
|
public void SetRange(float near, float far)
|
||||||
{
|
{
|
||||||
soundChannel.Near = Near = near;
|
soundChannel.Near = near;
|
||||||
soundChannel.Far = Far = far;
|
soundChannel.Far = far;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyFilters(short[] buffer, int readSamples)
|
public void ApplyFilters(short[] buffer, int readSamples)
|
||||||
|
|||||||
@@ -151,7 +151,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
for (int i = traitStart + NPCPersonalityTrait.List.Count; i < csvContent.Length; i++) // Conversations
|
for (int i = traitStart + NPCPersonalityTrait.List.Count; i < csvContent.Length; i++) // Conversations
|
||||||
{
|
{
|
||||||
string[] presplit = csvContent[i].Split(','); // Handling speaker index fetching, somehow doesn't work with the regex
|
|
||||||
string[] split = SplitCSV(csvContent[i]);
|
string[] split = SplitCSV(csvContent[i]);
|
||||||
|
|
||||||
int emptyFields = 0;
|
int emptyFields = 0;
|
||||||
@@ -173,20 +172,20 @@ namespace Barotrauma
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string speaker = presplit[1];
|
string speaker = split[1];
|
||||||
int depthIndex = int.Parse(presplit[2]);
|
int depthIndex = int.Parse(split[2]);
|
||||||
// 3 = original line
|
// 3 = original line
|
||||||
string line = split[4].Replace("\"", "");
|
string line = split[4].Replace("\"", "");
|
||||||
string flags = split[5].Replace("\"", "");
|
string flags = split[5].Replace("\"", "");
|
||||||
string allowedJobs = split[6].Replace("\"", "");
|
string allowedJobs = split[6].Replace("\"", "");
|
||||||
string speakerTags = split[7].Replace("\"", "");
|
string speakerTags = split[7].Replace("\"", "");
|
||||||
string minIntensity = split[8].Replace("\"", "").Replace(",", ".");
|
string minIntensity = split[8].Replace("\"", "");
|
||||||
string maxIntensity = split[9].Replace("\"", "").Replace(",", ".");
|
string maxIntensity = split[9].Replace("\"", "");
|
||||||
|
|
||||||
string element =
|
string element =
|
||||||
$"{GetIndenting(depthIndex)}" +
|
$"{GetIndenting(depthIndex)}" +
|
||||||
$"<Conversation line=\"{line}\" " +
|
$"<Conversation line=\"{line}\" " +
|
||||||
$"{GetVariable("speaker", speaker)}" +
|
$"{GetVariable("speaker" ,speaker)}" +
|
||||||
$"{GetVariable("flags", flags)}" +
|
$"{GetVariable("flags", flags)}" +
|
||||||
$"{GetVariable("allowedjobs", allowedJobs)}" +
|
$"{GetVariable("allowedjobs", allowedJobs)}" +
|
||||||
$"{GetVariable("speakertags", speakerTags)}" +
|
$"{GetVariable("speakertags", speakerTags)}" +
|
||||||
|
|||||||
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,41 @@
|
|||||||
|
<configuration>
|
||||||
|
<dllmap dll="i:cygwin1.dll" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="i:cygwin1.dll" target="libc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="libc" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="libc" target="libc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="intl" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="intl" target="libintl.dylib" os="osx"/>
|
||||||
|
<dllmap dll="libintl" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="libintl" target="libintl.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:libxslt.dll" target="libxslt.so" os="linux"/>
|
||||||
|
<dllmap dll="i:libxslt.dll" target="libxslt.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:odbc32.dll" target="libodbc.so" os="linux"/>
|
||||||
|
<dllmap dll="i:odbc32.dll" target="libodbc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="oci" target="libclntsh.so" os="linux"/>
|
||||||
|
<dllmap dll="oci" target="libclntsh.dylib" os="osx"/>
|
||||||
|
<dllmap dll="db2cli" target="libdb2_36.so" os="linux"/>
|
||||||
|
<dllmap dll="db2cli" target="libdb2_36.dylib" os="osx"/>
|
||||||
|
<dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.so" os="linux"/>
|
||||||
|
<dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:msvcrt" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="i:msvcrt" target="libc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:msvcrt.dll" target="libc.so.6" os="linux"/>
|
||||||
|
<dllmap dll="i:msvcrt.dll" target="libc.dylib" os="osx"/>
|
||||||
|
<dllmap dll="sqlite" target="libsqlite.so.0" os="linux"/>
|
||||||
|
<dllmap dll="sqlite" target="libsqlite.0.dylib" os="osx"/>
|
||||||
|
<dllmap dll="sqlite3" target="libsqlite3.so.0" os="linux"/>
|
||||||
|
<dllmap dll="sqlite3" target="libsqlite3.0.dylib" os="osx"/>
|
||||||
|
<dllmap dll="libX11" target="libX11.so.6" os="linux"/>
|
||||||
|
<dllmap dll="libX11" target="libX11.dylib" os="osx"/>
|
||||||
|
<dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="linux"/>
|
||||||
|
<dllmap dll="libcairo-2.dll" target="libcairo.2.dylib" os="osx"/>
|
||||||
|
<dllmap dll="libcups" target="libcups.so.2" os="linux"/>
|
||||||
|
<dllmap dll="libcups" target="libcups.dylib" os="osx"/>
|
||||||
|
<dllmap dll="i:kernel32.dll">
|
||||||
|
<dllentry dll="__Internal" name="CopyMemory" target="mono_win32_compat_CopyMemory"/>
|
||||||
|
<dllentry dll="__Internal" name="FillMemory" target="mono_win32_compat_FillMemory"/>
|
||||||
|
<dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
|
||||||
|
<dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
|
||||||
|
</dllmap>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<configSections>
|
||||||
|
<section name="configProtectedData" type="System.Configuration.ProtectedConfigurationSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="connectionStrings" type="System.Configuration.ConnectionStringsSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="mscorlib" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>
|
||||||
|
<section name="runtime" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>
|
||||||
|
<section name="assemblyBinding" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||||
|
<section name="satelliteassemblies" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||||
|
<section name="startup" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>
|
||||||
|
<section name="system.data" type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="system.diagnostics" type="System.Diagnostics.SystemDiagnosticsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||||
|
<section name="system.windows.forms" type="System.Windows.Forms.WindowsFormsSection, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="windows" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
|
||||||
|
<section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||||
|
<sectionGroup name="system.runtime.serialization" type="System.Runtime.Serialization.Configuration.SerializationSectionGroup, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="dataContractSerializer" type="System.Runtime.Serialization.Configuration.DataContractSerializerSection, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
</sectionGroup>
|
||||||
|
<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<section name="anonymousIdentification" type="System.Web.Configuration.AnonymousIdentificationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="authentication" type="System.Web.Configuration.AuthenticationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="authorization" type="System.Web.Configuration.AuthorizationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="browserCaps" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="clientTarget" type="System.Web.Configuration.ClientTargetSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="compilation" type="System.Web.Configuration.CompilationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="customErrors" type="System.Web.Configuration.CustomErrorsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="deployment" type="System.Web.Configuration.DeploymentSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" />
|
||||||
|
<section name="globalization" type="System.Web.Configuration.GlobalizationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="healthMonitoring" type="System.Web.Configuration.HealthMonitoringSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="hostingEnvironment" type="System.Web.Configuration.HostingEnvironmentSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication" />
|
||||||
|
<section name="httpCookies" type="System.Web.Configuration.HttpCookiesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="httpHandlers" type="System.Web.Configuration.HttpHandlersSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="httpModules" type="System.Web.Configuration.HttpModulesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="httpRuntime" type="System.Web.Configuration.HttpRuntimeSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="identity" type="System.Web.Configuration.IdentitySection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="machineKey" type="System.Web.Configuration.MachineKeySection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="membership" type="System.Web.Configuration.MembershipSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="mobileControls" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="deviceFilters" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="pages" type="System.Web.Configuration.PagesSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="processModel" type="System.Web.Configuration.ProcessModelSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineOnly" allowLocation="false" />
|
||||||
|
<section name="profile" type="System.Web.Configuration.ProfileSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="roleManager" type="System.Web.Configuration.RoleManagerSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="securityPolicy" type="System.Web.Configuration.SecurityPolicySection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication" />
|
||||||
|
<section name="sessionPageState" type="System.Web.Configuration.SessionPageStateSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="sessionState" type="System.Web.Configuration.SessionStateSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="siteMap" type="System.Web.Configuration.SiteMapSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="trace" type="System.Web.Configuration.TraceSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="trust" type="System.Web.Configuration.TrustSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication" />
|
||||||
|
<section name="urlMappings" type="System.Web.Configuration.UrlMappingsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="webControls" type="System.Web.Configuration.WebControlsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="webParts" type="System.Web.Configuration.WebPartsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="webServices" type="System.Web.Services.Configuration.WebServicesSection, System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="xhtmlConformance" type="System.Web.Configuration.XhtmlConformanceSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<sectionGroup name="caching" type="System.Web.Configuration.SystemWebCachingSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<section name="cache" type="System.Web.Configuration.CacheSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="outputCache" type="System.Web.Configuration.OutputCacheSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="outputCacheSettings" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="sqlCacheDependency" type="System.Web.Configuration.OutputCacheSettingsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
</sectionGroup>
|
||||||
|
<section name="monoSettings" type="System.Web.Configuration.MonoSettingsSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
</sectionGroup>
|
||||||
|
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
|
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
|
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||||
|
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||||
|
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/>
|
||||||
|
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||||
|
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||||
|
</sectionGroup>
|
||||||
|
</sectionGroup>
|
||||||
|
</sectionGroup>
|
||||||
|
<sectionGroup name="system.net" type="System.Net.Configuration.NetSectionGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="authenticationModules" type="System.Net.Configuration.AuthenticationModulesSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="connectionManagement" type="System.Net.Configuration.ConnectionManagementSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="defaultProxy" type="System.Net.Configuration.DefaultProxySection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<sectionGroup name="mailSettings" type="System.Net.Configuration.MailSettingsSectionGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="smtp" type="System.Net.Configuration.SmtpSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</sectionGroup>
|
||||||
|
<section name="requestCaching" type="System.Net.Configuration.RequestCachingSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="settings" type="System.Net.Configuration.SettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="webRequestModules" type="System.Net.Configuration.WebRequestModulesSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</sectionGroup>
|
||||||
|
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<sectionGroup name="system.serviceModel" type="System.ServiceModel.Configuration.ServiceModelSectionGroup, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<section name="behaviors" type="System.ServiceModel.Configuration.BehaviorsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="bindings" type="System.ServiceModel.Configuration.BindingsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="client" type="System.ServiceModel.Configuration.ClientSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="commonBehaviors" type="System.ServiceModel.Configuration.CommonBehaviorsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="diagnostics" type="System.ServiceModel.Configuration.DiagnosticSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="extensions" type="System.ServiceModel.Configuration.ExtensionsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="serviceHostingEnvironment" type="System.ServiceModel.Configuration.ServiceHostingEnvironmentSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="services" type="System.ServiceModel.Configuration.ServicesSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<section name="standardEndpoints" type="System.ServiceModel.Configuration.StandardEndpointsSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
<section name="routing" type="System.ServiceModel.Routing.Configuration.RoutingSection, System.ServiceModel.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<section name="protocolMapping" type="System.ServiceModel.Configuration.ProtocolMappingSection, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
</sectionGroup>
|
||||||
|
<sectionGroup name="system.transactions" type="System.Transactions.Configuration.TransactionsSectionGroup, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null">
|
||||||
|
<section name="defaultSettings" type="System.Transactions.Configuration.DefaultSettingsSection, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
|
||||||
|
<section name="machineSettings" type="System.Transactions.Configuration.MachineSettingsSection, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" allowDefinition="MachineOnly" allowExeDefinition="MachineOnly"/>
|
||||||
|
</sectionGroup>
|
||||||
|
<section name="system.webServer" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
<section name="uri" type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<sectionGroup name="system.runtime.caching" type="System.Runtime.Caching.Configuration.CachingSectionGroup, System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<section name="memoryCache" type="System.Runtime.Caching.Configuration.MemoryCacheSection, System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="MachineToApplication"/>
|
||||||
|
</sectionGroup>
|
||||||
|
</configSections>
|
||||||
|
|
||||||
|
<connectionStrings>
|
||||||
|
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
|
||||||
|
<add name="LocalSqliteServer" connectionString="Data Source=|DataDirectory|/aspnetdb.sqlite;version=3" providerName="Mono.Data.Sqlite"/>
|
||||||
|
</connectionStrings>
|
||||||
|
|
||||||
|
<configProtectedData defaultProvider="RsaProtectedConfigurationProvider">
|
||||||
|
<providers>
|
||||||
|
<add name="RsaProtectedConfigurationProvider" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||||
|
description="" keyContainerName="MonoFrameworkConfigurationKey" cspProviderName="" useMachineContainer="true" useOAEP="false" />
|
||||||
|
<add name="DataProtectionConfigurationProvider" type="System.Configuration.DpapiProtectedConfigurationProvider, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||||
|
description="" useMachineProtection="true" keyEntropy="" />
|
||||||
|
</providers>
|
||||||
|
</configProtectedData>
|
||||||
|
|
||||||
|
<system.net>
|
||||||
|
<authenticationModules>
|
||||||
|
<add type="System.Net.BasicClient, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<add type="System.Net.DigestClient, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<add type="System.Net.NtlmClient, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</authenticationModules>
|
||||||
|
<webRequestModules>
|
||||||
|
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</webRequestModules>
|
||||||
|
</system.net>
|
||||||
|
|
||||||
|
<system.runtime.remoting>
|
||||||
|
<application>
|
||||||
|
<channels>
|
||||||
|
<channel ref="http client" displayName="http client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||||
|
<channel ref="tcp client" displayName="tcp client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||||
|
<channel ref="ipc client" displayName="ipc client (delay loaded)" delayLoadAsClientChannel="true" />
|
||||||
|
</channels>
|
||||||
|
</application>
|
||||||
|
<channels>
|
||||||
|
<channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="ipc" type="System.Runtime.Remoting.Channels.Ipc.IpcChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="ipc client" type="System.Runtime.Remoting.Channels.Ipc.IpcClientChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<channel id="ipc server" type="System.Runtime.Remoting.Channels.Ipc.IpcServerChannel, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</channels>
|
||||||
|
<channelSinkProviders>
|
||||||
|
<clientProviders>
|
||||||
|
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</clientProviders>
|
||||||
|
<serverProviders>
|
||||||
|
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
</serverProviders>
|
||||||
|
</channelSinkProviders>
|
||||||
|
</system.runtime.remoting>
|
||||||
|
|
||||||
|
<appSettings>
|
||||||
|
<!--<add key="yourkey" value="your value" /> -->
|
||||||
|
<!--<remove key="a key defined higher in the hierarchy" /> -->
|
||||||
|
<!--<clear/> Removes all defined settings -->
|
||||||
|
</appSettings>
|
||||||
|
<system.diagnostics>
|
||||||
|
<trace autoflush="false" indentsize="4" />
|
||||||
|
</system.diagnostics>
|
||||||
|
<system.drawing>
|
||||||
|
</system.drawing>
|
||||||
|
|
||||||
|
<system.data>
|
||||||
|
<DbProviderFactories>
|
||||||
|
<add name="Mono Sqlite Data Provider" invariant="Mono.Data.SqliteClient"
|
||||||
|
description="Mono Framework Data Provider for SQLite (old version)"
|
||||||
|
type="Mono.Data.SqliteClient.SqliteFactory, Mono.Data.SqliteClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"/>
|
||||||
|
<add name="Mono Sqlite Provider" invariant="Mono.Data.Sqlite"
|
||||||
|
description="Mono Framework Data Provider for SQLite (new version)"
|
||||||
|
type="Mono.Data.Sqlite.SqliteFactory, Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"/>
|
||||||
|
<add name="Odbc Data Provider" invariant="System.Data.Odbc"
|
||||||
|
description=".Net Framework Data Provider for Odbc"
|
||||||
|
type="System.Data.Odbc.OdbcFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
<add name="OleDb Data Provider" invariant="System.Data.OleDb"
|
||||||
|
description=".Net Framework Data Provider for OleDb"
|
||||||
|
type="System.Data.OleDb.OleDbFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
<add name="OracleClient Data Provider" invariant="System.Data.OracleClient"
|
||||||
|
description=".Net Framework Data Provider for Oracle"
|
||||||
|
type="System.Data.OracleClient.OracleClientFactory, System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient"
|
||||||
|
description=".Net Framework Data Provider for SqlServer"
|
||||||
|
type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
|
||||||
|
<add name="Sybase Data Provider" invariant="Mono.Data.SybaseClient"
|
||||||
|
description=".Net Framework Data Provider for Sybase"
|
||||||
|
type="Mono.Data.SybaseClient.SybaseClientFactory, Mono.Data.SybaseClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"/>
|
||||||
|
</DbProviderFactories>
|
||||||
|
</system.data>
|
||||||
|
|
||||||
|
<mscorlib>
|
||||||
|
<cryptographySettings>
|
||||||
|
<cryptoNameMapping>
|
||||||
|
<cryptoClasses>
|
||||||
|
<cryptoClass monoMD2="Mono.Security.Cryptography.MD2Managed, Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
|
||||||
|
<cryptoClass monoMD4="Mono.Security.Cryptography.MD4Managed, Mono.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
|
||||||
|
</cryptoClasses>
|
||||||
|
<nameEntry name="MD2" class="monoMD2" />
|
||||||
|
<nameEntry name="MD4" class="monoMD4" />
|
||||||
|
</cryptoNameMapping>
|
||||||
|
<oidMap>
|
||||||
|
<oidEntry OID="1.2.840.113549.2.2" name="MD2" />
|
||||||
|
<oidEntry OID="1.2.840.113549.2.2" name="Mono.Security.Cryptography.MD2Managed" />
|
||||||
|
<oidEntry OID="1.2.840.113549.2.4" name="MD4" />
|
||||||
|
<oidEntry OID="1.2.840.113549.2.4" name="Mono.Security.Cryptography.MD4Managed" />
|
||||||
|
</oidMap>
|
||||||
|
</cryptographySettings>
|
||||||
|
</mscorlib>
|
||||||
|
|
||||||
|
<strongNames>
|
||||||
|
<pubTokenMapping>
|
||||||
|
<!-- ECMA key -->
|
||||||
|
<map Token="b77a5c561934e089" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||||
|
<!-- Microsoft (final) key -->
|
||||||
|
<map Token="b03f5f7f11d50a3a" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||||
|
<!-- Microsoft (Web Service Enhancement) key -->
|
||||||
|
<map Token="31bf3856ad364e35" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||||
|
<!-- IBM (DB2 Data Provider) key -->
|
||||||
|
<map Token="7c307b91aa13d208" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||||
|
<!-- Silverlight 2.0 key -->
|
||||||
|
<map Token="7cec85d7bea7798e" PublicKey="002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df" />
|
||||||
|
<!-- XNA Framework key -->
|
||||||
|
<map Token="6d5c3888ef60e27d" PublicKey="0024000004800000940000000602000000240000525341310004000001000100f9a2641bac9847900d92a33d652ccc4e8b529360f908e7af53e57008b2a9a1938c32a160d47f795a23590557608d2c8d0c0e8846a052d070f9298281b8185343dbe5b479bd52de256f73c2a943e1a8a42065b5c918622dc14b1c0151dbd94d9a4543e7cd03e536b1b1d2d6d99af535d227ab9bdac76af9312a21d457bdf817e6" />
|
||||||
|
</pubTokenMapping>
|
||||||
|
</strongNames>
|
||||||
|
|
||||||
|
<system.web>
|
||||||
|
<webServices>
|
||||||
|
<protocols>
|
||||||
|
<add name="HttpSoap"/>
|
||||||
|
<add name="HttpSoap12"/>
|
||||||
|
<add name="HttpPost"/>
|
||||||
|
<add name="HttpGet"/>
|
||||||
|
<add name="Documentation"/>
|
||||||
|
</protocols>
|
||||||
|
<conformanceWarnings>
|
||||||
|
<add name="BasicProfile1_1"/>
|
||||||
|
</conformanceWarnings>
|
||||||
|
<wsdlHelpGenerator href="DefaultWsdlHelpGenerator.aspx" />
|
||||||
|
</webServices>
|
||||||
|
|
||||||
|
<membership>
|
||||||
|
<providers>
|
||||||
|
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
|
||||||
|
<!-- <add name="AspNetSqlMembershipProvider" type="Mainsoft.Web.Security.GenericMembershipProvider, Mainsoft.Web.Security" applicationName="/" connectionStringName="LocalSqlServer" /> -->
|
||||||
|
</providers>
|
||||||
|
</membership>
|
||||||
|
|
||||||
|
<roleManager>
|
||||||
|
<providers>
|
||||||
|
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" applicationName="/" connectionStringName="LocalSqlServer" />
|
||||||
|
<!-- <add name="AspNetSqlRoleProvider" type="Mainsoft.Web.Security.GenericRoleProvider, Mainsoft.Web.Security" applicationName="/" connectionStringName="LocalSqlServer" /> -->
|
||||||
|
</providers>
|
||||||
|
</roleManager>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<providers>
|
||||||
|
<add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
|
</providers>
|
||||||
|
</profile>
|
||||||
|
</system.web>
|
||||||
|
|
||||||
|
|
||||||
|
<system.serviceModel>
|
||||||
|
<extensions>
|
||||||
|
<behaviorExtensions>
|
||||||
|
<add name="enableWebScript" type="System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="webHttp" type="System.ServiceModel.Configuration.WebHttpElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
</behaviorExtensions>
|
||||||
|
<bindingElementExtensions>
|
||||||
|
<add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
</bindingElementExtensions>
|
||||||
|
<bindingExtensions>
|
||||||
|
<add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
</bindingExtensions>
|
||||||
|
<endpointExtensions>
|
||||||
|
<add name="dynamicEndpoint" type="System.ServiceModel.Discovery.Configuration.DynamicEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="discoveryEndpoint" type="System.ServiceModel.Discovery.Configuration.DiscoveryEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="udpDiscoveryEndpoint" type="System.ServiceModel.Discovery.Configuration.UdpDiscoveryEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="announcementEndpoint" type="System.ServiceModel.Discovery.Configuration.AnnouncementEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="udpAnnouncementEndpoint" type="System.ServiceModel.Discovery.Configuration.UdpAnnouncementEndpointCollectionElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="webHttpEndpoint" type="System.ServiceModel.Configuration.WebHttpEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
<add name="webScriptEndpoint" type="System.ServiceModel.Configuration.WebScriptEndpointCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
|
</endpointExtensions>
|
||||||
|
</extensions>
|
||||||
|
</system.serviceModel>
|
||||||
|
</configuration>
|
||||||
|
|
||||||
|
|
||||||
Executable
BIN
Binary file not shown.
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# MonoKickstart Shell Script
|
||||||
|
# Written by Ethan "flibitijibibo" Lee
|
||||||
|
|
||||||
|
# Move to script's directory
|
||||||
|
cd "`dirname "$0"`"
|
||||||
|
|
||||||
|
# Get the system architecture
|
||||||
|
UNAME=`uname`
|
||||||
|
ARCH=`uname -m`
|
||||||
|
|
||||||
|
# MonoKickstart picks the right libfolder, so just execute the right binary.
|
||||||
|
if [ "$UNAME" == "Darwin" ]; then
|
||||||
|
# ... Except on OSX.
|
||||||
|
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/
|
||||||
|
|
||||||
|
# El Capitan is a total idiot and wipes this variable out, making the
|
||||||
|
# Steam overlay disappear. This sidesteps "System Integrity Protection"
|
||||||
|
# and resets the variable with Valve's own variable (they provided this
|
||||||
|
# fix by the way, thanks Valve!). Note that you will need to update your
|
||||||
|
# launch configuration to the script location, NOT just the app location
|
||||||
|
# (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app).
|
||||||
|
# -flibit
|
||||||
|
if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
|
||||||
|
export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
|
||||||
|
fi
|
||||||
|
|
||||||
|
./DedicatedServer.bin.osx $@
|
||||||
|
else
|
||||||
|
if [ "$ARCH" == "x86_64" ]; then
|
||||||
|
./DedicatedServer.bin.x86_64 $@
|
||||||
|
else
|
||||||
|
./DedicatedServer.bin.x86 $@
|
||||||
|
fi
|
||||||
|
fi
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -216,13 +216,22 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="'$(DefineConstants)' == 'LINUX' ">
|
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||||
<None Include="Launch_BarotraumaServer">
|
<None Include="Launch_BarotraumaServer">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="DedicatedServer">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="DedicatedServer.bin.x86">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="DedicatedServer.bin.x86_64">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
|
<Import Project="..\BarotraumaShared\SharedCode.projitems" Label="Shared" />
|
||||||
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
|
<Import Project="..\BarotraumaShared\SharedContent.projitems" Label="Shared" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
|
<Import Project="..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets" Condition="Exists('..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\build\net45\GameAnalytics.Mono.SDK.targets')" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ namespace Barotrauma
|
|||||||
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
|
Vector2 relativeCursorPos = cursorPosition - AimRefPosition;
|
||||||
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
|
tempBuffer.Write((UInt16)(65535.0 * Math.Atan2(relativeCursorPos.Y, relativeCursorPos.X) / (2.0 * Math.PI)));
|
||||||
}
|
}
|
||||||
tempBuffer.Write(IsRagdolled || IsUnconscious || Stun > 0.0f || IsDead);
|
tempBuffer.Write(IsRagdolled);
|
||||||
|
|
||||||
tempBuffer.Write(AnimController.Dir > 0.0f);
|
tempBuffer.Write(AnimController.Dir > 0.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ namespace Barotrauma
|
|||||||
Console.CursorLeft = 0;
|
Console.CursorLeft = 0;
|
||||||
Console.CursorTop -= cursorLine;
|
Console.CursorTop -= cursorLine;
|
||||||
Console.Write(input);
|
Console.Write(input);
|
||||||
Console.CursorLeft = input.Length % Console.WindowWidth;
|
Console.CursorLeft = input.Length % consoleWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
|
private static void AssignOnClientRequestExecute(string names, Action<Client, Vector2, string[]> onClientRequestExecute)
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ namespace Barotrauma
|
|||||||
LevelGenerationParams.LoadPresets();
|
LevelGenerationParams.LoadPresets();
|
||||||
ScriptedEventSet.LoadPrefabs();
|
ScriptedEventSet.LoadPrefabs();
|
||||||
|
|
||||||
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
|
|
||||||
StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure));
|
StructurePrefab.LoadAll(GetFilesOfType(ContentType.Structure));
|
||||||
ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item));
|
ItemPrefab.LoadAll(GetFilesOfType(ContentType.Item));
|
||||||
JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs));
|
JobPrefab.LoadAll(GetFilesOfType(ContentType.Jobs));
|
||||||
@@ -91,6 +90,7 @@ namespace Barotrauma
|
|||||||
NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations));
|
NPCConversation.LoadAll(GetFilesOfType(ContentType.NPCConversations));
|
||||||
ItemAssemblyPrefab.LoadAll();
|
ItemAssemblyPrefab.LoadAll();
|
||||||
LevelObjectPrefab.LoadAll();
|
LevelObjectPrefab.LoadAll();
|
||||||
|
AfflictionPrefab.LoadAll(GetFilesOfType(ContentType.Afflictions));
|
||||||
|
|
||||||
GameModePreset.Init();
|
GameModePreset.Init();
|
||||||
LocationType.Init();
|
LocationType.Init();
|
||||||
|
|||||||
@@ -168,8 +168,6 @@ namespace Barotrauma
|
|||||||
msg.Write(isRunning && endWatchman != null ? endWatchman.ID : (UInt16)0);
|
msg.Write(isRunning && endWatchman != null ? endWatchman.ID : (UInt16)0);
|
||||||
|
|
||||||
msg.Write(Money);
|
msg.Write(Money);
|
||||||
msg.Write(PurchasedHullRepairs);
|
|
||||||
msg.Write(PurchasedItemRepairs);
|
|
||||||
|
|
||||||
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
|
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
|
||||||
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
|
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
|
||||||
@@ -194,8 +192,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
UInt16 selectedLocIndex = msg.ReadUInt16();
|
UInt16 selectedLocIndex = msg.ReadUInt16();
|
||||||
byte selectedMissionIndex = msg.ReadByte();
|
byte selectedMissionIndex = msg.ReadByte();
|
||||||
bool purchasedHullRepairs = msg.ReadBoolean();
|
|
||||||
bool purchasedItemRepairs = msg.ReadBoolean();
|
|
||||||
UInt16 purchasedItemCount = msg.ReadUInt16();
|
UInt16 purchasedItemCount = msg.ReadUInt16();
|
||||||
|
|
||||||
List<PurchasedItem> purchasedItems = new List<PurchasedItem>();
|
List<PurchasedItem> purchasedItems = new List<PurchasedItem>();
|
||||||
@@ -212,17 +208,6 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (purchasedHullRepairs && !this.PurchasedHullRepairs && Money >= HullRepairCost)
|
|
||||||
{
|
|
||||||
this.PurchasedHullRepairs = true;
|
|
||||||
Money -= HullRepairCost;
|
|
||||||
}
|
|
||||||
if (purchasedItemRepairs && !this.PurchasedItemRepairs && Money >= ItemRepairCost)
|
|
||||||
{
|
|
||||||
this.PurchasedItemRepairs = true;
|
|
||||||
Money -= ItemRepairCost;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map.SelectLocation(selectedLocIndex == UInt16.MaxValue ? -1 : selectedLocIndex);
|
Map.SelectLocation(selectedLocIndex == UInt16.MaxValue ? -1 : selectedLocIndex);
|
||||||
if (Map.SelectedConnection != null)
|
if (Map.SelectedConnection != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1754,10 +1754,11 @@ namespace Barotrauma.Networking
|
|||||||
Log("Game mode: " + selectedMode.Name, ServerLog.MessageType.ServerMessage);
|
Log("Game mode: " + selectedMode.Name, ServerLog.MessageType.ServerMessage);
|
||||||
Log("Submarine: " + selectedSub.Name, ServerLog.MessageType.ServerMessage);
|
Log("Submarine: " + selectedSub.Name, ServerLog.MessageType.ServerMessage);
|
||||||
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
|
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
|
bool missionAllowRespawn = campaign == null &&
|
||||||
bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
|
(!(GameMain.GameSession.GameMode is MissionMode) ||
|
||||||
|
((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
|
||||||
|
|
||||||
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
|
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
|
||||||
|
|
||||||
@@ -1766,12 +1767,6 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
var teamID = n == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
|
var teamID = n == 0 ? Character.TeamType.Team1 : Character.TeamType.Team2;
|
||||||
|
|
||||||
Submarine.MainSubs[n].TeamID = teamID;
|
|
||||||
foreach (Submarine sub in Submarine.MainSubs[n].DockedTo)
|
|
||||||
{
|
|
||||||
sub.TeamID = teamID;
|
|
||||||
}
|
|
||||||
|
|
||||||
//find the clients in this team
|
//find the clients in this team
|
||||||
List<Client> teamClients = teamCount == 1 ?
|
List<Client> teamClients = teamCount == 1 ?
|
||||||
new List<Client>(connectedClients) :
|
new List<Client>(connectedClients) :
|
||||||
@@ -1940,8 +1935,10 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
|
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
|
||||||
|
|
||||||
MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
|
bool missionAllowRespawn = campaign == null &&
|
||||||
bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
|
(!(GameMain.GameSession.GameMode is MissionMode) ||
|
||||||
|
((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
|
||||||
|
|
||||||
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
|
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
|
||||||
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -10,7 +10,9 @@ namespace Barotrauma.Networking
|
|||||||
class ServerEntityEvent : NetEntityEvent
|
class ServerEntityEvent : NetEntityEvent
|
||||||
{
|
{
|
||||||
private IServerSerializable serializable;
|
private IServerSerializable serializable;
|
||||||
|
|
||||||
|
public bool Sent;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public string StackTrace;
|
public string StackTrace;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,14 +5,11 @@
|
|||||||
<Item file="Content/Items/Button/button.xml" />
|
<Item file="Content/Items/Button/button.xml" />
|
||||||
<Item file="Content/Items/Command/command.xml" />
|
<Item file="Content/Items/Command/command.xml" />
|
||||||
<Item file="Content/Items/Containers/containers.xml" />
|
<Item file="Content/Items/Containers/containers.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Captain/captain_gear.xml" />
|
<Item file="Content/Items/Jobgear/captaingear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Medic/medic_gear.xml" />
|
<Item file="Content/Items/Jobgear/doctorgear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Engineer/engineer_gear.xml" />
|
<Item file="Content/Items/Jobgear/engigear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Mechanic/mechanic_gear.xml" />
|
|
||||||
<Item file="Content/Items/Jobgear/Assistant/assistant_gear.xml" />
|
|
||||||
<Item file="Content/Items/Jobgear/Watchman/watchman_gear.xml" />
|
|
||||||
<Item file="Content/Items/Jobgear/Security/securityofficer_gear.xml" />
|
|
||||||
<Item file="Content/Items/Jobgear/misc.xml" />
|
<Item file="Content/Items/Jobgear/misc.xml" />
|
||||||
|
<Item file="Content/Items/Jobgear/securitygear.xml" />
|
||||||
<Item file="Content/Items/CreatureLoot/creatureloot.xml" />
|
<Item file="Content/Items/CreatureLoot/creatureloot.xml" />
|
||||||
<Item file="Content/Items/Diving/divinggear.xml" />
|
<Item file="Content/Items/Diving/divinggear.xml" />
|
||||||
<Item file="Content/Items/Door/doors.xml" />
|
<Item file="Content/Items/Door/doors.xml" />
|
||||||
|
|||||||
@@ -24,10 +24,6 @@
|
|||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Characters\Tigerthresher\Animations\" />
|
<Folder Include="$(MSBuildThisFileDirectory)Content\Characters\Tigerthresher\Animations\" />
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Characters\Watcher\Animations\" />
|
<Folder Include="$(MSBuildThisFileDirectory)Content\Characters\Watcher\Animations\" />
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\BackgroundCreatures\" />
|
<Folder Include="$(MSBuildThisFileDirectory)Content\BackgroundCreatures\" />
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\" />
|
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\" />
|
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\" />
|
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\" />
|
|
||||||
<Folder Include="$(MSBuildThisFileDirectory)Data\Saves\" />
|
<Folder Include="$(MSBuildThisFileDirectory)Data\Saves\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -361,81 +357,6 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Effects\waterbump.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Effects\waterbump.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Door\door2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Electricity\Lamps.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Electricity\LampsAdditive.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_gear.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_gear.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_legs_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_legs_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_torso_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_torso_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_gear.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_legs_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_legs_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_gear.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_legs_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_legs_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_legs_male_3.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_torso_female_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_torso_male_2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_torso_male_3.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\FinsA.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\FinsABack.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\LabelIcons.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\LabelLetters.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\1_CommandReactor\BaroTutorial_CommandReactor.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\1_CommandReactor\BaroTutorial_CommandReactor.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -670,94 +591,94 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\InventoryIconAtlas.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\InventoryIconAtlas.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\assistant_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\assistant_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\assistant_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\assistant_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\captain_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\captain_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\captain_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\captain_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\engineer_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\engineer_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\engineer_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\engineer_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\mechanic_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\mechanic_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\mechanic_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\mechanic_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\medic_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\medic_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\medic_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\medic_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\PortraitClothing.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\PortraitClothing.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securityofficer_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securityofficer_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securityofficer_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securityofficer_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securityofficer_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securityofficer_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securityofficer_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securityofficer_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\SecurityVest.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\SecurityVest.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_legs_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\watchman_legs_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_legs_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\watchman_legs_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_torso_female_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\watchman_torso_female.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_torso_male_1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\watchman_torso_male.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Materials\CraftingElements2.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Materials\CraftingElements2.png">
|
||||||
@@ -1380,7 +1301,7 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\MachineInterface.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\MachineInterface.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\riotgear.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\riotgear.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Reactor\graphLine.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Reactor\graphLine.png">
|
||||||
@@ -1647,7 +1568,7 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Labels\labels.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Labels\labels.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\captaingear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownmask.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownmask.png">
|
||||||
@@ -1659,7 +1580,10 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownshirt.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownshirt.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\doctorgear.xml">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\engigear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clothes.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clothes.png">
|
||||||
@@ -1668,10 +1592,10 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\misc.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\misc.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securitygear.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securitygear.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Security\securityofficer_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\securitygear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Ladder\ladder.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Ladder\ladder.png">
|
||||||
@@ -2004,27 +1928,6 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\Items\Weapons\ElectricalDischarger.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Items\Weapons\ElectricalDischarger.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore1.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore2.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore3.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore4.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore5.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore6.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Damage\Gore7.ogg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Impact\MetalImpactHeavy1.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Impact\MetalImpactHeavy1.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
partial class EnemyAIController : AIController
|
partial class EnemyAIController : AIController
|
||||||
{
|
{
|
||||||
public static bool DisableEnemyAI;
|
|
||||||
|
|
||||||
class WallTarget
|
class WallTarget
|
||||||
{
|
{
|
||||||
public Vector2 Position;
|
public Vector2 Position;
|
||||||
@@ -251,7 +249,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private TargetingPriority GetTargetingPriority(string targetTag)
|
public TargetingPriority GetTargetingPriority(string targetTag)
|
||||||
{
|
{
|
||||||
if (targetingPriorities.TryGetValue(targetTag, out TargetingPriority priority))
|
if (targetingPriorities.TryGetValue(targetTag, out TargetingPriority priority))
|
||||||
{
|
{
|
||||||
@@ -487,7 +485,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsProperlyLatchedOnSub)
|
if (!IsProperlyLatched)
|
||||||
{
|
{
|
||||||
UpdateWallTarget();
|
UpdateWallTarget();
|
||||||
}
|
}
|
||||||
@@ -1003,7 +1001,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void UpdateEating(float deltaTime)
|
private void UpdateEating(float deltaTime)
|
||||||
{
|
{
|
||||||
if (SelectedAiTarget == null) //SelectedAiTarget.Entity is Character c && !c.IsDead
|
if (SelectedAiTarget == null)
|
||||||
{
|
{
|
||||||
State = AIState.Idle;
|
State = AIState.Idle;
|
||||||
return;
|
return;
|
||||||
@@ -1040,14 +1038,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
#region Targeting
|
#region Targeting
|
||||||
|
|
||||||
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
private bool IsProperlyLatched => LatchOntoAI != null && LatchOntoAI.IsAttached && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
||||||
|
|
||||||
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
||||||
//whether the Character can see/hear the target and chooses the most preferable target within
|
//whether the Character can see/hear the target and chooses the most preferable target within
|
||||||
//sight/hearing range
|
//sight/hearing range
|
||||||
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
|
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
|
||||||
{
|
{
|
||||||
if (IsProperlyLatchedOnSub)
|
if (IsProperlyLatched)
|
||||||
{
|
{
|
||||||
// If attached to a valid target, just keep the target.
|
// If attached to a valid target, just keep the target.
|
||||||
// Priority not used in this case.
|
// Priority not used in this case.
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ namespace Barotrauma
|
|||||||
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
|
if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(newOrder, newOrder.FadeOutTime))
|
||||||
{
|
{
|
||||||
Character.Speak(
|
Character.Speak(
|
||||||
newOrder.GetChatMessage("", Character.CurrentHull?.DisplayName, givingOrderToSelf: false), ChatMessageType.Order);
|
newOrder.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: false), ChatMessageType.Order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,7 +286,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Character.PressureTimer > 50.0f && Character.CurrentHull != null)
|
if (Character.PressureTimer > 50.0f && Character.CurrentHull != null)
|
||||||
{
|
{
|
||||||
Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.DisplayName), null, 0, "pressure", 30.0f);
|
Character.Speak(TextManager.Get("DialogPressure").Replace("[roomname]", Character.CurrentHull.RoomName), null, 0, "pressure", 30.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -388,18 +388,6 @@ namespace Barotrauma
|
|||||||
buttonPressCooldown = ButtonPressInterval;
|
buttonPressCooldown = ButtonPressInterval;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!door.HasRequiredItems(character, false) && shouldBeOpen)
|
|
||||||
{
|
|
||||||
currentPath.Unreachable = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
door.Item.TryInteract(character, false, true, true);
|
|
||||||
buttonPressCooldown = ButtonPressInterval;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,12 +414,20 @@ namespace Barotrauma
|
|||||||
if (!nextNode.Waypoint.ConnectedDoor.HasRequiredItems(character, false)) { return null; }
|
if (!nextNode.Waypoint.ConnectedDoor.HasRequiredItems(character, false)) { return null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!canBreakDoors)
|
||||||
|
{
|
||||||
|
//door closed and the character can't open doors -> node can't be traversed
|
||||||
|
if (!canOpenDoors || character.LockHands) return null;
|
||||||
|
|
||||||
|
var doorButtons = nextNode.Waypoint.ConnectedDoor.Item.GetConnectedComponents<Controller>();
|
||||||
|
if (!doorButtons.Any()) return null;
|
||||||
|
|
||||||
foreach (Controller button in doorButtons)
|
foreach (Controller button in doorButtons)
|
||||||
{
|
{
|
||||||
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) !=
|
||||||
Math.Sign(node.Position.X - nextNode.Position.X)) { continue; }
|
Math.Sign(node.Position.X - nextNode.Position.X)) continue;
|
||||||
|
|
||||||
if (!button.HasRequiredItems(character, false)) { return null; }
|
if (!button.HasRequiredItems(character, false)) return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,8 +54,6 @@ namespace Barotrauma
|
|||||||
get { return attachJoints.Count > 0; }
|
get { return attachJoints.Count > 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsAttachedToSub => IsAttached && attachTargetBody?.UserData is Entity entity && (entity is Submarine sub || entity?.Submarine != null);
|
|
||||||
|
|
||||||
public LatchOntoAI(XElement element, EnemyAIController enemyAI)
|
public LatchOntoAI(XElement element, EnemyAIController enemyAI)
|
||||||
{
|
{
|
||||||
attachToWalls = element.GetAttributeBool("attachtowalls", false);
|
attachToWalls = element.GetAttributeBool("attachtowalls", false);
|
||||||
@@ -209,10 +207,10 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAttached && attachTargetBody != null && deattachTimer < 0.0f)
|
if (attachTargetBody != null && deattachTimer < 0.0f)
|
||||||
{
|
{
|
||||||
Entity entity = attachTargetBody.UserData as Entity;
|
Entity entity = attachTargetBody.UserData as Entity;
|
||||||
Submarine attachedSub = entity is Submarine sub ? sub : entity?.Submarine;
|
Submarine attachedSub = entity is Submarine ? (Submarine)entity : entity?.Submarine;
|
||||||
if (attachedSub != null)
|
if (attachedSub != null)
|
||||||
{
|
{
|
||||||
float velocity = attachedSub.Velocity == Vector2.Zero ? 0.0f : attachedSub.Velocity.Length();
|
float velocity = attachedSub.Velocity == Vector2.Zero ? 0.0f : attachedSub.Velocity.Length();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ namespace Barotrauma
|
|||||||
private AIObjectiveContainItem reloadWeaponObjective;
|
private AIObjectiveContainItem reloadWeaponObjective;
|
||||||
private Hull retreatTarget;
|
private Hull retreatTarget;
|
||||||
private AIObjectiveGoTo retreatObjective;
|
private AIObjectiveGoTo retreatObjective;
|
||||||
private AIObjectiveFindSafety findSafety;
|
|
||||||
|
|
||||||
private float coolDownTimer;
|
private float coolDownTimer;
|
||||||
|
|
||||||
@@ -61,9 +60,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Enemy = enemy;
|
Enemy = enemy;
|
||||||
coolDownTimer = CoolDown;
|
coolDownTimer = CoolDown;
|
||||||
findSafety = HumanAIController.ObjectiveManager.GetObjective<AIObjectiveFindSafety>();
|
HumanAIController.ObjectiveManager.GetObjective<AIObjectiveFindSafety>().Priority = 0;
|
||||||
findSafety.Priority = 0;
|
|
||||||
findSafety.unreachable.Clear();
|
|
||||||
Mode = mode;
|
Mode = mode;
|
||||||
if (Enemy == null)
|
if (Enemy == null)
|
||||||
{
|
{
|
||||||
@@ -178,7 +175,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (retreatTarget == null || (retreatObjective != null && !retreatObjective.CanBeCompleted))
|
if (retreatTarget == null || (retreatObjective != null && !retreatObjective.CanBeCompleted))
|
||||||
{
|
{
|
||||||
retreatTarget = findSafety.FindBestHull(new List<Hull>() { character.CurrentHull });
|
retreatTarget = HumanAIController.ObjectiveManager.GetObjective<AIObjectiveFindSafety>().FindBestHull(new List<Hull>() { character.CurrentHull });
|
||||||
}
|
}
|
||||||
if (retreatTarget != null)
|
if (retreatTarget != null)
|
||||||
{
|
{
|
||||||
@@ -238,7 +235,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Vector2.DistanceSquared(character.Position, Enemy.Position) <= meleeWeapon.Range * meleeWeapon.Range)
|
if (Vector2.DistanceSquared(character.Position, Enemy.Position) <= meleeWeapon.Range * meleeWeapon.Range)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Shoot, false, true);
|
|
||||||
Weapon.Use(deltaTime, character);
|
Weapon.Use(deltaTime, character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -268,7 +264,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (target != null && target == Enemy)
|
if (target != null && target == Enemy)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Shoot, false, true);
|
|
||||||
Weapon.Use(deltaTime, character);
|
Weapon.Use(deltaTime, character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,6 +275,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
abandon = true;
|
abandon = true;
|
||||||
SteeringManager.Reset();
|
SteeringManager.Reset();
|
||||||
|
//HumanAIController.ObjectiveManager.GetObjective<AIObjectiveFindSafety>().Priority = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsCompleted()
|
public override bool IsCompleted()
|
||||||
|
|||||||
+6
-17
@@ -18,7 +18,7 @@ namespace Barotrauma
|
|||||||
const float SearchHullInterval = 3.0f;
|
const float SearchHullInterval = 3.0f;
|
||||||
const float clearUnreachableInterval = 30;
|
const float clearUnreachableInterval = 30;
|
||||||
|
|
||||||
public readonly List<Hull> unreachable = new List<Hull>();
|
private List<Hull> unreachable = new List<Hull>();
|
||||||
|
|
||||||
private float currenthullSafety;
|
private float currenthullSafety;
|
||||||
private float unreachableClearTimer;
|
private float unreachableClearTimer;
|
||||||
@@ -60,16 +60,11 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
divingGearObjective = null;
|
divingGearObjective = null;
|
||||||
// Reduce the timer so that we get a safe hull target faster.
|
// Reset the timer so that we get a safe hull target.
|
||||||
searchHullTimer = Math.Min(1, searchHullTimer);
|
searchHullTimer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD)
|
|
||||||
{
|
|
||||||
searchHullTimer = Math.Min(1, searchHullTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unreachableClearTimer > 0)
|
if (unreachableClearTimer > 0)
|
||||||
{
|
{
|
||||||
unreachableClearTimer -= deltaTime;
|
unreachableClearTimer -= deltaTime;
|
||||||
@@ -84,7 +79,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
searchHullTimer -= deltaTime;
|
searchHullTimer -= deltaTime;
|
||||||
}
|
}
|
||||||
else
|
else if (currenthullSafety < HumanAIController.HULL_SAFETY_THRESHOLD)
|
||||||
{
|
{
|
||||||
var bestHull = FindBestHull();
|
var bestHull = FindBestHull();
|
||||||
if (bestHull != null && bestHull != currentHull)
|
if (bestHull != null && bestHull != currentHull)
|
||||||
@@ -193,17 +188,10 @@ namespace Barotrauma
|
|||||||
float dist = Math.Abs(character.WorldPosition.X - hull.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - hull.WorldPosition.Y) * 2.0f;
|
float dist = Math.Abs(character.WorldPosition.X - hull.WorldPosition.X) + Math.Abs(character.WorldPosition.Y - hull.WorldPosition.Y) * 2.0f;
|
||||||
float distanceFactor = MathHelper.Lerp(1, 0.9f, MathUtils.InverseLerp(0, 10000, dist));
|
float distanceFactor = MathHelper.Lerp(1, 0.9f, MathUtils.InverseLerp(0, 10000, dist));
|
||||||
hullSafety *= distanceFactor;
|
hullSafety *= distanceFactor;
|
||||||
//skip the hull if the safety is already less than the best hull
|
|
||||||
//(no need to do the expensive pathfinding if we already know we're not going to choose this hull)
|
|
||||||
if (hullSafety < bestValue) { continue; }
|
|
||||||
// Each unsafe node reduces the hull safety value.
|
// Each unsafe node reduces the hull safety value.
|
||||||
// Ignore current hull, because otherwise the would block all paths from the current hull to the target hull.
|
// Ignore current hull, because otherwise the would block all paths from the current hull to the target hull.
|
||||||
var path = PathSteering.PathFinder.FindPath(character.SimPosition, hull.SimPosition);
|
var path = PathSteering.PathFinder.FindPath(character.SimPosition, hull.SimPosition);
|
||||||
if (path.Unreachable)
|
if (path.Unreachable) { continue; }
|
||||||
{
|
|
||||||
unreachable.Add(hull);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int unsafeNodes = path.Nodes.Count(n => n.CurrentHull != character.CurrentHull && HumanAIController.UnsafeHulls.Contains(n.CurrentHull));
|
int unsafeNodes = path.Nodes.Count(n => n.CurrentHull != character.CurrentHull && HumanAIController.UnsafeHulls.Contains(n.CurrentHull));
|
||||||
hullSafety /= 1 + unsafeNodes;
|
hullSafety /= 1 + unsafeNodes;
|
||||||
// If the target is not inside a friendly submarine, considerably reduce the hull safety.
|
// If the target is not inside a friendly submarine, considerably reduce the hull safety.
|
||||||
@@ -231,6 +219,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Huge preference for closer targets
|
// Huge preference for closer targets
|
||||||
float distance = Vector2.DistanceSquared(character.WorldPosition, hull.WorldPosition);
|
float distance = Vector2.DistanceSquared(character.WorldPosition, hull.WorldPosition);
|
||||||
float distanceFactor = MathHelper.Lerp(1, 0.2f, MathUtils.InverseLerp(0, MathUtils.Pow(100000, 2), distance));
|
float distanceFactor = MathHelper.Lerp(1, 0.2f, MathUtils.InverseLerp(0, MathUtils.Pow(100000, 2), distance));
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ namespace Barotrauma
|
|||||||
private float standStillTimer;
|
private float standStillTimer;
|
||||||
private float walkDuration;
|
private float walkDuration;
|
||||||
|
|
||||||
private readonly List<Hull> targetHulls = new List<Hull>(20);
|
|
||||||
private readonly List<float> hullWeights = new List<float>(20);
|
|
||||||
|
|
||||||
public AIObjectiveIdle(Character character) : base(character, "")
|
public AIObjectiveIdle(Character character) : base(character, "")
|
||||||
{
|
{
|
||||||
standStillTimer = Rand.Range(-10.0f, 10.0f);
|
standStillTimer = Rand.Range(-10.0f, 10.0f);
|
||||||
@@ -109,7 +106,7 @@ namespace Barotrauma
|
|||||||
if (isCurrentHullOK)
|
if (isCurrentHullOK)
|
||||||
{
|
{
|
||||||
// Check that there is no unsafe or forbidden hulls on the way to the target
|
// Check that there is no unsafe or forbidden hulls on the way to the target
|
||||||
// Only do this when the current hull is ok, because otherwise would block all paths from the current hull to the target hull.
|
// Only do this when the current hull is ok, because otherwise the would block all paths from the current hull to the target hull.
|
||||||
var path = PathSteering.PathFinder.FindPath(character.SimPosition, randomHull.SimPosition);
|
var path = PathSteering.PathFinder.FindPath(character.SimPosition, randomHull.SimPosition);
|
||||||
if (path.Unreachable ||
|
if (path.Unreachable ||
|
||||||
path.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull) || IsForbidden(n.CurrentHull)))
|
path.Nodes.Any(n => HumanAIController.UnsafeHulls.Contains(n.CurrentHull) || IsForbidden(n.CurrentHull)))
|
||||||
@@ -131,8 +128,8 @@ namespace Barotrauma
|
|||||||
character.AIController.SelectTarget(currentTarget.AiTarget);
|
character.AIController.SelectTarget(currentTarget.AiTarget);
|
||||||
string errorMsg = null;
|
string errorMsg = null;
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
bool isRoomNameFound = currentTarget.DisplayName != null;
|
bool isRoomNameFound = currentTarget.RoomName != null;
|
||||||
errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.DisplayName : currentTarget.ToString()) + ")";
|
errorMsg = "(Character " + character.Name + " idling, target " + (isRoomNameFound ? currentTarget.RoomName : currentTarget.ToString()) + ")";
|
||||||
#endif
|
#endif
|
||||||
var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg);
|
var path = PathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition, errorMsg);
|
||||||
PathSteering.SetPath(path);
|
PathSteering.SetPath(path);
|
||||||
@@ -233,9 +230,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly List<Hull> targetHulls = new List<Hull>(20);
|
||||||
|
private readonly List<float> hullWeights = new List<float>(20);
|
||||||
|
|
||||||
private void FindTargetHulls()
|
private void FindTargetHulls()
|
||||||
{
|
{
|
||||||
bool isCurrentHullOK = !HumanAIController.UnsafeHulls.Contains(character.CurrentHull) && !IsForbidden(character.CurrentHull);
|
bool isCurrentHullOK = !HumanAIController.UnsafeHulls.Contains(character.CurrentHull) && !IsForbidden(character.CurrentHull);
|
||||||
|
|
||||||
targetHulls.Clear();
|
targetHulls.Clear();
|
||||||
hullWeights.Clear();
|
hullWeights.Clear();
|
||||||
foreach (var hull in Hull.hullList)
|
foreach (var hull in Hull.hullList)
|
||||||
@@ -265,6 +266,7 @@ namespace Barotrauma
|
|||||||
hullWeights.Add(weight);
|
hullWeights.Add(weight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsForbidden(Hull hull)
|
private bool IsForbidden(Hull hull)
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Barotrauma
|
|||||||
if (character.SelectedCharacter == null)
|
if (character.SelectedCharacter == null)
|
||||||
{
|
{
|
||||||
character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget")
|
character?.Speak(TextManager.Get("DialogFoundUnconsciousTarget")
|
||||||
.Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.DisplayName),
|
.Replace("[targetname]", targetCharacter.Name).Replace("[roomname]", character.CurrentHull.RoomName),
|
||||||
null, 1.0f,
|
null, 1.0f,
|
||||||
"foundunconscioustarget" + targetCharacter.Name, 60.0f);
|
"foundunconscioustarget" + targetCharacter.Name, 60.0f);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -527,12 +527,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Limb leftLeg = GetLimb(LimbType.LeftLeg);
|
Limb leftLeg = GetLimb(LimbType.LeftLeg);
|
||||||
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
Limb rightLeg = GetLimb(LimbType.RightLeg);
|
||||||
|
|
||||||
float limpAmount =
|
|
||||||
character.CharacterHealth.GetAfflictionStrength("damage", leftFoot, true) +
|
|
||||||
character.CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
|
||||||
limpAmount = MathHelper.Clamp(limpAmount / 100.0f, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
float walkCycleMultiplier = 1.0f;
|
float walkCycleMultiplier = 1.0f;
|
||||||
if (Stairs != null)
|
if (Stairs != null)
|
||||||
{
|
{
|
||||||
@@ -561,17 +556,13 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
Vector2 stepSize = StepSize.Value;
|
Vector2 stepSize = StepSize.Value;
|
||||||
stepSize.X *= walkPosX;
|
stepSize.X *= walkPosX;
|
||||||
stepSize.Y *= walkPosY;
|
stepSize.Y *= walkPosY;
|
||||||
|
|
||||||
float footMid = colliderPos.X;
|
float footMid = colliderPos.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
|
||||||
if (limpAmount > 0.0f)
|
|
||||||
{
|
|
||||||
//make the footpos oscillate when limping
|
|
||||||
footMid += ((float)Math.Max(Math.Abs(walkPosX) * limpAmount, 0.0f) * 0.3f);
|
|
||||||
}
|
|
||||||
|
|
||||||
movement = overrideTargetMovement == Vector2.Zero ?
|
movement = overrideTargetMovement == Vector2.Zero ?
|
||||||
MathUtils.SmoothStep(movement, TargetMovement, movementLerp) :
|
MathUtils.SmoothStep(movement, TargetMovement, movementLerp) :
|
||||||
@@ -585,7 +576,7 @@ namespace Barotrauma
|
|||||||
movement.Y = 0.0f;
|
movement.Y = 0.0f;
|
||||||
|
|
||||||
if (torso == null) { return; }
|
if (torso == null) { return; }
|
||||||
|
|
||||||
bool isNotRemote = true;
|
bool isNotRemote = true;
|
||||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer;
|
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient) isNotRemote = !character.IsRemotePlayer;
|
||||||
|
|
||||||
@@ -689,7 +680,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//make the character limp if the feet are damaged
|
//make the character limp if the feet are damaged
|
||||||
float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true);
|
float footAfflictionStrength = character.CharacterHealth.GetAfflictionStrength("damage", foot, true);
|
||||||
footPos.X *= MathHelper.Lerp(1.0f, 0.75f, MathHelper.Clamp(footAfflictionStrength / 50.0f, 0.0f, 1.0f));
|
footPos *= MathHelper.Lerp(1.0f, 0.5f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
||||||
|
|
||||||
if (onSlope && Stairs == null)
|
if (onSlope && Stairs == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-1
@@ -84,7 +84,6 @@ namespace Barotrauma
|
|||||||
var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
|
var folder = XMLExtensions.TryLoadXml(Character.GetConfigFile(speciesName))?.Root?.Element("ragdolls")?.GetAttributeString("folder", string.Empty);
|
||||||
if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default")
|
if (string.IsNullOrEmpty(folder) || folder.ToLowerInvariant() == "default")
|
||||||
{
|
{
|
||||||
//DebugConsole.NewMessage("[RagollParams] Using the default folder.");
|
|
||||||
folder = GetDefaultFolder(speciesName);
|
folder = GetDefaultFolder(speciesName);
|
||||||
}
|
}
|
||||||
return folder;
|
return folder;
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ namespace Barotrauma
|
|||||||
ImpactProjSpecific(impact, f1.Body);
|
ImpactProjSpecific(impact, f1.Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SeverLimbJoint(LimbJoint limbJoint, bool playSound = true)
|
public void SeverLimbJoint(LimbJoint limbJoint)
|
||||||
{
|
{
|
||||||
if (!limbJoint.CanBeSevered || limbJoint.IsSevered)
|
if (!limbJoint.CanBeSevered || limbJoint.IsSevered)
|
||||||
{
|
{
|
||||||
@@ -721,7 +721,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true);
|
partial void SeverLimbJointProjSpecific(LimbJoint limbJoint);
|
||||||
|
|
||||||
private void GetConnectedLimbs(List<Limb> connectedLimbs, List<LimbJoint> checkedJoints, Limb limb)
|
private void GetConnectedLimbs(List<Limb> connectedLimbs, List<LimbJoint> checkedJoints, Limb limb)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1103,14 +1103,14 @@ namespace Barotrauma
|
|||||||
if (leftFoot != null)
|
if (leftFoot != null)
|
||||||
{
|
{
|
||||||
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true);
|
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", leftFoot, true);
|
||||||
speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
|
speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
|
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
|
||||||
if (rightFoot != null)
|
if (rightFoot != null)
|
||||||
{
|
{
|
||||||
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
||||||
speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
|
speed *= MathHelper.Lerp(1.0f, 0.25f, MathHelper.Clamp(footAfflictionStrength / 100.0f, 0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
|
|||||||
@@ -231,8 +231,7 @@ namespace Barotrauma
|
|||||||
: afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter)));
|
: afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private LimbHealth GetMatchingLimbHealth(Limb limb) => limbHealths[limb.HealthIndex];
|
private LimbHealth GetMathingLimbHealth(Affliction affliction) => limbHealths[Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb).HealthIndex];
|
||||||
private LimbHealth GetMathingLimbHealth(Affliction affliction) => GetMatchingLimbHealth(Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb));
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb.
|
/// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb.
|
||||||
|
|||||||
@@ -255,10 +255,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
commands.Add(new Command("disablecrewai", "disablecrewai: Disable the AI of the NPCs in the crew.", (string[] args) =>
|
commands.Add(new Command("disablecrewai", "disablecrewai: Disable the AI of the NPCs in the crew.", (string[] args) =>
|
||||||
{
|
{
|
||||||
HumanAIController.DisableCrewAI = true;
|
ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma.");
|
||||||
NewMessage("Crew AI disabled", Color.Red);
|
return;
|
||||||
// This is probably not where it should be?
|
|
||||||
//ThrowError("Karma has not been fully implemented yet, and is disabled in this version of Barotrauma.");
|
|
||||||
/*if (GameMain.Server == null) return;
|
/*if (GameMain.Server == null) return;
|
||||||
GameMain.Server.KarmaEnabled = !GameMain.Server.KarmaEnabled;*/
|
GameMain.Server.KarmaEnabled = !GameMain.Server.KarmaEnabled;*/
|
||||||
}));
|
}));
|
||||||
@@ -266,19 +264,7 @@ namespace Barotrauma
|
|||||||
commands.Add(new Command("enablecrewai", "enablecrewai: Enable the AI of the NPCs in the crew.", (string[] args) =>
|
commands.Add(new Command("enablecrewai", "enablecrewai: Enable the AI of the NPCs in the crew.", (string[] args) =>
|
||||||
{
|
{
|
||||||
HumanAIController.DisableCrewAI = false;
|
HumanAIController.DisableCrewAI = false;
|
||||||
NewMessage("Crew AI enabled", Color.Green);
|
NewMessage("Crew AI enabled", Color.White);
|
||||||
}, isCheat: true));
|
|
||||||
|
|
||||||
commands.Add(new Command("disableenemyai", "disableenemyai: Disable the AI of the Enemy characters (monsters).", (string[] args) =>
|
|
||||||
{
|
|
||||||
EnemyAIController.DisableEnemyAI = true;
|
|
||||||
NewMessage("Enemy AI disabled", Color.Red);
|
|
||||||
}, isCheat: true));
|
|
||||||
|
|
||||||
commands.Add(new Command("enableenemyai", "enableenemyai: Enable the AI of the Enemy characters (monsters).", (string[] args) =>
|
|
||||||
{
|
|
||||||
EnemyAIController.DisableEnemyAI = false;
|
|
||||||
NewMessage("Enemy AI enabled", Color.Green);
|
|
||||||
}, isCheat: true));
|
}, isCheat: true));
|
||||||
|
|
||||||
commands.Add(new Command("botcount", "botcount [x]: Set the number of bots in the crew in multiplayer.", null));
|
commands.Add(new Command("botcount", "botcount [x]: Set the number of bots in the crew in multiplayer.", null));
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//isActive = false;
|
//isActive = false;
|
||||||
|
|
||||||
bool spawnReady = false;
|
|
||||||
if (spawnPending)
|
if (spawnPending)
|
||||||
{
|
{
|
||||||
//wait until there are no submarines at the spawnpos
|
//wait until there are no submarines at the spawnpos
|
||||||
@@ -220,30 +219,24 @@ namespace Barotrauma
|
|||||||
if (Vector2.DistanceSquared(submarine.WorldPosition, spawnPos) < minDist * minDist) return;
|
if (Vector2.DistanceSquared(submarine.WorldPosition, spawnPos) < minDist * minDist) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnPending = false;
|
|
||||||
|
|
||||||
//+1 because Range returns an integer less than the max value
|
//+1 because Range returns an integer less than the max value
|
||||||
int amount = Rand.Range(minAmount, maxAmount + 1, Rand.RandSync.Server);
|
int amount = Rand.Range(minAmount, maxAmount + 1, Rand.RandSync.Server);
|
||||||
monsters = new List<Character>();
|
monsters = new Character[amount];
|
||||||
float offsetAmount = spawnPosType == Level.PositionType.MainPath ? 1000 : 100;
|
|
||||||
for (int i = 0; i < amount; i++)
|
|
||||||
{
|
|
||||||
CoroutineManager.InvokeAfter(() =>
|
|
||||||
{
|
|
||||||
bool isClient = false;
|
|
||||||
#if CLIENT
|
|
||||||
isClient = GameMain.Client != null;
|
|
||||||
#endif
|
|
||||||
monsters.Add(Character.Create(characterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true));
|
|
||||||
if (monsters.Count == amount)
|
|
||||||
{
|
|
||||||
spawnReady = true;
|
|
||||||
}
|
|
||||||
}, Rand.Range(0f, amount / 2, Rand.RandSync.Server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!spawnReady) { return; }
|
for (int i = 0; i < amount; i++)
|
||||||
|
{
|
||||||
|
bool isClient = false;
|
||||||
|
#if CLIENT
|
||||||
|
isClient = GameMain.Client != null;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
monsters[i] = Character.Create(
|
||||||
|
characterFile, spawnPos + Rand.Vector(100.0f, Rand.RandSync.Server),
|
||||||
|
i.ToString(), null, isClient, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnPending = false;
|
||||||
|
}
|
||||||
|
|
||||||
Entity targetEntity = Submarine.FindClosest(GameMain.GameScreen.Cam.WorldViewCenter);
|
Entity targetEntity = Submarine.FindClosest(GameMain.GameScreen.Cam.WorldViewCenter);
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
|||||||
@@ -8,22 +8,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public static class StringFormatter
|
public static class StringFormatter
|
||||||
{
|
{
|
||||||
public static string Replace(this string s, string replacement, Func<char, bool> predicate)
|
|
||||||
{
|
|
||||||
var newString = new string[s.Length];
|
|
||||||
for (int i = 0; i < s.Length; i++)
|
|
||||||
{
|
|
||||||
char letter = s[i];
|
|
||||||
string newLetter = letter.ToString();
|
|
||||||
if (predicate(letter))
|
|
||||||
{
|
|
||||||
newLetter = replacement;
|
|
||||||
}
|
|
||||||
newString[i] = newLetter;
|
|
||||||
}
|
|
||||||
return new string(newString.SelectMany(str => str.ToCharArray()).ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string Remove(this string s, Func<char, bool> predicate)
|
public static string Remove(this string s, Func<char, bool> predicate)
|
||||||
{
|
{
|
||||||
return new string(s.ToCharArray().Where(c => !predicate(c)).ToArray());
|
return new string(s.ToCharArray().Where(c => !predicate(c)).ToArray());
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.DisplayName));
|
new GUIMessageBox("", TextManager.Get("CargoSpawnNotification").Replace("[roomname]", cargoRoom.RoomName));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>();
|
Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ namespace Barotrauma
|
|||||||
public bool CheatsEnabled;
|
public bool CheatsEnabled;
|
||||||
|
|
||||||
const int InitialMoney = 4700;
|
const int InitialMoney = 4700;
|
||||||
public const int HullRepairCost = 500, ItemRepairCost = 500;
|
|
||||||
|
|
||||||
protected bool watchmenSpawned;
|
protected bool watchmenSpawned;
|
||||||
protected Character startWatchman, endWatchman;
|
protected Character startWatchman, endWatchman;
|
||||||
@@ -21,8 +20,6 @@ namespace Barotrauma
|
|||||||
//key = dialog flag, double = Timing.TotalTime when the line was last said
|
//key = dialog flag, double = Timing.TotalTime when the line was last said
|
||||||
private Dictionary<string, double> dialogLastSpoken = new Dictionary<string, double>();
|
private Dictionary<string, double> dialogLastSpoken = new Dictionary<string, double>();
|
||||||
|
|
||||||
public bool PurchasedHullRepairs, PurchasedItemRepairs;
|
|
||||||
|
|
||||||
protected Map map;
|
protected Map map;
|
||||||
public Map Map
|
public Map Map
|
||||||
{
|
{
|
||||||
@@ -73,37 +70,6 @@ namespace Barotrauma
|
|||||||
watchmenSpawned = false;
|
watchmenSpawned = false;
|
||||||
startWatchman = null;
|
startWatchman = null;
|
||||||
endWatchman = null;
|
endWatchman = null;
|
||||||
|
|
||||||
if (PurchasedHullRepairs)
|
|
||||||
{
|
|
||||||
foreach (Structure wall in Structure.WallList)
|
|
||||||
{
|
|
||||||
if (wall.Submarine == null || wall.Submarine.IsOutpost) { continue; }
|
|
||||||
if (wall.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(wall.Submarine))
|
|
||||||
{
|
|
||||||
for (int i = 0; i < wall.SectionCount; i++)
|
|
||||||
{
|
|
||||||
wall.AddDamage(i, -100000.0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PurchasedHullRepairs = false;
|
|
||||||
}
|
|
||||||
if (PurchasedItemRepairs)
|
|
||||||
{
|
|
||||||
foreach (Item item in Item.ItemList)
|
|
||||||
{
|
|
||||||
if (item.Submarine == null || item.Submarine.IsOutpost) { continue; }
|
|
||||||
if (item.Submarine == Submarine.MainSub || Submarine.MainSub.DockedTo.Contains(item.Submarine))
|
|
||||||
{
|
|
||||||
if (item.GetComponent<Items.Components.Repairable>() != null)
|
|
||||||
{
|
|
||||||
item.Condition = item.Health;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PurchasedItemRepairs = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ namespace Barotrauma
|
|||||||
public bool ChromaticAberrationEnabled { get; set; }
|
public bool ChromaticAberrationEnabled { get; set; }
|
||||||
|
|
||||||
public bool MuteOnFocusLost { get; set; }
|
public bool MuteOnFocusLost { get; set; }
|
||||||
public bool UseDirectionalVoiceChat { get; set; }
|
|
||||||
|
|
||||||
public enum VoiceMode
|
public enum VoiceMode
|
||||||
{
|
{
|
||||||
@@ -150,9 +149,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public bool EnableMouseLook { get; set; } = true;
|
public bool EnableMouseLook { get; set; } = true;
|
||||||
|
|
||||||
public bool CrewMenuOpen { get; set; } = true;
|
|
||||||
public bool ChatOpen { get; set; } = true;
|
|
||||||
|
|
||||||
private bool unsavedSettings;
|
private bool unsavedSettings;
|
||||||
public bool UnsavedSettings
|
public bool UnsavedSettings
|
||||||
{
|
{
|
||||||
@@ -830,8 +826,6 @@ namespace Barotrauma
|
|||||||
SoundVolume = audioSettings.GetAttributeFloat("soundvolume", SoundVolume);
|
SoundVolume = audioSettings.GetAttributeFloat("soundvolume", SoundVolume);
|
||||||
MusicVolume = audioSettings.GetAttributeFloat("musicvolume", MusicVolume);
|
MusicVolume = audioSettings.GetAttributeFloat("musicvolume", MusicVolume);
|
||||||
VoiceChatVolume = audioSettings.GetAttributeFloat("voicechatvolume", VoiceChatVolume);
|
VoiceChatVolume = audioSettings.GetAttributeFloat("voicechatvolume", VoiceChatVolume);
|
||||||
MuteOnFocusLost = audioSettings.GetAttributeBool("muteonfocuslost", false);
|
|
||||||
UseDirectionalVoiceChat = audioSettings.GetAttributeBool("usedirectionalvoicechat", true);
|
|
||||||
string voiceSettingStr = audioSettings.GetAttributeString("voicesetting", "Disabled");
|
string voiceSettingStr = audioSettings.GetAttributeString("voicesetting", "Disabled");
|
||||||
VoiceCaptureDevice = audioSettings.GetAttributeString("voicecapturedevice", "");
|
VoiceCaptureDevice = audioSettings.GetAttributeString("voicecapturedevice", "");
|
||||||
NoiseGateThreshold = audioSettings.GetAttributeFloat("noisegatethreshold", -45);
|
NoiseGateThreshold = audioSettings.GetAttributeFloat("noisegatethreshold", -45);
|
||||||
@@ -850,9 +844,6 @@ namespace Barotrauma
|
|||||||
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
||||||
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
||||||
|
|
||||||
CrewMenuOpen = doc.Root.GetAttributeBool("crewmenuopen", CrewMenuOpen);
|
|
||||||
ChatOpen = doc.Root.GetAttributeBool("chatopen", ChatOpen);
|
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
@@ -1028,9 +1019,7 @@ namespace Barotrauma
|
|||||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||||
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
||||||
new XAttribute("aimassistamount", aimAssistAmount),
|
new XAttribute("aimassistamount", aimAssistAmount),
|
||||||
new XAttribute("enablemouselook", EnableMouseLook),
|
new XAttribute("enablemouselook", EnableMouseLook));
|
||||||
new XAttribute("chatopen", ChatOpen),
|
|
||||||
new XAttribute("crewmenuopen", CrewMenuOpen));
|
|
||||||
|
|
||||||
if (!ShowUserStatisticsPrompt)
|
if (!ShowUserStatisticsPrompt)
|
||||||
{
|
{
|
||||||
@@ -1066,8 +1055,6 @@ namespace Barotrauma
|
|||||||
audio.ReplaceAttributes(
|
audio.ReplaceAttributes(
|
||||||
new XAttribute("musicvolume", musicVolume),
|
new XAttribute("musicvolume", musicVolume),
|
||||||
new XAttribute("soundvolume", soundVolume),
|
new XAttribute("soundvolume", soundVolume),
|
||||||
new XAttribute("muteonfocuslost", MuteOnFocusLost),
|
|
||||||
new XAttribute("usedirectionalvoicechat", UseDirectionalVoiceChat),
|
|
||||||
new XAttribute("voicesetting", VoiceSetting),
|
new XAttribute("voicesetting", VoiceSetting),
|
||||||
new XAttribute("voicecapturedevice", VoiceCaptureDevice ?? ""),
|
new XAttribute("voicecapturedevice", VoiceCaptureDevice ?? ""),
|
||||||
new XAttribute("noisegatethreshold", NoiseGateThreshold));
|
new XAttribute("noisegatethreshold", NoiseGateThreshold));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Barotrauma
|
|||||||
switch (SlotTypes[i])
|
switch (SlotTypes[i])
|
||||||
{
|
{
|
||||||
//case InvSlotType.Head:
|
//case InvSlotType.Head:
|
||||||
//case InvSlotType.OuterClothes:
|
case InvSlotType.OuterClothes:
|
||||||
case InvSlotType.LeftHand:
|
case InvSlotType.LeftHand:
|
||||||
case InvSlotType.RightHand:
|
case InvSlotType.RightHand:
|
||||||
hideEmptySlot[i] = true;
|
hideEmptySlot[i] = true;
|
||||||
@@ -176,9 +176,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
|
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
|
|
||||||
#endif
|
|
||||||
if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List<InvSlotType> { InvSlotType.Any }, true))
|
if (!Items[i].AllowedSlots.Contains(InvSlotType.Any) || !TryPutItem(Items[i], character, new List<InvSlotType> { InvSlotType.Any }, true))
|
||||||
{
|
{
|
||||||
free = false;
|
free = false;
|
||||||
@@ -198,9 +195,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null)
|
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] == null)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[i])) { hidePersonalSlots = false; }
|
|
||||||
#endif
|
|
||||||
bool removeFromOtherSlots = item.ParentInventory != this;
|
bool removeFromOtherSlots = item.ParentInventory != this;
|
||||||
if (placedInSlot == -1 && inWrongSlot)
|
if (placedInSlot == -1 && inWrongSlot)
|
||||||
{
|
{
|
||||||
@@ -254,9 +248,7 @@ namespace Barotrauma
|
|||||||
GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("CharacterInventory.TryPutItem:IndexOutOfRange", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#if CLIENT
|
|
||||||
if (PersonalSlots.HasFlag(SlotTypes[index])) { hidePersonalSlots = false; }
|
|
||||||
#endif
|
|
||||||
//there's already an item in the slot
|
//there's already an item in the slot
|
||||||
if (Items[index] != null)
|
if (Items[index] != null)
|
||||||
{
|
{
|
||||||
@@ -281,9 +273,7 @@ namespace Barotrauma
|
|||||||
foreach (InvSlotType allowedSlot in allowedSlots)
|
foreach (InvSlotType allowedSlot in allowedSlots)
|
||||||
{
|
{
|
||||||
if (!allowedSlot.HasFlag(SlotTypes[index])) continue;
|
if (!allowedSlot.HasFlag(SlotTypes[index])) continue;
|
||||||
#if CLIENT
|
|
||||||
if (PersonalSlots.HasFlag(allowedSlot)) { hidePersonalSlots = false; }
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
|
if (allowedSlot.HasFlag(SlotTypes[i]) && Items[i] != null && Items[i] != item)
|
||||||
|
|||||||
@@ -221,64 +221,29 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) return true; //For repairing
|
if (item.Condition <= RepairThreshold) return true; //For repairing
|
||||||
|
|
||||||
var idCard = character.Inventory.FindItemByIdentifier("idcard");
|
|
||||||
hasValidIdCard = requiredItems.Any(ri => ri.Value.Any(r => r.MatchesItem(idCard)));
|
|
||||||
Msg = requiredItems.None() || hasValidIdCard ? "ItemMsgOpen" : "ItemMsgForceOpenCrowbar";
|
|
||||||
ParseMsg();
|
|
||||||
if (addMessage)
|
|
||||||
{
|
|
||||||
msg = msg ?? (HasIntegratedButtons ? accessDeniedTxt : cannotOpenText);
|
|
||||||
}
|
|
||||||
|
|
||||||
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
|
//this is a bit pointless atm because if canBePicked is false it won't allow you to do Pick() anyway, however it's still good for future-proofing.
|
||||||
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked;
|
return requiredItems.Any() ? base.HasRequiredItems(character, addMessage, msg) : canBePicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Pick(Character picker)
|
public override bool Pick(Character picker)
|
||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) { return true; }
|
return item.Condition <= RepairThreshold ? true : base.Pick(picker);
|
||||||
if (requiredItems.None()) { return false; }
|
|
||||||
if (HasRequiredItems(picker, false) && hasValidIdCard) { return false; }
|
|
||||||
return base.Pick(picker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnPicked(Character picker)
|
public override bool OnPicked(Character picker)
|
||||||
{
|
{
|
||||||
if (item.Condition <= RepairThreshold) return true; //repairs
|
if (item.Condition <= RepairThreshold) return true; //repairs
|
||||||
if (requiredItems.Any() && !hasValidIdCard)
|
|
||||||
{
|
|
||||||
ForceOpen(ActionType.OnPicked);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ForceOpen(ActionType actionType)
|
|
||||||
{
|
|
||||||
SetState(PredictedState == null ? !isOpen : !PredictedState.Value, false, true); //crowbar function
|
SetState(PredictedState == null ? !isOpen : !PredictedState.Value, false, true); //crowbar function
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
PlaySound(actionType, item.WorldPosition, picker);
|
PlaySound(ActionType.OnPicked, item.WorldPosition, picker);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Select(Character character)
|
public override bool Select(Character character)
|
||||||
{
|
{
|
||||||
//can only be selected if the item is broken
|
//can only be selected if the item is broken
|
||||||
if (item.Condition <= RepairThreshold) return true; //repairs
|
return item.Condition <= RepairThreshold;
|
||||||
bool hasRequiredItems = HasRequiredItems(character, false);
|
|
||||||
if (requiredItems.None() || hasRequiredItems && hasValidIdCard)
|
|
||||||
{
|
|
||||||
float originalPickingTime = PickingTime;
|
|
||||||
PickingTime = 0;
|
|
||||||
ForceOpen(ActionType.OnUse);
|
|
||||||
PickingTime = originalPickingTime;
|
|
||||||
}
|
|
||||||
else if (hasRequiredItems)
|
|
||||||
{
|
|
||||||
#if CLIENT
|
|
||||||
GUI.AddMessage(accessDeniedTxt, Color.Red);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime, Camera cam)
|
public override void Update(float deltaTime, Camera cam)
|
||||||
|
|||||||
@@ -34,20 +34,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsActive
|
|
||||||
{
|
|
||||||
get { return base.IsActive; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.IsActive = value;
|
|
||||||
if (!value)
|
|
||||||
{
|
|
||||||
nodes.Clear();
|
|
||||||
charactersInRange.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serialize(100.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 5000.0f)]
|
[Serialize(100.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 5000.0f)]
|
||||||
public float Range
|
public float Range
|
||||||
{
|
{
|
||||||
@@ -140,19 +126,14 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
nodes.Clear();
|
||||||
|
charactersInRange.Clear();
|
||||||
IsActive = false;
|
IsActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
voltage = 0.0f;
|
voltage = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateBroken(float deltaTime, Camera cam)
|
|
||||||
{
|
|
||||||
base.UpdateBroken(deltaTime, cam);
|
|
||||||
nodes.Clear();
|
|
||||||
charactersInRange.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Discharge()
|
private void Discharge()
|
||||||
{
|
{
|
||||||
ApplyStatusEffects(ActionType.OnUse, 1.0f);
|
ApplyStatusEffects(ActionType.OnUse, 1.0f);
|
||||||
|
|||||||
@@ -58,6 +58,13 @@ namespace Barotrauma.Items.Components
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serialize(true, true)]
|
||||||
|
public bool Aimable
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
[Serialize(false, false)]
|
[Serialize(false, false)]
|
||||||
public bool ControlPose
|
public bool ControlPose
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
private float lastSentDeattachTimer;
|
private float lastSentDeattachTimer;
|
||||||
|
|
||||||
private PhysicsBody trigger;
|
|
||||||
|
|
||||||
private Holdable holdable;
|
|
||||||
|
|
||||||
private float deattachTimer;
|
|
||||||
|
|
||||||
[Serialize(1.0f, false)]
|
[Serialize(1.0f, false)]
|
||||||
public float DeattachDuration
|
public float DeattachDuration
|
||||||
{
|
{
|
||||||
@@ -55,7 +49,13 @@ namespace Barotrauma.Items.Components
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PhysicsBody trigger;
|
||||||
|
|
||||||
|
private Holdable holdable;
|
||||||
|
|
||||||
|
private float deattachTimer;
|
||||||
|
|
||||||
public LevelResource(Item item, XElement element) : base(item, element)
|
public LevelResource(Item item, XElement element) : base(item, element)
|
||||||
{
|
{
|
||||||
IsActive = true;
|
IsActive = true;
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ namespace Barotrauma.Items.Components
|
|||||||
pickTimer / requiredTime,
|
pickTimer / requiredTime,
|
||||||
Color.Red, Color.Green);
|
Color.Red, Color.Green);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
picker.AnimController.UpdateUseItem(true, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((pickTimer / 10.0f) % 0.1f));
|
||||||
|
|
||||||
picker.AnimController.UpdateUseItem(true, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((pickTimer / 10.0f) % 0.1f));
|
picker.AnimController.UpdateUseItem(true, item.WorldPosition + new Vector2(0.0f, 100.0f) * ((pickTimer / 10.0f) % 0.1f));
|
||||||
pickTimer += CoroutineManager.DeltaTime;
|
pickTimer += CoroutineManager.DeltaTime;
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ namespace Barotrauma.Items.Components
|
|||||||
// If the character is climbing, ignore the check, because we cannot aim while climbing.
|
// If the character is climbing, ignore the check, because we cannot aim while climbing.
|
||||||
if (VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak) < MathHelper.PiOver4)
|
if (VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak) < MathHelper.PiOver4)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Shoot, false, true);
|
|
||||||
Use(deltaTime, character);
|
Use(deltaTime, character);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -338,11 +337,11 @@ namespace Barotrauma.Items.Components
|
|||||||
sinTime = 0;
|
sinTime = 0;
|
||||||
if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f))
|
if (!leak.FlowTargetHull.ConnectedGaps.Any(g => !g.IsRoomToRoom && g.Open > 0.0f))
|
||||||
{
|
{
|
||||||
character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leaksfixed", 10.0f);
|
character.Speak(TextManager.Get("DialogLeaksFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leaksfixed", 10.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.DisplayName), null, 0.0f, "leakfixed", 10.0f);
|
character.Speak(TextManager.Get("DialogLeakFixed").Replace("[roomname]", leak.FlowTargetHull.RoomName), null, 0.0f, "leakfixed", 10.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ namespace Barotrauma.Items.Components
|
|||||||
get { return name; }
|
get { return name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Editable, Serialize("", true, translationTextTag: "ItemMsg")]
|
[Editable, Serialize("", true)]
|
||||||
public string Msg
|
public string Msg
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -538,6 +538,7 @@ namespace Barotrauma.Items.Components
|
|||||||
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.DegreeOfSuccess:CharacterNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
float average = skillSuccessSum / requiredSkills.Count;
|
||||||
|
|
||||||
float skillSuccessSum = 0.0f;
|
float skillSuccessSum = 0.0f;
|
||||||
for (int i = 0; i < requiredSkills.Count; i++)
|
for (int i = 0; i < requiredSkills.Count; i++)
|
||||||
@@ -554,7 +555,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public virtual void FlipY(bool relativeToSub) { }
|
public virtual void FlipY(bool relativeToSub) { }
|
||||||
|
|
||||||
public bool HasRequiredContainedItems(bool addMessage, string msg = null)
|
public bool HasRequiredContainedItems(bool addMessage)
|
||||||
{
|
{
|
||||||
if (!requiredItems.ContainsKey(RelatedItem.RelationType.Contained)) return true;
|
if (!requiredItems.ContainsKey(RelatedItem.RelationType.Contained)) return true;
|
||||||
if (item.OwnInventory == null) return false;
|
if (item.OwnInventory == null) return false;
|
||||||
@@ -581,52 +582,33 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (!requiredItems.Any()) return true;
|
if (!requiredItems.Any()) return true;
|
||||||
if (character.Inventory == null) return false;
|
if (character.Inventory == null) return false;
|
||||||
bool hasRequiredItems = false;
|
|
||||||
bool canContinue = true;
|
|
||||||
if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped))
|
if (requiredItems.ContainsKey(RelatedItem.RelationType.Equipped))
|
||||||
{
|
{
|
||||||
foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Equipped])
|
foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Equipped])
|
||||||
{
|
{
|
||||||
canContinue = CheckItems(ri, character.SelectedItems);
|
if (character.SelectedItems.FirstOrDefault(it => it != null && it.Condition > 0.0f && ri.MatchesItem(it)) == null)
|
||||||
if (!canContinue) { break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (canContinue)
|
|
||||||
{
|
|
||||||
if (requiredItems.ContainsKey(RelatedItem.RelationType.Picked))
|
|
||||||
{
|
|
||||||
foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Picked])
|
|
||||||
{
|
{
|
||||||
if (!CheckItems(ri, character.Inventory.Items)) { break; }
|
#if CLIENT
|
||||||
|
if (addMessage && !string.IsNullOrEmpty(ri.Msg)) GUI.AddMessage(ri.Msg, Color.Red);
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (requiredItems.ContainsKey(RelatedItem.RelationType.Picked))
|
||||||
|
{
|
||||||
|
foreach (RelatedItem ri in requiredItems[RelatedItem.RelationType.Picked])
|
||||||
|
{
|
||||||
|
if (character.Inventory.Items.FirstOrDefault(it => it != null && it.Condition > 0.0f && ri.MatchesItem(it)) == null)
|
||||||
|
{
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (!hasRequiredItems && addMessage && !string.IsNullOrEmpty(msg))
|
if (!hasRequiredItems && addMessage && !string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
GUI.AddMessage(msg, Color.Red);
|
GUI.AddMessage(msg, Color.Red);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return hasRequiredItems;
|
return false;
|
||||||
|
|
||||||
bool CheckItems(RelatedItem relatedItem, IEnumerable<Item> itemList)
|
|
||||||
{
|
|
||||||
bool Predicate(Item it) => it != null && it.Condition > 0.0f && relatedItem.MatchesItem(it);
|
|
||||||
bool shouldBreak = false;
|
|
||||||
if (relatedItem.IsOptional)
|
|
||||||
{
|
|
||||||
if (!hasRequiredItems)
|
|
||||||
{
|
|
||||||
hasRequiredItems = itemList.Any(Predicate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hasRequiredItems = itemList.Any(Predicate);
|
|
||||||
if (!hasRequiredItems)
|
|
||||||
{
|
|
||||||
shouldBreak = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasRequiredItems)
|
if (!hasRequiredItems)
|
||||||
@@ -638,6 +620,8 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
return !shouldBreak;
|
return !shouldBreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null, Limb targetLimb = null, Character user = null)
|
public void ApplyStatusEffects(ActionType type, float deltaTime, Character character = null, Limb targetLimb = null, Character user = null)
|
||||||
@@ -782,7 +766,6 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
|
newRequiredItem.statusEffects = prevRequiredItem.statusEffects;
|
||||||
newRequiredItem.Msg = prevRequiredItem.Msg;
|
newRequiredItem.Msg = prevRequiredItem.Msg;
|
||||||
newRequiredItem.IsOptional = prevRequiredItem.IsOptional;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!requiredItems.ContainsKey(newRequiredItem.Type))
|
if (!requiredItems.ContainsKey(newRequiredItem.Type))
|
||||||
|
|||||||
@@ -343,7 +343,5 @@ namespace Barotrauma.Items.Components
|
|||||||
limbPositions[i] = new LimbPos(limbPositions[i].limbType, flippedPos);
|
limbPositions[i] = new LimbPos(limbPositions[i].limbType, flippedPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void HideHUDs(bool value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,19 +8,11 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable
|
partial class CustomInterface : ItemComponent, IClientSerializable, IServerSerializable
|
||||||
{
|
{
|
||||||
class CustomInterfaceElement : ISerializableEntity
|
class CustomInterfaceElement
|
||||||
{
|
{
|
||||||
public bool ContinuousSignal;
|
public bool ContinuousSignal;
|
||||||
public bool State;
|
public bool State;
|
||||||
public string Connection;
|
public string Label, Connection, Signal;
|
||||||
[Serialize("", false, translationTextTag = "Label.")]
|
|
||||||
public string Label { get; set; }
|
|
||||||
[Serialize("1", false)]
|
|
||||||
public string Signal { get; set; }
|
|
||||||
|
|
||||||
public string Name => "CustomInterfaceElement";
|
|
||||||
|
|
||||||
public Dictionary<string, SerializableProperty> SerializableProperties { get; set; }
|
|
||||||
|
|
||||||
public List<StatusEffect> StatusEffects = new List<StatusEffect>();
|
public List<StatusEffect> StatusEffects = new List<StatusEffect>();
|
||||||
|
|
||||||
@@ -41,7 +33,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string[] labels;
|
private string[] labels;
|
||||||
[Serialize("", true)]
|
[Serialize("", true), Editable()]
|
||||||
public string Labels
|
public string Labels
|
||||||
{
|
{
|
||||||
get { return string.Join(",", labels); }
|
get { return string.Join(",", labels); }
|
||||||
@@ -56,7 +48,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string[] signals;
|
private string[] signals;
|
||||||
[Serialize("", true)]
|
[Serialize("", true), Editable()]
|
||||||
public string Signals
|
public string Signals
|
||||||
{
|
{
|
||||||
//use semicolon as a separator because comma may be needed in the signals (for color or vector values for example)
|
//use semicolon as a separator because comma may be needed in the signals (for color or vector values for example)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using Barotrauma.Extensions;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -67,8 +66,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public LightComponent LightComponent { get; set; }
|
public LightComponent LightComponent { get; set; }
|
||||||
|
|
||||||
public int Variant { get; set; }
|
|
||||||
|
|
||||||
private Gender _gender;
|
private Gender _gender;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// None = Any/Not Defined -> no effect.
|
/// None = Any/Not Defined -> no effect.
|
||||||
@@ -115,65 +112,30 @@ namespace Barotrauma
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Note: this constructor cannot initialize automatically, because the gender is unknown at this point. We only know it when the item is equipped.
|
/// Note: this constructor cannot initialize automatically, because the gender is unknown at this point. We only know it when the item is equipped.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WearableSprite(XElement subElement, Wearable wearable, int variant = 0)
|
public WearableSprite(XElement subElement, Wearable wearable)
|
||||||
{
|
{
|
||||||
Type = WearableType.Item;
|
Type = WearableType.Item;
|
||||||
WearableComponent = wearable;
|
WearableComponent = wearable;
|
||||||
Variant = Math.Max(variant, 0);
|
|
||||||
SpritePath = ParseSpritePath(subElement.GetAttributeString("texture", string.Empty));
|
SpritePath = ParseSpritePath(subElement.GetAttributeString("texture", string.Empty));
|
||||||
SourceElement = subElement;
|
SourceElement = subElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ParseSpritePath(string texturePath) => texturePath.Contains("/") ? texturePath : $"{Path.GetDirectoryName(WearableComponent.Item.Prefab.ConfigFile)}/{texturePath}";
|
private string ParseSpritePath(string texturePath) => texturePath.Contains("/") ? texturePath : $"{Path.GetDirectoryName(WearableComponent.Item.Prefab.ConfigFile)}/{texturePath}";
|
||||||
|
|
||||||
public void RefreshPath()
|
|
||||||
{
|
|
||||||
if (Variant > 0)
|
|
||||||
{
|
|
||||||
// Restore the tag so that we can parse it again.
|
|
||||||
ReplaceNumbersWith("[VARIANT]");
|
|
||||||
}
|
|
||||||
ParsePath(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReplaceNumbersWith(string replacement)
|
|
||||||
{
|
|
||||||
var fileName = Path.GetFileName(SpritePath);
|
|
||||||
var path = Path.GetDirectoryName(SpritePath);
|
|
||||||
fileName = fileName.Replace(replacement, c => char.IsNumber(c));
|
|
||||||
SpritePath = Path.Combine(path, fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ParsePath(bool parseSpritePath)
|
|
||||||
{
|
|
||||||
if (_gender != Gender.None)
|
|
||||||
{
|
|
||||||
SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male");
|
|
||||||
}
|
|
||||||
SpritePath = SpritePath.Replace("[VARIANT]", Variant.ToString());
|
|
||||||
if (!File.Exists(SpritePath))
|
|
||||||
{
|
|
||||||
// If the variant does not exist, parse the path so that it uses first variant.
|
|
||||||
Variant = 1;
|
|
||||||
ReplaceNumbersWith(Variant.ToString());
|
|
||||||
}
|
|
||||||
if (parseSpritePath)
|
|
||||||
{
|
|
||||||
Sprite.ParseTexturePath(file: SpritePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsInitialized { get; private set; }
|
public bool IsInitialized { get; private set; }
|
||||||
public void Init(Gender gender = Gender.None)
|
public void Init(Gender gender = Gender.None)
|
||||||
{
|
{
|
||||||
if (IsInitialized) { return; }
|
if (IsInitialized) { return; }
|
||||||
_gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None;
|
_gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None;
|
||||||
ParsePath(false);
|
if (_gender != Gender.None)
|
||||||
|
{
|
||||||
|
SpritePath = SpritePath.Replace("[GENDER]", (_gender == Gender.Female) ? "female" : "male");
|
||||||
|
}
|
||||||
if (Sprite != null)
|
if (Sprite != null)
|
||||||
{
|
{
|
||||||
Sprite.Remove();
|
Sprite.Remove();
|
||||||
}
|
}
|
||||||
Sprite = new Sprite(SourceElement, file: SpritePath);
|
Sprite = new Sprite(SourceElement, "", SpritePath);
|
||||||
Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
|
Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
|
||||||
HideLimb = SourceElement.GetAttributeBool("hidelimb", false);
|
HideLimb = SourceElement.GetAttributeBool("hidelimb", false);
|
||||||
HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false);
|
HideOtherWearables = SourceElement.GetAttributeBool("hideotherwearables", false);
|
||||||
@@ -208,7 +170,7 @@ namespace Barotrauma.Items.Components
|
|||||||
get { return damageModifiers; }
|
get { return damageModifiers; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Wearable(Item item, XElement element) : base(item, element)
|
public Wearable (Item item, XElement element) : base(item, element)
|
||||||
{
|
{
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
|
||||||
@@ -235,7 +197,7 @@ namespace Barotrauma.Items.Components
|
|||||||
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
|
limbType[i] = (LimbType)Enum.Parse(typeof(LimbType),
|
||||||
subElement.GetAttributeString("limb", "Head"), true);
|
subElement.GetAttributeString("limb", "Head"), true);
|
||||||
|
|
||||||
wearableSprites[i] = new WearableSprite(subElement, this, variant);
|
wearableSprites[i] = new WearableSprite(subElement, this);
|
||||||
|
|
||||||
foreach (XElement lightElement in subElement.Elements())
|
foreach (XElement lightElement in subElement.Elements())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -801,12 +801,7 @@ namespace Barotrauma
|
|||||||
if (findNewHull) FindHull();
|
if (findNewHull) FindHull();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetActiveSprite()
|
partial void SetActiveSprite();
|
||||||
{
|
|
||||||
SetActiveSpriteProjSpecific();
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void SetActiveSpriteProjSpecific();
|
|
||||||
|
|
||||||
public override void Move(Vector2 amount)
|
public override void Move(Vector2 amount)
|
||||||
{
|
{
|
||||||
@@ -1437,13 +1432,13 @@ namespace Barotrauma
|
|||||||
selectHit = picker.IsKeyHit(ic.SelectKey);
|
selectHit = picker.IsKeyHit(ic.SelectKey);
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
//if the cursor is on a UI component, disable interaction with the left mouse button
|
//if the cursor is on a UI component, disable interaction with the left mouse button
|
||||||
//to prevent accidentally selecting items when clicking UI elements
|
//to prevent accidentally selecting items when clicking UI elements
|
||||||
if (picker == Character.Controlled && GUI.MouseOn != null)
|
if (picker == Character.Controlled && GUI.MouseOn != null)
|
||||||
{
|
{
|
||||||
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
|
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
|
||||||
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
|
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1613,7 +1608,6 @@ namespace Barotrauma
|
|||||||
if (remove) { Spawner?.AddToRemoveQueue(this); }
|
if (remove) { Spawner?.AddToRemoveQueue(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ColoredText> texts = new List<ColoredText>();
|
|
||||||
public List<ColoredText> GetHUDTexts(Character character)
|
public List<ColoredText> GetHUDTexts(Character character)
|
||||||
{
|
{
|
||||||
texts.Clear();
|
texts.Clear();
|
||||||
@@ -1623,13 +1617,6 @@ namespace Barotrauma
|
|||||||
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
if (!ic.CanBePicked && !ic.CanBeSelected) continue;
|
||||||
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
if (ic is Holdable holdable && !holdable.CanBeDeattached()) continue;
|
||||||
|
|
||||||
Color color = Color.Gray;
|
|
||||||
bool hasRequiredSkillsAndItems = ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false);
|
|
||||||
if (hasRequiredSkillsAndItems)
|
|
||||||
{
|
|
||||||
color = Color.Cyan;
|
|
||||||
}
|
|
||||||
|
|
||||||
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
|
texts.Add(new ColoredText(ic.DisplayMsg, color, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2067,8 +2054,6 @@ namespace Barotrauma
|
|||||||
public virtual void Reset()
|
public virtual void Reset()
|
||||||
{
|
{
|
||||||
SerializableProperties = SerializableProperty.DeserializeProperties(this, Prefab.ConfigElement);
|
SerializableProperties = SerializableProperty.DeserializeProperties(this, Prefab.ConfigElement);
|
||||||
Sprite.ReloadXML();
|
|
||||||
SpriteDepth = Sprite.Depth;
|
|
||||||
components.ForEach(c => c.Reset());
|
components.ForEach(c => c.Reset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user