Skip to content

Commit

Permalink
Fix yourself
Browse files Browse the repository at this point in the history
  • Loading branch information
CommodoreChet committed Jan 28, 2024
1 parent 4644e03 commit b968216
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 65 deletions.
2 changes: 1 addition & 1 deletion SCDefenseBlocks/Data/CubeBlock_FieldGen.sbc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<BlockPairName>SI_Field_Gen_Block</BlockPairName>
<EdgeType>Light</EdgeType>
<BuildTimeSeconds>25</BuildTimeSeconds>
<ResourceSinkGroup>Conveyors</ResourceSinkGroup>
<ResourceSinkGroup>Defense</ResourceSinkGroup>
<RequiredPowerInput>0.002</RequiredPowerInput>
<InventorySize>
<X>2.5</X>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
using VRage.Utils;
using VRage.ObjectBuilders;
using SpaceEngineers.Game.Entities.Blocks;
using StarCore.StructuralIntegrity;
using SpaceEngineers.Game.ModAPI;
using StarCore.StructuralIntegrity;

namespace YourName.ModName.Data.Scripts.OneFuckingFolderDeeper.StructuralIntegrity.Sync
namespace StarCore.StructuralIntegrity
{
[MyEntityComponentDescriptor(typeof(MyObjectBuilder_Collector), false, "SI_Field_Gen")]
public class SI_Core : MyGameLogicComponent, IMyEventProxy
Expand All @@ -36,15 +34,15 @@ public class SI_Core : MyGameLogicComponent, IMyEventProxy
public MyPoweredCargoContainerDefinition SIGenBlockDef;

public readonly Config_Settings Config = new Config_Settings();
public readonly SI_Settings Settings = new SI_Settings();
/*public readonly SI_Settings Settings = new SI_Settings();*/

//SI_Utility Mod => SI_Utility.Instance;
/*SI_Utility Mod => SI_Utility.Instance;*/

//Utility Declarations
public const string ControlPrefix = "SI_Control.";
public readonly Guid SettingsGUID = new Guid("9EFDABA1-E705-4F62-BD37-A4B046B60BC0");
public const int SettingsUpdateCount = 60 * 1 / 10;
int SyncCountdown;
/*int SyncCountdown;*/

//Regular Structural Integrity Values Init
public float MinFieldPower;
Expand Down Expand Up @@ -405,7 +403,7 @@ private void UpdateGridModifier(IMyTerminalBlock obj)
var blockLogic = obj.GameLogic?.GetAs<SI_Core>();
if (blockLogic != null)
{
float currentFieldPower = blockLogic.GridModifierSync.Value;
float currentFieldPower = blockLogic.FieldPowerSync.Value;

float value1 = (currentFieldPower - MinFieldPower) / MaxFieldPower - MinFieldPower;
float newGridModifier = MinGridModifier + value1 * (MaxGridModifier - MinGridModifier);
Expand Down Expand Up @@ -487,7 +485,7 @@ private void SiegeMode(MySync<bool, SyncDirection.BothWays> SiegeActivated)

if (SiegeTimer > 0)
{
//SiegeBlockShutdown(allTerminalBlocks);
SiegeBlockShutdown(allTerminalBlocks);

if (SIGenBlock.CubeGrid.Physics.LinearVelocity != Vector3D.Zero)
{
Expand Down Expand Up @@ -631,30 +629,30 @@ block.FatBlock is IMySolarPanel || block.FatBlock is IMyWindTurbine ||
}
}*/

/* void SettingsChanged()
{
if (SyncCountdown == 0)
{
SyncCountdown = SettingsUpdateCount;
}
}
void SyncSettings()
{
try
{
if (SyncCountdown > 0 && --SyncCountdown <= 0)
{
SaveSettings();
Mod.CachedPacketSettings.Send(SIGenBlock.EntityId, Settings);
}
}
catch (Exception e)
{
Log.Error($"Error syncing settings!\n{e}");
}
}*/
/* void SettingsChanged()
{
if (SyncCountdown == 0)
{
SyncCountdown = SettingsUpdateCount;
}
}
void SyncSettings()
{
try
{
if (SyncCountdown > 0 && --SyncCountdown <= 0)
{
SaveSettings();
Mod.CachedPacketSettings.Send(SIGenBlock.EntityId, Settings);
}
}
catch (Exception e)
{
Log.Error($"Error syncing settings!\n{e}");
}
}*/

/*public override bool IsSerialized()
{
Expand All @@ -678,7 +676,7 @@ static void SetupTerminalControls<T>(float minDivertedPower, float maxDivertedPo

if (mod.ControlsCreated)
return;

mod.ControlsCreated = true;

#region SiegeToggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,27 @@
using VRage.Game.Components;
using VRage.Game.Entity;
using VRage.Utils;
using StarCore.StructuralIntegrity;

namespace StarCore.StructuralIntegrity
{
[MySessionComponentDescriptor(MyUpdateOrder.NoUpdate)]
public class SI_Utility : MySessionComponentBase
{
public static SI_Utility Instance;

public bool ControlsCreated = false;
// public Networking Networking = new Networking(58936);
// public List<MyEntity> Entities = new List<MyEntity>();
// public PacketBlockSettings CachedPacketSettings;
//
// public readonly MyStringId MATERIAL_SQUARE = MyStringId.GetOrCompute("Square");
// public readonly MyStringId MATERIAL_DOT = MyStringId.GetOrCompute("WhiteDot");
//
public override void LoadData()
{
Instance = this;

// Networking.Register();

// CachedPacketSettings = new PacketBlockSettings();
}

protected override void UnloadData()
{
Instance = null;

//Networking?.Unregister();
//Networking = null;
}
}
[MySessionComponentDescriptor(MyUpdateOrder.NoUpdate)]
public class SI_Utility : MySessionComponentBase
{
public static SI_Utility Instance;

public bool ControlsCreated = false;
public List<MyEntity> Entities = new List<MyEntity>();

public readonly MyStringId MATERIAL_SQUARE = MyStringId.GetOrCompute("Square");
public readonly MyStringId MATERIAL_DOT = MyStringId.GetOrCompute("WhiteDot");

public override void LoadData()
{
Instance = this;
}
protected override void UnloadData()
{
Instance = null;
}
}
}

0 comments on commit b968216

Please sign in to comment.