Fixed password box not working, connecting powered items with multiple parallel wires works, velocity/depth indicators on nav, stuff

This commit is contained in:
Regalis
2016-02-18 21:09:10 +02:00
parent 4ad8105cd6
commit cd4e3a3d2a
20 changed files with 182 additions and 82 deletions

View File

@@ -1,40 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<contentpackage name="Vanilla 0.3" path="Data/ContentPackages/Vanilla 0.3">
<Item file="Content\Items\idcard.xml" />
<Item file="Content\Items\itemlabel.xml" />
<Item file="Content\Items\Artifacts\artifacts.xml" />
<Item file="Content\Items\Button\button.xml" />
<Item file="Content\Items\Clothes\clothes.xml" />
<Item file="Content\Items\Diving\divinggear.xml" />
<Item file="Content\Items\Door\doors.xml" />
<Item file="Content\Items\Electricity\lights.xml" />
<Item file="Content\Items\Electricity\monitors.xml" />
<Item file="Content\Items\Electricity\poweritems.xml" />
<Item file="Content\Items\Electricity\signalitems.xml" />
<Item file="Content\Items\Engine\engine.xml" />
<Item file="Content\Items\Fabricators\fabricators.xml" />
<Item file="Content\Items\Fabricators\materials.xml" />
<Item file="Content\Items\Ladder\ladder.xml" />
<Item file="Content\Items\Lockers\lockers.xml" />
<Item file="Content\Items\Medical\medical.xml" />
<Item file="Content\Items\MiniMap\item.xml" />
<Item file="Content\Items\OxygenGenerator\oxygengenerator.xml" />
<Item file="Content\Items\Pump\pump.xml" />
<Item file="Content\Items\Reactor\reactor.xml" />
<Item file="Content\Items\Tools\tools.xml" />
<Item file="Content\Items\Weapons\explosives.xml" />
<Item file="Content\Items\Weapons\railgun.xml" />
<Item file="Content\Items\Weapons\weapons.xml" />
<Character file="Content\Characters\Crawler\crawler.xml" />
<Character file="Content\Characters\Endworm\endworm.xml" />
<Character file="Content\Characters\Human\human.xml" />
<Character file="Content\Characters\Mantis\mantis.xml" />
<Character file="Content\Characters\Moloch\moloch.xml" />
<Character file="Content\Characters\Scorpion\scorpion.xml" />
<Character file="Content\Characters\TigerThresher\tigerthresher.xml" />
<Character file="Content\Characters\Watcher\watcher.xml" />
<Structure file="Content\Map\StructurePrefabs.xml" />
<RandomEvents file="Content\randomevents.xml" />
<Jobs file="Content\Jobs.xml" />
<Item file="Content/Items/idcard.xml" />
<Item file="Content/Items/itemlabel.xml" />
<Item file="Content/Items/Artifacts/artifacts.xml" />
<Item file="Content/Items/Button/button.xml" />
<Item file="Content/Items/Clothes/clothes.xml" />
<Item file="Content/Items/Diving/divinggear.xml" />
<Item file="Content/Items/Door/doors.xml" />
<Item file="Content/Items/Electricity/lights.xml" />
<Item file="Content/Items/Electricity/monitors.xml" />
<Item file="Content/Items/Electricity/poweritems.xml" />
<Item file="Content/Items/Electricity/signalitems.xml" />
<Item file="Content/Items/Engine/engine.xml" />
<Item file="Content/Items/Fabricators/fabricators.xml" />
<Item file="Content/Items/Fabricators/materials.xml" />
<Item file="Content/Items/Ladder/ladder.xml" />
<Item file="Content/Items/Lockers/lockers.xml" />
<Item file="Content/Items/Medical/medical.xml" />
<Item file="Content/Items/MiniMap/item.xml" />
<Item file="Content/Items/OxygenGenerator/oxygengenerator.xml" />
<Item file="Content/Items/Pump/pump.xml" />
<Item file="Content/Items/Reactor/reactor.xml" />
<Item file="Content/Items/Tools/tools.xml" />
<Item file="Content/Items/Weapons/explosives.xml" />
<Item file="Content/Items/Weapons/railgun.xml" />
<Item file="Content/Items/Weapons/weapons.xml" />
<Character file="Content/Characters/Crawler/crawler.xml" />
<Character file="Content/Characters/Endworm/endworm.xml" />
<Character file="Content/Characters/Human/human.xml" />
<Character file="Content/Characters/Husk/husk.xml" />
<Character file="Content/Characters/Mantis/mantis.xml" />
<Character file="Content/Characters/Moloch/moloch.xml" />
<Character file="Content/Characters/Scorpion/scorpion.xml" />
<Character file="Content/Characters/TigerThresher/tigerthresher.xml" />
<Character file="Content/Characters/Watcher/watcher.xml" />
<Structure file="Content/Map/StructurePrefabs.xml" />
<RandomEvents file="Content/randomevents.xml" />
<Jobs file="Content/Jobs.xml" />
<Executable file="Barotrauma.exe" />
</contentpackage>
</contentpackage>

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.3.2.4")]
[assembly: AssemblyFileVersion("0.3.2.4")]
[assembly: AssemblyVersion("0.3.2.5")]
[assembly: AssemblyFileVersion("0.3.2.5")]

View File

@@ -45,7 +45,11 @@ namespace Barotrauma
var frame = new GUIFrame(new Rectangle(0,0,width,height), null, Alignment.Center, GUI.Style, this);
new GUITextBlock(new Rectangle(0, 0, 0, 30), header, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text, Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
if (!string.IsNullOrWhiteSpace(text))
{
new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
Color.Transparent, Color.White, textAlignment, GUI.Style, frame, true);
}
int x = 0;
this.Buttons = new GUIButton[buttons.Length];

View File

@@ -333,13 +333,21 @@ namespace Barotrauma.Tutorials
//fix everything except the command windows
foreach (Structure w in Structure.WallList)
{
if (windows.Contains(w)) continue;
bool isWindow = windows.Contains(w);
for (int i = 0; i < w.SectionCount; i++)
{
if (!w.SectionIsLeaking(i)) continue;
w.AddDamage(i, -100000.0f);
if (isWindow)
{
w.AddDamage(i, -w.SectionDamage(i) * 0.2f);
}
else
{
w.AddDamage(i, -100000.0f);
}
}
}
@@ -365,8 +373,19 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("You should quickly find yourself a diving mask or a diving suit. " +
"There are some in the room next to the airlock.");
bool divingMaskSelected = false;
while (!HasItem("Diving Mask") && !HasItem("Diving Suit"))
{
if (!divingMaskSelected &&
Character.Controlled.ClosestItem != null && Character.Controlled.ClosestItem.Name == "Diving Suit")
{
infoBox = CreateInfoFrame("The can only be one item in each inventory slot, so you need to take off "
+"the jumpsuit if you wish to wear a diving suit.");
divingMaskSelected = true;
}
yield return CoroutineStatus.Running;
}

View File

@@ -317,7 +317,8 @@ namespace Barotrauma.Items.Components
GUI.DrawRectangle(spriteBatch, new Rectangle((int)markerPos.X, (int)markerPos.Y, 5, 5), Color.LightGreen);
spriteBatch.DrawString(GUI.SmallFont, label, new Vector2(markerPos.X + 10, markerPos.Y), Color.LightGreen);
spriteBatch.DrawString(GUI.SmallFont, (int)(dist / 80.0f) + " m", new Vector2(markerPos.X + 10, markerPos.Y + 15), Color.LightGreen);
spriteBatch.DrawString(GUI.SmallFont, (int)(dist * Physics.DisplayToRealWorldRatio) + " m",
new Vector2(markerPos.X + 10, markerPos.Y + 15), Color.LightGreen);
}
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)

View File

@@ -164,7 +164,22 @@ namespace Barotrauma.Items.Components
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
if (Submarine.Loaded != null && Level.Loaded != null)
{
Vector2 realWorldVelocity = ConvertUnits.ToDisplayUnits(Submarine.Loaded.Velocity * Physics.DisplayToRealWorldRatio) * 3.6f;
float realWorldDepth = (Submarine.Loaded.Position.Y - Level.Loaded.Size.Y) *Physics.DisplayToRealWorldRatio;
GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 65),
"Velocity: " + (int)realWorldVelocity.X + " km/h", Color.LightGreen, null, 0, GUI.SmallFont);
GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 50),
"Descent velocity: " + -(int)realWorldVelocity.Y + " km/h", Color.LightGreen, null, 0, GUI.SmallFont);
GUI.DrawString(spriteBatch, new Vector2(x + 20, y + height - 30),
"Depth: " + (int)realWorldDepth + " m", Color.LightGreen, null, 0, GUI.SmallFont);
}
GUI.DrawLine(spriteBatch,
new Vector2(velRect.Center.X,velRect.Center.Y),
new Vector2(velRect.Center.X + currVelocity.X, velRect.Center.Y - currVelocity.Y),

View File

@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Globalization;
using System.Linq;
namespace Barotrauma.Items.Components
{
@@ -105,13 +106,19 @@ namespace Barotrauma.Items.Components
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
List<Connection> alreadyChecked = new List<Connection>();
List<Connection> connections = item.Connections;
if (connections == null) return;
foreach (Connection c in connections)
{
if (!c.IsPower) continue;
foreach (Connection recipient in c.Recipients)
var recipients = c.Recipients;
foreach (Connection recipient in recipients)
{
if (recipient == null || !c.IsPower) continue;
@@ -123,6 +130,8 @@ namespace Barotrauma.Items.Components
Powered powered = it.GetComponent<Powered>();
if (powered == null) continue;
if (connectedList.Contains(powered)) continue;
PowerTransfer powerTransfer = powered as PowerTransfer;
PowerContainer powerContainer = powered as PowerContainer;
if (powerTransfer != null)
@@ -140,6 +149,8 @@ namespace Barotrauma.Items.Components
{
fullPower += powerContainer.CurrPowerOutput;
}
alreadyChecked.Add(recipient);
}
else
{

View File

@@ -174,7 +174,7 @@ namespace Barotrauma.Items.Components
var otherConnection = c.Wires[i].OtherConnection(c);
Networking.GameServer.Log(
item.Name+" ("+ c.Name + ") -> " +
otherConnection.Item.Name+" ("+(otherConnection == null ? "none" : otherConnection.Name)+")", Color.Orange);
(otherConnection == null ? "none" : otherConnection.Item.Name+" ("+(otherConnection.Name)+")"), Color.Orange);
}
c.UpdateRecipients();
}

View File

@@ -79,28 +79,8 @@ namespace Barotrauma
if (force == 0.0f && attack.Stun == 0.0f && attack.GetDamage(1.0f) == 0.0f) return;
foreach (Character c in Character.CharacterList)
{
ApplyExplosionForces(worldPosition, attack.Range, force, attack.GetDamage(1.0f), attack.Stun);
foreach (Limb limb in c.AnimController.Limbs)
{
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
if (dist > attack.Range) continue;
float distFactor = 1.0f - dist / attack.Range;
if (limb.WorldPosition == worldPosition) continue;
c.AddDamage(limb.SimPosition, DamageType.None,
attack.GetDamage(1.0f) / c.AnimController.Limbs.Length * distFactor, 0.0f, attack.Stun * distFactor, false);
if (force > 0.0f)
{
limb.body.ApplyLinearImpulse(Vector2.Normalize(limb.WorldPosition - worldPosition) * distFactor * force);
}
}
}
}
private IEnumerable<object> DimLight()
@@ -123,6 +103,32 @@ namespace Barotrauma
yield return CoroutineStatus.Success;
}
public static void ApplyExplosionForces(Vector2 worldPosition, float range, float force, float damage = 0.0f, float stun = 0.0f)
{
if (range <= 0.0f) return;
foreach (Character c in Character.CharacterList)
{
foreach (Limb limb in c.AnimController.Limbs)
{
float dist = Vector2.Distance(limb.WorldPosition, worldPosition);
if (dist > range) continue;
float distFactor = 1.0f - dist / range;
if (limb.WorldPosition == worldPosition) continue;
c.AddDamage(limb.SimPosition, DamageType.None,
damage / c.AnimController.Limbs.Length * distFactor, 0.0f, stun * distFactor, false);
if (force > 0.0f)
{
limb.body.ApplyLinearImpulse(Vector2.Normalize(limb.WorldPosition - worldPosition) * distFactor * force);
}
}
}
}
public static void RangedStructureDamage(Vector2 worldPosition, float worldRange, float damage)
{
List<Structure> structureList = new List<Structure>();

View File

@@ -208,7 +208,11 @@ namespace Barotrauma
{
flowForce = Vector2.Zero;
if (open == 0.0f) return;
if (open == 0.0f)
{
lerpedFlowForce = Vector2.Zero;
return;
}
UpdateOxygen();

View File

@@ -518,7 +518,11 @@ namespace Barotrauma
bool hasHole = SectionHasHole(sectionIndex);
if (hadHole != hasHole) UpdateSections();
if (hadHole != hasHole)
{
if (hasHole) Explosion.ApplyExplosionForces(sections[sectionIndex].gap.WorldPosition, 500.0f, 5.0f, 0.0f, 0.0f);
UpdateSections();
}
}

View File

@@ -41,6 +41,9 @@ namespace Barotrauma.Networking
endRoundButton.OnSelected = ToggleEndRoundVote;
endRoundButton.Visible = false;
newName = newName.Replace(":", "");
newName = newName.Replace(";", "");
GameMain.DebugDraw = false;
Hull.EditFire = false;
Hull.EditWater = false;

View File

@@ -39,6 +39,9 @@ namespace Barotrauma.Networking
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
{
name = name.Replace(":", "");
name = name.Replace(";", "");
this.name = name;
this.password = password;
@@ -1121,12 +1124,11 @@ namespace Barotrauma.Networking
int traitorIndex = Rand.Range(0, characters.Count);
int targetIndex = Rand.Range(0, characters.Count);
while (targetIndex==traitorIndex)
while (targetIndex == traitorIndex)
{
targetIndex = Rand.Range(0, characters.Count);
}
traitor = characters[traitorIndex];
target = characters[targetIndex];

View File

@@ -12,6 +12,8 @@ namespace Barotrauma.Networking
//UpdateEntity networkevents aren't sent to clients if they're further than this from the entity
public const float UpdateEntityDistance = 2500.0f;
public const int MaxPlayers = 16;
public static string MasterServerUrl = GameMain.Config.MasterServerUrl;
//if a Character is further than this from the sub, the server will ignore it

View File

@@ -18,6 +18,8 @@ namespace Barotrauma
public const Category CollisionProjectile = Category.Cat6;
public const Category CollisionLevel = Category.Cat7;
public static float DisplayToRealWorldRatio = 1.0f / 80.0f;
public static double accumulator;
public static double step = 1.0/60.0;

View File

@@ -43,6 +43,15 @@ namespace Barotrauma
}
}
public static void CrashMessageBox(string message)
{
#if WINDOWS
MessageBox.Show(message, "Oops! Barotrauma just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
Sounds.SoundManager.Dispose();
}
static void CrashDump(GameMain game, string filePath, Exception exception)
{
StreamWriter sw = new StreamWriter(filePath);
@@ -88,15 +97,8 @@ namespace Barotrauma
sw.WriteLine(sb.ToString());
sw.Close();
#if WINDOWS
MessageBox.Show( "A crash report (''crashreport.txt'') was saved in the root folder of the game."+
" If you'd like to help fix this bug, please post the report on the Undertow Games forums.",
"Oops! Barotrauma just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
Sounds.SoundManager.Dispose();
CrashMessageBox( "A crash report (''crashreport.txt'') was saved in the root folder of the game."+
" If you'd like to help fix this bug, please post the report on the Undertow Games forums.");
}
}
#endif

View File

@@ -288,10 +288,10 @@ namespace Barotrauma
private bool ChangeMaxPlayers(GUIButton button, object obj)
{
int currMaxPlayers = 10;
int currMaxPlayers = 8;
int.TryParse(maxPlayersBox.Text, out currMaxPlayers);
currMaxPlayers = (int)MathHelper.Clamp(currMaxPlayers+(int)button.UserData, 1, 10);
currMaxPlayers = (int)MathHelper.Clamp(currMaxPlayers + (int)button.UserData, 1, NetConfig.MaxPlayers);
maxPlayersBox.Text = currMaxPlayers.ToString();

View File

@@ -33,7 +33,15 @@ namespace Barotrauma.Sounds
public static void Init()
{
AC = new AudioContext();
try
{
AC = new AudioContext();
}
catch (DllNotFoundException e)
{
Program.CrashMessageBox("OpenAL32.dll not found");
throw e;
}
for (int i = 0 ; i < DefaultSourceCount; i++)
{

View File

@@ -1,3 +1,19 @@
---------------------------------------------------------------------------------------------------------
v0.3.2.5
---------------------------------------------------------------------------------------------------------
- fixed null reference exception when starting a client
---------------------------------------------------------------------------------------------------------
v0.3.2.4
---------------------------------------------------------------------------------------------------------
- fixed crashing when highlighting a dead husk
- fixed the unclickable checkboxes in server settings
- sending messages to specific players using ''d; [message]'' and ''name; [message]'' (messages can be
sent to players with spaces in their names now)
- more descriptive log messages when taking items from cabinets or other players
---------------------------------------------------------------------------------------------------------
v0.3.2.3
---------------------------------------------------------------------------------------------------------

Binary file not shown.