Jump to content

Require help for simple mod

Recommended Posts

I have started looking into creating mods for ONI today because I would like to modify stats of existing items. For a start, I want to modify the quality of Pickled Meal.

My problem right now is that it seems that Harmony exclusively changes functions. However, I would simply wish to modify a variable: In the file TUNING>FOOD.cs, inside the class FOOD_TYPES the variable PICKLEDMEAL.

So I kept looking into the files and found PickledMealConfig.cs. I hoped to be able to patch the CreatePrefab function to override the Gameobject with a modified version. However, I get an error "Duplicate diet entry: PickledMeal". Which makes it seem like I have to modify the variable in FOOD.cs after all...

I am sure that someone with some ONI modding experience could easily point me towards the solution of my problem. I would be happy about any pointers. I attached my code and anonymized log. Here the essentials:

[HarmonyPatch(typeof(PickledMealConfig), "CreatePrefab")]

public class Patch_Pickled_Meal
     public static void Postfix(ref GameObject __result)
          __result = EntityTemplates.ExtendEntityToFood(EntityTemplates.CreateLooseEntity("PickledMeal", (string)ITEMS.FOOD.PICKLEDMEAL.NAME, (string)ITEMS.FOOD.PICKLEDMEAL.DESC, 1f, false, Assets.GetAnim((HashedString)"pickledmeal_kanim"), "object", Grid.SceneLayer.Front, EntityTemplates.CollisionShape.RECTANGLE, 0.6f, 0.7f, true, 0, SimHashes.Creature, (List<Tag>)null), new EdiblesManager.FoodInfo("PickledMeal", 1800000f, 0, 255.15f, 277.15f, 9600f, true));
          __result.GetComponent<KPrefabID>().AddTag(GameTags.Pickled, false);

[22:13:38.365] [1] [WARNING] Tried loading prefab with duplicate tag, ignoring: CompostPickledMeal
[22:13:38.693] [1] [ERROR] Duplicate diet entry: PickledMeal
Duplicate diet entry: PickledMeal
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)



Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

  • Create New...