-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
124 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
using I2.Loc; | ||
|
||
namespace COTL_API.CustomInventory; | ||
|
||
public abstract class CustomMealEffect | ||
{ | ||
internal string _internalObjectName = ""; | ||
internal CookingData.MealEffectType _mealEffect; | ||
internal string _modPrefix = ""; | ||
internal string InternalObjectName = ""; | ||
|
||
internal CookingData.MealEffectType MealEffect; | ||
internal string ModPrefix = ""; | ||
public abstract string InternalName { get; } | ||
public virtual bool EffectEnabled() => true; | ||
|
||
/// <summary> | ||
/// This is the effect that will occur when the follower eats this dish. | ||
/// </summary> | ||
public abstract Action<FollowerBrain> Effect { get; } | ||
|
||
public virtual bool EffectEnabled() | ||
{ | ||
return true; | ||
} | ||
|
||
public virtual string Description() | ||
{ | ||
return $"CookingData/{InternalName}/Description"; | ||
return LocalizationManager.GetTranslation($"CookingData/{ModPrefix}.{InternalName}/Description"); | ||
} | ||
|
||
/// <summary> | ||
/// Used for adding a suffix to the description, normally for when the effect is disabled | ||
/// Used for adding a suffix to the description, normally for when the effect is disabled | ||
/// </summary> | ||
/// <returns>The suffix to the description</returns> | ||
public virtual string DescriptionSuffix() | ||
{ | ||
return ""; | ||
return LocalizationManager.GetTranslation($"CookingData/{ModPrefix}.{InternalName}/DescriptionSuffix"); | ||
} | ||
|
||
/// <summary> | ||
/// Whether this MealEffect is positive or negative (The arrow on the cooking screen) | ||
/// </summary> | ||
public virtual bool Positive() => true; | ||
|
||
/// <summary> | ||
/// This is the effect that will occur when the follower eats this dish. | ||
/// Whether this MealEffect is positive or negative (The arrow on the cooking screen) | ||
/// </summary> | ||
public abstract Action<FollowerBrain> Effect { get; } | ||
public virtual bool Positive() | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,23 @@ | ||
using COTL_API.Guid; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using COTL_API.Guid; | ||
|
||
namespace COTL_API.CustomInventory; | ||
|
||
public static partial class CustomMealEffectManager | ||
public static partial class CustomMealEffectManager | ||
{ | ||
public static Dictionary<CookingData.MealEffectType, CustomMealEffect> CustomEffectList { get; } = new(); | ||
public static Dictionary<CookingData.MealEffectType, CustomMealEffect> CustomEffectList { get; } = []; | ||
|
||
public static CookingData.MealEffectType Add(CustomMealEffect effect) | ||
{ | ||
var guid = TypeManager.GetModIdFromCallstack(Assembly.GetCallingAssembly()); | ||
|
||
var effectType = GuidManager.GetEnumValue<CookingData.MealEffectType>(guid, effect.InternalName); | ||
LogInfo("Regestering effect with effecType " + effectType); | ||
effect._mealEffect = effectType; | ||
effect._modPrefix = guid; | ||
effect._internalObjectName = $"CustomEffect_{effect.InternalName}"; | ||
effect.MealEffect = effectType; | ||
effect.ModPrefix = guid; | ||
effect.InternalObjectName = $"CustomMealEffect_{effect.InternalName}"; | ||
|
||
CustomEffectList.Add(effectType, effect); | ||
|
||
return effectType; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.