Skip to content

Commit

Permalink
Merge pull request #434 from InvalidArgument3/sifieldgenfinalsolution
Browse files Browse the repository at this point in the history
sifieldgenfixing (real)
  • Loading branch information
InvalidArgument3 authored Jan 27, 2024
2 parents 1d0d7ab + 0f89773 commit 238efeb
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
using VRage.Utils;
using VRage.ObjectBuilders;
using SpaceEngineers.Game.Entities.Blocks;
using StarCore.StructuralIntegrity;
using SpaceEngineers.Game.ModAPI;
using StarCore.StructuralIntegrity;

namespace StarCore.StructuralIntegrity
namespace YourName.ModName.Data.Scripts.OneFuckingFolderDeeper.StructuralIntegrity.Sync
{
[MyEntityComponentDescriptor(typeof(MyObjectBuilder_Collector), false, "SI_Field_Gen")]
public class SI_Core : MyGameLogicComponent, IMyEventProxy
Expand All @@ -34,15 +36,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 @@ -629,30 +631,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 @@ -672,12 +674,12 @@ void SyncSettings()
#region Terminal Controls
static void SetupTerminalControls<T>(float minDivertedPower, float maxDivertedPower)
{
var mod = SI_Utility.Instance;

if (mod.ControlsCreated)
return;
//var mod = SI_Utility.Instance;

mod.ControlsCreated = true;
//if (mod.ControlsCreated)
// return;
//
//mod.ControlsCreated = true;

#region SiegeToggle
var siegeModeToggle = MyAPIGateway.TerminalControls.CreateControl<IMyTerminalControlOnOffSwitch, IMyCollector>(ControlPrefix + "SiegeMode");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Collections.Generic;
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;
// }
}
}

This file was deleted.

0 comments on commit 238efeb

Please sign in to comment.