diff --git a/.gitignore b/.gitignore index 170cb30..04b3fd0 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ ### LethalLib project !/LethalLib +!deps LethalLib/[Bb]in LethalLib/[Oo]bj LethalLib/[Dd]ist diff --git a/CHANGELOG.md b/CHANGELOG.md index af8acaf..e1a170f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## LethalLib [1.2.0] + +### Fixed + +- Updated mod version to work with V80 Lethal. + ## LethalLib [1.1.1] ### Added diff --git a/LethalLib/Extras/SpawnableMapObjectDef.cs b/LethalLib/Extras/SpawnableMapObjectDef.cs index a416c27..23da0ca 100644 --- a/LethalLib/Extras/SpawnableMapObjectDef.cs +++ b/LethalLib/Extras/SpawnableMapObjectDef.cs @@ -10,4 +10,30 @@ namespace LethalLib.Extras; public class SpawnableMapObjectDef : ScriptableObject { public SpawnableMapObject spawnableMapObject; + + private IndoorMapHazardType runtimeCreatedIndoorMapHazardType; + internal IndoorMapHazardType ConvertToIndoorMapHazardType() + { + if (runtimeCreatedIndoorMapHazardType != null) + { + return runtimeCreatedIndoorMapHazardType; + } + + IndoorMapHazardType indoorMapHazardType = ScriptableObject.CreateInstance(); + if (spawnableMapObject == null) + { + return indoorMapHazardType; + } + + indoorMapHazardType.prefabToSpawn = spawnableMapObject.prefabToSpawn; + indoorMapHazardType.requireDistanceBetweenSpawns = spawnableMapObject.requireDistanceBetweenSpawns; + indoorMapHazardType.disallowSpawningNearEntrances = spawnableMapObject.disallowSpawningNearEntrances; + indoorMapHazardType.spawnFacingAwayFromWall = spawnableMapObject.spawnFacingAwayFromWall; + indoorMapHazardType.spawnWithBackToWall = spawnableMapObject.spawnWithBackToWall; + indoorMapHazardType.spawnWithBackFlushAgainstWall = spawnableMapObject.spawnWithBackFlushAgainstWall; + indoorMapHazardType.spawnFacingWall = spawnableMapObject.spawnFacingWall; + + runtimeCreatedIndoorMapHazardType = indoorMapHazardType; + return runtimeCreatedIndoorMapHazardType; + } } \ No newline at end of file diff --git a/LethalLib/LethalLib.csproj b/LethalLib/LethalLib.csproj index 21c4962..9aac835 100644 --- a/LethalLib/LethalLib.csproj +++ b/LethalLib/LethalLib.csproj @@ -39,7 +39,8 @@ - + + + + + all + true + ..\deps\Assembly-CSharp.dll + + + all + ..\deps\Unity.Netcode.Runtime.dll + + + all + ..\deps\DunGen.dll + + + all + ..\deps\Unity.InputSystem.dll + + + all + ..\deps\Assembly-CSharp-firstpass.dll + + + all + ..\deps\MMHOOK_Assembly-CSharp.dll + - $(ProjectDir)../lib/MMHOOK_Assembly-CSharp.dll diff --git a/LethalLib/Modules/Enemies.cs b/LethalLib/Modules/Enemies.cs index 4cce05b..43be497 100644 --- a/LethalLib/Modules/Enemies.cs +++ b/LethalLib/Modules/Enemies.cs @@ -35,11 +35,7 @@ private static void QuickMenuManager_Start(On.QuickMenuManager.orig_Start orig, foreach (SpawnableEnemy spawnableEnemy in spawnableEnemies) { if (inside.All(x => x.enemyType == spawnableEnemy.enemy)) continue; - SpawnableEnemyWithRarity spawnableEnemyWithRarity = new SpawnableEnemyWithRarity - { - enemyType = spawnableEnemy.enemy, - rarity = spawnableEnemy.rarity - }; + SpawnableEnemyWithRarity spawnableEnemyWithRarity = new SpawnableEnemyWithRarity(spawnableEnemy.enemy, spawnableEnemy.rarity); switch (spawnableEnemy.spawnType) { case SpawnType.Default: @@ -118,11 +114,7 @@ private static void Terminal_Start(On.Terminal.orig_Start orig, Terminal self) // if doesn't contain noun, add it if (!itemInfoNouns.Any(x => x.noun.word == keyword.word)) { - itemInfoNouns.Add(new CompatibleNoun() - { - noun = keyword, - result = spawnableEnemy.terminalNode - }); + itemInfoNouns.Add(new CompatibleNoun(keyword, spawnableEnemy.terminalNode)); } infoKeyword.compatibleNouns = itemInfoNouns.ToArray(); @@ -246,11 +238,7 @@ private static void AddEnemyToLevel(SpawnableEnemy spawnableEnemy, SelectableLev rarity = spawnableEnemy.levelRarities[Levels.LevelTypes.All]; } - var spawnableEnemyWithRarity = new SpawnableEnemyWithRarity() - { - enemyType = spawnableEnemy.enemy, - rarity = rarity - }; + var spawnableEnemyWithRarity = new SpawnableEnemyWithRarity(spawnableEnemy.enemy, rarity); // make sure spawnableScrap does not already contain item //Plugin.logger.LogInfo($"Checking if {spawnableEnemy.enemy.name} is already in {name}"); diff --git a/LethalLib/Modules/Items.cs b/LethalLib/Modules/Items.cs index 52f7dd6..bcf9a04 100644 --- a/LethalLib/Modules/Items.cs +++ b/LethalLib/Modules/Items.cs @@ -69,8 +69,9 @@ public struct BuyableItemAssetInfo public TerminalKeyword keyword; } - public static List LethalLibItemList = new List(); - public static List buyableItemAssetInfos = new List(); + public static List LethalLibItemList = new(); + public static List vanillaItemGroups = new(); + public static List buyableItemAssetInfos = new(); public static Terminal terminal; private static void StartOfRound_Start(On.StartOfRound.orig_Start orig, StartOfRound self) @@ -92,8 +93,6 @@ private static void StartOfRound_Start(On.StartOfRound.orig_Start orig, StartOfR }); }); - - // load itemlist from es3 if (ES3.KeyExists("LethalLibAllItemsList", GameNetworkManager.Instance.currentSaveFileName)) { @@ -105,7 +104,7 @@ private static void StartOfRound_Start(On.StartOfRound.orig_Start orig, StartOfR // if item is not in list, add it at the end List list = StartOfRound.Instance.allItemsList.itemsList; - List newList = new List(); + List newList = new(); foreach (ItemSaveOrderData item in itemList) { @@ -160,11 +159,11 @@ private static void RegisterLevelScrapforLE_Terminal_Start(On.Terminal.orig_Star private static void RegisterLethalLibScrapItemsForAllLevels() { - foreach (SelectableLevel level in StartOfRound.Instance.levels) { - if(levelsAlreadyAddedTo.Contains(level)) + if (levelsAlreadyAddedTo.Contains(level)) continue; + foreach (ScrapItem scrapItem in scrapItems) { AddScrapItemToLevel(scrapItem, level); @@ -229,12 +228,7 @@ private static void AddScrapItemToLevel(ScrapItem scrapItem, SelectableLevel lev rarity = scrapItem.levelRarities[Levels.LevelTypes.All]; } - var spawnableÍtemWithRarity = new SpawnableItemWithRarity() - { - spawnableItem = scrapItem.item, - rarity = rarity - }; - + var spawnableÍtemWithRarity = new SpawnableItemWithRarity(scrapItem.item, rarity); // make sure spawnableScrap does not already contain item //Plugin.logger.LogInfo($"Checking if {scrapItem.item.name} is already in {name}"); @@ -423,19 +417,11 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) //Plugin.logger.LogInfo($"Item price: {buyNode1.itemCost}, Item index: {buyNode1.buyItemIndex}"); - buyNode1.terminalOptions = new CompatibleNoun[2] - { - new CompatibleNoun() - { - noun = self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "confirm"), - result = buyNode2 - }, - new CompatibleNoun() - { - noun = self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "deny"), - result = cancelPurchaseNode - } - }; + buyNode1.terminalOptions = + [ + new CompatibleNoun(self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "confirm"), buyNode2), + new CompatibleNoun(self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "deny"), cancelPurchaseNode) + ]; var keyword = TerminalUtils.CreateTerminalKeyword(itemName.ToLowerInvariant().Replace(" ", "-"), defaultVerb: buyKeyword); @@ -447,11 +433,7 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) self.terminalNodes.allKeywords = allKeywords.ToArray(); var nouns = buyKeyword.compatibleNouns.ToList(); - nouns.Add(new CompatibleNoun() - { - noun = keyword, - result = buyNode1 - }); + nouns.Add(new CompatibleNoun(keyword, buyNode1)); buyKeyword.compatibleNouns = nouns.ToArray(); @@ -470,11 +452,7 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) self.terminalNodes.allKeywords = allKeywords.ToArray(); var itemInfoNouns = infoKeyword.compatibleNouns.ToList(); - itemInfoNouns.Add(new CompatibleNoun() - { - noun = keyword, - result = itemInfo - }); + itemInfoNouns.Add(new CompatibleNoun(keyword, itemInfo)); infoKeyword.compatibleNouns = itemInfoNouns.ToArray(); BuyableItemAssetInfo buyableItemAssetInfo = new BuyableItemAssetInfo() @@ -530,33 +508,32 @@ public class ScrapItem public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.LevelTypes.None, string[] spawnLevelOverrides = null) { origItem = item; - if (item.isScrap == false) + if (!item.isScrap) { - item = item.Clone(); item.isScrap = true; - if(item.maxValue == 0 && item.minValue == 0) + if (item.maxValue == 0 && item.minValue == 0) { item.minValue = 40; item.maxValue = 100; } - else if(item.maxValue == 0) + else if (item.maxValue == 0) { item.maxValue = item.minValue * 2; } - else if(item.minValue == 0) + else if (item.minValue == 0) { item.minValue = item.maxValue / 2; } var newPrefab = NetworkPrefabs.CloneNetworkPrefab(item.spawnPrefab); - if(newPrefab.GetComponent() != null) + if (newPrefab.GetComponent() != null) { newPrefab.GetComponent().itemProperties = item; } - if(newPrefab.GetComponentInChildren() == null) + if (newPrefab.GetComponentInChildren() == null) { // add scan node var scanNode = Object.Instantiate(scanNodePrefab, newPrefab.transform); @@ -568,7 +545,9 @@ public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.L item.spawnPrefab = newPrefab; } + ReplaceInvalidReferences(item); this.item = item; + /*this.rarity = rarity; this.spawnLevels = spawnLevels; this.spawnLevelOverrides = spawnLevelOverrides;*/ @@ -582,22 +561,25 @@ public ScrapItem(Item item, int rarity, Levels.LevelTypes spawnLevels = Levels.L } } - if (spawnLevels != Levels.LevelTypes.None) + if (spawnLevels == Levels.LevelTypes.None) + { + return; + } + + foreach (Levels.LevelTypes level in Enum.GetValues(typeof(Levels.LevelTypes))) { - foreach (Levels.LevelTypes level in Enum.GetValues(typeof(Levels.LevelTypes))) + if (!spawnLevels.HasFlag(level)) { - if (spawnLevels.HasFlag(level)) - { - levelRarities.Add(level, rarity); - } + continue; } + levelRarities.Add(level, rarity); } } public ScrapItem(Item item, Dictionary? levelRarities = null, Dictionary? customLevelRarities = null) { origItem = item; - if (item.isScrap == false) + if (!item.isScrap) { item = item.Clone(); item.isScrap = true; @@ -634,6 +616,7 @@ public ScrapItem(Item item, Dictionary? levelRarities = item.spawnPrefab = newPrefab; } + ReplaceInvalidReferences(item); this.item = item; if (customLevelRarities != null) @@ -864,56 +847,79 @@ private static void ValidateItemProperties(Item item) if (item == null) return; - if (item.weight < 1 || item.weight > 4) + if (item.weight < 1 || item.weight > 3.75) { Plugin.logger.LogWarning($"Item {item.itemName} has an invalid weight of {item.weight}, resetting to weight of 1, please check the lethal.wiki for the weight calculation and give it a valid number, anything below 1 or above 4 gets forced to be 1 or 4."); - item.weight = Mathf.Clamp(item.weight, 1, 4); + item.weight = Mathf.Clamp(item.weight, 1, 3.75f); } } + + private static void ReplaceInvalidReferences(Item item) + { + List replacementGroups = new(); + foreach (var itemGroup in item.spawnPositionTypes) + { + if (itemGroup == null) + continue; + + var replacementVanillaItemGroup = vanillaItemGroups.Where(x => x != null && x.name == itemGroup.name).FirstOrDefault(); + if (replacementVanillaItemGroup == null) + continue; + + replacementGroups.Add(replacementVanillaItemGroup); + } + + item.spawnPositionTypes = replacementGroups; + } /// ///Removes a scrap from the given levels. ///This needs to be called after StartOfRound.Awake. /// public static void RemoveScrapFromLevels(Item scrapItem, Levels.LevelTypes levelFlags = Levels.LevelTypes.None, string[] levelOverrides = null) { - if (StartOfRound.Instance != null) + if (StartOfRound.Instance == null) { - foreach (SelectableLevel level in StartOfRound.Instance.levels) - { - var name = level.name; - - if(!Enum.IsDefined(typeof(Levels.LevelTypes), name)) - name = Levels.Compatibility.GetLLLNameOfLevel(name); + return; + } - var alwaysValid = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides != null && levelOverrides.Any(item => Levels.Compatibility.GetLLLNameOfLevel(item).ToLowerInvariant() == name.ToLowerInvariant())); - var isModded = levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name); + foreach (SelectableLevel level in StartOfRound.Instance.levels) + { + var name = level.name; - if (isModded) - { - alwaysValid = true; - } + if (!Enum.IsDefined(typeof(Levels.LevelTypes), name)) + name = Levels.Compatibility.GetLLLNameOfLevel(name); - if (Enum.IsDefined(typeof(Levels.LevelTypes), name) || alwaysValid) - { - var levelEnum = alwaysValid ? Levels.LevelTypes.All : (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name); - if (alwaysValid || levelFlags.HasFlag(levelEnum)) - { - // find item in scrapItems - var actualItem = scrapItems.FirstOrDefault(x => x.origItem == scrapItem || x.item == scrapItem); + var alwaysValid = levelFlags.HasFlag(Levels.LevelTypes.All) || (levelOverrides != null && levelOverrides.Any(item => Levels.Compatibility.GetLLLNameOfLevel(item).ToLowerInvariant() == name.ToLowerInvariant())); + var isModded = levelFlags.HasFlag(Levels.LevelTypes.Modded) && !Enum.IsDefined(typeof(Levels.LevelTypes), name); - var spawnableItemWithRarity = level.spawnableScrap.FirstOrDefault(x => x.spawnableItem == actualItem.item); + if (isModded) + { + alwaysValid = true; + } - if (spawnableItemWithRarity != null) - { - if (Plugin.extendedLogging.Value) - Plugin.logger.LogInfo("Removed Item " + spawnableItemWithRarity.spawnableItem.name + " from Level " + name); + if (!Enum.IsDefined(typeof(Levels.LevelTypes), name) && !alwaysValid) + { + continue; + } - level.spawnableScrap.Remove(spawnableItemWithRarity); - } + var levelEnum = alwaysValid ? Levels.LevelTypes.All : (Levels.LevelTypes)Enum.Parse(typeof(Levels.LevelTypes), name); + if (!alwaysValid && !levelFlags.HasFlag(levelEnum)) + { + continue; + } - } - } + // find item in scrapItems + var actualItem = scrapItems.FirstOrDefault(x => x.origItem == scrapItem || x.item == scrapItem); + var spawnableItemWithRarity = level.spawnableScrap.FirstOrDefault(x => x.spawnableItem == actualItem.item); + if (spawnableItemWithRarity == null) + { + continue; } + + if (Plugin.extendedLogging.Value) + Plugin.logger.LogInfo("Removed Item " + spawnableItemWithRarity.spawnableItem.name + " from Level " + name); + + level.spawnableScrap.Remove(spawnableItemWithRarity); } } diff --git a/LethalLib/Modules/MapObjects.cs b/LethalLib/Modules/MapObjects.cs index 0b9cf16..114a8f7 100644 --- a/LethalLib/Modules/MapObjects.cs +++ b/LethalLib/Modules/MapObjects.cs @@ -12,7 +12,7 @@ namespace LethalLib.Modules; public class MapObjects { - public static void Init() + internal static void Init() { On.StartOfRound.Awake += StartOfRound_Awake; On.RoundManager.SpawnMapObjects += RoundManager_SpawnMapObjects; @@ -26,11 +26,11 @@ private static void RoundManager_SpawnMapObjects(On.RoundManager.orig_SpawnMapOb { foreach (RegisteredMapObject mapObject in mapObjects) { - if (mapObject.mapObject != null) + if (mapObject.indoorMapHazardType != null) { - if (!randomMapObject.spawnablePrefabs.Any((prefab) => prefab == mapObject.mapObject.prefabToSpawn)) + if (!randomMapObject.spawnablePrefabs.Any((prefab) => prefab == mapObject.indoorMapHazardType.prefabToSpawn)) { - randomMapObject.spawnablePrefabs.Add(mapObject.mapObject.prefabToSpawn); + randomMapObject.spawnablePrefabs.Add(mapObject.indoorMapHazardType.prefabToSpawn); } } } @@ -125,9 +125,9 @@ private static void AddMapObjectToLevel(RegisteredMapObject mapObject, Selectabl || (!isCurrentLevelFromVanilla && mapObject.spawnLevelOverrides != null && mapObject.spawnLevelOverrides.Contains(customName)); string mapObjectName = "invalid!"; - if (mapObject.mapObject != null) + if (mapObject.indoorMapHazardType != null) { - mapObjectName = mapObject.mapObject.prefabToSpawn.name; + mapObjectName = mapObject.indoorMapHazardType.prefabToSpawn.name; } else if (mapObject.outsideObject != null) { @@ -137,39 +137,34 @@ private static void AddMapObjectToLevel(RegisteredMapObject mapObject, Selectabl Plugin.logger.LogInfo($"{name} for mapObject: {mapObjectName}, isCurrentLevelFromVanilla: {isCurrentLevelFromVanilla}, Found valid: {mapObjectValidToAdd}"); if (!mapObjectValidToAdd) return; - if (mapObject.mapObject != null) + if (mapObject.indoorMapHazardType != null) { // Remove existing object if it exists - if (level.spawnableMapObjects.Any(x => x.prefabToSpawn == mapObject.mapObject.prefabToSpawn)) + if (level.indoorMapHazards.Any(x => x.hazardType.prefabToSpawn == mapObject.indoorMapHazardType.prefabToSpawn)) { - var list = level.spawnableMapObjects.ToList(); - list.RemoveAll(x => x.prefabToSpawn == mapObject.mapObject.prefabToSpawn); - level.spawnableMapObjects = list.ToArray(); + var list = level.indoorMapHazards.ToList(); + list.RemoveAll(x => x.hazardType.prefabToSpawn == mapObject.indoorMapHazardType.prefabToSpawn); + level.indoorMapHazards = list.ToArray(); } // Create a new instance so it can have its own `numberToSpawn` value - SpawnableMapObject spawnableMapObject = new() + IndoorMapHazard indoorMapHazard = new() { - prefabToSpawn = mapObject.mapObject.prefabToSpawn, - spawnFacingAwayFromWall = mapObject.mapObject.spawnFacingAwayFromWall, - spawnFacingWall = mapObject.mapObject.spawnFacingWall, - spawnWithBackToWall = mapObject.mapObject.spawnWithBackToWall, - spawnWithBackFlushAgainstWall = mapObject.mapObject.spawnWithBackFlushAgainstWall, - requireDistanceBetweenSpawns = mapObject.mapObject.requireDistanceBetweenSpawns, - disallowSpawningNearEntrances = mapObject.mapObject.disallowSpawningNearEntrances, + hazardType = mapObject.indoorMapHazardType, + numberToSpawn = AnimationCurve.Constant(0f, 1f, 0f), }; if (mapObject.spawnRateFunction != null) { - spawnableMapObject.numberToSpawn = mapObject.spawnRateFunction(level); + indoorMapHazard.numberToSpawn = mapObject.spawnRateFunction(level); } - var mapObjectsList = level.spawnableMapObjects.ToList(); - mapObjectsList.Add(spawnableMapObject); - level.spawnableMapObjects = mapObjectsList.ToArray(); + var indoorMapHazardsList = level.indoorMapHazards.ToList(); + indoorMapHazardsList.Add(indoorMapHazard); + level.indoorMapHazards = indoorMapHazardsList.ToArray(); if (Plugin.extendedLogging.Value) - Plugin.logger.LogInfo($"Added {spawnableMapObject.prefabToSpawn.name} to {name}"); + Plugin.logger.LogInfo($"Added {indoorMapHazard.hazardType.prefabToSpawn.name} to {name}"); } else if (mapObject.outsideObject != null) { @@ -180,7 +175,7 @@ private static void AddMapObjectToLevel(RegisteredMapObject mapObject, Selectabl level.spawnableOutsideObjects = list.ToArray(); } - SpawnableOutsideObjectWithRarity spawnableOutsideObject = new() + SpawnableOutsideObjectWithRarity spawnableOutsideObject = new(mapObject.outsideObject.spawnableObject, AnimationCurve.Constant(0f, 1f, 0f)) { spawnableObject = mapObject.outsideObject.spawnableObject }; @@ -201,7 +196,10 @@ private static void AddMapObjectToLevel(RegisteredMapObject mapObject, Selectabl public class RegisteredMapObject { + [Obsolete("Use IndoorMapHazardType instead")] public SpawnableMapObject mapObject; + + public IndoorMapHazardType indoorMapHazardType; public SpawnableOutsideObjectWithRarity outsideObject; public Levels.LevelTypes levels; public string[] spawnLevelOverrides; @@ -235,6 +233,7 @@ public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelT mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, + indoorMapHazardType = TurnMapObjectIntoIndoorMapHazard(mapObject), levels = levels, spawnRateFunction = spawnRateFunction }); @@ -248,6 +247,7 @@ public static void RegisterMapObject(SpawnableMapObject mapObject, Levels.LevelT mapObjects.Add(new RegisteredMapObject { mapObject = mapObject, + indoorMapHazardType = TurnMapObjectIntoIndoorMapHazard(mapObject), levels = levels, spawnRateFunction = spawnRateFunction, spawnLevelOverrides = levelOverrides @@ -329,7 +329,7 @@ public static void RemoveMapObject(SpawnableMapObject mapObject, Levels.LevelTyp if (alwaysValid || levelFlags.HasFlag(levelEnum)) { - level.spawnableMapObjects = level.spawnableMapObjects.Where(x => x.prefabToSpawn != mapObject.prefabToSpawn).ToArray(); + level.indoorMapHazards = level.indoorMapHazards.Where(x => x.hazardType.prefabToSpawn != mapObject.prefabToSpawn).ToArray(); } } } @@ -344,6 +344,19 @@ public static void RemoveOutsideObject(SpawnableOutsideObjectDef mapObject, Leve RemoveOutsideObject(mapObject.spawnableMapObject, levelFlags, levelOverrides); } + internal static IndoorMapHazardType TurnMapObjectIntoIndoorMapHazard(SpawnableMapObject mapObject) + { + IndoorMapHazardType indoorMapHazardType = ScriptableObject.CreateInstance(); + indoorMapHazardType.prefabToSpawn = mapObject.prefabToSpawn; + indoorMapHazardType.requireDistanceBetweenSpawns = mapObject.requireDistanceBetweenSpawns; + indoorMapHazardType.disallowSpawningNearEntrances = mapObject.disallowSpawningNearEntrances; + indoorMapHazardType.spawnFacingAwayFromWall = mapObject.spawnFacingAwayFromWall; + indoorMapHazardType.spawnWithBackToWall = mapObject.spawnWithBackToWall; + indoorMapHazardType.spawnWithBackFlushAgainstWall = mapObject.spawnWithBackFlushAgainstWall; + indoorMapHazardType.spawnFacingWall = mapObject.spawnFacingWall; + + return indoorMapHazardType; + } /// /// Remove a outside map object from a level /// diff --git a/LethalLib/Modules/Unlockables.cs b/LethalLib/Modules/Unlockables.cs index 98e8b22..dac3694 100644 --- a/LethalLib/Modules/Unlockables.cs +++ b/LethalLib/Modules/Unlockables.cs @@ -213,19 +213,11 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) buyNode1.isConfirmationNode = true; buyNode1.overrideOptions = true; buyNode1.itemCost = item.price; - buyNode1.terminalOptions = new CompatibleNoun[2] - { - new CompatibleNoun() - { - noun = self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "confirm"), - result = buyNode2 - }, - new CompatibleNoun() - { - noun = self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "deny"), - result = cancelPurchaseNode - } - }; + buyNode1.terminalOptions = + [ + new CompatibleNoun(self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "confirm"), buyNode2), + new CompatibleNoun(self.terminalNodes.allKeywords.First(keyword2 => keyword2.word == "deny"), cancelPurchaseNode) + ]; if (item.StoreType == StoreType.Decor) { @@ -242,11 +234,7 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) self.terminalNodes.allKeywords = allKeywords.ToArray(); var nouns = buyKeyword.compatibleNouns.ToList(); - nouns.Add(new CompatibleNoun() - { - noun = keyword, - result = buyNode1 - }); + nouns.Add(new CompatibleNoun(keyword, buyNode1)); buyKeyword.compatibleNouns = nouns.ToArray(); @@ -263,11 +251,7 @@ private static void Terminal_Awake(On.Terminal.orig_Awake orig, Terminal self) self.terminalNodes.allKeywords = allKeywords.ToArray(); var itemInfoNouns = infoKeyword.compatibleNouns.ToList(); - itemInfoNouns.Add(new CompatibleNoun() - { - noun = keyword, - result = itemInfo - }); + itemInfoNouns.Add(new CompatibleNoun(keyword, itemInfo)); infoKeyword.compatibleNouns = itemInfoNouns.ToArray(); var buyableItemAssetInfo = new BuyableUnlockableAssetInfo() diff --git a/README.md b/README.md index 71f37e8..6c4574d 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ ## Features Currently includes: + - Custom Scrap Item API - Custom Shop Item API - Unlockables API @@ -34,6 +35,7 @@ Fork the repository on GitHub and clone your fork locally. ### Configure Git hooks & `post-checkout` Configure the Git hooks directory for your local copy of the repository: + ```sh git config core.hooksPath hooks/ ``` @@ -41,14 +43,17 @@ git config core.hooksPath hooks/ Alternatively, you can create symbolic links in `.git/hooks/*` that point to `../hooks/*`. Then re-checkout to trigger the `post-checkout` hook: + ```sh git checkout main ``` ### `LethalLib.csproj.user` + You will need to create a `LethalLib/LethalLib.csproj.user` file to provide your Lethal Company game directory path. #### Template + ```xml diff --git a/deps/Assembly-CSharp-firstpass.dll b/deps/Assembly-CSharp-firstpass.dll new file mode 100644 index 0000000..c83186a Binary files /dev/null and b/deps/Assembly-CSharp-firstpass.dll differ diff --git a/deps/Assembly-CSharp.dll b/deps/Assembly-CSharp.dll new file mode 100644 index 0000000..2dd4283 Binary files /dev/null and b/deps/Assembly-CSharp.dll differ diff --git a/deps/DunGen.dll b/deps/DunGen.dll new file mode 100644 index 0000000..9fe01e3 Binary files /dev/null and b/deps/DunGen.dll differ diff --git a/deps/MMHOOK_Assembly-CSharp.dll b/deps/MMHOOK_Assembly-CSharp.dll new file mode 100644 index 0000000..6389865 Binary files /dev/null and b/deps/MMHOOK_Assembly-CSharp.dll differ diff --git a/deps/Unity.InputSystem.dll b/deps/Unity.InputSystem.dll new file mode 100644 index 0000000..0a50a86 Binary files /dev/null and b/deps/Unity.InputSystem.dll differ diff --git a/deps/Unity.Netcode.Runtime.dll b/deps/Unity.Netcode.Runtime.dll new file mode 100644 index 0000000..e1264b7 Binary files /dev/null and b/deps/Unity.Netcode.Runtime.dll differ