Skip to content

Commit

Permalink
Modpocalypse 2 Electric Boogaloo
Browse files Browse the repository at this point in the history
Asset Interfaces.
Refactor Custom Batteries stuff to be more inline with SMLHelpers systems.
Make ModPrefabCache actually a cache instead of just a thing that deletes prefabs after 30 seconds.

Bye Bye Abstract assets and PrefabHandler

Move all patching to awake.  Will probably break something... but they should not need to be done after mods are loaded if we have the patching done right.
And if we don't then it needs to be fixed instead of hidden by delaying the patches.

Fixed the Reflection Helper saying the Battery tabs that we added were being added by unity instead of smlhelper.

Removed automatic calling of the sync version of GetGameObject unless the person inherits IModPrefabSync and sets the action.
  • Loading branch information
MrPurple6411 committed Jan 18, 2023
1 parent 63f2358 commit 8e21fda
Show file tree
Hide file tree
Showing 62 changed files with 1,502 additions and 2,998 deletions.
34 changes: 34 additions & 0 deletions Example mod/BatteryExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace SMLHelper.Examples;

using SMLHelper.Assets;
using SMLHelper.Assets.Interfaces;
using SMLHelper.Crafting;
using SMLHelper.Handlers;

#if SUBNAUTICA
using static CraftData;
#endif

public class NuclearBattery: ICraftable, ICustomBattery
{
public CraftTree.Type FabricatorType => CraftTree.Type.Fabricator;
public string[] StepsToFabricatorTab => CustomBatteryHandler.BatteryCraftPath;
public float CraftingTime => 1;
public BatteryModel BatteryModel => BatteryModel.IonBattery;
public BatteryType BatteryType => BatteryType.Battery;
public float PowerCapacity => 69420;
public RecipeData RecipeData { get; } = new()
{
craftAmount = 1,
Ingredients = new()
{
new Ingredient(TechType.ReactorRod, 1),
new Ingredient(TechType.Lead, 2),
new Ingredient(TechType.CopperWire, 1)
},
LinkedItems = new()
{
TechType.DepletedReactorRod
}
};
}
5 changes: 4 additions & 1 deletion Example mod/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using BepInEx;
using BepInEx.Logging;
using SMLHelper.Utility;
using SMLHelper.Assets;

[BepInPlugin(GUID, MODNAME, VERSION)]
[BepInDependency("com.ahk1221.smlhelper", BepInDependency.DependencyFlags.HardDependency)]
Expand All @@ -36,7 +37,9 @@ internal class SaveData: SaveDataCache

public void Awake()
{
NuclearBattery.CreateAndRegister();
PrefabInfo.Create("NuclearBattery")
.CreateTechType().WithLanguageLines("Nuclear Battery", "Nuclear Battery that makes me go yes")
.WithIcon(SpriteManager.Get(TechType.PrecursorIonBattery)).RegisterPrefab(new NuclearBattery());

LogSource = base.Logger;

Expand Down
57 changes: 0 additions & 57 deletions Example mod/NuclearBatteryExample.cs

This file was deleted.

42 changes: 0 additions & 42 deletions SMLHelper/API/CBModelData.cs

This file was deleted.

15 changes: 0 additions & 15 deletions SMLHelper/API/CbBattery.cs

This file was deleted.

88 changes: 0 additions & 88 deletions SMLHelper/API/CbDatabase.cs

This file was deleted.

133 changes: 0 additions & 133 deletions SMLHelper/API/CbItem.cs

This file was deleted.

Loading

0 comments on commit 8e21fda

Please sign in to comment.