Ragdoll raycast crash, holding items in correct angles, ghost wires, dropping items properly in editmapscreen, radar wont work without power, remove wire from connectors if its deleted
This commit is contained in:
@@ -67,8 +67,8 @@
|
||||
|
||||
<Body width="90" height="30" density="10"/>
|
||||
|
||||
<MeleeWeapon slots="Any,RightHand,LeftHand"
|
||||
aimpos="50,0" handle1="-15,-6" holdangle="100" reload="1.0">
|
||||
<MeleeWeapon slots="Any,RightHand"
|
||||
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="10.0" disabledeltatime="true" sound="Content/Items/Weapons/stunbaton.ogg">
|
||||
<RequiredItem name="Battery Cell" type="Contained" msg="Loaded Battery Cell required"/>
|
||||
|
||||
@@ -518,8 +518,8 @@ namespace Barotrauma
|
||||
|
||||
if (wallAttack)
|
||||
{
|
||||
message.WriteRangedSingle(wallAttackPos.X, -50.0f, 50.0f, 10);
|
||||
message.WriteRangedSingle(wallAttackPos.Y, -50.0f, 50.0f, 10);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.X, -50.0f, 50.0f), -50.0f, 50.0f, 10);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.Y, -50.0f, 50.0f), -50.0f, 50.0f, 10);
|
||||
}
|
||||
|
||||
//message.Write(Velocity.X);
|
||||
|
||||
@@ -95,10 +95,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (limb.ignoreCollisions) continue;
|
||||
|
||||
if (limb.SimPosition.Length() > NetConfig.AllowedRagdollDistance) return false;
|
||||
if (limb.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) return false;
|
||||
|
||||
message.WriteRangedSingle(limb.body.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16);
|
||||
message.WriteRangedSingle(limb.body.SimPosition.Y, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16);
|
||||
message.WriteRangedSingle(limb.body.SimPosition.X, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
message.WriteRangedSingle(limb.body.SimPosition.Y, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
|
||||
|
||||
message.Write(limb.body.Rotation);
|
||||
@@ -114,11 +114,11 @@ namespace Barotrauma
|
||||
message.Write((float)NetTime.Now);
|
||||
|
||||
message.Write(AnimController.TargetDir == Direction.Right);
|
||||
message.WriteRangedSingle(AnimController.TargetMovement.X, -1.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(AnimController.TargetMovement.Y, -1.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8);
|
||||
message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8);
|
||||
|
||||
message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16);
|
||||
message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16);
|
||||
message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
message.WriteRangedSingle(AnimController.RefLimb.SimPosition.Y, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
|
||||
//message.Write(AnimController.RefLimb.LinearVelocity.X);
|
||||
//message.Write(AnimController.RefLimb.LinearVelocity.Y);
|
||||
@@ -196,8 +196,8 @@ namespace Barotrauma
|
||||
targetMovement.X = message.ReadRangedSingle(-1.0f, 1.0f, 8);
|
||||
targetMovement.Y = message.ReadRangedSingle(-1.0f, 1.0f, 8);
|
||||
|
||||
pos.X = message.ReadRangedSingle(-1.0f, 1.0f, 8);
|
||||
pos.Y = message.ReadRangedSingle(-1.0f, 1.0f, 8);
|
||||
pos.X = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
pos.Y = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16);
|
||||
|
||||
//vel.X = message.ReadFloat();
|
||||
//vel.Y = message.ReadFloat();
|
||||
|
||||
@@ -1077,9 +1077,14 @@ namespace Barotrauma
|
||||
if (GameMain.Client!=null) chatMessage += " Your chat messages will only be visible to other dead players.";
|
||||
|
||||
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
||||
GameMain.LightManager.LosEnabled = false;
|
||||
GameMain.LightManager.LosEnabled = false;
|
||||
|
||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
||||
}
|
||||
//if it's an ai character, only let the server kill it
|
||||
else if (GameMain.Server != null && this is AICharacter)
|
||||
{
|
||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
||||
}
|
||||
//otherwise don't kill the character unless received a message about the character dying
|
||||
else if (!isNetworkMessage)
|
||||
@@ -1210,8 +1215,13 @@ namespace Barotrauma
|
||||
{
|
||||
Vector2 relativeCursorPosition = cursorPosition - Position;
|
||||
|
||||
message.WriteRangedSingle(relativeCursorPosition.X, -2000.0f, 2000.0f, 8);
|
||||
message.WriteRangedSingle(relativeCursorPosition.Y, -2000.0f, 2000.0f, 8);
|
||||
if (relativeCursorPosition.Length()>4950.0f)
|
||||
{
|
||||
relativeCursorPosition = Vector2.Normalize(relativeCursorPosition) * 4950.0f;
|
||||
}
|
||||
|
||||
message.WriteRangedSingle(relativeCursorPosition.X, -5000.0f, 5000.0f, 16);
|
||||
message.WriteRangedSingle(relativeCursorPosition.Y, -5000.0f, 5000.0f, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1397,8 +1407,8 @@ namespace Barotrauma
|
||||
if (secondaryKeyState)
|
||||
{
|
||||
relativeCursorPos = new Vector2(
|
||||
message.ReadRangedSingle(-2000.0f, 2000.0f, 8),
|
||||
message.ReadRangedSingle(-2000.0f, 2000.0f, 8));
|
||||
message.ReadRangedSingle(-5000.0f, 5000.0f, 16),
|
||||
message.ReadRangedSingle(-5000.0f, 5000.0f, 16));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -832,16 +832,17 @@ namespace Barotrauma
|
||||
|
||||
if (itemPos == Vector2.Zero)
|
||||
{
|
||||
if (character.SelectedItems[0] == item)
|
||||
{
|
||||
transformedHoldPos = rightHand.pullJoint.WorldAnchorA - transformedHandlePos[0];
|
||||
itemAngle = (rightHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir);
|
||||
}
|
||||
|
||||
if (character.SelectedItems[1] == item)
|
||||
{
|
||||
transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1];
|
||||
itemAngle = (leftHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir);
|
||||
}
|
||||
if (character.SelectedItems[0] == item)
|
||||
{
|
||||
transformedHoldPos = rightHand.pullJoint.WorldAnchorA - transformedHandlePos[0];
|
||||
itemAngle = (rightHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -279,6 +279,8 @@ namespace Barotrauma
|
||||
{
|
||||
limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.0001f;
|
||||
}
|
||||
|
||||
FindLowestLimb();
|
||||
}
|
||||
|
||||
public bool OnLimbCollision(Fixture f1, Fixture f2, Contact contact)
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
item.body.FarseerBody.IgnoreCollisionWith(l.body.FarseerBody);
|
||||
|
||||
if (character.AnimController.InWater) continue;
|
||||
if (l.type == LimbType.LeftFoot || l.type == LimbType.LeftThigh || l.type == LimbType.LeftLeg) continue;
|
||||
|
||||
if (l.type == LimbType.Head || l.type == LimbType.Torso)
|
||||
|
||||
@@ -95,8 +95,10 @@ namespace Barotrauma.Items.Components
|
||||
if (item.body!= null && !item.body.Enabled)
|
||||
{
|
||||
Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand);
|
||||
|
||||
item.SetTransform(rightHand.SimPosition, 0.0f);
|
||||
item.body.Enabled = true;
|
||||
|
||||
}
|
||||
picker.Inventory.RemoveItem(item);
|
||||
picker = null;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Barotrauma.Items.Components
|
||||
else
|
||||
{
|
||||
pingState = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
@@ -201,6 +201,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
prevPos = pos;
|
||||
}
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, Vector2 position, float scale, Vector2 center, float radius)
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
message.Write(autoTemp);
|
||||
message.WriteRangedSingle(temperature, 0.0f, 10000.0f, 16);
|
||||
message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 7);
|
||||
message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 8);
|
||||
|
||||
message.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8);
|
||||
message.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8);
|
||||
@@ -443,8 +443,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
newAutoTemp = message.ReadBoolean();
|
||||
newTemperature = message.ReadRangedSingle(0.0f, 10000.0f, 16);
|
||||
newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 7);
|
||||
newShutDownTemp = MathUtils.Round(newShutDownTemp, 100.0f);
|
||||
newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 8);
|
||||
newShutDownTemp = MathUtils.RoundTowardsClosest(newShutDownTemp, 100.0f);
|
||||
|
||||
newCoolingRate = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
newFissionRate = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Barotrauma.Items.Components
|
||||
private bool valueChanged;
|
||||
|
||||
private float autopilotRayCastTimer;
|
||||
|
||||
|
||||
bool AutoPilot
|
||||
{
|
||||
get { return autoPilot; }
|
||||
@@ -104,6 +104,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
item.SendSignal(targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out");
|
||||
|
||||
item.SendSignal((-targetVelocity.Y).ToString(CultureInfo.InvariantCulture), "velocity_y_out");
|
||||
}
|
||||
|
||||
|
||||
@@ -281,6 +281,7 @@ namespace Barotrauma.Items.Components
|
||||
if (!PlayerInput.LeftButtonDown())
|
||||
{
|
||||
panel.Item.NewComponentEvent(panel, true, true);
|
||||
//draggingConnected.Drop(character);
|
||||
draggingConnected = null;
|
||||
}
|
||||
}
|
||||
@@ -318,6 +319,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (index>-1 && wireComponent!=null && !Wires.Contains(wireComponent))
|
||||
{
|
||||
wireComponent.RemoveConnection(item);
|
||||
|
||||
Wires[index] = wireComponent;
|
||||
wireComponent.Connect(this);
|
||||
}
|
||||
@@ -325,15 +328,15 @@ namespace Barotrauma.Items.Components
|
||||
//far away -> disconnect if the wire is linked to this connector
|
||||
else
|
||||
{
|
||||
int index = FindWireIndex(draggingConnected);
|
||||
if (index>-1)
|
||||
{
|
||||
Wires[index].RemoveConnection(this);
|
||||
//Wires[index].Item.SetTransform(item.SimPosition, 0.0f);
|
||||
//Wires[index].Item.Drop();
|
||||
//Wires[index].Item.body.Enabled = true;
|
||||
Wires[index] = null;
|
||||
}
|
||||
//int index = FindWireIndex(draggingConnected);
|
||||
//if (index>-1)
|
||||
//{
|
||||
// Wires[index].RemoveConnection(this);
|
||||
// //Wires[index].Item.SetTransform(item.SimPosition, 0.0f);
|
||||
// //Wires[index].Item.Drop();
|
||||
// //Wires[index].Item.body.Enabled = true;
|
||||
// Wires[index] = null;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace Barotrauma.Items.Components
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
if (character != Character.Controlled || character != user) return;
|
||||
|
||||
if (character.GetInputState(InputType.Select) &&
|
||||
character.SelectedConstruction==this.item) character.SelectedConstruction = null;
|
||||
|
||||
Connection.DrawConnections(spriteBatch, this, character);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,9 +57,23 @@ namespace Barotrauma.Items.Components
|
||||
return null;
|
||||
}
|
||||
|
||||
public void RemoveConnection(Item item)
|
||||
{
|
||||
for (int i = 0; i<2; i++)
|
||||
{
|
||||
if (connections[i]==null || connections[i].Item!=item) continue;
|
||||
|
||||
for (int n = 0; n< connections[i].Wires.Length; n++)
|
||||
{
|
||||
if (connections[i].Wires[n] == this) connections[i].Wires[n] = null;
|
||||
}
|
||||
connections[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveConnection(Connection connection)
|
||||
{
|
||||
if (connection == connections[0]) connections[0] = null;
|
||||
if (connection == connections[0]) connections[0] = null;
|
||||
if (connection == connections[1]) connections[1] = null;
|
||||
}
|
||||
|
||||
@@ -407,6 +421,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
ClearConnections();
|
||||
|
||||
base.Remove();
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write((byte)Math.Min(Nodes.Count, 10));
|
||||
|
||||
@@ -130,12 +130,13 @@ namespace Barotrauma.Items.Components
|
||||
Projectile projectileComponent = null;
|
||||
//search for a projectile from linked containers
|
||||
Item projectile = null;
|
||||
Item projectileContainer = null;
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
Item container = e as Item;
|
||||
if (container == null) continue;
|
||||
projectileContainer = e as Item;
|
||||
if (projectileContainer == null) continue;
|
||||
|
||||
ItemContainer containerComponent = container.GetComponent<ItemContainer>();
|
||||
ItemContainer containerComponent = projectileContainer.GetComponent<ItemContainer>();
|
||||
if (containerComponent == null) continue;
|
||||
|
||||
for (int i = 0; i < containerComponent.inventory.items.Length; i++)
|
||||
@@ -182,7 +183,7 @@ namespace Barotrauma.Items.Components
|
||||
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
|
||||
|
||||
projectileComponent.Use(deltaTime);
|
||||
item.RemoveContained(projectile);
|
||||
projectileContainer.RemoveContained(projectile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Barotrauma
|
||||
UpdateSlot(spriteBatch, slotRect, i, items[i], false);
|
||||
}
|
||||
|
||||
if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition))
|
||||
if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition) && draggingItem.container == this.Owner)
|
||||
{
|
||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
|
||||
{
|
||||
@@ -198,6 +198,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
DropItem(draggingItem);
|
||||
//draggingItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,19 @@ namespace Barotrauma
|
||||
|
||||
public void SetTransform(Vector2 simPosition, float rotation)
|
||||
{
|
||||
if (body != null) body.SetTransform(simPosition, rotation);
|
||||
if (body != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
body.SetTransform(simPosition, rotation);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError("Failed to set item transform", e);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 displayPos = ConvertUnits.ToDisplayUnits(simPosition);
|
||||
|
||||
@@ -803,7 +815,7 @@ namespace Barotrauma
|
||||
foreach (Item item in itemList)
|
||||
{
|
||||
if (ignoredItems!=null && ignoredItems.Contains(item)) continue;
|
||||
if (hull != item.CurrentHull && (hull==null || (item.Rect.Height<hull.Rect.Height && item.rect.Width < hull.Rect.Width))) continue;
|
||||
//if (hull != item.CurrentHull && (hull==null || (item.Rect.Height<hull.Rect.Height && item.rect.Width < hull.Rect.Width))) continue;
|
||||
if (item.body != null && !item.body.Enabled) continue;
|
||||
|
||||
Pickable pickableComponent = item.GetComponent<Pickable>();
|
||||
@@ -813,7 +825,7 @@ namespace Barotrauma
|
||||
{
|
||||
Rectangle transformedTrigger = item.TransformTrigger(trigger);
|
||||
|
||||
if (!Submarine.RectContains(transformedTrigger, displayPos))continue;
|
||||
if (!Submarine.RectContains(transformedTrigger, displayPos)) continue;
|
||||
|
||||
Vector2 triggerCenter =
|
||||
new Vector2(
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma
|
||||
{
|
||||
item.Drop();
|
||||
item.body.Enabled = true;
|
||||
item.body.SetTransform(container.Item.SimPosition, 0.0f);
|
||||
item.SetTransform(container.Item.SimPosition, 0.0f);
|
||||
}
|
||||
|
||||
public override int FindAllowedSlot(Item item)
|
||||
|
||||
@@ -484,6 +484,7 @@ namespace Barotrauma
|
||||
try
|
||||
{
|
||||
float newPercentage = message.ReadRangedSingle(0.0f, 1.5f, 6);
|
||||
newVolume = newPercentage * FullVolume;
|
||||
}
|
||||
|
||||
catch
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace Barotrauma
|
||||
|
||||
public float lastSentDamage;
|
||||
|
||||
public float lastUpdate;
|
||||
|
||||
public bool isHighLighted;
|
||||
|
||||
public WallSection(Rectangle rect)
|
||||
@@ -56,6 +54,8 @@ namespace Barotrauma
|
||||
private WallSection[] sections;
|
||||
|
||||
bool isHorizontal;
|
||||
|
||||
public float lastUpdate;
|
||||
|
||||
public override Sprite Sprite
|
||||
{
|
||||
@@ -451,8 +451,8 @@ namespace Barotrauma
|
||||
|
||||
if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f)
|
||||
{
|
||||
new NetworkEvent(NetworkEventType.WallDamage, ID, false, sectionIndex);
|
||||
sections[sectionIndex].lastSentDamage = damage;
|
||||
new NetworkEvent(NetworkEventType.WallDamage, ID, false);
|
||||
//sections[sectionIndex].lastSentDamage = damage;
|
||||
}
|
||||
|
||||
if (damage < prefab.MaxHealth*0.5f)
|
||||
@@ -638,48 +638,32 @@ namespace Barotrauma
|
||||
|
||||
public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
{
|
||||
int sectionIndex = 0;
|
||||
byte byteIndex = 0;
|
||||
|
||||
try
|
||||
{
|
||||
sectionIndex = (int)data;
|
||||
byteIndex = (byte)sectionIndex;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
message.Write((float)NetTime.Now);
|
||||
message.Write(byteIndex);
|
||||
message.WriteRangedSingle(sections[sectionIndex].damage/Health, 0.0f, 1.0f, 8);
|
||||
|
||||
for (int i = 0; i < sections.Length; i++)
|
||||
{
|
||||
if (Math.Abs(sections[i].damage - sections[i].lastSentDamage) < 0.1f) continue;
|
||||
message.Write((byte)i);
|
||||
message.WriteRangedSingle(sections[i].damage / Health, 0.0f, 1.0f, 8);
|
||||
|
||||
sections[i].lastSentDamage = sections[i].damage;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
{
|
||||
int sectionIndex = 0;
|
||||
float damage = 0.0f;
|
||||
float updateTime = 0.0f;
|
||||
float updateTime = message.ReadFloat();
|
||||
if (updateTime < lastUpdate) return;
|
||||
|
||||
try
|
||||
while (message.Position <= message.LengthBits-8)
|
||||
{
|
||||
updateTime = message.ReadFloat();
|
||||
sectionIndex = message.ReadByte();
|
||||
damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
byte sectionIndex = message.ReadByte();
|
||||
float damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||
|
||||
if (sections[sectionIndex].lastUpdate != 0.0f && updateTime < sections[sectionIndex].lastUpdate) return;
|
||||
|
||||
sections[sectionIndex].lastUpdate = updateTime;
|
||||
SetDamage(sectionIndex, damage);
|
||||
|
||||
SetDamage(sectionIndex, damage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,8 @@ namespace Barotrauma
|
||||
"Oops! Subsurface just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
#endif
|
||||
|
||||
Sounds.SoundManager.Dispose();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,7 @@ namespace Barotrauma
|
||||
if (dummyCharacter.SelectedConstruction == dummyCharacter.ClosestItem)
|
||||
{
|
||||
dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -329,6 +330,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||
|
||||
if (!PlayerInput.LeftButtonDown()) Inventory.draggingItem = null;
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
@@ -81,9 +81,7 @@ namespace Barotrauma
|
||||
GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//dustOffset -= Vector2.UnitY * 100.0f * (float)deltaTime;
|
||||
dustOffset -= Vector2.UnitY * 10.0f * (float)deltaTime;
|
||||
|
||||
if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime);
|
||||
//EventManager.Update(gameTime);
|
||||
@@ -208,7 +206,7 @@ namespace Barotrauma
|
||||
|
||||
BackgroundSpriteManager.Draw(spriteBatch);
|
||||
|
||||
backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y);
|
||||
backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y) + dustOffset;
|
||||
if (Level.Loaded != null) backgroundPos -= Level.Loaded.Position;
|
||||
|
||||
Rectangle viewRect = cam.WorldView;
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace Barotrauma
|
||||
(float)Math.Floor(value / div) * div;
|
||||
}
|
||||
|
||||
public static float RoundTowardsClosest(float value, float div)
|
||||
{
|
||||
return (float)Math.Round(value / div) * div;
|
||||
}
|
||||
|
||||
public static float VectorToAngle(Vector2 vector)
|
||||
{
|
||||
return (float)Math.Atan2(vector.Y, vector.X);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user