Hull volume helper in editor + Character name matches client name + Better-looking Watcher light source
Also '' is a thing of the past, use \" instead
This commit is contained in:
@@ -1485,7 +1485,6 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Submarines\Aegir Mark II.sub" />
|
||||
<None Include="Submarines\Nehalennia.sub" />
|
||||
<None Include="Submarines\TutorialSub.sub" />
|
||||
<None Include="Submarines\Vellamo.sub" />
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<limb id = "1" radius="50" height="120" flip="true">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="395,0,117,239" depth="0.025" origin="0.5,0.5"/>
|
||||
<lightsource range="200.0" color="0.8,0.8,1.0,1.0">
|
||||
<sprite texture="Content/Characters/Watcher/watcher.png" sourcerect="391,282,121,230" depth="0.025" origin="0.5,0.5"/>
|
||||
<lighttexture texture="Content/Characters/Watcher/watcher.png" sourcerect="391,282,121,230" depth="0.025" origin="0.5,0.5"/>
|
||||
</lightsource>
|
||||
</limb>
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace Barotrauma
|
||||
|
||||
if (collider[0] == null)
|
||||
{
|
||||
DebugConsole.ThrowError("No collider configured for ''"+character.Name+"''!");
|
||||
DebugConsole.ThrowError("No collider configured for \""+character.Name+"\"!");
|
||||
collider[0] = new PhysicsBody(0.0f, 0.0f, 0.5f, 5.0f);
|
||||
collider[0].BodyType = BodyType.Dynamic;
|
||||
collider[0].CollisionCategories = Physics.CollisionCharacter;
|
||||
@@ -624,7 +624,7 @@ namespace Barotrauma
|
||||
public virtual void Flip()
|
||||
{
|
||||
dir = (dir == Direction.Left) ? Direction.Right : Direction.Left;
|
||||
|
||||
|
||||
for (int i = 0; i < limbJoints.Length; i++)
|
||||
{
|
||||
float lowerLimit = -limbJoints[i].UpperLimit;
|
||||
@@ -648,6 +648,11 @@ namespace Barotrauma
|
||||
|
||||
Limbs[i].Dir = Dir;
|
||||
|
||||
if (Limbs[i].LightSource != null)
|
||||
{
|
||||
Limbs[i].LightSource.SpriteEffect = (dir == Direction.Left) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
}
|
||||
|
||||
if (Limbs[i].pullJoint == null) continue;
|
||||
|
||||
Limbs[i].pullJoint.LocalAnchorA =
|
||||
@@ -913,6 +918,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (limb.LightSource != null)
|
||||
{
|
||||
limb.LightSource.Rotation = limb.Rotation;
|
||||
}
|
||||
limb.Update(deltaTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Barotrauma.Items.Components
|
||||
if (value == drawable) return;
|
||||
if (!(this is IDrawableComponent))
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't make ''"+this+"'' drawable (the component doesn't implement the IDrawableComponent interface)");
|
||||
DebugConsole.ThrowError("Couldn't make \""+this+"\" drawable (the component doesn't implement the IDrawableComponent interface)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Barotrauma.Lights
|
||||
|
||||
private float range;
|
||||
|
||||
public SpriteEffects SpriteEffect = SpriteEffects.None;
|
||||
|
||||
private Texture2D texture;
|
||||
|
||||
public Sprite LightSprite;
|
||||
@@ -312,13 +314,14 @@ namespace Barotrauma.Lights
|
||||
overrideLightTexture.Draw(spriteBatch,
|
||||
drawPos, color * (color.A / 255.0f),
|
||||
overrideLightTexture.Origin, -Rotation,
|
||||
new Vector2(overrideLightTexture.size.X / overrideLightTexture.SourceRect.Width, overrideLightTexture.size.Y / overrideLightTexture.SourceRect.Height));
|
||||
new Vector2(overrideLightTexture.size.X / overrideLightTexture.SourceRect.Width, overrideLightTexture.size.Y / overrideLightTexture.SourceRect.Height),
|
||||
SpriteEffect);
|
||||
}
|
||||
}
|
||||
|
||||
if (LightSprite != null)
|
||||
{
|
||||
LightSprite.Draw(spriteBatch, drawPos, Color, LightSprite.Origin);
|
||||
LightSprite.Draw(spriteBatch, drawPos, Color, LightSprite.Origin, -Rotation, 1, SpriteEffect);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void WriteNetworkMessage(NetOutgoingMessage msg)
|
||||
{
|
||||
msg.WriteRangedInteger(0, Enum.GetValues(typeof(ChatMessageType)).Length, (byte)Type);
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
msg.WriteRangedInteger(0, Enum.GetValues(typeof(ChatMessageType)).Length, (byte)Type);
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
msg.Write(Sender == null ? (ushort)0 : Sender.ID);
|
||||
msg.Write(SenderName);
|
||||
}
|
||||
@@ -128,30 +128,30 @@ namespace Barotrauma.Networking
|
||||
|
||||
public static ChatMessage ReadNetworkMessage(NetBuffer msg)
|
||||
{
|
||||
ChatMessageType type = (ChatMessageType)msg.ReadRangedInteger(0, Enum.GetValues(typeof(ChatMessageType)).Length);
|
||||
string senderName="";
|
||||
Character character = null;
|
||||
if (GameMain.Server == null)
|
||||
{
|
||||
ChatMessageType type = (ChatMessageType)msg.ReadRangedInteger(0, Enum.GetValues(typeof(ChatMessageType)).Length);
|
||||
string senderName="";
|
||||
Character character = null;
|
||||
if (GameMain.Server == null)
|
||||
{
|
||||
ushort senderId = msg.ReadUInt16();
|
||||
character = Entity.FindEntityByID(senderId) as Character;
|
||||
senderName = msg.ReadString();
|
||||
}
|
||||
else
|
||||
{
|
||||
NetIncomingMessage inc = msg as NetIncomingMessage;
|
||||
if (inc == null) return null;
|
||||
Client sender = GameMain.Server.ConnectedClients.Find(x => x.Connection == inc.SenderConnection);
|
||||
if (sender == null) return null;
|
||||
character = sender.Character;
|
||||
if (character != null)
|
||||
{
|
||||
senderName = character.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
senderName = sender.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
NetIncomingMessage inc = msg as NetIncomingMessage;
|
||||
if (inc == null) return null;
|
||||
Client sender = GameMain.Server.ConnectedClients.Find(x => x.Connection == inc.SenderConnection);
|
||||
if (sender == null) return null;
|
||||
character = sender.Character;
|
||||
if (character != null)
|
||||
{
|
||||
senderName = character.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
senderName = sender.name;
|
||||
}
|
||||
}
|
||||
string text = msg.ReadString();
|
||||
|
||||
|
||||
@@ -1117,7 +1117,7 @@ namespace Barotrauma.Networking
|
||||
NetOutgoingMessage msg = client.CreateMessage();
|
||||
msg.Write((byte)PacketTypes.CharacterInfo);
|
||||
|
||||
msg.Write(characterInfo.Name);
|
||||
//msg.Write(characterInfo.Name);
|
||||
msg.Write(characterInfo.Gender == Gender.Male);
|
||||
msg.Write((byte)characterInfo.HeadSpriteId);
|
||||
|
||||
|
||||
@@ -1719,24 +1719,25 @@ namespace Barotrauma.Networking
|
||||
Gender gender = Gender.Male;
|
||||
int headSpriteId = 0;
|
||||
|
||||
name = sender.name;
|
||||
try
|
||||
{
|
||||
name = message.ReadString();
|
||||
//name = message.ReadString();
|
||||
gender = message.ReadBoolean() ? Gender.Male : Gender.Female;
|
||||
headSpriteId = message.ReadByte();
|
||||
}
|
||||
catch
|
||||
{
|
||||
name = "";
|
||||
//name = "";
|
||||
gender = Gender.Male;
|
||||
headSpriteId = 0;
|
||||
}
|
||||
|
||||
if (sender.characterInfo != null)
|
||||
/*if (sender.characterInfo != null)
|
||||
{
|
||||
//clients can't change their character's name once it's been set
|
||||
name = sender.characterInfo.Name;
|
||||
}
|
||||
}*/
|
||||
|
||||
List<JobPrefab> jobPreferences = new List<JobPrefab>();
|
||||
int count = message.ReadByte();
|
||||
|
||||
@@ -143,14 +143,14 @@ namespace Barotrauma.Networking
|
||||
inc.SenderConnection.Disconnect("The name \"" + name + "\" is already in use. Please choose another name.");
|
||||
DebugConsole.NewMessage(name + " couldn't join the server (name already in use)", Color.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
if (!whitelist.IsWhiteListed(name, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
||||
{
|
||||
if (!whitelist.IsWhiteListed(name, inc.SenderConnection.RemoteEndPoint.Address.ToString()))
|
||||
{
|
||||
inc.SenderConnection.Disconnect("You're not in this server's whitelist.");
|
||||
DebugConsole.NewMessage(name + " (" + inc.SenderConnection.RemoteEndPoint.Address.ToString() + ") couldn't join the server (not in whitelist)", Color.Red);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
//existing user re-joining
|
||||
|
||||
@@ -63,6 +63,41 @@ namespace Barotrauma
|
||||
return "Structures: " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
|
||||
}
|
||||
|
||||
private string GetTotalHullVolume()
|
||||
{
|
||||
float totalVol = 0.0f;
|
||||
Hull.hullList.ForEach(h => { totalVol += h.FullVolume; });
|
||||
return "Total Hull Volume:\n" + totalVol;
|
||||
}
|
||||
|
||||
private string GetSelectedHullVolume()
|
||||
{
|
||||
float buoyancyVol = 0.0f;
|
||||
float selectedVol = 0.0f;
|
||||
float neutralPercentage = 0.07f;
|
||||
Hull.hullList.ForEach(h => {
|
||||
buoyancyVol += h.FullVolume;
|
||||
if (h.IsSelected)
|
||||
{
|
||||
selectedVol += h.FullVolume;
|
||||
}
|
||||
});
|
||||
buoyancyVol *= neutralPercentage;
|
||||
string retVal = "Selected Hull Volume:\n" + selectedVol;
|
||||
if (selectedVol>0.0f && buoyancyVol>0.0f)
|
||||
{
|
||||
if (buoyancyVol / selectedVol < 1.0f)
|
||||
{
|
||||
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol) + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal += " (insufficient volume for buoyancy control)";
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private string GetPhysicsBodyCount()
|
||||
{
|
||||
return "Physics bodies: " + GameMain.World.BodyList.Count;
|
||||
@@ -89,6 +124,15 @@ namespace Barotrauma
|
||||
topPanel = new GUIFrame(new Rectangle(0, 0, 0, 31), GUI.Style);
|
||||
topPanel.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
|
||||
GUIFrame hullVolumeFrame = new GUIFrame(new Rectangle(145, 26, 400, 100), GUI.Style, topPanel);
|
||||
hullVolumeFrame.Padding = new Vector4(3.0f, 3.0f, 3.0f, 3.0f);
|
||||
|
||||
GUITextBlock totalHullVolume = new GUITextBlock(new Rectangle(0, 0, 0, 20), "", GUI.Style, hullVolumeFrame);
|
||||
totalHullVolume.TextGetter = GetTotalHullVolume;
|
||||
|
||||
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 50, 0, 20), "", GUI.Style, hullVolumeFrame);
|
||||
selectedHullVolume.TextGetter = GetSelectedHullVolume;
|
||||
|
||||
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", GUI.Style, topPanel);
|
||||
button.OnClicked = CreateLoadScreen;
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace Barotrauma
|
||||
{
|
||||
return musicClips.Where(x => x != null && x.type == OverrideMusicType).ToList();
|
||||
}
|
||||
else if (Character.Controlled != null && Level.Loaded != null && Level.Loaded.Ruins.Any(r => r.Area.Contains(Character.Controlled.WorldPosition)))
|
||||
else if (Character.Controlled != null && Level.Loaded != null && Level.Loaded.Ruins!=null && Level.Loaded.Ruins.Any(r => r.Area.Contains(Character.Controlled.WorldPosition)))
|
||||
{
|
||||
return musicClips.Where(x => x != null && x.type == "ruins").ToList();
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace Barotrauma
|
||||
if (components.Length!=3)
|
||||
{
|
||||
if (!errorMessages) return vector;
|
||||
DebugConsole.ThrowError("Failed to parse the string ''"+stringVector3+"'' to Vector3");
|
||||
DebugConsole.ThrowError("Failed to parse the string \""+stringVector3+"\" to Vector3");
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user