(eeeb15d3d) Added: Platform collision for items
This commit is contained in:
@@ -2047,15 +2047,13 @@ namespace Barotrauma.Networking
|
|||||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupNewCampaign(Submarine sub, string saveName, string mapSeed)
|
public void SetupNewCampaign(Submarine sub, string savePath, 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(saveName);
|
msg.Write(savePath);
|
||||||
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 saveName = inc.ReadString();
|
string savePath = 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,11 +743,7 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string localSavePath = SaveUtil.CreateSavePath(SaveUtil.SaveType.Multiplayer, saveName);
|
if (connectedClient.HasPermission(ClientPermissions.SelectMode)) MultiPlayerCampaign.StartNewCampaign(savePath, matchingSub.FilePath, seed);
|
||||||
if (connectedClient.HasPermission(ClientPermissions.SelectMode))
|
|
||||||
{
|
|
||||||
MultiPlayerCampaign.StartNewCampaign(localSavePath, matchingSub.FilePath, seed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -840,15 +840,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(humanConfigFile))
|
if (string.IsNullOrEmpty(humanConfigFile))
|
||||||
{
|
{
|
||||||
humanConfigFile = GameMain.Instance.GetFilesOfType(ContentType.Character)?
|
humanConfigFile = GetConfigFile("Human");
|
||||||
.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;
|
||||||
}
|
}
|
||||||
@@ -867,6 +859,42 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||||
|
{
|
||||||
|
string configFile = null;
|
||||||
|
if (contentPackage == null)
|
||||||
|
{
|
||||||
|
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsKeyHit(InputType inputType)
|
||||||
|
{
|
||||||
|
#if SERVER
|
||||||
|
if (GameMain.Server != null && IsRemotePlayer)
|
||||||
|
{
|
||||||
|
if (characterConfigFiles == null)
|
||||||
|
{
|
||||||
|
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
||||||
|
}
|
||||||
|
return characterConfigFiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Searches for a character config file from all currently selected content packages,
|
/// Searches for a character config file from all currently selected content packages,
|
||||||
/// or from a specific package if the contentPackage parameter is given.
|
/// or from a specific package if the contentPackage parameter is given.
|
||||||
@@ -952,6 +980,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)
|
||||||
{
|
{
|
||||||
@@ -1099,13 +1128,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ namespace Barotrauma
|
|||||||
//Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
//Enum.TryParse(element.GetAttributeString("bodytype", "Dynamic"), out BodyType bodyType);
|
||||||
body.BodyType = BodyType.Dynamic;
|
body.BodyType = BodyType.Dynamic;
|
||||||
body.CollisionCategories = Physics.CollisionItem;
|
body.CollisionCategories = Physics.CollisionItem;
|
||||||
body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel;
|
body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionPlatform;
|
||||||
body.Friction = element.GetAttributeFloat("friction", 0.3f);
|
body.Friction = element.GetAttributeFloat("friction", 0.3f);
|
||||||
body.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
body.Restitution = element.GetAttributeFloat("restitution", 0.05f);
|
||||||
body.UserData = this;
|
body.UserData = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user