Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions DecorationsMod/DecorationItem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using UnityEngine;
using System.Collections;
using System;

#if SUBNAUTICA_NAUTILUS
using Nautilus.Assets;
Expand Down Expand Up @@ -35,13 +33,8 @@ public abstract class DecorationItem : SMLHelper.V2.Assets.ModPrefab, IDecoratio
public DecorationItem(string classID, string name, string desc, string icon) : this(
PrefabInfo.WithTechType(classID, name, desc, unlockAtStart: true)
.WithFileName(DefaultResourcePath + classID)
.WithIcon(AssetsHelper.Assets.LoadAsset<Sprite>(icon))) { }

[SetsRequiredMembers]
public DecorationItem(string classID, string name, string desc, Atlas.Sprite icon) : this(
PrefabInfo.WithTechType(classID, name, desc, unlockAtStart: true)
.WithFileName(DefaultResourcePath + classID)
.WithIcon(icon)) { }
.WithIcon(AssetsHelper.Assets.LoadAsset<Sprite>(icon)))
{ }

[SetsRequiredMembers]
public DecorationItem(string classID, string name, string desc, Sprite icon) : this(
Expand Down
7 changes: 1 addition & 6 deletions DecorationsMod/DecorationsMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@
<PropertyGroup>
<ApplicationIcon>configurator.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="SMLHelper">
<HintPath>$(SubnauticaDir)\BepInEx\plugins\Modding Helper\SMLHelper.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssetsHelper.cs" />
<Compile Include="ConfigOptions.cs" />
Expand Down Expand Up @@ -342,7 +337,7 @@
<PackageReference Include="BepInEx.Core" Version="5.4.21" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.1.0" />
<PackageReference Include="UnityEngine.Modules" Version="2019.4.36" IncludeAssets="compile" />
<PackageReference Include="Subnautica.GameLibs" Version="71288.0.0-r.0" />
<PackageReference Include="Subnautica.GameLibs" Version="82304.0.0-r.0" />
<PackageReference Include="PolySharp" Version="1.13.1" />
<PackageReference Include="Subnautica.Nautilus" Version="1.*-*" PrivateAssets="all" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions DecorationsMod/Fixers/EquipmentFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public static bool AllowedToAdd_Prefix(Equipment __instance, ref bool __result,
if (slotType == EquipmentType.BatteryCharger && ModdedBatteriesFixer.BatteriesTechTypes().Contains(objTechType))
{
#if SUBNAUTICA
EquipmentType eType = CraftData.GetEquipmentType(objTechType);
EquipmentType eType = TechData.GetEquipmentType(objTechType);
#else
EquipmentType eType = TechData.GetEquipmentType(objTechType);
#endif
Expand All @@ -26,7 +26,7 @@ public static bool AllowedToAdd_Prefix(Equipment __instance, ref bool __result,
else if (slotType == EquipmentType.PowerCellCharger && ModdedBatteriesFixer.PowercellsTechTypes().Contains(objTechType))
{
#if SUBNAUTICA
EquipmentType eType = CraftData.GetEquipmentType(objTechType);
EquipmentType eType = TechData.GetEquipmentType(objTechType);
#else
EquipmentType eType = TechData.GetEquipmentType(objTechType);
#endif
Expand All @@ -39,6 +39,7 @@ public static bool AllowedToAdd_Prefix(Equipment __instance, ref bool __result,
return false;
}
}

return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion DecorationsMod/Fixers/KnifeFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void GiveResourceOnDamage_Postfix(GameObject target, bool isAlive,
Logger.Debug("DEBUG: Entering custom purple pinecone event. techType=[" + (int)techType + "][" + techType.AsString(false) + "] purplePineConeTechType=[" + (int)purplePineConeTechType + "][" + purplePineConeTechType.AsString(false) + "]");
#endif
#if SUBNAUTICA
HarvestType harvestTypeFromTech = CraftData.GetHarvestTypeFromTech(techType);
HarvestType harvestTypeFromTech = TechData.GetHarvestType(techType);
#else
HarvestType harvestTypeFromTech = TechData.GetHarvestType(techType);
#endif
Expand Down
20 changes: 11 additions & 9 deletions DecorationsMod/NewItems/BarBottle1.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using DecorationsMod.Controllers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using Nautilus.Handlers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public override void RegisterItem()

// Scale model
model.transform.localScale *= 22f;

// Set tech tag
var techTag = _barBottle1.AddComponent<TechTag>();
techTag.type = this.TechType;
Expand Down Expand Up @@ -123,22 +123,24 @@ public override void RegisterItem()
eatable.despawns = false;
eatable.kDecayRate = 0.0f;
eatable.despawnDelay = 0.0f;
CraftData.useEatSound[this.TechType] = "event:/player/drink";

// Set eating sound
CraftDataHandler.SetEatingSound(this.TechType, "event:/player/drink");

// Associate recipe to the new TechType
Nautilus.Handlers.CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);
CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);

// Add the new TechType to Hand Equipment type.
Nautilus.Handlers.CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);
CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);

// Set quick slot type.
Nautilus.Handlers.CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);
CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);

// Set the buildable prefab
this.Register();

// Set the custom sprite
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle01icon"));
SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle01icon"));

this.IsRegistered = true;
}
Expand Down
18 changes: 10 additions & 8 deletions DecorationsMod/NewItems/BarBottle2.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using DecorationsMod.Controllers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using Nautilus.Handlers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -123,22 +123,24 @@ public override void RegisterItem()
eatable.despawns = false;
eatable.kDecayRate = 0.0f;
eatable.despawnDelay = 0.0f;
CraftData.useEatSound[this.TechType] = "event:/player/drink";

// Set eating sound
CraftDataHandler.SetEatingSound(this.TechType, "event:/player/drink");

// Associate recipe to the new TechType
Nautilus.Handlers.CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);
CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);

// Add the new TechType to Hand Equipment type.
Nautilus.Handlers.CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);
CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);

// Set quick slot type.
Nautilus.Handlers.CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);
CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);

// Set the buildable prefab
this.Register();

// Set the custom sprite
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle02icon"));
SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle02icon"));

this.IsRegistered = true;
}
Expand Down
18 changes: 10 additions & 8 deletions DecorationsMod/NewItems/BarBottle3.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using DecorationsMod.Controllers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using Nautilus.Handlers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -123,22 +123,24 @@ public override void RegisterItem()
eatable.despawns = false;
eatable.kDecayRate = 0.0f;
eatable.despawnDelay = 0.0f;
CraftData.useEatSound[this.TechType] = "event:/player/drink";

// Set eating sound
CraftDataHandler.SetEatingSound(this.TechType, "event:/player/drink");

// Associate recipe to the new TechType
Nautilus.Handlers.CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);
CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);

// Add the new TechType to Hand Equipment type.
Nautilus.Handlers.CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);
CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);

// Set quick slot type.
Nautilus.Handlers.CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);
CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);

// Set the buildable prefab
this.Register();

// Set the custom sprite
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle03icon"));
SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle03icon"));

this.IsRegistered = true;
}
Expand Down
18 changes: 10 additions & 8 deletions DecorationsMod/NewItems/BarBottle4.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using DecorationsMod.Controllers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using Nautilus.Handlers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -123,22 +123,24 @@ public override void RegisterItem()
eatable.despawns = false;
eatable.kDecayRate = 0.0f;
eatable.despawnDelay = 0.0f;
CraftData.useEatSound[this.TechType] = "event:/player/drink";

// Set eating sound
CraftDataHandler.SetEatingSound(this.TechType, "event:/player/drink");

// Associate recipe to the new TechType
Nautilus.Handlers.CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);
CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);

// Add the new TechType to Hand Equipment type.
Nautilus.Handlers.CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);
CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);

// Set quick slot type.
Nautilus.Handlers.CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);
CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);

// Set the buildable prefab
this.Register();

// Set the custom sprite
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle04icon"));
SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle04icon"));

this.IsRegistered = true;
}
Expand Down
18 changes: 10 additions & 8 deletions DecorationsMod/NewItems/BarBottle5.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using DecorationsMod.Controllers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using Nautilus.Handlers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -123,22 +123,24 @@ public override void RegisterItem()
eatable.despawns = false;
eatable.kDecayRate = 0.0f;
eatable.despawnDelay = 0.0f;
CraftData.useEatSound[this.TechType] = "event:/player/drink";

// Set eating sound
CraftDataHandler.SetEatingSound(this.TechType, "event:/player/drink");

// Associate recipe to the new TechType
Nautilus.Handlers.CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);
CraftDataHandler.SetRecipeData(this.TechType, this.Recipe);

// Add the new TechType to Hand Equipment type.
Nautilus.Handlers.CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);
CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.Hand);

// Set quick slot type.
Nautilus.Handlers.CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);
CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Selectable);

// Set the buildable prefab
this.Register();

// Set the custom sprite
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle05icon"));
SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("barbottle05icon"));

this.IsRegistered = true;
}
Expand Down
12 changes: 6 additions & 6 deletions DecorationsMod/NewItems/DecorationsSpecimenAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using DecorationsMod.Controllers;
using DecorationsMod.Fixers;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using DecorationsMod.Controllers;
using DecorationsMod.Fixers;
using UnityEngine;
using static CraftData;

namespace DecorationsMod.NewItems
{
Expand Down Expand Up @@ -76,7 +75,7 @@ public override void RegisterItem()

// Set the custom icon
Nautilus.Handlers.SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset<Sprite>("specimenanalyzer"));

this.IsRegistered = true;
}
}
Expand Down Expand Up @@ -122,14 +121,15 @@ public override GameObject GetGameObject()
// Remove "Constructable" possibility
Constructable construct = prefab.GetComponent<Constructable>();
GameObject.DestroyImmediate(construct);

// Disable colliders to prevent physics bug in Cyclops, and add a small one so we can
// pick the Specimen Analyzer.
Collider[] colliders = prefab.GetComponentsInChildren<Collider>();
foreach (Collider coll in colliders)
{
coll.enabled = false;
}

SphereCollider newCollider = prefab.AddComponent<SphereCollider>();
newCollider.radius = 0.9f;

Expand Down