//+ HANDLING internal FoodHandler InternalSetup() { foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.VEGGIES)) { VEGGIES_GROUP.Add(id); } foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.FRUIT)) { FRUIT_GROUP.Add(id); } foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.MEAT)) { MEAT_GROUP.Add(id); } foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.NONTARRGOLD_SLIMES)) { NONTARRGOLD_SLIMES_GROUP.Add(id); } foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.PLORTS)) { PLORTS_GROUP.Add(id); } foreach (Identifiable.Id id in SlimeEat.GetFoodGroupIds(SlimeEat.FoodGroup.GINGER)) { GINGER_GROUP.Add(id); } Setup(); return(this); }
protected override void Build() { // Get GameObjects Prefab = CustomBase != null?PrefabUtils.CopyPrefab(CustomBase) : PrefabUtils.CopyPrefab(BaseItem); Prefab.name = NamePrefix + Name; Prefab.transform.localScale = Scale * Definition.PrefabScale; // Load Components SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>(); SlimeVarietyModules mod = Prefab.GetComponent <SlimeVarietyModules>(); SlimeEat eat = Prefab.GetComponent <SlimeEat>(); SlimeHealth hp = Prefab.GetComponent <SlimeHealth>(); Rigidbody body = Prefab.GetComponent <Rigidbody>(); Vacuumable vac = Prefab.GetComponent <Vacuumable>(); Identifiable iden = Prefab.GetComponent <Identifiable>(); // Setup Components app.SlimeDefinition = Definition; app.Appearance = Definition.AppearancesDefault[0]; mod.baseModule = Definition.BaseModule; mod.slimeModules = Definition.SlimeModules; eat.slimeDefinition = Definition; eat.minDriveToEat = MinDriveToEat; eat.drivePerEat = DrivePerEat; eat.agitationPerEat = AgitationPerEat; eat.agitationPerFavEat = AgitationPerFavEat; hp.maxHealth = Health; body.mass = Mass; vac.size = Size; iden.id = ID; // Get rid of unneeded components Object.Destroy(Prefab.GetComponent <PinkSlimeFoodTypeTracker>()); }
public static void Postfix(SlimeEat __instance, ref Identifiable.Id[] __result, SlimeEat.FoodGroup group) { if (FoodGroupRegistry.FOOD_GROUPS.ContainsKey(group)) { List <Identifiable.Id> foodGroupIds; if (__result != null) { foodGroupIds = __result.ToList(); } else { foodGroupIds = new List <Identifiable.Id>(); } foreach (Identifiable.Id id in FoodGroupRegistry.FOOD_GROUPS[group]) { if (!foodGroupIds.Contains(id)) { foodGroupIds.Add(id); } } __result = foodGroupIds.ToArray(); } }
/// <summary>Builds this Item</summary> protected override void Build() { //foreach (Identifiable.Id slime in Identifiable.SLIME_CLASS) //{ // Make new Definition SlimeDefinition other = SlimeUtils.GetDefinitionByID(Identifiable.Id.PINK_SLIME); SlimeDefinition newDef = Definition.CombineForLargo(other); // Translation DefTranslation.Add(newDef.IdentifiableId, Regex.Replace(Definition.Name, "(\\B[A-Z])", " $1") + " " + Regex.Replace(other.Name, "(\\B[A-Z])", " $1") + " Largo"); //if (newDef == null) // continue; // Get GameObjects Prefab = PrefabUtils.CopyPrefab(BaseItem); Prefab.name = NamePrefix + Definition.Name + other.Name; Prefab.transform.localScale = Scale * newDef.PrefabScale; // PRIMARY SETUP // Load Components SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>(); SlimeVarietyModules mod = Prefab.GetComponent <SlimeVarietyModules>(); // Setup Components app.SlimeDefinition = newDef; mod.baseModule = newDef.BaseModule; mod.slimeModules = newDef.SlimeModules; mod.Assemble(); // SECONDARY SETUP // Load Components SlimeEat eat = Prefab.GetComponent <SlimeEat>(); SlimeHealth hp = Prefab.GetComponent <SlimeHealth>(); Rigidbody body = Prefab.GetComponent <Rigidbody>(); Vacuumable vac = Prefab.GetComponent <Vacuumable>(); Identifiable iden = Prefab.GetComponent <Identifiable>(); // Setup Components eat.slimeDefinition = newDef; eat.minDriveToEat = MinDriveToEat; eat.drivePerEat = DrivePerEat; eat.agitationPerEat = AgitationPerEat; eat.agitationPerFavEat = AgitationPerFavEat; hp.maxHealth = Health; body.mass = Mass; vac.size = Size; iden.id = newDef.IdentifiableId; // TERTIARY SETUP // Load Components SlimeEmotions emot = Prefab.GetComponent <SlimeEmotions>(); SlimeEmotions emot2 = BaseItem.GetComponent <SlimeEmotions>(); emot.initAgitation = emot2.initAgitation; emot.initFear = emot2.initFear; emot.initHunger = emot2.initHunger; // Add to Largo List Prefabs.Add(newDef.IdentifiableId, Prefab); //} }