Track LocalMods as part of monolith
This commit is contained in:
+1076
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
||||
using Barotrauma;
|
||||
using Barotrauma.Items.Components;
|
||||
using Microsoft.Xna.Framework;
|
||||
using MoreLevelContent.Shared;
|
||||
using MoreLevelContent.Shared.Data;
|
||||
using MoreLevelContent.Shared.Generation;
|
||||
using MoreLevelContent.Shared.Utils;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MoreLevelContent.Items
|
||||
{
|
||||
internal class SonarGuide : Powered
|
||||
{
|
||||
[Serialize(30.0f, IsPropertySaveable.Yes, description: "How often the guide sends out a ping."), Editable]
|
||||
public float PingInterval { get; private set; }
|
||||
|
||||
[Serialize(30000.0f, IsPropertySaveable.Yes, description: "How far away this guide can be detected from, 10000.0f is the default sonar range."), Editable]
|
||||
public float Range { get; private set; }
|
||||
|
||||
private float _Interval;
|
||||
public SonarGuide(Item item, ContentXElement element) : base(item, element)
|
||||
{
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
UpdateOnActiveEffects(deltaTime);
|
||||
|
||||
#if CLIENT
|
||||
if (Voltage >= MinVoltage)
|
||||
{
|
||||
if (_Interval > 0)
|
||||
{
|
||||
_Interval -= deltaTime;
|
||||
return;
|
||||
}
|
||||
|
||||
_Interval = PingInterval;
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
item.GetComponent<Sonar>()?.AddSonarCircle(Item.WorldPosition, (Sonar.BlipType)5, blipCount: 100, range: Range);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Barotrauma;
|
||||
using Barotrauma.Items.Components;
|
||||
using MoreLevelContent.Shared;
|
||||
using MoreLevelContent.Shared.Utils;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace MoreLevelContent.Items
|
||||
{
|
||||
internal class SonarJammer : Powered
|
||||
{
|
||||
private readonly int _Strength;
|
||||
private bool _ActiveDisturbance;
|
||||
public SonarJammer(Item item, ContentXElement element) : base(item, element)
|
||||
{
|
||||
IsActive = true;
|
||||
_Strength = element.GetAttributeInt("strength", 100);
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
UpdateOnActiveEffects(deltaTime);
|
||||
|
||||
#if CLIENT
|
||||
|
||||
if (Voltage >= MinVoltage && !_ActiveDisturbance)
|
||||
{
|
||||
SonarExtensions.Instance.Add(Item, _Strength);
|
||||
_ActiveDisturbance = true;
|
||||
Log.Debug("Added Disturbance");
|
||||
}
|
||||
|
||||
if (Voltage < MinVoltage && _ActiveDisturbance)
|
||||
{
|
||||
SonarExtensions.Instance.Remove(Item);
|
||||
_ActiveDisturbance = false;
|
||||
Log.Debug("Removed Disturbance");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user