Fixes
It compiles now, but it's probably really broken.
This commit is contained in:
@@ -395,9 +395,7 @@ namespace Barotrauma.Items.Components
|
||||
public void Undock()
|
||||
{
|
||||
if (dockingTarget == null || !docked) return;
|
||||
|
||||
item.NewComponentEvent(this, false, true);
|
||||
|
||||
|
||||
PlaySound(ActionType.OnUse, item.WorldPosition);
|
||||
|
||||
dockingTarget.item.Submarine.DockedTo.Remove(item.Submarine);
|
||||
@@ -512,8 +510,6 @@ namespace Barotrauma.Items.Components
|
||||
if (!item.linkedTo.Any(e => e is Hull) && !dockingTarget.item.linkedTo.Any(e => e is Hull))
|
||||
{
|
||||
CreateHull();
|
||||
|
||||
item.NewComponentEvent(this, false, true);
|
||||
}
|
||||
}
|
||||
dockingState = MathHelper.Lerp(dockingState, 0.5f, deltaTime * 10.0f);
|
||||
|
||||
@@ -455,11 +455,11 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power=0.0f)
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power = 0.0f)
|
||||
{
|
||||
if (isStuck || GameMain.Client != null) return;
|
||||
|
||||
if (connection.Name=="toggle")
|
||||
if (connection.Name == "toggle")
|
||||
{
|
||||
SetState(!isOpen, false, true);
|
||||
}
|
||||
@@ -491,7 +491,7 @@ namespace Barotrauma.Items.Components
|
||||
public override void ServerWrite(Lidgren.Network.NetOutgoingMessage msg, Barotrauma.Networking.Client c)
|
||||
{
|
||||
msg.Write(isOpen);
|
||||
msg.WriteRangedSingle(stuck, 0.0f, 100.0f, 8);
|
||||
msg.WriteRangedSingle(stuck, 0.0f, 100.0f, 8);
|
||||
}
|
||||
|
||||
public override void ClientRead(Lidgren.Network.NetIncomingMessage msg)
|
||||
@@ -499,6 +499,6 @@ namespace Barotrauma.Items.Components
|
||||
SetState(msg.ReadBoolean(), true);
|
||||
Stuck = msg.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,9 +228,7 @@ namespace Barotrauma.Items.Components
|
||||
Msg = prevMsg;
|
||||
|
||||
attached = true;
|
||||
|
||||
if (character != null) item.NewComponentEvent(this, true, true);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,9 +95,7 @@ namespace Barotrauma.Items.Components
|
||||
SetActive(!IsActive);
|
||||
|
||||
currPowerConsumption = IsActive ? powerConsumption : 0.0f;
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,7 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
targetForce -= 1.0f;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -62,8 +61,7 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
targetForce += 1.0f;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -240,14 +240,10 @@ namespace Barotrauma.Items.Components
|
||||
if (fabricatedItem == null)
|
||||
{
|
||||
StartFabricating(obj as FabricableItem);
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
CancelFabricating();
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -74,7 +74,6 @@ namespace Barotrauma.Items.Components
|
||||
targetLevel = null;
|
||||
IsActive = !IsActive;
|
||||
if (!IsActive) currPowerConsumption = 0.0f;
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -83,7 +82,6 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
FlowPercentage -= 10.0f;
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -92,7 +90,6 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
FlowPercentage += 10.0f;
|
||||
item.NewComponentEvent(this, true, true);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -60,7 +60,6 @@ namespace Barotrauma.Items.Components
|
||||
isActiveTickBox.OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
IsActive = box.Selected;
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -117,12 +116,7 @@ namespace Barotrauma.Items.Components
|
||||
int radius = GuiFrame.Rect.Height / 2 - 30;
|
||||
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
||||
}
|
||||
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
}
|
||||
|
||||
|
||||
private void DrawRadar(SpriteBatch spriteBatch, Rectangle rect)
|
||||
{
|
||||
Vector2 center = new Vector2(rect.X + rect.Width*0.5f, rect.Center.Y);
|
||||
|
||||
@@ -324,7 +324,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (unsentChanges && sendUpdateTimer<= 0.0f)
|
||||
{
|
||||
item.NewComponentEvent(this, true, true);
|
||||
sendUpdateTimer = NetworkUpdateInterval;
|
||||
unsentChanges = false;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ namespace Barotrauma.Items.Components
|
||||
networkUpdateTimer -= deltaTime;
|
||||
if (networkUpdateTimer <= 0.0f)
|
||||
{
|
||||
item.NewComponentEvent(this, true, false);
|
||||
networkUpdateTimer = 0.5f;
|
||||
valueChanged = false;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,6 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
RechargeSpeed = Math.Max(rechargeSpeed - maxRechargeSpeed * 0.1f, 0.0f);
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
return true;
|
||||
};
|
||||
@@ -95,7 +94,6 @@ namespace Barotrauma.Items.Components
|
||||
button.OnClicked = (GUIButton btn, object obj) =>
|
||||
{
|
||||
RechargeSpeed = Math.Max(rechargeSpeed + maxRechargeSpeed * 0.1f, 0.0f);
|
||||
item.NewComponentEvent(this, true, false);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -309,7 +309,6 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (!PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
panel.Item.NewComponentEvent(panel, true, true);
|
||||
//draggingConnected.Drop(Character);
|
||||
draggingConnected = null;
|
||||
}
|
||||
|
||||
@@ -75,43 +75,19 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
else if (connection.Name == "toggle")
|
||||
{
|
||||
SetState(!IsOn,false,true);
|
||||
SetState(!IsOn);
|
||||
}
|
||||
else if (connection.Name == "set_state")
|
||||
{
|
||||
SetState(signal != "0", false, true);
|
||||
SetState(signal != "0");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetState(bool on, bool isNetworkMessage, bool sendNetworkMessage = false)
|
||||
public void SetState(bool on)
|
||||
{
|
||||
if (GameMain.Client != null && !isNetworkMessage) return;
|
||||
//if (GameMain.Client != null && !isNetworkMessage) return;
|
||||
|
||||
IsOn = on;
|
||||
if (sendNetworkMessage)
|
||||
{
|
||||
item.NewComponentEvent(this, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
|
||||
{
|
||||
message.Write(IsOn);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
|
||||
{
|
||||
if (sendingTime < lastReceivedMessage) return;
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lastReceivedMessage = sendingTime;
|
||||
|
||||
SetState(message.ReadBoolean(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,7 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
Drawable = Nodes.Any();
|
||||
|
||||
if (!loading) Item.NewComponentEvent(this, true, true);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -255,8 +253,6 @@ namespace Barotrauma.Items.Components
|
||||
if (Nodes.Count > 1)
|
||||
{
|
||||
Nodes.RemoveAt(Nodes.Count - 1);
|
||||
|
||||
item.NewComponentEvent(this, true, true);
|
||||
}
|
||||
|
||||
Drawable = Nodes.Any();
|
||||
|
||||
Reference in New Issue
Block a user