public static OutputSlot[] ResizeArray(OutputSlot[] oldArray, int newSize) { if (oldArray == null) { return(new OutputSlot[newSize]); } else if (oldArray.Length != newSize) { var newArray = new OutputSlot[newSize]; if (oldArray.Length < newSize) { System.Array.Copy(oldArray, newArray, oldArray.Length); } else { System.Array.Copy(oldArray, newArray, newSize); for (int i = newSize; i < oldArray.Length; ++i) { oldArray[i].DisconnectAll(); } } return(newArray); } else { return(oldArray); } }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IFaceAttribute <Color> >(faceColorsInputSlot); OutputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Color> >(faceEdgeColorsOutputSlot); }
private void grindInput() { ItemStack grindedStack = InputGrindProps.GroundStack.ResolvedItemstack.Clone(); if (OutputSlot.Itemstack == null) { OutputSlot.Itemstack = grindedStack; } else { int mergableQuantity = OutputSlot.Itemstack.Collectible.GetMergableQuantity(OutputSlot.Itemstack, grindedStack, EnumMergePriority.AutoMerge); if (mergableQuantity > 0) { OutputSlot.Itemstack.StackSize += grindedStack.StackSize; } else { BlockFacing face = BlockFacing.HORIZONTALS[nowOutputFace]; nowOutputFace = (nowOutputFace + 1) % 4; Block block = Api.World.BlockAccessor.GetBlock(this.Pos.AddCopy(face)); if (block.Replaceable < 6000) { return; } Api.World.SpawnItemEntity(grindedStack, this.Pos.ToVec3d().Add(0.5 + face.Normalf.X * 0.7, 0.75, 0.5 + face.Normalf.Z * 0.7), new Vec3d(face.Normalf.X * 0.02f, 0, face.Normalf.Z * 0.02f)); } } InputSlot.TakeOut(1); InputSlot.MarkDirty(); OutputSlot.MarkDirty(); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Surface>(surfaceInputSlot); InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IVertexAttribute <Vector3> >(vertexPositionsInputSlot); OutputSlot.ResetAssetTypeIfNull <IFaceAttribute <Vector3> >(faceCentroidsOutputSlot); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Surface>(surfaceInputSlot); InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IVertexAttribute <Vector3> >(vertexPositionsInputSlot); OutputSlot.ResetAssetTypeIfNull <UniversalFaceSpatialPartitioning>(partitioningOutputSlot); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(vertexPositionsInputSlot); InputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(offsetsInputSlot); OutputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(offsetVertexPositionsOutputSlot); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <FaceGroupCollection>(faceGroupCollectionInputSlot); InputSlot.ResetAssetTypeIfNull <IFaceAttribute <int> >(faceGroupIndicesInputSlot); randomness.ResetIfBroken(this); OutputSlot.ResetAssetTypeIfNull <IFaceGroupAttribute <Color> >(faceGroupColorsOutputSlot); OutputSlot.ResetAssetTypeIfNull <IFaceAttribute <Color> >(faceColorsOutputSlot); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Surface>(ref surfaceInputSlot, this); InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IVertexAttribute <Vector3> >(ref vertexPositionsInputSlot, this); // Outputs OutputSlot.CreateOrReset <UniversalFaceSpatialPartitioning>(ref partitioningOutputSlot, this, "Face Spatial Partitioning"); }
public FurnaceEntity(uint id, int x, int y, Action <uint> onDestroy, FurnaceData data) : base(id, x, y, onDestroy) { _data = data; CurrentFuel = new Fuel(0.0f, 0.0f); Input = new Slot(); FuelSlot = new ConstrainedSlot <IFuel>(new Slot()); _outputSlot = new Slot(); Output = new OutputSlot(_outputSlot); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <DynamicMesh>(ref dynamicMeshInputSlot, this); // Fields meshPrefab = null; // Outputs OutputSlot.CreateOrReset <GameObject>(ref prefabOutputSlot, this, "Prefab"); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Surface>(ref surfaceInputSlot, this); InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IEdgeAttribute <Vector3> >(ref vertexPositionsInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <Vector3> >(ref facePositionsInputSlot, this); // Outputs OutputSlot.CreateOrResetGrouped <IEdgeAttribute <Vector3> >(ref bisectorsOutputSlot, this, "Face Edge Bisectors", "Attributes"); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); randomness.ResetIfBroken(this); OutputSlot.ResetAssetTypeIfNull <FaceGroupCollection>(faceGroupCollectionOutputSlot); OutputSlot.ResetAssetTypeIfNull <IFaceAttribute <int> >(faceGroupIndicesOutputSlot); foreach (var outputSlot in faceGroupOutputSlots) { OutputSlot.ResetAssetTypeIfNull <FaceGroup>(outputSlot); } }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Surface>(ref surfaceInputSlot, this); InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IVertexAttribute <Vector3> >(ref vertexPositionsInputSlot, this); // Fields flatten = false; // Outputs OutputSlot.CreateOrResetGrouped <IFaceAttribute <Vector3> >(ref faceCentroidsOutputSlot, this, "Face Centroids", "Attributes"); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IEdgeAttribute <Vector3> >(ref vertexPositionsInputSlot, this); InputSlot.CreateOrResetRequired <IEdgeAttribute <Vector3> >(ref offsetsInputSlot, this); // Fields scale = 1f; // Outputs OutputSlot.CreateOrResetGrouped <IEdgeAttribute <Vector3> >(ref offsetVertexPositionsOutputSlot, this, "Offset Vertex Positions", "Attributes"); }
public void OnAfterDeserialize() { InputSlot.ResetAssetTypeIfNull <Surface>(surfaceInputSlot); InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IFaceAttribute <Vector3> >(facePositionsInputSlot); OutputSlot.ResetAssetTypeIfNull <FaceGroupCollection>(faceGroupCollectionOutputSlot); OutputSlot.ResetAssetTypeIfNull <IFaceAttribute <int> >(faceGroupIndicesOutputSlot); foreach (var outputSlot in faceGroupOutputSlots) { OutputSlot.ResetAssetTypeIfNull <FaceGroup>(outputSlot); } }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); // Fields groupCount = 1; randomness.Initialize(this); // Outputs OutputSlot.CreateOrResetGrouped <FaceGroupCollection>(ref faceGroupCollectionOutputSlot, this, "Random Face Groups", "Face Groups"); OutputSlot.CreateOrResetGrouped <IFaceAttribute <int> >(ref faceGroupIndicesOutputSlot, this, "Random Face Group Indices", "Attributes"); faceGroupOutputSlots = new OutputSlot[0]; }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <Color> >(ref faceColorsInputSlot, this); // Fields colorSource = ColorSource.Constant; constantColor = Color.black; blendWeight = 0.5f; // Outputs OutputSlot.CreateOrResetGrouped <IEdgeAttribute <Color> >(ref faceEdgeColorsOutputSlot, this, "Face Edge Colors", "Attributes"); }
public void OnAfterDeserialize() { if (surfaceInputSlot.generator == null) { surfaceInputSlot = InputSlot.CreateRequired <Surface>(this); } InputSlot.ResetAssetTypeIfNull <Surface>(surfaceInputSlot); InputSlot.ResetAssetTypeIfNull <Topology>(topologyInputSlot); InputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(vertexPositionsInputSlot); InputSlot.ResetAssetTypeIfNull <IFaceAttribute <Vector3> >(facePositionsInputSlot); OutputSlot.ResetAssetTypeIfNull <IEdgeAttribute <Vector3> >(bisectorsOutputSlot); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <QuadrilateralSurface>(ref surfaceInputSlot, this); InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <Vector3> >(ref facePositionsInputSlot, this); // Fields axisDivisions = new IntVector2(1, 1); // Outputs OutputSlot.CreateOrResetGrouped <FaceGroupCollection>(ref faceGroupCollectionOutputSlot, this, "Rectangular Face Groups", "Face Groups"); OutputSlot.CreateOrResetGrouped <IFaceAttribute <int> >(ref faceGroupIndicesOutputSlot, this, "Rectangular Face Group Indices", "Attributes"); faceGroupOutputSlots = new OutputSlot[0]; }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Surface>(ref surfaceInputSlot, this); InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <IVertexAttribute <Vector3> >(ref vertexPositionsInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <Vector3> >(ref facePositionsInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <Vector3> >(ref faceNormalsInputSlot, this); // Fields calculationMethod = CalculationMethod.FromSurfaceNormal; // Outputs OutputSlot.CreateOrResetGrouped <IVertexAttribute <Vector3> >(ref vertexNormalsOutputSlot, this, "Vertex Normals", "Attributes"); }
public void OnAfterDeserialize() { if (primaryPole == Vector3.zero) { primaryPole = Vector3.up; } if (equatorialPole == Vector3.zero) { equatorialPole = Vector3.right; } OutputSlot.ResetAssetTypeIfNull <SphericalSurface>(surfaceOutputSlot); OutputSlot.ResetAssetTypeIfNull <Topology>(topologyOutputSlot); OutputSlot.ResetAssetTypeIfNull <IVertexAttribute <Vector3> >(vertexPositionsOutputSlot); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <FaceGroupCollection>(ref faceGroupCollectionInputSlot, this); InputSlot.CreateOrResetRequired <IFaceAttribute <int> >(ref faceGroupIndicesInputSlot, this); // Fields colorSource = ColorSource.Constant; constantColor = Color.white; randomness.Initialize(this); // Outputs OutputSlot.CreateOrResetGrouped <IFaceGroupAttribute <Color> >(ref faceGroupColorsOutputSlot, this, "Face Group Colors", "Attributes"); OutputSlot.CreateOrResetGrouped <IFaceAttribute <Color> >(ref faceColorsOutputSlot, this, "Face Colors", "Attributes"); }
protected override void Initialize() { // Fields radius = 1f; primaryPole = Vector3.up; equatorialPole = Vector3.right; isInverted = false; sphericalPolyhedron = SphericalPolyhedrons.Icosahedron; subdivisionDegree = 10; useDualPolyhedron = true; // Outputs OutputSlot.CreateOrReset <SphericalSurface>(ref surfaceOutputSlot, this, "Surface"); OutputSlot.CreateOrReset <Topology>(ref topologyOutputSlot, this, "Topology"); OutputSlot.CreateOrResetGrouped <IVertexAttribute <Vector3> >(ref vertexPositionsOutputSlot, this, "Vertex Positions", "Attributes"); }
private void grindInput() { ItemStack grindedStack = InputGrindProps.GrindedStack.ResolvedItemstack; if (OutputSlot.Itemstack == null) { OutputSlot.Itemstack = grindedStack.Clone(); } else { OutputSlot.Itemstack.StackSize += grindedStack.StackSize; } InputSlot.TakeOut(1); InputSlot.MarkDirty(); OutputSlot.MarkDirty(); }
public static OutputSlot[] ResizeArray(OutputSlot[] oldArray, int newSize, System.Func <int, OutputSlot> initializer, System.Func <OutputSlot, int, OutputSlot> updater) { if (oldArray == null) { var newArray = new OutputSlot[newSize]; for (int i = 0; i < newSize; ++i) { newArray[i] = initializer(i); } return(newArray); } else if (oldArray.Length != newSize) { var newArray = new OutputSlot[newSize]; if (oldArray.Length < newSize) { for (int i = 0; i < oldArray.Length; ++i) { newArray[i] = updater(oldArray[i], i); } for (int i = oldArray.Length; i < newSize; ++i) { newArray[i] = initializer(i); } } else { for (int i = 0; i < newSize; ++i) { newArray[i] = updater(oldArray[i], i); } for (int i = newSize; i < oldArray.Length; ++i) { oldArray[i].DisconnectAll(); } } return(newArray); } else { return(oldArray); } }
public void OnAfterDeserialize() { OutputSlot.ResetAssetTypeIfNull <QuadrilateralSurface>(surfaceOutputSlot); OutputSlot.ResetAssetTypeIfNull <Topology>(topologyOutputSlot); OutputSlot.ResetAssetTypeIfNull <IVertexAttribute <Vector3> >(vertexPositionsOutputSlot); if (string.IsNullOrEmpty(_version) || _version == "1.0") { Updgrade_From_1_0_To_1_1(); } switch (tileType) { case TileTypes.Quadrilateral: SetQuadTileShape(quadTileShape); break; case TileTypes.Hexagonal: SetHexTileShape(hexTileShape); break; default: throw new System.NotImplementedException(); } }
public override int GetHashCode() { int hash = 1; if (NodeName.Length != 0) { hash ^= NodeName.GetHashCode(); } if (OutputSlot != 0) { hash ^= OutputSlot.GetHashCode(); } hash ^= debugOps_.GetHashCode(); hash ^= debugUrls_.GetHashCode(); if (TolerateDebugOpCreationFailures != false) { hash ^= TolerateDebugOpCreationFailures.GetHashCode(); } return(hash); }
public virtual void TryOutputItem() { if (!OutputSlotOccupied && thingPlacementQueue.Count > 0) { GenPlace.TryPlaceThing(thingPlacementQueue.First(), OutputSlot, Map, ThingPlaceMode.Direct); thingPlacementQueue.RemoveAt(0); } else if (thingPlacementQueue.Count > 0) { foreach (var t in thingPlacementQueue) { var thing = OutputSlot.GetThingList(Map).Find(th => th.CanStackWith(t)); thing?.TryAbsorbStack(t, true); if (t.Destroyed || t.stackCount == 0) { thingPlacementQueue.Remove(t); break; } } } }
protected override void Initialize() { // Fields _version = "1.1"; tileType = TileTypes.Quadrilateral; size = new IntVector2(64, 64); SetHexTileShape(HexTileShapes.RegularPointUp, true); SetQuadTileShape(QuadTileShapes.Square, true); isAxis0Wrapped = false; isAxis1Wrapped = false; hexGridAxisStyle = HexGridAxisStyles.Staggered; swapAxes = false; origin = Vector3.zero; rotation = Vector3.zero; // Outputs OutputSlot.CreateOrReset <QuadrilateralSurface>(ref surfaceOutputSlot, this, "Surface"); OutputSlot.CreateOrReset <Topology>(ref topologyOutputSlot, this, "Topology"); OutputSlot.CreateOrResetGrouped <IVertexAttribute <Vector3> >(ref vertexPositionsOutputSlot, this, "Vertex Positions", "Attributes"); }
protected override void Initialize() { // Inputs InputSlot.CreateOrResetRequired <Topology>(ref topologyInputSlot, this); InputSlot.CreateOrResetRequired <FaceGroupCollection>(ref faceGroupCollectionInputSlot, this); InputSlot.CreateOrResetRequired <FaceGroup>(ref faceGroupInputSlot, this); ringVertexPositionsInputSlots = new InputSlot[0]; ringVertexNormalsInputSlots = new InputSlot[0]; ringVertexColorsInputSlots = new InputSlot[0]; ringVertexColor32sInputSlots = new InputSlot[0]; ringVertexUV1sInputSlots = new InputSlot[0]; ringVertexUV2sInputSlots = new InputSlot[0]; ringVertexUV3sInputSlots = new InputSlot[0]; ringVertexUV4sInputSlots = new InputSlot[0]; ringVertexTangentsInputSlots = new InputSlot[0]; centerVertexPositionsInputSlots = new InputSlot[0]; centerVertexNormalsInputSlots = new InputSlot[0]; centerVertexColorsInputSlots = new InputSlot[0]; centerVertexColor32sInputSlots = new InputSlot[0]; centerVertexUV1sInputSlots = new InputSlot[0]; centerVertexUV2sInputSlots = new InputSlot[0]; centerVertexUV3sInputSlots = new InputSlot[0]; centerVertexUV4sInputSlots = new InputSlot[0]; centerVertexTangentsInputSlots = new InputSlot[0]; UpdateVertexAttributeInputSlots(); // Fields sourceType = SourceType.InternalFaces; triangulation = Triangulation.Fan; ringDepth = 1; maxVerticesPerSubmesh = 65534; // Outputs OutputSlot.CreateOrReset <DynamicMesh>(ref dynamicMeshOutputSlot, this, "Dynamic Mesh"); meshOutputSlots = new OutputSlot[0]; }