e08c5e7...2ad9b5d

commit 2ad9b5de40f128e8413f1ad5f568a4bc006d0971
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 20:11:41 2019 +0200

    v0.8.9.3

commit 2d64da9d1e0d10f9ccb08d6e3fbc45d69fcda368
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 18:08:10 2019 +0200

    Randomize the races and the heads in the net lobby. TODO: remember the previous heads and check that the next in line is unique (not exactly the same as the current).

commit 09f74ab37692291ca070bac5dbc53eef395fb1cf
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 16:30:16 2019 +0200

    AI characters can give treatment to characters who aren't unconscious, fixed AI characters attempting to treat dead characters. Closes #1083

commit a8fea2450cf4ef0b80a8fc809aee339bc39b28c6
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 16:28:23 2019 +0200

    Fixed horizontal docking ports failing to find the hull prefab

commit dd5a7a4f09195ecfeb82605e1e73ea22607694e7
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Wed Feb 6 16:02:52 2019 +0200

    halved the hitpoints for baby moloch

commit 92ae260558ece991560d83819168ef51d5267a66
Merge: 75fe087d7 8f451825e
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:44:08 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 75fe087d7263b46611fb0aad5c91c616e22ad41b
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:43:12 2019 +0200

    Update the ai block in the moloch boss config file.

commit caf11944294dfe66b5d302888baecbfddad7293a
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:42:42 2019 +0200

    Remove the lowercase version of the moloch boss config file.

commit b422feece1e620c427fa62d41c2b847b6b8837e9
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:41:40 2019 +0200

    Fix molochbaby character name in the config file.

commit 913762516dd17921c185de2cb912333f2e5230dd
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:41:22 2019 +0200

    Include the baby moloch files in the project.

commit 8f451825e95b415b1262f984d83828c379d36ea2
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 15:36:50 2019 +0200

    Added molochbaby to the project file

commit 2078307f255f432c19fcbbc0b690acf5655f3c99
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:33:08 2019 +0200

    Disable creating humanoids in the wizard for now, because it can go wrong in so many ways.

commit 55a931795ac5f60699033c4ff484a9a2d0ae9b7e
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 15:32:18 2019 +0200

    Unfreeze when adjusting the joint scale, because the limbs are not otherwise updated to the joint positions.

commit 2c92373ccbf331c545c830c9780f450b116f0359
Author: Iiro Enges <iiro@fakefish.fi>
Date:   Wed Feb 6 15:28:22 2019 +0200

    Tinted baby moloch to differentiate from the adult version (for testing purposes)

commit f05be351cdf8a6073702e988ed1861f665399048
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 15:26:52 2019 +0200

    Fixed automatic temperature control setting turbine output above 100 if the power consumption is higher than what the reactor can generate. Caused "failed to write an event for the entity" errors in MP when the server tried to write the targetTurbineOutput using WriteRangedSingle with a maximum value of 100. Closes #1085

commit 7b737ebbea41fd5b7825a6c6373e578c1b1c91fd
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Wed Feb 6 15:15:59 2019 +0200

    Baby moloch, doo doo doo doo doo doo

commit f5d13649915ba761bbc6fe78370c607905e2d5f8
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Wed Feb 6 15:15:04 2019 +0200

    Small fixes and tweaks to gun performance dependent on skill of user.

commit 4bf61738c6da08d771dedf1c96160cc76e0b4dd7
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Wed Feb 6 15:14:11 2019 +0200

    New staggered swarm medium difficulty event

commit 3e593f46850987ba074d9b26d59d08eeeddd1d70
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 15:05:43 2019 +0200

    Removed incorrect item name/description instructions fron EnglishVanilla.xml. Correct instructions are at the beginning of the file.

commit ce33a523e440a5b5037b84ca96bebf1f977e0aa8
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 15:00:48 2019 +0200

    Attempt to fix "attempted to move pull joint extremely far" errors (#895). I think they were (at least for the most part) caused by characters switching to simple physics mode and then moving a significant distance, and when the character switched back to normal animation, the pull joints were still somewhere far away and lerping them to the position of the collider failed (because the lerped position triggers the error).

commit c8212e3eff6d9272c9d38b833743b0f33b3611a2
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 13:54:15 2019 +0200

    Fixed nullref exception when teleporting from a sub to ruins or vice versa. Closes #1037

commit 0d812394944eb05be4291be7b56593cc4def6d0f
Author: Daniel Asteljoki <daniel.asteljoki@gmail.com>
Date:   Wed Feb 6 13:34:58 2019 +0200

    Made regular ruin walls much more durable (500 -> 5000)

commit c9a4d9d6f6c9c767ecd8cf34f917db9da852f4bf
Author: Daniel Asteljoki <daniel.asteljoki@gmail.com>
Date:   Wed Feb 6 13:34:26 2019 +0200

    Rebalanced Humpback battery grid, added toggles for using backup power

commit 47617a6d54f933714dffeca5fa311776e9d0523c
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 13:17:57 2019 +0200

    Remove the lowercase variant of moloch's config file from the source control.

commit 640662835684464e4a66b106b1958e5a9fde8a0c
Merge: 80e91f96b 7861d00a6
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 13:10:00 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 80e91f96bf5f1e9f89c5a6e4695292298a802b06
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 13:09:37 2019 +0200

    Fix a null reference exception.

commit 91b16aaa7aacc658cb36325ea85944802166ef53
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 13:09:26 2019 +0200

    Instead of having a bad sight, make the Hammerhead deaf. Add "provocative" priority tag, remove "sonar". Make slightly less aggressive towards weaker.

commit a383c136f6f6915163e98c472ec7ba7f575ea479
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 13:02:00 2019 +0200

    Add "provocative" tag on Moloch and Mudraptor targeting priorities. Tweak moloch priorities a bit.

commit 7861d00a609f2555a19f510d72591bd0330f607e
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 12:53:37 2019 +0200

    Attempt to fix/diagnose "collection was modified; enumeration operation may not execute" exceptions when using the fixhulls command (see #1011). Haven't been able to reproduce this issue.

commit 1d1321c60e8815b3beaffb81bfb9c5f5c2528297
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 12:52:29 2019 +0200

    Add "provocative" tag that can be used as a red flag for the monsters. Add the tag on the diving scooter. Also add an ai target with sound ranges.

commit 8530f4c9e4b1c444687cadbf615a9ade0440262b
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 12:50:43 2019 +0200

    Propulsion can now make sound that attracts the enemies. The sound is on when the propulsion is active.

commit 291f12676e5148da1a83d4dd72071381c1ae73e3
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 12:49:39 2019 +0200

    If a target item is held by a character, attack the character instead.

commit 2aeaa9eaa51f3ed3db71f7853efef37bf5998838
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 12:46:27 2019 +0200

    Allow to define min and max sound ranges.

commit 3bf5d2383cbcc33fa862a79c06756e6d9f20a753
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 12:42:57 2019 +0200

    Adjust the ai debug info.

commit 369355ffef340875335c0d81d9a2c9a4bfac898b
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 12:40:30 2019 +0200

    ContextualTutorial Update cleanup

commit 101387adc1308ad87e3134ab2960d3032f725735
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 12:34:07 2019 +0200

    Formatting

commit cc44eff21d57d93e4b0a67249af2135e5782e3c3
Merge: 9a338a2d4 33d1cd1be
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 12:31:54 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 9a338a2d440ff12426171fe9c3121efb934b6803
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 12:31:50 2019 +0200

    Modified: ContextualTutorial dismissal logic to use buttons instead of the press any key logic

commit 33d1cd1beb61862a91bce16ebeb5090a8969cf1b
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 12:07:21 2019 +0200

    Fixed spectate button staying disabled if starting a round fails (due to a missing sub file for example). Closes #1066

commit 8935825146203725759463278e7776a42d84a6a0
Merge: 2cdc96214 9fd3de63b
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 11:45:06 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 2cdc96214e2285bfa83a566ed8bc2aed4156c31d
Author: EdusFF <pitkanen.eetu@gmail.com>
Date:   Wed Feb 6 11:44:56 2019 +0200

    Added: Saving of the download size to the Workshop.Item, allows displaying the file size for non-downloaded content in SteamWorshopScreen. Closes #1052

commit 9fd3de63bc08e06a924bf5ec8a8b2938a647282f
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 11:34:38 2019 +0200

    Watchmen cannot be dragged or grabbed, fixed watchmen imploding continuously if they end up outside. Closes #1072

commit eb3fca43d77e79f04e0ae80daac53b7e2c1e37f7
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 11:14:06 2019 +0200

    Fixed server not sending PowerContainer events until the charge of the PowerContainer has changed by more then 100% (i.e. never). Closes #1068

commit 5b3b71bab75489714f72ce55621f6da7d5ec8d94
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 10:59:09 2019 +0200

    Prevent locations from being generated too close to each other. Closes #1048

commit b032b36a50b60432f565cab0178de749585562ad
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Wed Feb 6 10:48:43 2019 +0200

    Fixed a couple of errors in the translation instructions in EnglishVanilla.xml

commit a31b2f257ef863f2cdd1504a3a15356f95262225
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Wed Feb 6 09:34:11 2019 +0200

    Show inventory icons in the sprite editor.

commit fb7a69d6179824dde0a44d27ce5143a1a25d0147
Author: Roni Kovaniemi <roni.kovaniemi@gmail.com>
Date:   Wed Feb 6 02:18:44 2019 +0200

    Improved background smoke texture

commit 888e86a0e7d6e6a70feb2b87ea16cee17adcfd76
Author: Juan Pablo Arce <juanjp600@users.noreply.github.com>
Date:   Tue Feb 5 11:36:06 2019 -0300

    whoops strikes again

commit 67e94c6bb9e59b20bc1b9f3cb796780d1c2141f7
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 16:32:45 2019 +0200

    Adjust the min and max values for the sight range and add a todo note.

commit ad0becdf175a66c963b2cbea5259b435c250ffa6
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 16:31:47 2019 +0200

    Refactor the sound range calculation. It was way off.

commit adc0aa96be5426dbb845e4138acab87c44c935ba
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 16:31:18 2019 +0200

    Improve the ai target debug info.

commit 9230ba0865896d5740898993ab3389659a4cbb4a
Author: Juan Pablo Arce <juanjp600@users.noreply.github.com>
Date:   Tue Feb 5 10:53:51 2019 -0300

    Attempted audio buffer queue fix

commit dfbc61628de37a60acbaa208934957a9d892eb99
Author: Eetu <pitkanen.eetu@gmail.com>
Date:   Tue Feb 5 15:18:34 2019 +0200

    Fixed: Rubber ducks not floating like a good duck should

commit 8b8523dad99b5c1db271ac13e48975487a7c7c99
Merge: 509c67594 c0156c3d3
Author: Eetu <pitkanen.eetu@gmail.com>
Date:   Tue Feb 5 14:34:59 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 509c6759484750d44a154a7f1703f92d0d6e1692
Author: Eetu <pitkanen.eetu@gmail.com>
Date:   Tue Feb 5 14:34:53 2019 +0200

    Fixed: Holdable items retaining their pushing ability even when the user is stunned or unconscious. Closes #1061

commit c0156c3d350b64309c8068f437ddd57765f0b911
Author: itchyOwl <lauri.harkanen@gmail.com>
Date:   Tue Feb 5 13:46:32 2019 +0200

    If no limb is selected, select the limb with the most critical affliction. Re-evaluate when new affliction is received. Sort afflictions so that dmg/sec is prioritized. Implements the feature request #1033.

commit 4a056c6e9b78f3d6f43574b1b9ff5493d36565b0
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 13:25:57 2019 +0200

    Fixed order messages not being visible in single player if the character issuing the order has no headset. Closes #1030

commit 357b14fb4f4b1a56a04d192c17a2ce8e0ab7405e
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Tue Feb 5 12:52:40 2019 +0200

    new load tips

commit 1f158760e1ed79968f10647c0a2931d2c603281e
Author: ezjamsen <ezjames.fi@gmail.com>
Date:   Tue Feb 5 12:52:20 2019 +0200

    minor formatting tweak to xml

commit c53438151043174e18fbfe979ac3b3b862d24255
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 12:48:47 2019 +0200

    Stop Steam auth session of a client when they disconnect. Probably fixes servers reporting incorrect player counts (#1049)?

commit 2073b170e4fdd5cedd998ff9d01f37842995194b
Merge: 9914631c7 9b912a7bf
Author: Eetu <pitkanen.eetu@gmail.com>
Date:   Tue Feb 5 12:43:05 2019 +0200

    Merge branch 'dev' of https://github.com/Regalis11/Barotrauma into dev

commit 9914631c7eb30c02913cd4ed44f7b7827169ad83
Author: Eetu <pitkanen.eetu@gmail.com>
Date:   Tue Feb 5 12:42:53 2019 +0200

    Fixed: Fabricator allowing new items to be created when the output is not empty, resulting in wasted materials.

commit 9b912a7bf16bd121bbe8b7eae20f4a253a9e1eba
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 12:33:00 2019 +0200

    Fixed LOS effect not working on ruins when looking at them from inside a sub

commit aeaf190c6d3b45d4d12654926acbe223dc4f5888
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Feb 5 11:57:17 2019 +0200

    Pressing the radio chat hotkey doesn't deselect the chatbox. Closes #1044
This commit is contained in:
Joonas Rikkonen
2019-03-18 21:12:20 +02:00
parent 74086415fc
commit 74f32d14d4
50 changed files with 554 additions and 228 deletions

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.9.2")]
[assembly: AssemblyFileVersion("0.8.9.2")]
[assembly: AssemblyVersion("0.8.9.3")]
[assembly: AssemblyFileVersion("0.8.9.3")]

View File

@@ -10,31 +10,16 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch)
{
if (!ShowAITargets) return;
var rangeSprite = GUI.SubmarineIcon;
var pos = new Vector2(WorldPosition.X, -WorldPosition.Y);
if (soundRange > 0.0f)
{
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Cyan * 0.1f, rangeSprite.Origin,
0.0f, soundRange / rangeSprite.size.X);
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Cyan, rangeSprite.Origin,
0.0f, 1.0f);
Color color = Entity is Character ? Color.Yellow : Color.Orange;
ShapeExtensions.DrawCircle(spriteBatch, pos, SoundRange, 100, color, thickness: 1 / Screen.Selected.Cam.Zoom);
}
if (sightRange > 0.0f)
{
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Orange * 0.1f, rangeSprite.Origin,
0.0f, sightRange / rangeSprite.size.X);
rangeSprite.Draw(spriteBatch,
new Vector2(WorldPosition.X, -WorldPosition.Y),
Color.Orange, rangeSprite.Origin,
0.0f, 1.0f);
Color color = Entity is Character ? Color.CornflowerBlue : Color.CadetBlue;
ShapeExtensions.DrawCircle(spriteBatch, pos, SightRange, 100, color, thickness: 1 / Screen.Selected.Cam.Zoom);
}
}
}

View File

@@ -27,7 +27,7 @@ namespace Barotrauma
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
}
GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 20.0f, Color.Red);
GUI.Font.DrawString(spriteBatch, $"{selectedAiTarget.Entity.ToString()} ({targetValue.ToString()})", pos - Vector2.UnitY * 20.0f, Color.Red);
}
/*GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, Color.Red);

View File

@@ -54,7 +54,7 @@ namespace Barotrauma
private GUIListBox recommendedTreatmentContainer;
private float bloodParticleTimer;
private GUIFrame healthWindow;
private GUIComponent deadIndicator;
@@ -73,7 +73,7 @@ namespace Barotrauma
private GUIComponent draggingMed;
private int highlightedLimbIndex = -1;
private int selectedLimbIndex = 0;
private int selectedLimbIndex = -1;
private float distortTimer;
@@ -96,7 +96,7 @@ namespace Barotrauma
if (value != null && !value.UseHealthWindow) return;
if (value == null &&
Character.Controlled?.SelectedCharacter?.CharacterHealth == openHealthWindow &&
Character.Controlled?.SelectedCharacter?.CharacterHealth == openHealthWindow &&
!Character.Controlled.SelectedCharacter.CanInventoryBeAccessed)
{
Character.Controlled.DeselectCharacter();
@@ -114,7 +114,7 @@ namespace Barotrauma
}
static CharacterHealth()
{
{
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
}
@@ -144,14 +144,14 @@ namespace Barotrauma
IsHorizontal = horizontal
};
healthShadowSize = 1.0f;
afflictionInfoFrame = new GUIFrame(new RectTransform(new Point(HUDLayoutSettings.HealthWindowAreaLeft.Width / 2, 200), GUI.Canvas));
var paddedInfoFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.9f), afflictionInfoFrame.RectTransform, Anchor.Center), style: null);
new GUITextBlock(new RectTransform(new Vector2(0.8f, 0.08f), paddedInfoFrame.RectTransform), "", font: GUI.LargeFont)
{
UserData = "selectedlimbname"
};
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.08f), paddedInfoFrame.RectTransform), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
@@ -191,7 +191,7 @@ namespace Barotrauma
{
CanBeFocused = false
};
healthWindow = new GUIFrame(new RectTransform(new Point(100, 200), GUI.Canvas));
var paddedHealthWindow = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), healthWindow.RectTransform, Anchor.Center))
{
@@ -303,7 +303,7 @@ namespace Barotrauma
}
}
}
private void OnAttacked(Character attacker, AttackResult attackResult)
{
if (Math.Abs(attackResult.Damage) < 0.01f && attackResult.Afflictions.Count == 0) return;
@@ -328,13 +328,13 @@ namespace Barotrauma
{
healthBar.RectTransform.SetPosition(Anchor.BottomLeft);
healthBarShadow.RectTransform.SetPosition(Anchor.BottomLeft);
healthBar.RectTransform.AbsoluteOffset = healthBarShadow.RectTransform.AbsoluteOffset =
healthBar.RectTransform.AbsoluteOffset = healthBarShadow.RectTransform.AbsoluteOffset =
new Point(HUDLayoutSettings.HealthBarAreaLeft.X, GameMain.GraphicsHeight - HUDLayoutSettings.HealthBarAreaLeft.Bottom);
healthBar.RectTransform.NonScaledSize = healthBarShadow.RectTransform.NonScaledSize = HUDLayoutSettings.HealthBarAreaLeft.Size;
healthWindow.RectTransform.AbsoluteOffset = HUDLayoutSettings.HealthWindowAreaLeft.Location + new Point(healthWindowHealthBarWidth, 0);
healthWindow.RectTransform.NonScaledSize = new Point(
HUDLayoutSettings.HealthWindowAreaLeft.Width / 3 - healthWindowHealthBarWidth,
HUDLayoutSettings.HealthWindowAreaLeft.Width / 3 - healthWindowHealthBarWidth,
HUDLayoutSettings.HealthWindowAreaLeft.Height);
afflictionInfoFrame.RectTransform.AbsoluteOffset = new Point(
@@ -346,7 +346,7 @@ namespace Barotrauma
healthWindowHealthBar.RectTransform.NonScaledSize = healthWindowHealthBarShadow.RectTransform.NonScaledSize =
new Point(healthWindowHealthBarWidth, healthWindow.Rect.Height);
healthWindowHealthBar.RectTransform.AbsoluteOffset = healthWindowHealthBarShadow.RectTransform.AbsoluteOffset =
healthWindowHealthBar.RectTransform.AbsoluteOffset = healthWindowHealthBarShadow.RectTransform.AbsoluteOffset =
HUDLayoutSettings.HealthWindowAreaLeft.Location;
int cprButtonSize = (int)(100 * GUI.Scale);
@@ -365,7 +365,7 @@ namespace Barotrauma
HUDLayoutSettings.HealthWindowAreaRight.X + HUDLayoutSettings.HealthWindowAreaRight.Width / 3 * 2,
HUDLayoutSettings.HealthWindowAreaRight.Y);
healthWindow.RectTransform.NonScaledSize = new Point(
HUDLayoutSettings.HealthWindowAreaRight.Width / 3 - healthWindowHealthBarWidth,
HUDLayoutSettings.HealthWindowAreaRight.Width / 3 - healthWindowHealthBarWidth,
HUDLayoutSettings.HealthWindowAreaRight.Height);
afflictionInfoFrame.RectTransform.AbsoluteOffset = new Point(
@@ -384,7 +384,7 @@ namespace Barotrauma
cprButton.RectTransform.AbsoluteOffset = new Point(HUDLayoutSettings.HealthWindowAreaRight.X - cprButtonSize, dropItemArea.Rect.Center.Y - cprButtonSize / 2);
cprButton.RectTransform.NonScaledSize = new Point(cprButtonSize);
}
dropItemArea.RectTransform.NonScaledSize = new Point(dropItemArea.Rect.Width);
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
@@ -456,13 +456,13 @@ namespace Barotrauma
}
dropItemArea.Visible = !Character.IsDead;
float blurStrength = 0.0f;
float distortStrength = 0.0f;
float distortSpeed = 0.0f;
float radialDistortStrength = 0.0f;
float chromaticAberrationStrength = 0.0f;
if (Character.IsUnconscious)
{
blurStrength = 1.0f;
@@ -509,7 +509,7 @@ namespace Barotrauma
distortTimer = 0.0f;
}
if (PlayerInput.KeyHit(InputType.Health) && GUI.KeyboardDispatcher.Subscriber == null &&
if (PlayerInput.KeyHit(InputType.Health) && GUI.KeyboardDispatcher.Subscriber == null &&
Character.AllowInput && Character.FocusedCharacter == null && !toggledThisFrame)
{
if (openHealthWindow != null)
@@ -529,8 +529,8 @@ namespace Barotrauma
}
}
toggledThisFrame = false;
if (Character.IsDead)
{
healthBar.Color = healthWindowHealthBar.Color = Color.Black;
@@ -538,7 +538,7 @@ namespace Barotrauma
}
else
{
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(Vitality / MaxVitality, Color.Red, Color.Orange, Color.Green );
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(Vitality / MaxVitality, Color.Red, Color.Orange, Color.Green);
healthBar.HoverColor = healthWindowHealthBar.HoverColor = healthBar.Color * 2.0f;
healthBar.BarSize = healthWindowHealthBar.BarSize = (Vitality > 0.0f) ? Vitality / MaxVitality : 1.0f - Vitality / MinVitality;
@@ -556,7 +556,7 @@ namespace Barotrauma
healthBar.RectTransform.LocalScale = Vector2.One;
}
}
if (OpenHealthWindow == this)
{
if (Character == Character.Controlled && !Character.AllowInput)
@@ -600,8 +600,21 @@ namespace Barotrauma
}
Rectangle limbArea = healthWindow.Children.First().Rect;
UpdateAfflictionContainer(
selectedLimbIndex < 0 ? (highlightedLimbIndex < 0 ? null : limbHealths[highlightedLimbIndex]) : limbHealths[selectedLimbIndex]);
var highlightedLimb = highlightedLimbIndex < 0 ? null : limbHealths[highlightedLimbIndex];
if (highlightedLimb == null && selectedLimbIndex < 0)
{
// If no limb is selected or highlighted, select the one with the most critical afflictions.
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
.OrderByDescending(a => a.DamagePerSecond)
.ThenByDescending(a => a.Strength).FirstOrDefault();
var limbHealth = GetMathingLimbHealth(affliction);
if (limbHealth != null)
{
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
}
}
UpdateAfflictionContainer(selectedLimbIndex < 0 ? highlightedLimb : limbHealths[selectedLimbIndex]);
if (Inventory.draggingItem != null)
{
@@ -691,7 +704,7 @@ namespace Barotrauma
public void DrawHUD(SpriteBatch spriteBatch)
{
if (GUI.DisableHUD) return;
if (GameMain.GraphicsWidth != screenResolution.X ||
if (GameMain.GraphicsWidth != screenResolution.X ||
GameMain.GraphicsHeight != screenResolution.Y ||
Math.Abs(inventoryScale - Inventory.UIScale) > 0.01f ||
Math.Abs(uiScale - GUI.Scale) > 0.01f)
@@ -755,12 +768,12 @@ namespace Barotrauma
Pair<Affliction, string> highlightedIcon = null;
Vector2 highlightedIconPos = Vector2.Zero;
Rectangle afflictionArea = alignment == Alignment.Left ? HUDLayoutSettings.AfflictionAreaLeft : HUDLayoutSettings.AfflictionAreaRight;
Rectangle afflictionArea = alignment == Alignment.Left ? HUDLayoutSettings.AfflictionAreaLeft : HUDLayoutSettings.AfflictionAreaRight;
Point pos = afflictionArea.Location + healthBar.RectTransform.ScreenSpaceOffset;
bool horizontal = afflictionArea.Width > afflictionArea.Height;
int iconSize = horizontal ? afflictionArea.Height : afflictionArea.Width;
foreach (Pair<Affliction, string> statusIcon in statusIcons)
{
Rectangle afflictionIconRect = new Rectangle(pos, new Point(iconSize));
@@ -805,7 +818,7 @@ namespace Barotrauma
highlightedIcon.Second,
Color.White * 0.8f, Color.Black * 0.5f);
}
if (Vitality > 0.0f)
{
float currHealth = healthBar.BarSize;
@@ -849,12 +862,7 @@ namespace Barotrauma
afflictionInfoContainer.Content.ClearChildren();
return;
}
var currentAfflictions = selectedLimb.Afflictions.Where(a => a.Strength >= a.Prefab.ShowIconThreshold).ToList();
currentAfflictions.AddRange(afflictions.Where(a => a.Strength >=
a.Prefab.ShowIconThreshold &&
limbHealths[Character.AnimController.GetLimb(a.Prefab.IndicatorLimb).HealthIndex] == selectedLimb));
var currentAfflictions = GetMatchingAfflictions(selectedLimb, a => a.Strength >= a.Prefab.ShowIconThreshold);
var displayedAfflictions = afflictionInfoContainer.Content.Children.Select(c => c.UserData as Affliction);
if (currentAfflictions.Any(a => !displayedAfflictions.Contains(a)) ||
displayedAfflictions.Any(a => !currentAfflictions.Contains(a)))
@@ -984,10 +992,18 @@ namespace Barotrauma
itemSlot.ToolTip = item.Name + "\n" + item.Description;
}
afflictionInfoContainer.Content.RectTransform.SortChildren((r1,r2) =>
afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
{
return Math.Sign(((Affliction)r2.GUIComponent.UserData).GetVitalityDecrease(this) - ((Affliction)r1.GUIComponent.UserData).GetVitalityDecrease(this));
var first = r1.GUIComponent.UserData as Affliction;
var second = r2.GUIComponent.UserData as Affliction;
int dmgPerSecond = Math.Sign(second.DamagePerSecond - first.DamagePerSecond);
return dmgPerSecond != 0 ? dmgPerSecond : Math.Sign(second.Strength - first.Strength);
});
//afflictionInfoContainer.Content.RectTransform.SortChildren((r1, r2) =>
//{
// return Math.Sign(((Affliction)r2.GUIComponent.UserData).GetVitalityDecrease(this) - ((Affliction)r1.GUIComponent.UserData).GetVitalityDecrease(this));
//});
}
private void UpdateAfflictionInfos(IEnumerable<Affliction> afflictions)

View File

@@ -25,6 +25,7 @@ namespace Barotrauma
private int currentFrameIndex = 0;
private Color backgroundColor = new Color(0f, 0f, 0f, 1f);
private Action callbackOnStop;
private bool isPlaying;
public bool IsPlaying
@@ -117,17 +118,24 @@ namespace Barotrauma
isPlaying = false;
}
private bool OKButtonClicked(GUIButton button, object userData)
{
Stop();
callbackOnStop?.Invoke();
return true;
}
public void AddToGUIUpdateList()
{
if (!isPlaying) return;
background.AddToGUIUpdateList();
}
public void LoadContent(string contentPath, XElement videoElement, string contentId, bool startPlayback)
public void LoadContent(string contentPath, XElement videoElement, string contentId, bool startPlayback, bool hasButton, Action callback = null)
{
totalElapsed = loopTimer = 0.0f;
animationSpeed = videoElement.GetAttributeFloat("animationspeed", 0.1f);
loopDelay = videoElement.GetAttributeFloat("loopdelay", 0.0f); ;
loopDelay = videoElement.GetAttributeFloat("loopdelay", 0.0f);
if (playingSheets != null)
{
@@ -155,6 +163,17 @@ namespace Barotrauma
title.Text = TextManager.Get(contentId);
title.RectTransform.NonScaledSize = new Point(resolution.X, 30);
callbackOnStop = callback;
if (hasButton)
{
var okButton = new GUIButton(new RectTransform(new Point(160, 50), videoFrame.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
TextManager.Get("OK"))
{
OnClicked = OKButtonClicked
};
}
if (startPlayback) Play();
}

View File

@@ -669,7 +669,7 @@ namespace Barotrauma
if (IsSinglePlayer)
{
orderGiver?.Speak(
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, option), ChatMessageType.Order);
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, option), null);
}
else if (orderGiver != null)
{
@@ -987,21 +987,25 @@ namespace Barotrauma
chatBox.Update(deltaTime);
chatBox.InputBox.Visible = Character.Controlled != null;
if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) &&
!DebugConsole.IsOpen && chatBox.InputBox.Visible)
if (!DebugConsole.IsOpen && chatBox.InputBox.Visible)
{
if (chatBox.InputBox.Selected)
if (PlayerInput.KeyHit(InputType.Chat))
{
chatBox.InputBox.Text = "";
chatBox.InputBox.Deselect();
if (chatBox.InputBox.Selected)
{
chatBox.InputBox.Text = "";
chatBox.InputBox.Deselect();
}
else
{
chatBox.InputBox.Select();
}
}
else
if (PlayerInput.KeyHit(InputType.RadioChat) && !chatBox.InputBox.Selected)
{
chatBox.InputBox.Select();
if (PlayerInput.KeyHit(InputType.RadioChat))
{
chatBox.InputBox.Text = "r; ";
}
chatBox.InputBox.Text = "r; ";
}
}
}

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Xml.Linq;
using System;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Barotrauma.Items.Components;
using System.Linq;
@@ -30,9 +29,7 @@ namespace Barotrauma.Tutorials
private bool started = false;
private string playableContentPath;
private float inputGracePeriodTimer;
private const float inputGracePeriod = .5f;
private float tutorialTimer;
private float degrading2ActivationCountdown;
@@ -161,7 +158,6 @@ namespace Barotrauma.Tutorials
activeSegment = null;
tutorialTimer = 0.0f;
inputGracePeriodTimer = 0.0f;
degrading2ActivationCountdown = -1;
subStartingPosition = Vector2.Zero;
characterTimeOnSonar.Clear();
@@ -228,36 +224,10 @@ namespace Barotrauma.Tutorials
public override void Update(float deltaTime)
{
if (!started) return;
if (!started || ContentRunning) return;
deltaTime *= 0.5f;
if (ContentRunning) // Content is running, wait until dismissed
{
if (inputGracePeriodTimer < inputGracePeriod)
{
inputGracePeriodTimer += deltaTime;
}
else if (Keyboard.GetState().GetPressedKeys().Length > 0 || Mouse.GetState().LeftButton == ButtonState.Pressed || Mouse.GetState().RightButton == ButtonState.Pressed)
{
switch (activeSegment.ContentType)
{
case ContentTypes.None:
break;
case ContentTypes.Video:
spriteSheetPlayer.Stop();
break;
case ContentTypes.Text:
infoBox = null;
break;
}
activeSegment = null;
ContentRunning = false;
inputGracePeriodTimer = 0.0f;
}
return;
}
for (int i = 0; i < segments.Count; i++)
{
if (segments[i].IsTriggered) continue;
@@ -268,6 +238,12 @@ namespace Barotrauma.Tutorials
}
}
private void CurrentSegmentStopCallback()
{
activeSegment = null;
ContentRunning = false;
}
private bool CheckContextualTutorials(int index, float deltaTime)
{
switch (index)
@@ -485,13 +461,13 @@ namespace Barotrauma.Tutorials
case ContentTypes.None:
break;
case ContentTypes.Video:
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true);
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
break;
case ContentTypes.Text:
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.Get(activeSegment.Content.GetAttributeString("tag", ""), false, args),
activeSegment.Content.GetAttributeInt("width", 300),
activeSegment.Content.GetAttributeInt("height", 80),
activeSegment.Content.GetAttributeString("anchor", "Center"), false);
activeSegment.Content.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);
break;
}

View File

@@ -11,6 +11,7 @@ namespace Barotrauma.Tutorials
public static List<Tutorial> Tutorials;
protected GUIComponent infoBox;
private Action infoBoxClosedCallback;
protected XElement configElement;
private enum TutorialType { None, Scenario, Contextual };
@@ -136,10 +137,11 @@ namespace Barotrauma.Tutorials
protected bool CloseInfoFrame(GUIButton button, object userData)
{
infoBox = null;
infoBoxClosedCallback?.Invoke();
return true;
}
protected GUIComponent CreateInfoFrame(string text, bool hasButton = false)
protected GUIComponent CreateInfoFrame(string text, bool hasButton = false, Action callback = null)
{
int width = 300;
int height = hasButton ? 110 : 80;
@@ -154,9 +156,11 @@ namespace Barotrauma.Tutorials
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.7f), infoBlock.RectTransform, Anchor.Center),
text, wrap: true);
infoBoxClosedCallback = callback;
if (hasButton)
{
var okButton = new GUIButton(new RectTransform(new Point(80, 25), infoBlock.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(0, 5) },
var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
TextManager.Get("OK"))
{
OnClicked = CloseInfoFrame
@@ -168,7 +172,7 @@ namespace Barotrauma.Tutorials
return infoBlock;
}
protected GUIComponent CreateInfoFrame(string title, string text, int width, int height, string anchorStr, bool hasButton = false)
protected GUIComponent CreateInfoFrame(string title, string text, int width, int height, string anchorStr, bool hasButton = false, Action callback = null)
{
if (hasButton) height += 30;
@@ -196,9 +200,11 @@ namespace Barotrauma.Tutorials
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 1f), infoBlock.RectTransform, Anchor.BottomCenter),
text, wrap: true);
infoBoxClosedCallback = callback;
if (hasButton)
{
var okButton = new GUIButton(new RectTransform(new Point(80, 25), infoBlock.RectTransform, Anchor.BottomCenter) { AbsoluteOffset = new Point(0, 5) },
var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
TextManager.Get("OK"))
{
OnClicked = CloseInfoFrame

View File

@@ -306,6 +306,13 @@ namespace Barotrauma.Items.Components
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), paddedFrame.RectTransform), text,
textColor: inadequateSkills.Any() ? Color.Red : Color.LightGreen, font: GUI.SmallFont);
}
}
private bool SelectItem(Character user, FabricableItem selectedItem)
{
selectedItemFrame.ClearChildren();
var paddedFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.95f, 0.9f), selectedItemFrame.RectTransform, Anchor.Center)) { RelativeSpacing = 0.03f, Stretch = true };
float degreeOfSuccess = user == null ? 0.0f : DegreeOfSuccess(user, selectedItem.RequiredSkills);
if (degreeOfSuccess > 0.5f) { degreeOfSuccess = 1.0f; }
@@ -321,6 +328,12 @@ namespace Barotrauma.Items.Components
private bool StartButtonClicked(GUIButton button, object obj)
{
if (selectedItem == null) { return false; }
if (!outputContainer.Inventory.IsEmpty())
{
outputInventoryHolder.Flash(Color.Red);
return false;
}
if (fabricatedItem == null)
{
StartFabricating(selectedItem, Character.Controlled);

View File

@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Barotrauma.Lights
{
@@ -112,11 +113,11 @@ namespace Barotrauma.Lights
public int shadowVertexCount;
private Entity parentEntity;
private MapEntity parentEntity;
private Rectangle boundingBox;
public Entity ParentEntity
public MapEntity ParentEntity
{
get { return parentEntity; }
@@ -151,7 +152,7 @@ namespace Barotrauma.Lights
get { return boundingBox; }
}
public ConvexHull(Vector2[] points, Color color, Entity parent)
public ConvexHull(Vector2[] points, Color color, MapEntity parent)
{
if (shadowEffect == null)
{
@@ -567,8 +568,18 @@ namespace Barotrauma.Lights
else
{
//light is inside, convexhull outside
if (chList.Submarine == null) continue;
if (chList.Submarine == null)
{
lightPos += (ParentSub.WorldPosition - ParentSub.HiddenSubPosition);
HashSet<RuinGeneration.Ruin> visibleRuins = new HashSet<RuinGeneration.Ruin>();
foreach (RuinGeneration.Ruin ruin in Level.Loaded.Ruins)
{
if (!MathUtils.CircleIntersectsRectangle(lightPos, range, ruin.Area)) { continue; }
visibleRuins.Add(ruin);
}
list.AddRange(chList.List.FindAll(ch => ch.ParentEntity?.ParentRuin != null && visibleRuins.Contains(ch.ParentEntity.ParentRuin)));
continue;
}
//light and convexhull are both inside the same sub
if (chList.Submarine == ParentSub)
{

View File

@@ -1182,6 +1182,15 @@ namespace Barotrauma.Networking
ConnectedClients.RemoveAt(i);
}
}
//remove clients that aren't present anymore
for (int i = ConnectedClients.Count - 1; i >= 0; i--)
{
if (!currentClients.Contains(ConnectedClients[i]))
{
GameMain.NetLobbyScreen.RemovePlayer(ConnectedClients[i].Name);
ConnectedClients.RemoveAt(i);
}
}
Voting.AllowSubVoting = allowSubVoting;
Voting.AllowModeVoting = allowModeVoting;

View File

@@ -160,23 +160,32 @@ namespace Barotrauma.Networking
//tab doesn't autoselect the chatbox when debug console is open,
//because tab is used for autocompleting console commands
if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) &&
!DebugConsole.IsOpen && (Screen.Selected != GameMain.GameScreen || msgBox.Visible))
if (!DebugConsole.IsOpen && (Screen.Selected != GameMain.GameScreen || msgBox.Visible))
{
if (msgBox.Selected)
if (PlayerInput.KeyHit(InputType.Chat))
{
msgBox.Text = "";
msgBox.Deselect();
}
else
{
msgBox.Select();
if (Screen.Selected == GameMain.GameScreen && PlayerInput.KeyHit(InputType.RadioChat))
if (msgBox.Selected)
{
msgBox.Text = "r; ";
msgBox.Text = "";
msgBox.Deselect();
}
else
{
msgBox.Select();
if ( PlayerInput.KeyHit(InputType.RadioChat))
{
msgBox.Text = "r; ";
}
}
}
if (Screen.Selected == GameMain.GameScreen && PlayerInput.KeyHit(InputType.RadioChat) && !msgBox.Selected)
{
msgBox.Select();
msgBox.Text = "r; ";
}
}
if (ServerLog.LogFrame != null) ServerLog.LogFrame.AddToGUIUpdateList();
}

View File

@@ -1559,6 +1559,7 @@ namespace Barotrauma
};
void UpdateJointScale(float value)
{
freezeToggle.Selected = false;
TryUpdateRagdollParam("jointscale", value);
jointScaleText.Text = $"Joint Scale: {RagdollParams.JointScale.FormatDoubleDecimal()}";
character.AnimController.ResetJoints();
@@ -4301,11 +4302,15 @@ namespace Barotrauma
};
break;
case 1:
new GUITextBlock(leftElement, "Is Humanoid?");
new GUITextBlock(leftElement, "Is Humanoid?")
{
TextColor = Color.White * 0.3f
};
new GUITickBox(rightElement, string.Empty)
{
Selected = IsHumanoid,
OnSelected = (tB) => IsHumanoid = tB.Selected
OnSelected = (tB) => IsHumanoid = tB.Selected,
Enabled = false
};
break;
case 2:

View File

@@ -692,6 +692,7 @@ namespace Barotrauma
{
if (GameMain.Client == null) return;
spectateButton.Visible = true;
spectateButton.Enabled = true;
}
public void SetCampaignCharacterInfo(CharacterInfo characterInfo)
@@ -1510,14 +1511,16 @@ namespace Barotrauma
if ((prevSize == 1.0f && chatBox.BarScroll == 0.0f) || (prevSize < 1.0f && chatBox.BarScroll == 1.0f)) chatBox.BarScroll = 1.0f;
}
// TODO: remember the previous head(s), check that the next is unique
private bool ToggleHead(GUIButton button, object userData)
{
if (GameMain.NetworkMember.CharacterInfo == null) return true;
int dir = (int)userData;
GameMain.NetworkMember.CharacterInfo.HeadSpriteId += dir;
GameMain.NetworkMember.CharacterInfo.LoadHeadAttachments();
GameMain.NetworkMember.CharacterInfo.LoadHeadSprite();
var info = GameMain.NetworkMember.CharacterInfo;
info.SetRandomRace();
info.SetRandomHead();
info.LoadHeadAttachments();
info.LoadHeadSprite();
StoreHead();
GameMain.Config.Save();
return true;
@@ -1526,26 +1529,27 @@ namespace Barotrauma
private bool SwitchGender(GUIButton button, object obj)
{
Gender gender = (Gender)obj;
GameMain.NetworkMember.CharacterInfo.Gender = gender;
GameMain.NetworkMember.CharacterInfo.SetRandomHead();
GameMain.NetworkMember.CharacterInfo.LoadHeadAttachments();
GameMain.NetworkMember.CharacterInfo.LoadHeadSprite();
var info = GameMain.NetworkMember.CharacterInfo;
info.Gender = gender;
info.SetRandomHead();
info.LoadHeadAttachments();
info.LoadHeadSprite();
StoreHead();
GameMain.Config.Save();
return true;
}
// TODO: switch race
private void StoreHead()
{
GameMain.Config.CharacterRace = GameMain.NetworkMember.CharacterInfo.Race;
GameMain.Config.CharacterGender = GameMain.NetworkMember.CharacterInfo.Gender;
GameMain.Config.CharacterHeadIndex = GameMain.NetworkMember.CharacterInfo.HeadSpriteId;
GameMain.Config.CharacterHairIndex = GameMain.NetworkMember.CharacterInfo.HairIndex;
GameMain.Config.CharacterBeardIndex = GameMain.NetworkMember.CharacterInfo.BeardIndex;
GameMain.Config.CharacterMoustacheIndex = GameMain.NetworkMember.CharacterInfo.MoustacheIndex;
GameMain.Config.CharacterFaceAttachmentIndex = GameMain.NetworkMember.CharacterInfo.FaceAttachmentIndex;
var info = GameMain.NetworkMember.CharacterInfo;
var config = GameMain.Config;
config.CharacterRace = info.Race;
config.CharacterGender = info.Gender;
config.CharacterHeadIndex = info.HeadSpriteId;
config.CharacterHairIndex = info.HairIndex;
config.CharacterBeardIndex = info.BeardIndex;
config.CharacterMoustacheIndex = info.MoustacheIndex;
config.CharacterFaceAttachmentIndex = info.FaceAttachmentIndex;
}
public void SelectMode(int modeIndex)

View File

@@ -333,6 +333,8 @@ namespace Barotrauma
element.Elements("BrokenSprite").ForEach(s => CreateSprite(s));
element.Elements("containedsprite").ForEach(s => CreateSprite(s));
element.Elements("ContainedSprite").ForEach(s => CreateSprite(s));
element.Elements("inventoryicon").ForEach(s => CreateSprite(s));
element.Elements("InventoryIcon").ForEach(s => CreateSprite(s));
//decorativesprites don't necessarily have textures (can be used to hide/disable other sprites)
element.Elements("decorativesprite").ForEach(s => { if (s.Attribute("texture") != null) CreateSprite(s); });
element.Elements("DecorativeSprite").ForEach(s => { if (s.Attribute("texture") != null) CreateSprite(s); });

View File

@@ -613,7 +613,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), modificationDate.RectTransform, Anchor.TopRight), item.Modified.ToString(), textAlignment: Alignment.TopRight);
var fileSize = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), content.RectTransform), TextManager.Get("WorkshopItemFileSize") + ": ");
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), fileSize.RectTransform, Anchor.TopRight), MathUtils.GetBytesReadable((long)item.Size), textAlignment: Alignment.TopRight);
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), fileSize.RectTransform, Anchor.TopRight), MathUtils.GetBytesReadable(item.Installed ? (long)item.Size : item.DownloadSize), textAlignment: Alignment.TopRight);
new GUIButton(new RectTransform(new Vector2(0.2f, 0.05f), content.RectTransform), TextManager.Get("WorkshopShowItemInSteam"))
{

View File

@@ -457,7 +457,11 @@ namespace Barotrauma.Sounds
{
startedPlaying = false;
buffersToUnqueue = 4;
unqueuedBuffers = (int[])streamBuffers.Clone();
unqueuedBuffers = new int[4];
for (int i = 0; i < 4; i++)
{
unqueuedBuffers[i] = (int)streamBuffers[i];
}
}
for (int i = 0; i < buffersToUnqueue; i++)

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.8.9.2")]
[assembly: AssemblyFileVersion("0.8.9.2")]
[assembly: AssemblyVersion("0.8.9.3")]
[assembly: AssemblyFileVersion("0.8.9.3")]

View File

@@ -246,6 +246,21 @@
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Husk\Ragdolls\HuskDefaultRagdoll.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Molochbaby\Animations\MolochbabySwimFast.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Molochbaby\Animations\MolochbabySwimSlow.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Molochbaby\Molochbaby.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Molochbaby\Molochbaby.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Molochbaby\Ragdolls\MolochbabyDefaultRagdoll.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Mudraptor\Animations\MudraptorRun.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@@ -60,6 +60,7 @@
<Character file="Content/Characters/Mudraptor/Mudraptor.xml" />
<Character file="Content/Characters/Mantis/Mantis.xml" />
<Character file="Content/Characters/Moloch/Moloch.xml" />
<Character file="Content/Characters/Molochbaby/Molochbaby.xml" />
<Character file="Content/Characters/Molochboss/Molochboss.xml" />
<Character file="Content/Characters/Tigerthresher/Tigerthresher.xml" />
<Character file="Content/Characters/Tigerthresherboss/Tigerthresherboss.xml" />

View File

@@ -21,13 +21,13 @@ namespace Barotrauma
public float SoundRange
{
get { return soundRange; }
set { soundRange = Math.Max(value, MinSoundRange); }
set { soundRange = MathHelper.Clamp(value, MinSoundRange, MaxSoundRange); }
}
public float SightRange
{
get { return sightRange; }
set { sightRange = Math.Max(value, MinSightRange); }
set { sightRange = MathHelper.Clamp(value, MinSightRange, MaxSoundRange); }
}
private float sectorRad = MathHelper.TwoPi;
@@ -58,7 +58,8 @@ namespace Barotrauma
public bool Enabled = true;
public float MinSoundRange, MinSightRange;
public readonly float MinSoundRange, MinSightRange;
public readonly float MaxSoundRange = float.MaxValue, MaxSightRange = float.MaxValue;
public Vector2 WorldPosition
{
@@ -102,6 +103,17 @@ namespace Barotrauma
{
SightRange = MinSightRange = element.GetAttributeFloat("sightrange", 0.0f);
SoundRange = MinSoundRange = element.GetAttributeFloat("soundrange", 0.0f);
// Use the min and max definitions if found.
if (element.Attribute("minsightrange") != null)
{
MinSightRange = element.GetAttributeFloat("minsightrange", MinSightRange);
}
if (element.Attribute("minsoundrange") != null)
{
MinSoundRange = element.GetAttributeFloat("minsoundrange", MinSoundRange);
}
MaxSightRange = element.GetAttributeFloat("maxsightrange", MaxSightRange);
MaxSoundRange = element.GetAttributeFloat("maxsoundrange", MaxSoundRange);
SonarLabel = element.GetAttributeString("sonarlabel", "");
}

View File

@@ -432,6 +432,20 @@ namespace Barotrauma
attackSimPosition = ConvertUnits.ToSimUnits(selectedAiTarget.WorldPosition - Character.Submarine.Position);
}
if (selectedAiTarget.Entity is Item item)
{
// If the item is held by a character, attack the character instead.
var pickable = item.components.Select(c => c as Pickable).FirstOrDefault();
if (pickable != null)
{
var target = pickable.Picker?.AiTarget;
if (target != null)
{
selectedAiTarget = target;
}
}
}
if (wallTarget != null)
{
attackSimPosition = ConvertUnits.ToSimUnits(wallTarget.Position);

View File

@@ -21,8 +21,13 @@ namespace Barotrauma
{
get
{
if (targetCharacter.Removed) return false;
if (goToObjective != null && !goToObjective.CanBeCompleted) return false;
if (targetCharacter.Removed ||
targetCharacter.IsDead ||
targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.VitalityThreshold)
{
return false;
}
if (goToObjective != null && !goToObjective.CanBeCompleted) { return false; }
return true;
}
@@ -208,7 +213,8 @@ namespace Barotrauma
public override bool IsCompleted()
{
bool isCompleted = !targetCharacter.IsUnconscious || targetCharacter.IsDead;
bool isCompleted =
targetCharacter.Vitality / targetCharacter.MaxVitality > AIObjectiveRescueAll.VitalityThreshold;
if (isCompleted)
{
@@ -216,14 +222,19 @@ namespace Barotrauma
null, 1.0f, "targethealed" + targetCharacter.Name, 60.0f);
}
return isCompleted;
return isCompleted || targetCharacter.IsDead;
}
public override float GetPriority(AIObjectiveManager objectiveManager)
{
if (targetCharacter.AnimController.CurrentHull == null) return 0.0f;
float distance = Vector2.DistanceSquared(character.WorldPosition, targetCharacter.WorldPosition);
return targetCharacter.IsDead ? 1000.0f / distance : 10000.0f / distance;
if (targetCharacter.AnimController.CurrentHull == null || targetCharacter.IsDead) { return 0.0f; }
Vector2 diff = targetCharacter.WorldPosition - character.WorldPosition;
float distance = Math.Abs(diff.X) + Math.Abs(diff.Y);
float vitalityFactor = (targetCharacter.MaxVitality - targetCharacter.Vitality) / targetCharacter.MaxVitality;
return 1000.0f * vitalityFactor / distance;
}
}
}

View File

@@ -5,6 +5,9 @@ namespace Barotrauma
{
class AIObjectiveRescueAll : AIObjective
{
//only treat characters whose vitality is below this (0.8 = 80% of max vitality)
public const float VitalityThreshold = 0.8f;
private List<Character> rescueTargets;
public AIObjectiveRescueAll(Character character)
@@ -38,7 +41,8 @@ namespace Barotrauma
rescueTargets = Character.CharacterList.FindAll(c =>
c.AIController is HumanAIController &&
c != character &&
c.IsUnconscious);
!c.IsDead &&
c.Vitality / c.MaxVitality < VitalityThreshold);
}
protected override void Act(float deltaTime)
@@ -52,7 +56,6 @@ namespace Barotrauma
public override bool IsCompleted()
{
return false;
}
}
}
}

View File

@@ -349,7 +349,7 @@ namespace Barotrauma
if (movement.LengthSquared() < 0.00001f)
{
WalkPos = MathHelper.SmoothStep(WalkPos, MathHelper.PiOver2, deltaTime * 5);
MainLimb.PullJointWorldAnchorB = Vector2.Lerp(MainLimb.PullJointWorldAnchorB, Collider.SimPosition, 0.5f);
MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
return;
}
@@ -459,14 +459,21 @@ namespace Barotrauma
Limbs[i].body.ApplyForce(movement * Limbs[i].SteerForce * Limbs[i].Mass, pullPos);
}
Vector2 mainLimbDiff = MainLimb.PullJointWorldAnchorB - MainLimb.SimPosition;
if (CurrentSwimParams.UseSineMovement)
{
MainLimb.PullJointWorldAnchorB = Vector2.SmoothStep(MainLimb.PullJointWorldAnchorB, Collider.SimPosition, (float)Math.Abs(Math.Sin(WalkPos)));
MainLimb.PullJointWorldAnchorB = Vector2.SmoothStep(
MainLimb.PullJointWorldAnchorB,
Collider.SimPosition,
mainLimbDiff.LengthSquared() > 10.0f ? 1.0f : (float)Math.Abs(Math.Sin(WalkPos)));
}
else
{
//MainLimb.PullJointWorldAnchorB = Collider.SimPosition;
MainLimb.PullJointWorldAnchorB = Vector2.Lerp(MainLimb.PullJointWorldAnchorB, Collider.SimPosition, 0.5f);
MainLimb.PullJointWorldAnchorB = Vector2.Lerp(
MainLimb.PullJointWorldAnchorB,
Collider.SimPosition,
mainLimbDiff.LengthSquared() > 10.0f ? 1.0f : 0.5f);
}
floorY = Limbs[0].SimPosition.Y;

View File

@@ -1694,26 +1694,33 @@ namespace Barotrauma
if (holdable.Pusher != null)
{
if (!holdable.Pusher.Enabled)
if (character.IsUnconscious || character.Stun > 0.0f)
{
holdable.Pusher.Enabled = true;
holdable.Pusher.ResetDynamics();
holdable.Pusher.SetTransform(currItemPos, itemAngle);
foreach (Character character in Character.CharacterList)
{
holdable.Pusher.FarseerBody.RestoreCollisionWith(character.AnimController.Collider.FarseerBody);
}
holdable.Pusher.FarseerBody.IgnoreCollisionWith(Collider.FarseerBody);
holdable.Pusher.Enabled = false;
}
else
{
holdable.Pusher.TargetPosition = currItemPos;
holdable.Pusher.TargetRotation = character.IsUnconscious || character.Stun > 0.0f ? itemAngle : holdAngle * Dir;
if (!holdable.Pusher.Enabled)
{
holdable.Pusher.Enabled = true;
holdable.Pusher.ResetDynamics();
holdable.Pusher.SetTransform(currItemPos, itemAngle);
foreach (Character character in Character.CharacterList)
{
holdable.Pusher.FarseerBody.RestoreCollisionWith(character.AnimController.Collider.FarseerBody);
}
holdable.Pusher.FarseerBody.IgnoreCollisionWith(Collider.FarseerBody);
}
else
{
holdable.Pusher.TargetPosition = currItemPos;
holdable.Pusher.TargetRotation = character.IsUnconscious || character.Stun > 0.0f ? itemAngle : holdAngle * Dir;
holdable.Pusher.MoveToTargetPosition(true);
holdable.Pusher.MoveToTargetPosition(true);
currItemPos = holdable.Pusher.SimPosition;
itemAngle = holdable.Pusher.Rotation;
currItemPos = holdable.Pusher.SimPosition;
itemAngle = holdable.Pusher.Rotation;
}
}
}

View File

@@ -216,6 +216,9 @@ namespace Barotrauma
{
if (limb.IsSevered) continue;
limb.body.SetTransform(Collider.SimPosition, Collider.Rotation);
//reset pull joints (they may be somewhere far away if the character has moved from the position where animations were last updated)
limb.PullJointEnabled = false;
limb.PullJointWorldAnchorB = limb.SimPosition;
}
}
}
@@ -903,7 +906,10 @@ namespace Barotrauma
else if (newHull != null && currentHull != null && newHull.Submarine != currentHull.Submarine)
{
character.MemLocalState?.Clear();
Teleport(ConvertUnits.ToSimUnits(currentHull.Submarine.Position - newHull.Submarine.Position),
Vector2 newSubPos = newHull.Submarine == null ? Vector2.Zero : newHull.Submarine.Position;
Vector2 prevSubPos = currentHull.Submarine == null ? Vector2.Zero : currentHull.Submarine.Position;
Teleport(ConvertUnits.ToSimUnits(prevSubPos - newSubPos),
Vector2.Zero);
}
}

View File

@@ -486,22 +486,25 @@ namespace Barotrauma
}
}
private bool canBeDragged = true;
public bool CanBeDragged
{
get
{
if (Removed || !AnimController.Draggable) return false;
if (!canBeDragged) { return false; }
if (Removed || !AnimController.Draggable) { return false; }
return IsDead || Stun > 0.0f || LockHands || IsUnconscious;
}
set { canBeDragged = value; }
}
//can other characters access the inventory of this character
private bool canInventoryBeAccessed = true;
public bool CanInventoryBeAccessed
{
get
{
if (Removed || Inventory == null) return false;
if (!canInventoryBeAccessed || Removed || Inventory == null) { return false; }
if (!Inventory.AccessibleWhenAlive)
{
return IsDead;
@@ -511,6 +514,7 @@ namespace Barotrauma
return (IsDead || Stun > 0.0f || LockHands || IsUnconscious);
}
}
set { canInventoryBeAccessed = value; }
}
public override Vector2 SimPosition
@@ -1580,12 +1584,12 @@ namespace Barotrauma
if (!CanInteractWith(c)) continue;
float dist = Vector2.DistanceSquared(mouseSimPos, c.SimPosition);
if (dist < maxDist*maxDist && (closestCharacter == null || dist < closestDist))
if (dist < maxDist * maxDist && (closestCharacter == null || dist < closestDist))
{
closestCharacter = c;
closestDist = dist;
}
/*FarseerPhysics.Common.Transform transform;
c.AnimController.Collider.FarseerBody.GetTransform(out transform);
for (int i = 0; i < c.AnimController.Collider.FarseerBody.FixtureList.Count; i++)
@@ -1717,7 +1721,7 @@ namespace Barotrauma
{
SelectCharacter(focusedCharacter);
}
else if (focusedCharacter != null && IsKeyHit(InputType.Health))
else if (focusedCharacter != null && IsKeyHit(InputType.Health) && focusedCharacter.CharacterHealth.UseHealthWindow)
{
if (focusedCharacter == SelectedCharacter)
{
@@ -2018,15 +2022,16 @@ namespace Barotrauma
private void UpdateSightRange()
{
if (aiTarget == null) { return; }
// TODO: the formula might need some tweaking
float range = (float)Math.Sqrt(Mass) * 1000.0f + AnimController.Collider.LinearVelocity.Length() * 500.0f;
aiTarget.SightRange = MathHelper.Clamp(range, 2000.0f, 50000.0f);
aiTarget.SightRange = MathHelper.Clamp(range, 0, 15000.0f);
}
private void UpdateSoundRange()
{
if (aiTarget == null) { return; }
float range = (float)Math.Sqrt(Mass) * 100.0f + AnimController.Collider.LinearVelocity.Length() * Noise;
aiTarget.SoundRange = MathHelper.Clamp(range, 2000f, 50000f);
float range = Mass / 5 * AnimController.TargetMovement.Length() * Noise;
aiTarget.SoundRange = MathHelper.Clamp(range, 0f, 5000f);
}
public void SetOrder(Order order, string orderOption, Character orderGiver, bool speak = true)
@@ -2306,15 +2311,17 @@ namespace Barotrauma
private void Implode(bool isNetworkMessage = false)
{
if (CharacterHealth.Unkillable) { return; }
if (!isNetworkMessage)
{
if (GameMain.Client != null) return;
if (GameMain.Client != null) return;
}
Kill(CauseOfDeathType.Pressure, null, isNetworkMessage);
CharacterHealth.PressureAffliction.Strength = CharacterHealth.PressureAffliction.Prefab.MaxStrength;
CharacterHealth.SetAllDamage(200.0f, 0.0f, 0.0f);
BreakJoints();
BreakJoints();
}
public void BreakJoints()

View File

@@ -200,12 +200,9 @@ namespace Barotrauma
if (headSpriteId < (int)spriteRange.X) headSpriteId = (int)(spriteRange.Y);
if (headSpriteId > (int)spriteRange.Y) headSpriteId = (int)(spriteRange.X);
if (headSpriteId != oldId)
{
headSprite = null;
attachmentSprites = null;
ResetHeadAttachments();
}
headSprite = null;
attachmentSprites = null;
ResetHeadAttachments();
}
}
@@ -282,12 +279,15 @@ namespace Barotrauma
SourceElement = doc.Root;
if (doc.Root.GetAttributeBool("genders", false))
{
this.gender = gender == Gender.None ? SetRandomGender() : gender;
this.gender = gender == Gender.None ? GetRandomGender() : gender;
}
if (!Enum.TryParse(doc.Root.GetAttributeString("race", "None"), true, out race))
{
race = GetRandomRace();
}
Enum.TryParse(doc.Root.GetAttributeString("race", "None"), true, out race);
if (race == Race.None)
{
SetRandomRace();
race = GetRandomRace();
}
CalculateHeadSpriteRange();
SetRandomHeadID();
@@ -403,10 +403,6 @@ namespace Barotrauma
}
}
public Gender SetRandomGender() => gender = (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < SourceElement.GetAttributeFloat("femaleratio", 0.5f)) ? Gender.Female : Gender.Male;
public Race SetRandomRace() => race = new Race[] { Race.White, Race.Black, Race.Asian }.GetRandom(Rand.RandSync.Server);
public int SetRandomHead() => HeadSpriteId = SetRandomHeadID();
private XDocument GetConfig(string file)
{
if (!cachedConfigs.TryGetValue(file, out XDocument doc))
@@ -418,6 +414,12 @@ namespace Barotrauma
return doc;
}
public Gender SetRandomGender() => Gender = GetRandomGender();
public Race SetRandomRace() => Race = GetRandomRace();
public int SetRandomHead() => HeadSpriteId = SetRandomHeadID();
public Gender GetRandomGender() => (Rand.Range(0.0f, 1.0f, Rand.RandSync.Server) < SourceElement.GetAttributeFloat("femaleratio", 0.5f)) ? Gender.Female : Gender.Male;
public Race GetRandomRace() => new Race[] { Race.White, Race.Black, Race.Asian }.GetRandom(Rand.RandSync.Server);
private int SetRandomHeadID()
{
if (headSpriteRange != Vector2.Zero)

View File

@@ -96,7 +96,7 @@ namespace Barotrauma
private Affliction oxygenLowAffliction;
private Affliction pressureAffliction;
private Affliction stunAffliction;
public bool IsUnconscious
{
get { return Vitality <= 0.0f; }
@@ -222,11 +222,22 @@ namespace Barotrauma
partial void InitProjSpecific(XElement element, Character character);
public IEnumerable<Affliction> GetAllAfflictions()
public IEnumerable<Affliction> GetAllAfflictions(Func<Affliction, bool> limbHealthFilter = null)
{
return afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions).ToList());
// TODO: If there can be duplicates, we should use Union instead.
return limbHealthFilter == null
? afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions))
: afflictions.Concat(limbHealths.SelectMany(lh => lh.Afflictions.Where(limbHealthFilter)));
}
private LimbHealth GetMathingLimbHealth(Affliction affliction) => limbHealths[Character.AnimController.GetLimb(affliction.Prefab.IndicatorLimb).HealthIndex];
/// <summary>
/// Returns the limb afflictions and non-limbspecific afflictions that are set to be displayed on this limb.
/// </summary>
private IEnumerable<Affliction> GetMatchingAfflictions(LimbHealth limb, Func<Affliction, bool> predicate)
=> limb.Afflictions.Where(predicate).Union(afflictions.Where(a => predicate(a) && GetMathingLimbHealth(a) == limb));
public Affliction GetAffliction(string afflictionType, bool allowLimbAfflictions = true)
{
foreach (Affliction affliction in afflictions)
@@ -466,9 +477,11 @@ namespace Barotrauma
CalculateVitality();
if (Vitality <= MinVitality) Kill();
#if CLIENT
selectedLimbIndex = -1;
#endif
}
private void AddAffliction(Affliction newAffliction)
{
if (!DoesBleed && newAffliction is AfflictionBleeding) return;
@@ -675,7 +688,7 @@ namespace Barotrauma
return allAfflictions;
}
public void ServerWrite(NetBuffer msg)
{
List<Affliction> activeAfflictions = afflictions.FindAll(a => a.Strength > 0.0f && a.Strength >= a.Prefab.ActivationThreshold);

View File

@@ -1909,11 +1909,20 @@ namespace Barotrauma
commands.Add(new Command("fixhulls|fixwalls", "fixwalls/fixhulls: Fixes all walls.", (string[] args) =>
{
foreach (Structure w in Structure.WallList)
var walls = new List<Structure>(Structure.WallList);
foreach (Structure w in walls)
{
for (int i = 0; i < w.SectionCount; i++)
try
{
w.AddDamage(i, -100000.0f);
for (int i = 0; i < w.SectionCount; i++)
{
w.AddDamage(i, -100000.0f);
}
}
catch (InvalidOperationException e)
{
string errorMsg = "Error while executing the fixhulls command.\n" + e.StackTrace;
GameAnalyticsManager.AddErrorEventOnce("DebugConsole.FixHulls", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
}
}
}, null, null, isCheat: true));

View File

@@ -133,8 +133,10 @@ namespace Barotrauma
CharacterInfo characterInfo = new CharacterInfo(Character.HumanConfigFile, jobPrefab: watchmanJob);
var spawnedCharacter = Character.Create(characterInfo, watchmanSpawnpoint.WorldPosition,
Level.Loaded.Seed + (outpost == Level.Loaded.StartOutpost ? "start" : "end"));
spawnedCharacter.CharacterHealth.Unkillable = true;
spawnedCharacter.CharacterHealth.UseHealthWindow = false;
spawnedCharacter.CharacterHealth.Unkillable = true;
spawnedCharacter.CanInventoryBeAccessed = false;
spawnedCharacter.CanBeDragged = false;
spawnedCharacter.SetCustomInteract(
WatchmanInteract,
hudText: TextManager.Get("TalkHint").Replace("[key]", GameMain.Config.KeyBind(InputType.Select).ToString()));

View File

@@ -383,6 +383,10 @@ namespace Barotrauma
{
CharacterRace = r;
}
else
{
CharacterRace = Race.White;
}
CharacterHairIndex = subElement.GetAttributeInt("hairindex", -1);
CharacterBeardIndex = subElement.GetAttributeInt("beardindex", -1);
CharacterMoustacheIndex = subElement.GetAttributeInt("moustacheindex", -1);

View File

@@ -449,12 +449,11 @@ namespace Barotrauma.Items.Components
hullRects[1].Width += rightHullDiff;
}
}
for (int i = 0; i < 2; i++)
{
hullRects[i].Location -= MathUtils.ToPoint((subs[i].WorldPosition - subs[i].HiddenSubPosition));
hulls[i] = new Hull(MapEntityPrefab.Find(null, "Hull"), hullRects[i], subs[i]);
hulls[i] = new Hull(MapEntityPrefab.Find(null, "hull"), hullRects[i], subs[i]);
hulls[i].AddToGrid(subs[i]);
hulls[i].FreeID();

View File

@@ -53,6 +53,7 @@ namespace Barotrauma.Items.Components
usableIn = UsableIn.Both;
break;
}
ResetSoundRange();
}
public override bool Use(float deltaTime, Character character = null)
@@ -108,7 +109,25 @@ namespace Barotrauma.Items.Components
useState -= deltaTime;
if (useState <= 0.0f) IsActive = false;
if (item.AiTarget != null)
{
item.AiTarget.SoundRange = IsActive ? item.AiTarget.MaxSoundRange : item.AiTarget.MinSoundRange;
}
}
public override void Unequip(Character character)
{
base.Unequip(character);
ResetSoundRange();
}
private void ResetSoundRange()
{
if (item.AiTarget != null)
{
item.AiTarget.SoundRange = item.AiTarget.MinSoundRange;
}
}
}
}

View File

@@ -210,6 +210,7 @@ namespace Barotrauma.Items.Components
private void StartFabricating(FabricableItem selectedItem, Character user)
{
if (selectedItem == null) return;
if (!outputContainer.Inventory.IsEmpty()) return;
if (user != null)
{

View File

@@ -355,6 +355,7 @@ namespace Barotrauma.Items.Components
{
float desiredTurbineOutput = (optimalTurbineOutput.X + optimalTurbineOutput.Y) / 2.0f;
targetTurbineOutput += MathHelper.Clamp(desiredTurbineOutput - targetTurbineOutput, -speed, speed) * deltaTime;
targetTurbineOutput = MathHelper.Clamp(targetTurbineOutput, 0.0f, 100.0f);
float desiredFissionRate = (optimalFissionRate.X + optimalFissionRate.Y) / 2.0f;
targetFissionRate += MathHelper.Clamp(desiredFissionRate - targetFissionRate, -speed, speed) * deltaTime;
@@ -367,6 +368,7 @@ namespace Barotrauma.Items.Components
{
targetFissionRate = Math.Min(targetFissionRate + speed * 2 * deltaTime, allowedFissionRate.Y);
}
targetFissionRate = MathHelper.Clamp(targetFissionRate, 0.0f, 100.0f);
}
public override void UpdateBroken(float deltaTime, Camera cam)

View File

@@ -83,7 +83,8 @@ namespace Barotrauma.Items.Components
if (!MathUtils.IsValid(value)) return;
charge = MathHelper.Clamp(value, 0.0f, capacity);
if (Math.Abs(charge - lastSentCharge) / capacity > 1.0f)
//send a network event if the charge has changed by more than 5%
if (Math.Abs(charge - lastSentCharge) / capacity > 0.05f)
{
if (GameMain.Server != null) item.CreateServerEvent(this);
lastSentCharge = charge;

View File

@@ -189,6 +189,16 @@ namespace Barotrauma
}
}
public bool IsEmpty()
{
for (int i = 0; i < capacity; i++)
{
if (Items[i] != null) return false;
}
return true;
}
protected bool TrySwapping(int index, Item item, Character user, bool createNetworkEvent)
{
if (item?.ParentInventory == null || Items[index] == null) return false;

View File

@@ -191,6 +191,14 @@ namespace Barotrauma.RuinGeneration
private BTRoom entranceRoom;
private List<RuinEntity> ruinEntities = new List<RuinEntity>();
private List<Door> doors = new List<Door>();
public IEnumerable<RuinEntity> RuinEntities
{
get { return ruinEntities; }
}
public List<RuinShape> RuinShapes
{
get { return allShapes; }
@@ -303,7 +311,7 @@ namespace Barotrauma.RuinGeneration
GenerateRuinEntities(caveCells, area, mirror);
}
class RuinEntity
public class RuinEntity
{
public readonly RuinEntityConfig Config;
public readonly MapEntity Entity;
@@ -319,8 +327,6 @@ namespace Barotrauma.RuinGeneration
}
}
private List<RuinEntity> ruinEntities = new List<RuinEntity>();
private List<Door> doors = new List<Door>();
private void GenerateRuinEntities(List<VoronoiCell> caveCells, Rectangle ruinArea, bool mirror)
{
var entityGrid = Hull.GenerateEntityGrid(new Rectangle(ruinArea.X, ruinArea.Y + ruinArea.Height, ruinArea.Width, ruinArea.Height));

View File

@@ -208,16 +208,16 @@ namespace Barotrauma
}
//remove connections that are too short
float minDistance = generationParams.MinConnectionDistance;
float minConnectionDistanceSqr = generationParams.MinConnectionDistance * generationParams.MinConnectionDistance;
for (int i = connections.Count - 1; i >= 0; i--)
{
LocationConnection connection = connections[i];
if (Vector2.Distance(connection.Locations[0].MapPosition, connection.Locations[1].MapPosition) > minDistance)
if (Vector2.DistanceSquared(connection.Locations[0].MapPosition, connection.Locations[1].MapPosition) > minConnectionDistanceSqr)
{
continue;
}
//locations.Remove(connection.Locations[0]);
connections.Remove(connection);
@@ -227,7 +227,7 @@ namespace Barotrauma
if (connection2.Locations[1] == connection.Locations[0]) connection2.Locations[1] = connection.Locations[1];
}
}
HashSet<Location> connectedLocations = new HashSet<Location>();
foreach (LocationConnection connection in connections)
{
@@ -238,15 +238,44 @@ namespace Barotrauma
connectedLocations.Add(connection.Locations[1]);
}
//remove orphans
Locations.RemoveAll(c => !connectedLocations.Contains(c));
//remove locations that are too close to each other
float minLocationDistanceSqr = generationParams.MinLocationDistance * generationParams.MinLocationDistance;
for (int i = Locations.Count - 1; i >= 0; i--)
{
for (int j = Locations.Count - 1; j > i; j--)
{
float dist = Vector2.DistanceSquared(Locations[i].MapPosition, Locations[j].MapPosition);
if (dist > minLocationDistanceSqr)
{
continue;
}
//move connections from Locations[j] to Locations[i]
foreach (LocationConnection connection in Locations[j].Connections)
{
if (connection.Locations[0] == Locations[j])
{
connection.Locations[0] = Locations[i];
}
else
{
connection.Locations[1] = Locations[i];
}
Locations[i].Connections.Add(connection);
}
Locations.RemoveAt(j);
}
}
//remove orphans
Locations.RemoveAll(c => !connectedLocations.Contains(c));
for (int i = connections.Count - 1; i >= 0; i--)
{
i = Math.Min(i, connections.Count - 1);
LocationConnection connection = connections[i];
for (int n = Math.Min(i - 1, connections.Count - 1); n >= 0; n--)
{
if (connection.Locations.Contains(connections[n].Locations[0])
@@ -399,6 +428,7 @@ namespace Barotrauma
GameAnalyticsManager.AddErrorEventOnce("Map.SelectLocation:LocationNotFound", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
return;
}
CurrentLocation.SelectedMissionIndex = missionIndex;
SelectedLocation = location;
SelectedConnection = connections.Find(c => c.Locations.Contains(CurrentLocation) && c.Locations.Contains(SelectedLocation));

View File

@@ -108,6 +108,9 @@ namespace Barotrauma
[Serialize(10.0f, true), Editable(0.0f, 500.0f, ToolTip = "Connections smaller than this are removed.")]
public float MinConnectionDistance { get; set; }
[Serialize(5.0f, true), Editable(0.0f, 100.0f, ToolTip = "Locations that are closer than this to another location are removed.")]
public float MinLocationDistance { get; set; }
[Serialize(0.2f, true), Editable(0.0f, 10.0f,
ToolTip = "Affects how many iterations are done when generating the jagged shape of the connections (iterations = Sqrt(connectionLength * multiplier)).")]
public float ConnectionIterationMultiplier { get; set; }

View File

@@ -1897,6 +1897,8 @@ namespace Barotrauma.Networking
Log(msg, ServerLog.MessageType.ServerMessage);
if (client.SteamID > 0) { SteamManager.StopAuthSession(client.SteamID); }
client.Connection.Disconnect(targetmsg);
connectedClients.Remove(client);

View File

@@ -183,6 +183,7 @@ namespace Barotrauma.Networking
{
//server is full, can't allow new connection
connection.Disconnect(DisconnectReason.ServerFull.ToString());
if (steamID > 0) { Steam.SteamManager.StopAuthSession(steamID); }
return;
}
@@ -224,6 +225,7 @@ namespace Barotrauma.Networking
{
//client did not ask for nonce first, can't authorize
inc.SenderConnection.Disconnect(DisconnectReason.AuthenticationRequired.ToString());
if (unauthClient.SteamID > 0) { Steam.SteamManager.StopAuthSession(unauthClient.SteamID); }
return;
}
@@ -450,7 +452,7 @@ namespace Barotrauma.Networking
private void DisconnectUnauthClient(NetIncomingMessage inc, UnauthenticatedClient unauthClient, DisconnectReason reason, string message)
{
inc.SenderConnection.Disconnect(reason.ToString() + "; " + message);
if (unauthClient.SteamID > 0) { Steam.SteamManager.StopAuthSession(unauthClient.SteamID); }
if (unauthClient != null)
{
unauthenticatedClients.Remove(unauthClient);

View File

@@ -408,6 +408,14 @@ namespace Barotrauma.Steam
return true;
}
public static void StopAuthSession(ulong clientSteamID)
{
if (instance == null || !instance.isInitialized || instance.server == null) return;
DebugConsole.Log("SteamManager ending auth session with Steam client " + clientSteamID);
instance.server.Auth.EndSession(clientSteamID);
}
public static bool CloseServer()
{
if (instance == null || !instance.isInitialized || instance.server == null) return false;

View File

@@ -1,3 +1,68 @@
---------------------------------------------------------------------------------------------------------
v0.8.9.3
---------------------------------------------------------------------------------------------------------
- Made molochs slower.
- Watchmen cannot be dragged or grabbed.
- AI characters can give treatment to characters who aren't unconscious.
- Added a button that dismisses the tutorial popups to prevent accidentally closing the popups.
- Underwater scooters now attract monsters.
- Improvements and balancing to vanilla submarines.
- Made alien ruin walls more durable.
- Reduced item deterioration speeds.
- Added "yes to all" and "no to all" buttons to the prompts when deleting containers in the submarine editor.
- Improved the background smoke texture in hydrothermal wastes.
- Baby moloch, doo doo doo doo doo doo
- Fixed console errors in the chemical shipment mission due to auxiliorizine being still present in the
mission configuration despite the item being removed.
- Made coilgun ammunition boxes craftable and purchaseable, coilgun bolts cannot be purchased anymore.
- Fixed AI-controlled husk not spawning when a huskified player dies.
- Fixed AI crew occasionally going outside to fix leaks.
- Fixed server failing to sync clients who join the server after a character has been removed during
the round (e.g. eaten, turned into a husk).
- Fixed server-side console errors when clients attempt to use a fabricator.
- Display Steam authentication errors in the server logs.
- Fixed status effects with a ReduceAffliction value of 0 freezing the game.
- Fixed sliders not moving in the battery/supercapacitor interface when an AI character is operating it.
- Fixed chatbox being deselected in the net lobby when receiving a lobby update from the server (i.e.
whenever the server host changes any setting).
- Fixed OnBroken status effects firing in the submarine editor when an item's condition is set to zero
(for example, reactors exploding and breaking all the nearby walls).
- Fixed file number being added to the file extension of debug console log files ("file123.txt (2)"
instead of "file123 (2).txt").
- Fixed battery positioning in charging docks.
- Fixed crashing when ending a single player round while a character is outside the sub.
- Fixed "attempting to remove an already removed item" console errors when ending a round.
- Fixed fire sounds persisting in menus.
- Fixed the layout of the extra cargo menu in server settings.
- Fixed depth charges disappearing from loaders when interacting them with both hand slots full.
- Fixed StatusEffects not being able to target item components. Caused doors to be impossible to weld
and most likely other issues with item StatusEffects as well.
- Artifacts spawn in artifact holders again.
- Fixes to "attempted to move pulljoint extremely far" errors which occasionally caused severe problems
in syncing characters' positions.
- Fixed a bug that occasionally caused monsters to spawn very close to the submarine in monster missions.
- Fixed servers occasionally starting the round multiple times when automatically starting the game via
autorestart or clients being ready.
- Fixed up-to-date content packages being reported as incompatible in the Steam workshop menu.
- Changed the default radio chat hotkey to T.
- Fixed the line of sight effect not working on ruins when looking at them from inside a sub.
- Fixed fabricator allowing new items to be created when the output is not empty, resulting in wasted materials.
- Fixed servers reporting incorrect player counts in the server list.
- Fixed order messages not being visible in single player if the character issuing the order has no headset.
- Fixed riot shields retaining their pushing ability even when the user is stunned or unconscious.
- Fixed rubber ducks not floating like a good duck should.
- Prevent locations from being generated too close to each other in the campaign map.
- Fixed battery and supercapacitor charges not staying in sync between the server and clients.
- Fixed watchmen imploding continuously if they end up outside.
- Fixed non-downloaded workshop items showing zero as the file size.
- Fixed spectate button staying disabled if starting a round fails (due to a missing sub file for example).
- Fixed crashing when teleporting characters from a submarine to ruins in multiplayer.
- Fixed automatic temperature control setting turbine output above 100 if the power consumption is higher
than what the reactor can generate. Caused "failed to write an event for the entity" errors in multiplayer.
- Fixed AI characters attempting to treat dead characters.
---------------------------------------------------------------------------------------------------------
v0.8.9.2
---------------------------------------------------------------------------------------------------------

View File

@@ -26,6 +26,7 @@ namespace Facepunch.Steamworks
public uint VotesUp { get; private set; }
public DateTime Modified { get; private set; }
public DateTime Created { get; private set; }
public int DownloadSize { get; private set; }
public Item( ulong Id, Workshop workshop )
{
@@ -46,6 +47,7 @@ namespace Facepunch.Steamworks
item.VotesDown = details.VotesDown;
item.Modified = Utility.Epoch.ToDateTime( details.TimeUpdated );
item.Created = Utility.Epoch.ToDateTime( details.TimeCreated );
item.DownloadSize = details.FileSize;
return item;
}