Improved map rendering, shops, light bugfix, junction boxes wont break as easily
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Subsurface.Items.Components
|
||||
MeltDown();
|
||||
return;
|
||||
}
|
||||
else if (temperature==0.0f)
|
||||
else if (temperature == 0.0f)
|
||||
{
|
||||
if (powerUpTask == null || powerUpTask.IsFinished)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Subsurface.Items.Components
|
||||
pt.powerLoad += (fullLoad - pt.powerLoad) / inertia;
|
||||
pt.currPowerConsumption += (-fullPower - pt.currPowerConsumption) / inertia;
|
||||
pt.Item.SendSignal("", "power", fullPower / Math.Max(fullLoad, 1.0f));
|
||||
if (-pt.currPowerConsumption > pt.powerLoad * 2.0f) pt.item.Condition = 0.0f;
|
||||
if (-pt.currPowerConsumption > Math.Max(pt.powerLoad * 2.0f, 200.0f)) pt.item.Condition -= deltaTime*10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,6 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
connection.SendSignal(signal, sender, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,6 +83,12 @@ namespace Subsurface.Items.Components
|
||||
light.Position = ConvertUnits.ToDisplayUnits(item.body.Position);
|
||||
}
|
||||
|
||||
if (item.container!= null)
|
||||
{
|
||||
light.Color = Color.Transparent;
|
||||
return;
|
||||
}
|
||||
|
||||
if (powerConsumption == 0.0f)
|
||||
{
|
||||
voltage = 1.0f;
|
||||
@@ -92,9 +98,9 @@ namespace Subsurface.Items.Components
|
||||
currPowerConsumption = powerConsumption;
|
||||
}
|
||||
|
||||
if (Rand.Range(0.0f, 1.0f)<0.05f && voltage < Rand.Range(0.0f, minVoltage))
|
||||
if (Rand.Range(0.0f, 1.0f) < 0.05f && voltage < Rand.Range(0.0f, minVoltage))
|
||||
{
|
||||
if (voltage>0.1f) sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 400.0f, item.Position);
|
||||
if (voltage > 0.1f) sparkSounds[Rand.Int(sparkSounds.Length)].Play(1.0f, 400.0f, item.Position);
|
||||
lightBrightness = 0.0f;
|
||||
}
|
||||
else
|
||||
@@ -117,6 +123,13 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
base.Remove();
|
||||
|
||||
light.Remove();
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
|
||||
{
|
||||
base.ReceiveSignal(signal, connection, sender, power);
|
||||
|
||||
@@ -65,6 +65,8 @@ namespace Subsurface
|
||||
get { return condition; }
|
||||
set
|
||||
{
|
||||
if (float.IsNaN(value)) return;
|
||||
|
||||
float prev = condition;
|
||||
condition = MathHelper.Clamp(value, 0.0f, 100.0f);
|
||||
if (condition==0.0f && prev>0.0f)
|
||||
@@ -1063,6 +1065,8 @@ namespace Subsurface
|
||||
|
||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
{
|
||||
message.Write(condition);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case NetworkEventType.DropItem:
|
||||
@@ -1077,6 +1081,8 @@ namespace Subsurface
|
||||
|
||||
public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message)
|
||||
{
|
||||
Condition = message.ReadFloat();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case NetworkEventType.DropItem:
|
||||
@@ -1096,7 +1102,7 @@ namespace Subsurface
|
||||
base.Remove();
|
||||
|
||||
//sprite.Remove();
|
||||
if (body!=null) body.Remove();
|
||||
if (body != null) body.Remove();
|
||||
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
|
||||
@@ -156,6 +156,8 @@ namespace Subsurface
|
||||
focusOnSelected = ToolBox.GetAttributeBool(element, "focusonselected", false);
|
||||
|
||||
offsetOnSelected = ToolBox.GetAttributeFloat(element, "offsetonselected", 0.0f);
|
||||
|
||||
price = ToolBox.GetAttributeInt(element, "price", 0);
|
||||
|
||||
Triggers = new List<Rectangle>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user