(31379c825) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -2047,13 +2047,15 @@ namespace Barotrauma.Networking
|
|||||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupNewCampaign(Submarine sub, string savePath, string mapSeed)
|
public void SetupNewCampaign(Submarine sub, string saveName, string mapSeed)
|
||||||
{
|
{
|
||||||
|
saveName = Path.GetFileNameWithoutExtension(saveName);
|
||||||
|
|
||||||
NetOutgoingMessage msg = client.CreateMessage();
|
NetOutgoingMessage msg = client.CreateMessage();
|
||||||
msg.Write((byte)ClientPacketHeader.CAMPAIGN_SETUP_INFO);
|
msg.Write((byte)ClientPacketHeader.CAMPAIGN_SETUP_INFO);
|
||||||
|
|
||||||
msg.Write(true); msg.WritePadBits();
|
msg.Write(true); msg.WritePadBits();
|
||||||
msg.Write(savePath);
|
msg.Write(saveName);
|
||||||
msg.Write(mapSeed);
|
msg.Write(mapSeed);
|
||||||
msg.Write(sub.Name);
|
msg.Write(sub.Name);
|
||||||
msg.Write(sub.MD5Hash.Hash);
|
msg.Write(sub.MD5Hash.Hash);
|
||||||
|
|||||||
@@ -728,7 +728,7 @@ namespace Barotrauma.Networking
|
|||||||
bool isNew = inc.ReadBoolean(); inc.ReadPadBits();
|
bool isNew = inc.ReadBoolean(); inc.ReadPadBits();
|
||||||
if (isNew)
|
if (isNew)
|
||||||
{
|
{
|
||||||
string savePath = inc.ReadString();
|
string saveName = inc.ReadString();
|
||||||
string seed = inc.ReadString();
|
string seed = inc.ReadString();
|
||||||
string subName = inc.ReadString();
|
string subName = inc.ReadString();
|
||||||
string subHash = inc.ReadString();
|
string subHash = inc.ReadString();
|
||||||
@@ -743,7 +743,11 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (connectedClient.HasPermission(ClientPermissions.SelectMode)) MultiPlayerCampaign.StartNewCampaign(savePath, matchingSub.FilePath, seed);
|
string localSavePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer, saveName);
|
||||||
|
if (connectedClient.HasPermission(ClientPermissions.SelectMode))
|
||||||
|
{
|
||||||
|
MultiPlayerCampaign.StartNewCampaign(localSavePath, matchingSub.FilePath, seed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -840,7 +840,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(humanConfigFile))
|
if (string.IsNullOrEmpty(humanConfigFile))
|
||||||
{
|
{
|
||||||
humanConfigFile = GetConfigFile("Human");
|
humanConfigFile = GameMain.Instance.GetFilesOfType(ContentType.Character)?
|
||||||
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == "human.xml");
|
||||||
|
|
||||||
|
if (humanConfigFile == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError($"Couldn't find a human config file from the selected content packages!");
|
||||||
|
DebugConsole.ThrowError($"(The config file must end with \"human.xml\")");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return humanConfigFile;
|
return humanConfigFile;
|
||||||
}
|
}
|
||||||
@@ -859,6 +867,74 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Searches for a character config file from all currently selected content packages,
|
||||||
|
/// or from a specific package if the contentPackage parameter is given.
|
||||||
|
/// </summary>
|
||||||
|
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||||
|
{
|
||||||
|
string configFile = null;
|
||||||
|
if (contentPackage == null)
|
||||||
|
{
|
||||||
|
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
||||||
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
||||||
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
||||||
|
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return configFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<string> characterConfigFiles;
|
||||||
|
private static IEnumerable<string> CharacterConfigFiles
|
||||||
|
{
|
||||||
|
#if SERVER
|
||||||
|
if (GameMain.Server != null && IsRemotePlayer)
|
||||||
|
{
|
||||||
|
if (characterConfigFiles == null)
|
||||||
|
{
|
||||||
|
case InputType.Left:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Left)) && (prevDequeuedInput.HasFlag(InputNetFlags.Left));
|
||||||
|
case InputType.Right:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Right)) && (prevDequeuedInput.HasFlag(InputNetFlags.Right));
|
||||||
|
case InputType.Up:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Up)) && (prevDequeuedInput.HasFlag(InputNetFlags.Up));
|
||||||
|
case InputType.Down:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Down)) && (prevDequeuedInput.HasFlag(InputNetFlags.Down));
|
||||||
|
case InputType.Run:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Run)) && (prevDequeuedInput.HasFlag(InputNetFlags.Run));
|
||||||
|
case InputType.Crouch:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Crouch)) && (prevDequeuedInput.HasFlag(InputNetFlags.Crouch));
|
||||||
|
case InputType.Select:
|
||||||
|
return dequeuedInput.HasFlag(InputNetFlags.Select); //TODO: clean up the way this input is registered
|
||||||
|
case InputType.Deselect:
|
||||||
|
return dequeuedInput.HasFlag(InputNetFlags.Deselect);
|
||||||
|
case InputType.Health:
|
||||||
|
return dequeuedInput.HasFlag(InputNetFlags.Health);
|
||||||
|
case InputType.Grab:
|
||||||
|
return dequeuedInput.HasFlag(InputNetFlags.Grab);
|
||||||
|
case InputType.Use:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Use)) && (prevDequeuedInput.HasFlag(InputNetFlags.Use));
|
||||||
|
case InputType.Shoot:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Shoot)) && (prevDequeuedInput.HasFlag(InputNetFlags.Shoot));
|
||||||
|
case InputType.Ragdoll:
|
||||||
|
return !(dequeuedInput.HasFlag(InputNetFlags.Ragdoll)) && (prevDequeuedInput.HasFlag(InputNetFlags.Ragdoll));
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return characterConfigFiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||||
{
|
{
|
||||||
string configFile = null;
|
string configFile = null;
|
||||||
@@ -872,6 +948,7 @@ namespace Barotrauma
|
|||||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
||||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (configFile == null)
|
if (configFile == null)
|
||||||
{
|
{
|
||||||
@@ -1128,6 +1205,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ResetSpeedMultiplier(); // Reset, items will set the value before the next update
|
ResetSpeedMultiplier(); // Reset, items will set the value before the next update
|
||||||
|
|
||||||
|
var rightFoot = AnimController.GetLimb(LimbType.RightFoot);
|
||||||
|
if (rightFoot != null)
|
||||||
|
{
|
||||||
|
float footAfflictionStrength = CharacterHealth.GetAfflictionStrength("damage", rightFoot, true);
|
||||||
|
speed *= MathHelper.Lerp(1.0f, 0.4f, MathHelper.Clamp(footAfflictionStrength / 80.0f, 0.0f, 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user