// Gordo Creation System public static SlimeTemplate MakeRoamingGordo(this LookupDirector director, string name, Identifiable.Id gordoID, SlimeDefinition definition) { SlimeDefinition gordoDef = ScriptableObject.CreateInstance <SlimeDefinition>(); gordoDef.AppearancesDefault = definition.AppearancesDefault; gordoDef.AppearancesDynamic = definition.AppearancesDynamic; gordoDef.BaseModule = definition.BaseModule; gordoDef.BaseSlimes = definition.BaseSlimes; gordoDef.CanLargofy = false; gordoDef.Diet = definition.Diet; gordoDef.FavoriteToys = new Identifiable.Id[0]; gordoDef.IdentifiableId = gordoID; gordoDef.IsLargo = true; gordoDef.PrefabScale = 4f; gordoDef.SlimeModules = definition.SlimeModules; gordoDef.Sounds = definition.Sounds; gordoDef.Name = "roamGordo." + definition.Name; FearProfile prof = ScriptableObject.CreateInstance <FearProfile>(); prof.threats = new List <FearProfile.ThreatEntry>(); prof.GetType().GetMethod("OnEnable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(prof, new object[0]); SlimeTemplate gordo = new SlimeTemplate(name, gordoDef).SetVacSize(Vacuumable.Size.GIANT) .SetHealth(60).SetFeralState(false).SetGlitchState(false).SetFearProfile(prof).SetTranslation(definition.Name + " Gordo"); Identifiable.SLIME_CLASS.Add(gordoID); return(gordo); }
public static Identifiable.Id CraftLargo(this LookupDirector director, Identifiable.Id slimeA, Identifiable.Id slimeB, Action <SlimeDefinition> extraLargoBehaviour = null, Predicate <Identifiable.Id> canBeTarr = null, Predicate <Identifiable.Id> forceLargo = null) { if (director.LargoExists(slimeA, slimeB)) { return(Identifiable.Id.NONE); } string prefabName = "slime" + slimeA.ToString().Replace("_SLIME", "").ToUpper()[0] + slimeA.ToString().Replace("_SLIME", "").ToLower().Substring(1) + slimeB.ToString().Replace("_SLIME", "").ToUpper()[0] + slimeB.ToString().Replace("_SLIME", "").ToLower().Substring(1); string name = slimeA.ToString().Replace("_SLIME", "") + slimeB.ToString().Replace("_SLIME", "") + "_LARGO"; Identifiable.Id largoID = IdentifiableRegistry.CreateIdentifiableId(EnumPatcher.GetFirstFreeValue(typeof(Identifiable.Id)), name); SlimeDefinitions defs = GameContext.Instance.SlimeDefinitions; SlimeDefinition curr = defs.GetSlimeByIdentifiableId(slimeA); SlimeDefinition other = defs.GetSlimeByIdentifiableId(slimeB); bool largofyState = curr.CanLargofy; curr.CanLargofy = true; if (!other.CanLargofy && !(forceLargo?.Invoke(slimeB) ?? false)) { return(Identifiable.Id.NONE); } bool largofyStateB = other.CanLargofy; other.CanLargofy = true; SlimeDefinition largoDef = defs.GetLargoByBaseSlimes(curr, other); largoDef.IdentifiableId = largoID; curr.CanLargofy = largofyState; other.CanLargofy = largofyStateB; if (!(canBeTarr?.Invoke(slimeB) ?? true)) { largoDef.Diet.EatMap.RemoveAll((entry) => entry.becomesId == Identifiable.Id.TARR_SLIME); largoDef.Diet.EatMap.RemoveAll((entry) => entry.becomesId == Identifiable.Id.GLITCH_TARR_SLIME); } extraLargoBehaviour?.Invoke(largoDef); SlimeTemplate largoTemplate = new SlimeTemplate(prefabName, largoDef).SetVacSize(Vacuumable.Size.LARGE) .SetTranslation(curr.Name + " " + other.Name + " Largo").Create(); LookupRegistry.RegisterIdentifiablePrefab(largoTemplate.ToPrefab()); return(largoID); }