Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using spaar.ModLoader;
- using TheGuysYouDespise;
- using UnityEngine;
- namespace Blocks
- {
- public class LoadExampleBlock : BlockMod
- {
- /// ModLoader stuff
- /// Set name, author and so on for the blockloader to know what you made.
- public override string Name { get { return "hornBlock"; } }
- public override string DisplayName { get { return "War Horn Block"; } }
- public override string Author { get { return "TheGuysYouDespise"; } }
- public override Version Version { get { return new Version("0.1"); } }
- /// <Block-loading-info>
- /// Place .obj file in Mods/Blocks/Obj
- /// Place texture in Mods/Blocks/Textures
- /// Place any additional resources in Mods/Blocks/Resources
- /// </Block-loading-info>
- protected Block example = new Block()
- ///ID of the Block
- .ID(300)
- ///Name of the Block
- .BlockName("War Horn")
- ///Load the 3d model information
- .Obj(new List<Obj> { new Obj("warHorn.obj", //Mesh name with extension (only works for .obj files)
- "warHorn.png", //Texture name with extension
- new VisualOffset(new Vector3(1f, 1f, 1f), //Scale
- new Vector3(0f, 0f, 0f), //Position
- new Vector3(0f, 0f, 0f)))//Rotation
- })
- ///For the button that we will create setup the visual offset needed
- .IconOffset(new Icon(new Vector3( 1.30f, 1.30f, 1.30f), //Scale
- new Vector3(-0.11f, -0.13f, 0.00f), //Position
- new Vector3( 85f, 90f, 270f))) //Rotation
- ///Script, Components, etc. you want to be on your block.
- .Components(new Type[] {
- typeof(HornBlock),
- })
- ///Properties such as keywords for searching and setting up how how this block behaves to other elements.
- .Properties(new BlockProperties().SearchKeywords(new string[] {
- "Music",
- "Horn",
- "War",
- "War Horn",
- "Trumpet",
- "Sound",
- })
- //.Burnable(3f)
- //.CanBeDamaged(3)
- )
- ///Mass of the block 0.5 being equal to a double wooden block
- .Mass(0.3f)
- ///Display the collider while working on the block if you wish, then replace "true" with "false" when done looking at the colliders.
- .ShowCollider(false)
- ///Setup the collier of the block, which can consist of several different colliders.
- ///Therefore we have this CompoundCollider,
- .CompoundCollider(new List<ColliderComposite> {
- ColliderComposite.Sphere(0.49f, //radius
- new Vector3(-0.10f, -0.05f, 0.27f), //Position
- new Vector3(0f, 0f, 0f)) //Rotation
- .IgnoreForGhost(), //Do not use this collider on the ghost
- ColliderComposite.Capsule(0.33f, //radius
- 1.33f, //length
- Direction.Y, //direction
- new Vector3(-0.52f, 0.38f, 0.30f), //position
- new Vector3(5f, 0f, -5f)), //rotation
- ColliderComposite.Capsule(0.20f, //radius
- 0.90f, //length
- Direction.X, //direction
- new Vector3(-0.1f, -0.36f, 0.40f), //position
- new Vector3(0f, 0f, 0f)), //rotation
- ColliderComposite.Box(new Vector3(0.65f, 0.65f, 0.25f), //scale
- new Vector3(0f, 0f, 0.25f), //position
- new Vector3(0f, 0f, 0f)), //rotation
- ColliderComposite.Box(new Vector3(0.5f, 0.5f, 0.10f), //scale
- new Vector3(-0.38f, 1.05f, 0.34f), //position
- new Vector3(312f, 25f, 337.5f)), //rotation
- ColliderComposite.Box(new Vector3(0.5f, 0.5f, 0.10f), //scale
- new Vector3(-0.38f, 1.05f, 0.34f), //position
- new Vector3(312f, 35f, 10f)), //rotation
- ColliderComposite.Sphere(0.5f, //radius
- new Vector3(-0.10f, -0.05f, 0.35f), //Position
- new Vector3(0f, 0f, 0f)) //Rotation
- .Trigger().Layer(2)
- .IgnoreForGhost(), //Do not use this collider on the ghost
- //ColliderComposite.Box(new Vector3(0.35f, 0.35f, 0.15f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f)).Trigger().Layer(2).IgnoreForGhost(), <---Example: Box Trigger on specific Layer
- })
- ///Make sure a block being placed on another block can intersect with it.
- .IgnoreIntersectionForBase()
- ///Load resources that will be needed for the block.
- .NeededResources(new List<NeededResource> {
- new NeededResource(ResourceType.Audio, //Type of resource - types available are Audio, Texture, Mesh, and AssetBundle
- "warHorn.ogg")
- })
- ///Setup where on your block you can add other blocks.
- .AddingPoints(new List<AddingPoint> {
- (AddingPoint)new BasePoint(false, true) //The base point is unique compared to the other adding points, the two booleans represent whether you can add to the base, and whether it sticks automatically.
- .Motionable(false,false,false) //Set each of these booleans to "true" to Let the block rotate around X, Y, Z accordingly
- .SetStickyRadius(0.5f), //Set the radius of which the base point will connect to others
- //new AddingPoint(new Vector3(0f, 0f, 0.5f), new Vector3(-90f, 0f, 0f),true).SetStickyRadius(0.3f), <---Example: Top sticky adding point
- });
- public override void OnLoad()
- {
- LoadBlock(example);
- }
- public override void OnUnload() { }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement