Husk improvements, option for admin to talk to dead players, spectators or one specific player, entitygrid bugfix

This commit is contained in:
Regalis
2016-02-14 22:22:24 +02:00
parent 94e34c0ed9
commit ef78f2d0f6
12 changed files with 81 additions and 32 deletions

View File

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<Character name="husk" humanoid="true" needsair="false">
<Character name="husk" humanoid="true" needsair="false" doesbleed="false">
<ragdoll headposition="114" torsoposition="88"
<ragdoll headposition="134" torsoposition="108"
stepsize="42.0, 12.0"
walkanimspeed="4.58"
movementlerp="0.4"
legtorque="-15.0"
thightorque="5.0">
legtorque="15.0"
thightorque="-5.0"
walkspeed="2.0"
swimspeed="2.0">
<!-- head -->
<limb id = "0" radius="13" mass = "6" type="Head" attackpriority="2" impacttolerance="5.0">
@@ -78,18 +80,18 @@
<!-- body to left leg -->
<joint limb1="12" limb1anchor="0,-1" limb2="6" limb2anchor="0,14" lowerlimit="-30" upperlimit="120"/>
<joint limb1="6" limb1anchor="0,-15" limb2="7" limb2anchor="0,20" lowerlimit="0" upperlimit="150"/>
<joint limb1="6" limb1anchor="0,-15" limb2="7" limb2anchor="0,20" lowerlimit="-150" upperlimit="-10"/>
<joint limb1="7" limb1anchor="-3,-21" limb2="8" limb2anchor="5,7" lowerlimit="20" upperlimit="90"/>
<!-- body to right leg -->
<joint limb1="12" limb1anchor="0,-1" limb2="9" limb2anchor="0,14" lowerlimit="-30" upperlimit="120"/>
<joint limb1="9" limb1anchor="0,-15" limb2="10" limb2anchor="0,20" lowerlimit="0" upperlimit="150"/>
<joint limb1="9" limb1anchor="0,-15" limb2="10" limb2anchor="0,20" lowerlimit="-150" upperlimit="-10"/>
<joint limb1="10" limb1anchor="-3,-21" limb2="11" limb2anchor="5,7" lowerlimit="20" upperlimit="90"/>
</ragdoll>
<ai attackhumans="500" attackrooms="50.0" attackweaker="50" attackstronger="-30"
<ai attackhumans="500" attackrooms="5.0" attackweaker="50" attackstronger="-30"
sight="0.5" hearing="1.0"
attackcooldown="5.0"/>
</Character>

View File

@@ -109,7 +109,7 @@
<MeleeWeapon slots="Any,RightHand,LeftHand"
aimpos="50,0" handle1="-5,0" holdangle="10" reload="1.0">
<Attack damage="2" stun="0.2" damagetype="Blunt" sound="Content/Items/Weapons/smack.ogg"/>
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="15.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
<StatusEffect type="OnUse" target="Contained,Character" Condition="-25.0" stun="20.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
<Explosion range="100.0" force="0.1" shockwave="false" flames="false" camerashake="5.0"/>
</StatusEffect>

View File

@@ -107,6 +107,14 @@ namespace Barotrauma
Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X));
if (Character.AnimController is HumanoidAnimController)
{
if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater)
{
Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left;
}
}
if (updateTargetsTimer > 0.0)
{
updateTargetsTimer -= deltaTime;

View File

@@ -43,6 +43,9 @@ namespace Barotrauma
stepSize = ToolBox.GetAttributeVector2(element, "stepsize", Vector2.One);
stepSize = ConvertUnits.ToSimUnits(stepSize);
walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f);
swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f);
//stepOffset = ToolBox.GetAttributeVector2(element, "stepoffset", Vector2.One);
//stepOffset = ConvertUnits.ToSimUnits(stepOffset);

View File

@@ -31,9 +31,6 @@ namespace Barotrauma
flip = ToolBox.GetAttributeBool(element, "flip", false);
walkSpeed = ToolBox.GetAttributeFloat(element, "walkspeed", 1.0f);
swimSpeed = ToolBox.GetAttributeFloat(element, "swimspeed", 1.0f);
float footRot = ToolBox.GetAttributeFloat(element,"footrotation", float.NaN);
if (float.IsNaN(footRot))
{

View File

@@ -241,7 +241,7 @@ namespace Barotrauma
float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f;
movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp);
movement = MathUtils.SmoothStep(movement, TargetMovement*walkSpeed, movementLerp);
movement.Y = 0.0f;
for (int i = 0; i < 2; i++)
@@ -502,7 +502,7 @@ namespace Barotrauma
if (TargetMovement == Vector2.Zero) return;
movement = MathUtils.SmoothStep(movement, TargetMovement, 0.3f);
movement = MathUtils.SmoothStep(movement, TargetMovement*swimSpeed, 0.3f);
//dont try to move upwards if head is already out of water
if (surfaceLimiter > 1.0f && TargetMovement.Y > 0.0f)

View File

@@ -391,7 +391,10 @@ namespace Barotrauma
Properties = ObjectProperty.GetProperties(this);
Info = characterInfo==null ? new CharacterInfo(file) : characterInfo;
if (file == humanConfigFile)
{
Info = characterInfo == null ? new CharacterInfo(file) : characterInfo;
}
XDocument doc = ToolBox.TryLoadXml(file);
if (doc == null || doc.Root == null) return;
@@ -453,22 +456,26 @@ namespace Barotrauma
}
}
if (Info.PickedItemIDs.Any())
if (file == humanConfigFile)
{
for (ushort i = 0; i < Info.PickedItemIDs.Count; i++ )
if (Info.PickedItemIDs.Any())
{
if (Info.PickedItemIDs[i] == 0) continue;
for (ushort i = 0; i < Info.PickedItemIDs.Count; i++ )
{
if (Info.PickedItemIDs[i] == 0) continue;
Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item;
Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item;
System.Diagnostics.Debug.Assert(item != null);
if (item == null) continue;
System.Diagnostics.Debug.Assert(item != null);
if (item == null) continue;
item.Pick(this, true, true, true);
inventory.TryPutItem(item, i, false);
item.Pick(this, true, true, true);
inventory.TryPutItem(item, i, false);
}
}
}
AnimController.FindHull(null);
if (AnimController.CurrentHull != null) Submarine = AnimController.CurrentHull.Submarine;

View File

@@ -132,6 +132,8 @@ namespace Barotrauma
return;
}
name = "";
if (doc.Root.Element("name") != null)
{
string firstNamePath = ToolBox.GetAttributeString(doc.Root.Element("name"), "firstname", "");

View File

@@ -32,16 +32,17 @@ namespace Barotrauma
Rectangle rect = entity.Rect;
//if (Submarine.Loaded != null) rect.Offset(-Submarine.HiddenSubPosition);
Rectangle indices = GetIndices(rect);
if (indices.X < 0 || indices.Width >= entities.GetLength(0) ||
indices.Y < 0 || indices.Height >= entities.GetLength(1))
if (indices.Width < 0 || indices.X >= entities.GetLength(0) ||
indices.Height < 0 || indices.Y >= entities.GetLength(1))
{
DebugConsole.ThrowError("Error in EntityGrid.InsertEntity: " + entity + " is outside the grid");
return;
}
for (int x = indices.X; x <= indices.Width; x++)
for (int x = Math.Max(indices.X, 0); x <= Math.Min(indices.Width, entities.GetLength(0)); x++)
{
for (int y = indices.Y; y <= indices.Height; y++)
for (int y = Math.Max(indices.Y,0); y <= Math.Min(indices.Height, entities.GetLength(1)); y++)
{
entities[x, y].Add(entity);
}

View File

@@ -882,6 +882,9 @@ namespace Barotrauma.Networking
GameMain.GameScreen.Select();
AddChatMessage("Press TAB to chat. Use ''/d'' to talk to dead players and spectators, and ''/playername'' to only send the message to a specific player.", ChatMessageType.Server);
yield return CoroutineStatus.Success;
}
@@ -1267,17 +1270,43 @@ namespace Barotrauma.Networking
public override void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server)
{
AddChatMessage(message, type);
if (server.Connections.Count == 0) return;
string[] words = message.Split(' ');
List<Client> recipients = new List<Client>();
Client targetClient = null;
foreach (Client c in ConnectedClients)
if (words.Length > 2)
{
if (type!=ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c);
if (words[1] == "/dead" || words[1] == "/d")
{
type = ChatMessageType.Dead;
}
else
{
targetClient = ConnectedClients.Find(c =>
words[0] == "/" + c.name.ToLower() ||
c.Character != null && words[0] == "/" + c.Character.Name.ToLower());
}
message = words[0] + " " + string.Join(" ", words, 2, words.Length - 2);
}
if (targetClient != null)
{
recipients.Add(targetClient);
}
else
{
foreach (Client c in ConnectedClients)
{
if (type != ChatMessageType.Dead || (c.Character != null && c.Character.IsDead)) recipients.Add(c);
}
}
AddChatMessage(message, type);
if (!server.Connections.Any()) return;
foreach (Client c in recipients)
{
ReliableMessage msg = c.ReliableChannel.CreateMessage();

View File

@@ -9,7 +9,7 @@ namespace Barotrauma.Networking
{
class ServerLog
{
const int LinesPerFile = 500;
const int LinesPerFile = 300;
const string SavePath = "ServerLogs";

Binary file not shown.