示例#1
0
        /// <summary>
        /// Adds Pedia mappings
        /// </summary>
        /// <param name="id">The pedia ID to register</param>
        /// <param name="cat">The pedia category to add this in</param>
        public IdentifiableItem AddPediaMapping(PediaDirector.Id id, PediaRegistry.PediaCategory cat = PediaRegistry.PediaCategory.RESOURCES)
        {
            PediaRegistry.RegisterIdentifiableMapping(id, ID);
            PediaRegistry.RegisterIdEntry(id, Icon);
            PediaRegistry.SetPediaCategory(id, cat);

            return(this);
        }
        /// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override CraftResourceTemplate Create()
        {
            // Sets up the stuff for the Pedia Entry
            PediaRegistry.RegisterIdentifiableMapping(pediaID, ID);

            // Create main object
            mainObject.AddComponents(
                new Create <Identifiable>((ident) => ident.id = ID),
                new Create <Vacuumable>((vac) => vac.size     = vacSize),
                new Create <Rigidbody>((body) =>
            {
                body.drag        = 0.2f;
                body.angularDrag = 5f;
                body.mass        = 0.3f;
                body.useGravity  = true;
            }),
                new Create <DragFloatReactor>((drag) => drag.floatDragMultiplier = 10),
                new Create <SphereCollider>((col) =>
            {
                col.center = Vector3.zero;
                col.radius = colRadius;
            }),
                new Create <CollisionAggregator>(null),
                new Create <RegionMember>((rg) => rg.canHibernate = true)
                );

            // Create model
            mainObject.AddChild(new GameObjectTemplate("resource_ld",
                                                       new Create <MeshFilter>((filter) => filter.sharedMesh        = mesh),
                                                       new Create <MeshRenderer>((render) => render.sharedMaterials = materials)
                                                       ).SetTransform(modelTrans));

            // Create delaunch
            mainObject.AddChild(new GameObjectTemplate("DelaunchTrigger",
                                                       new Create <SphereCollider>((col) =>
            {
                col.center    = Vector3.zero;
                col.radius    = 0.1f;
                col.isTrigger = true;
            }),
                                                       new Create <VacDelaunchTrigger>(null)
                                                       ).SetTransform(Vector3.zero, Vector3.zero, delaunchScale));

            mainObject.Layer = BaseObjects.layers["Actor"];

            return(this);
        }
示例#3
0
 // Called before GameContext.Awake
 // You want to register new things and enum values here, as well as do all your harmony patching
 public override void PreLoad()
 {
     HarmonyInstance.PatchAll();
     TranslationPatcher.AddActorTranslation("l." + ModdedIds.MAPLE_SLIME.ToString().ToLower(), "Maple Slime");
     TranslationPatcher.AddActorTranslation("l." + ModdedIds.MAPLE_PLORT.ToString().ToLower(), "Maple Plort");
     TranslationPatcher.AddActorTranslation("l." + ModdedIds.TEST_CRATE_01.ToString().ToLower(), "Test Crate");
     new SlimePediaEntryTranslation(ModdedIds.MAPLE_SLIMES).SetTitleTranslation("Maple Slimes").SetIntroTranslation("Pancakes, anyone?").SetSlimeologyTranslation("A syrupy relative of the Honey Slime, the Maple Slimes are a fall favorite which can be found in the Moss Blanket. It is rumored that they were created in a collaboration between Ogden Ortiz and Viktor Humphries and then got loose. Maybe someday they'll make Butter Slimes too...").SetDietTranslation("Fruit").SetFavoriteTranslation("Pogofruit").SetRisksTranslation("These slimes produce very sticky plorts. If they get loose, you'll have a very sticky situation on your very sticky hands. Best not let that happen.").SetPlortonomicsTranslation("These delicious morsels are just about the best thing since sliced... anything! They're highly prized by top chefs and breakfast enthusiasts alike. There's nothing like the smell of warm syrup to wake up a hungry rancher.");
     new SlimePediaEntryTranslation(ModdedIds.CARAMEL_APPLES).SetTitleTranslation("Caramel Apples").SetIntroTranslation("Intro TK").SetDescriptionTranslation("Description TK");
     PlortRegistry.AddPlortEntry(ModdedIds.MAPLE_PLORT, new ProgressDirector.ProgressType[] {
         ProgressDirector.ProgressType.UNLOCK_MOSS
     });
     DataModelRegistry.RegisterCustomActorModel(ModdedIds.MAPLE_SLIME, (long x, Identifiable.Id y, RegionRegistry.RegionSetId z, GameObject w) => new SlimeModel(x, y, z, w.transform));
     PediaRegistry.RegisterIdentifiableMapping(PediaDirector.Id.PLORTS, ModdedIds.MAPLE_PLORT);
     PediaRegistry.RegisterIdentifiableMapping(ModdedIds.MAPLE_SLIMES, ModdedIds.MAPLE_SLIME);
     PediaRegistry.RegisterIdentifiableMapping(ModdedIds.CARAMEL_APPLES, ModdedIds.CARAMEL_APPLE_FRUIT);
     PediaRegistry.SetPediaCategory(ModdedIds.MAPLE_SLIMES, PediaRegistry.PediaCategory.SLIMES);
     PediaRegistry.SetPediaCategory(ModdedIds.CARAMEL_APPLES, PediaRegistry.PediaCategory.RESOURCES);
 }
示例#4
0
        /// <summary>
        /// Creates the object of the template (To get the prefab version use .ToPrefab() after calling this)
        /// </summary>
        public override FoodTemplate Create()
        {
            // Sets up the stuff for the Pedia Entry
            PediaRegistry.RegisterIdentifiableMapping(pediaID, ID);

            // Create main object
            mainObject.AddComponents(
                new Create <MeshFilter>((filter) => filter.sharedMesh = mesh),
                new Create <Identifiable>((ident) => ident.id         = ID),
                new Create <Vacuumable>((vac) => vac.size             = vacSize),
                new Create <Rigidbody>((body) =>
            {
                body.drag        = 0.2f;
                body.angularDrag = 5f;
                body.mass        = 0.3f;
                body.useGravity  = true;
            }),
                new Create <DragFloatReactor>((drag) => drag.floatDragMultiplier = 10),
                new Create <MeshCollider>((col) =>
            {
                col.sharedMesh = mesh;
                col.convex     = true;
            }),
                new Create <CollisionAggregator>(null),
                new Create <RegionMember>((rg) => rg.canHibernate = true),
                new Create <ResourceCycle>((res) =>
            {
                res.unripeGameHours    = unripeHours;
                res.ripeGameHours      = ripeHours;
                res.edibleGameHours    = edibleHours;
                res.rottenGameHours    = rottenHours;
                res.rottenMat          = rottenMaterial;
                res.destroyFX          = EffectObjects.fxRottenDespawn;
                res.releaseCue         = releaseCue;
                res.vacuumableWhenRipe = true;
                res.addEjectionForce   = ejectWhenMature;
                res.releasePrepTime    = 0.5f;
            }),
                new Create <SECTR_PointSource>((source) =>
            {
                source.Loop                  = false;
                source.PlayOnStart           = false;
                source.RestartLoopsOnEnabled = true;
                source.Volume                = 1;
                source.Pitch                 = 1;
            }),
                new Create <PlaySoundOnHit>((hit) =>
            {
                hit.hitCue         = hitCue;
                hit.minTimeBetween = 0.2f;
                hit.minForce       = 1;
                hit.includeControllerCollisions = false;
            })
                ).AddAfterChildren(AddShakeTransform);

            // Create delaunch trigger
            mainObject.AddChild(new GameObjectTemplate("DelaunchTrigger",
                                                       new Create <SphereCollider>((col) =>
            {
                col.center    = Vector3.zero;
                col.radius    = 0.1f;
                col.isTrigger = true;
            }),
                                                       new Create <VacDelaunchTrigger>(null)
                                                       ).SetTransform(Vector3.zero, Vector3.zero, delaunchScale));

            // Create model
            mainObject.AddChild(new GameObjectTemplate("model_food",
                                                       new Create <MeshFilter>((filter) => filter.sharedMesh = mesh),
                                                       new Create <MeshRenderer>((render) =>
            {
                render.sharedMaterials   = materials;
                render.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
                render.receiveShadows    = true;
            })
                                                       ).SetTransform(Vector3.zero, Vector3.zero, modelScale));

            mainObject.Layer = BaseObjects.layers["Actor"];

            return(this);
        }