Particle.FindAdjacentHulls exception fix, OpenAL "invalid value" dix, radar sync, better ragdoll sync, autoupdate cancel/retry on error
This commit is contained in:
@@ -77,7 +77,11 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) IsActive = !IsActive;
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 200, 30), "Activate Radar"))
|
||||
{
|
||||
IsActive = !IsActive;
|
||||
item.NewComponentEvent(this, true);
|
||||
}
|
||||
|
||||
int radius = GuiFrame.Rect.Height / 2 - 10;
|
||||
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
||||
@@ -217,5 +221,22 @@ namespace Subsurface.Items.Components
|
||||
spriteBatch.DrawString(GUI.SmallFont, (int)(dist / 80.0f) + " m", new Vector2(markerPos.X + 10, markerPos.Y + 15), Color.LightGreen);
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write(IsActive);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
IsActive = message.ReadBoolean();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (autopilotRayCastTimer<=0.0f && steeringPath.NextNode != null)
|
||||
{
|
||||
Vector2 diff = steeringPath.NextNode.Position - Submarine.Loaded.Position;
|
||||
Vector2 diff = ConvertUnits.ToSimUnits(steeringPath.NextNode.Position - Submarine.Loaded.Position);
|
||||
|
||||
bool nextVisible = true;
|
||||
for (int x = -1; x < 2; x += 2)
|
||||
|
||||
@@ -517,24 +517,36 @@ namespace Subsurface
|
||||
|
||||
body.SetToTargetPosition();
|
||||
|
||||
bool inWater = true;
|
||||
|
||||
if (CurrentHull != null)
|
||||
{
|
||||
float surfaceY = ConvertUnits.ToSimUnits(CurrentHull.Surface);
|
||||
if (surfaceY > body.SimPosition.Y) return;
|
||||
|
||||
//the item has gone through the surface of the water -> apply an impulse which serves as surface tension
|
||||
if ((body.SimPosition.Y - (body.LinearVelocity.Y / 60.0f)) < surfaceY)
|
||||
if (body.SimPosition.Y < surfaceY )
|
||||
{
|
||||
Vector2 impulse = -body.LinearVelocity * (body.Mass / body.Density);
|
||||
body.ApplyLinearImpulse(impulse);
|
||||
int n = (int)((ConvertUnits.ToDisplayUnits(body.SimPosition.X) - CurrentHull.Rect.X) / Hull.WaveWidth);
|
||||
CurrentHull.WaveVel[n] = impulse.Y * 10.0f;
|
||||
inWater = true;
|
||||
|
||||
//the item has gone through the surface of the water -> apply an impulse which serves as surface tension
|
||||
//if (body.SimPosition.Y - (body.LinearVelocity.Y / 60.0f) < surfaceY)
|
||||
//{
|
||||
// Vector2 impulse = -body.LinearVelocity * (body.Mass / body.Density);
|
||||
// body.ApplyLinearImpulse(impulse);
|
||||
// int n = (int)((ConvertUnits.ToDisplayUnits(body.SimPosition.X) - CurrentHull.Rect.X) / Hull.WaveWidth);
|
||||
// CurrentHull.WaveVel[n] = impulse.Y * 10.0f;
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
inWater = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inWater) return;
|
||||
|
||||
//calculate (a rough approximation of) buoyancy
|
||||
float volume = body.Mass / body.Density;
|
||||
Vector2 buoyancy = new Vector2(0, volume * 20.0f);
|
||||
Vector2 buoyancy = new Vector2(0, volume * 10.0f);
|
||||
|
||||
//apply buoyancy and drag
|
||||
|
||||
@@ -808,7 +820,7 @@ namespace Subsurface
|
||||
|
||||
public bool Pick(Character picker, bool forcePick=false)
|
||||
{
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("Item.Pick("+picker+", "+forcePick+")");
|
||||
bool hasRequiredSkills = true;
|
||||
|
||||
bool picked = false, selected = false;
|
||||
|
||||
Reference in New Issue
Block a user