(bf212a41f) v0.9.2.0 pre-release test version
This commit is contained in:
@@ -206,7 +206,7 @@ namespace Barotrauma
|
||||
set
|
||||
{
|
||||
if (scale == value) { return; }
|
||||
scale = MathHelper.Clamp(value, 0.1f, 10.0f);
|
||||
scale = MathHelper.Clamp(value, 0.01f, 10.0f);
|
||||
|
||||
float relativeScale = scale / prefab.Scale;
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// Can be used by status effects or conditionals to modify the sound range
|
||||
/// </summary>
|
||||
public float SoundRange
|
||||
public new float SoundRange
|
||||
{
|
||||
get { return aiTarget == null ? 0.0f : aiTarget.SoundRange; }
|
||||
set { if (aiTarget != null) { aiTarget.SoundRange = Math.Max(0.0f, value); } }
|
||||
@@ -298,7 +298,7 @@ namespace Barotrauma
|
||||
/// <summary>
|
||||
/// Can be used by status effects or conditionals to modify the sound range
|
||||
/// </summary>
|
||||
public float SightRange
|
||||
public new float SightRange
|
||||
{
|
||||
get { return aiTarget == null ? 0.0f : aiTarget.SightRange; }
|
||||
set { if (aiTarget != null) { aiTarget.SightRange = Math.Max(0.0f, value); } }
|
||||
@@ -1154,7 +1154,14 @@ namespace Barotrauma
|
||||
{
|
||||
ic.Update(deltaTime, cam);
|
||||
#if CLIENT
|
||||
if (ic.IsActive) ic.PlaySound(ActionType.OnActive, WorldPosition);
|
||||
if (ic.IsActive)
|
||||
{
|
||||
if (ic.IsActiveTimer > 0.02f)
|
||||
{
|
||||
ic.PlaySound(ActionType.OnActive, WorldPosition);
|
||||
}
|
||||
ic.IsActiveTimer += deltaTime;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1381,7 +1388,7 @@ namespace Barotrauma
|
||||
return connectedComponents;
|
||||
}
|
||||
|
||||
private static readonly Pair<string, string>[] connectionPairs = new Pair<string, string>[]
|
||||
public static readonly Pair<string, string>[] connectionPairs = new Pair<string, string>[]
|
||||
{
|
||||
new Pair<string, string>("power_in", "power_out"),
|
||||
new Pair<string, string>("signal_in1", "signal_out1"),
|
||||
@@ -1453,11 +1460,11 @@ namespace Barotrauma
|
||||
public void SendSignal(int stepsTaken, string signal, string connectionName, Character sender, float power = 0.0f, Item source = null, float signalStrength = 1.0f)
|
||||
{
|
||||
LastSentSignalRecipients.Clear();
|
||||
if (connections == null) return;
|
||||
if (connections == null) { return; }
|
||||
|
||||
stepsTaken++;
|
||||
|
||||
if (!connections.TryGetValue(connectionName, out Connection c)) return;
|
||||
if (!connections.TryGetValue(connectionName, out Connection c)) { return; }
|
||||
|
||||
if (stepsTaken > 10)
|
||||
{
|
||||
@@ -1467,6 +1474,11 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (StatusEffect effect in c.Effects)
|
||||
{
|
||||
if (condition <= 0.0f && effect.type != ActionType.OnBroken) { continue; }
|
||||
if (signal != "0" && !string.IsNullOrEmpty(signal)) { ApplyStatusEffect(effect, ActionType.OnUse, (float)Timing.Step, null, null, false, false); }
|
||||
}
|
||||
c.SendSignal(stepsTaken, signal, source ?? this, sender, power, signalStrength);
|
||||
}
|
||||
}
|
||||
@@ -1519,47 +1531,50 @@ namespace Barotrauma
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
bool pickHit = false, selectHit = false;
|
||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||
|
||||
if (picker.IsKeyDown(InputType.Aim))
|
||||
{
|
||||
pickHit = picker.IsKeyHit(InputType.Select);
|
||||
selectHit = picker.IsKeyHit(InputType.Select);
|
||||
pickHit = false;
|
||||
selectHit = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (picker.IsKeyDown(InputType.Aim))
|
||||
if (forceSelectKey)
|
||||
{
|
||||
pickHit = false;
|
||||
selectHit = false;
|
||||
if (ic.PickKey == InputType.Select) pickHit = true;
|
||||
if (ic.SelectKey == InputType.Select) selectHit = true;
|
||||
}
|
||||
else if (forceActionKey)
|
||||
{
|
||||
if (ic.PickKey == InputType.Use) pickHit = true;
|
||||
if (ic.SelectKey == InputType.Use) selectHit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (forceSelectKey)
|
||||
{
|
||||
if (ic.PickKey == InputType.Select) pickHit = true;
|
||||
if (ic.SelectKey == InputType.Select) selectHit = true;
|
||||
}
|
||||
else if (forceActionKey)
|
||||
{
|
||||
if (ic.PickKey == InputType.Use) pickHit = true;
|
||||
if (ic.SelectKey == InputType.Use) selectHit = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pickHit = picker.IsKeyHit(ic.PickKey);
|
||||
selectHit = picker.IsKeyHit(ic.SelectKey);
|
||||
pickHit = picker.IsKeyHit(ic.PickKey);
|
||||
selectHit = picker.IsKeyHit(ic.SelectKey);
|
||||
|
||||
#if CLIENT
|
||||
//if the cursor is on a UI component, disable interaction with the left mouse button
|
||||
//to prevent accidentally selecting items when clicking UI elements
|
||||
if (picker == Character.Controlled && GUI.MouseOn != null)
|
||||
{
|
||||
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
|
||||
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
|
||||
}
|
||||
#endif
|
||||
//if the cursor is on a UI component, disable interaction with the left mouse button
|
||||
//to prevent accidentally selecting items when clicking UI elements
|
||||
if (picker == Character.Controlled && GUI.MouseOn != null)
|
||||
{
|
||||
if (GameMain.Config.KeyBind(ic.PickKey).MouseButton == 0) pickHit = false;
|
||||
if (GameMain.Config.KeyBind(ic.SelectKey).MouseButton == 0) selectHit = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if CLIENT
|
||||
//use the non-mouse interaction key (E on both default and legacy keybinds) in wiring mode
|
||||
//LMB is used to manipulate wires, so using E to select connection panels is much easier
|
||||
if (Screen.Selected == GameMain.SubEditorScreen && GameMain.SubEditorScreen.WiringMode)
|
||||
{
|
||||
pickHit = selectHit = GameMain.Config.KeyBind(InputType.Use).MouseButton == null ?
|
||||
picker.IsKeyHit(InputType.Use) :
|
||||
picker.IsKeyHit(InputType.Select);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!pickHit && !selectHit) continue;
|
||||
|
||||
@@ -1621,8 +1636,8 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (condition == 0.0f) return;
|
||||
|
||||
if (condition == 0.0f) { return; }
|
||||
|
||||
bool remove = false;
|
||||
|
||||
foreach (ItemComponent ic in components)
|
||||
@@ -1631,7 +1646,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
isControlled = character == Character.Controlled;
|
||||
#endif
|
||||
if (!ic.HasRequiredContainedItems(isControlled)) continue;
|
||||
if (!ic.HasRequiredContainedItems(character, isControlled)) { continue; }
|
||||
if (ic.Use(deltaTime, character))
|
||||
{
|
||||
ic.WasUsed = true;
|
||||
@@ -1642,7 +1657,7 @@ namespace Barotrauma
|
||||
|
||||
ic.ApplyStatusEffects(ActionType.OnUse, deltaTime, character, targetLimb);
|
||||
|
||||
if (ic.DeleteOnUse) remove = true;
|
||||
if (ic.DeleteOnUse) { remove = true; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1654,7 +1669,7 @@ namespace Barotrauma
|
||||
|
||||
public void SecondaryUse(float deltaTime, Character character = null)
|
||||
{
|
||||
if (condition == 0.0f) return;
|
||||
if (condition == 0.0f) { return; }
|
||||
|
||||
bool remove = false;
|
||||
|
||||
@@ -1664,7 +1679,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
isControlled = character == Character.Controlled;
|
||||
#endif
|
||||
if (!ic.HasRequiredContainedItems(isControlled)) continue;
|
||||
if (!ic.HasRequiredContainedItems(character, isControlled)) { continue; }
|
||||
if (ic.SecondaryUse(deltaTime, character))
|
||||
{
|
||||
ic.WasUsed = true;
|
||||
@@ -1675,7 +1690,7 @@ namespace Barotrauma
|
||||
|
||||
ic.ApplyStatusEffects(ActionType.OnSecondaryUse, deltaTime, character);
|
||||
|
||||
if (ic.DeleteOnUse) remove = true;
|
||||
if (ic.DeleteOnUse) { remove = true; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1702,7 +1717,7 @@ namespace Barotrauma
|
||||
bool remove = false;
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
if (!ic.HasRequiredContainedItems(user == Character.Controlled)) continue;
|
||||
if (!ic.HasRequiredContainedItems(user, addMessage: user == Character.Controlled)) continue;
|
||||
|
||||
bool success = Rand.Range(0.0f, 0.5f) < ic.DegreeOfSuccess(user);
|
||||
ActionType actionType = success ? ActionType.OnUse : ActionType.OnFailure;
|
||||
@@ -1713,7 +1728,7 @@ namespace Barotrauma
|
||||
ic.WasUsed = true;
|
||||
ic.ApplyStatusEffects(actionType, 1.0f, character, targetLimb, user: user);
|
||||
|
||||
if (GameMain.NetworkMember!=null && GameMain.NetworkMember.IsServer)
|
||||
if (GameMain.NetworkMember != null && GameMain.NetworkMember.IsServer)
|
||||
{
|
||||
GameMain.NetworkMember.CreateEntityEvent(this, new object[]
|
||||
{
|
||||
@@ -1729,11 +1744,15 @@ namespace Barotrauma
|
||||
|
||||
public bool Combine(Item item)
|
||||
{
|
||||
if (item == this) { return false; }
|
||||
bool isCombined = false;
|
||||
foreach (ItemComponent ic in components)
|
||||
{
|
||||
if (ic.Combine(item)) isCombined = true;
|
||||
if (ic.Combine(item)) { isCombined = true; }
|
||||
}
|
||||
#if CLIENT
|
||||
if (isCombined) { GameMain.Client?.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Combine, item.ID }); }
|
||||
#endif
|
||||
return isCombined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user