// Handles the emittion of BUD to neighboring blocks public void EmitBlockUpdate(BUDCode type, int x, int y, int z, int tickOffset, ChunkLoader_Server cl) { CastCoord thisPos = new CastCoord(new Vector3(x, y, z)); CastCoord[] neighbors = { thisPos.Add(1, 0, 0), thisPos.Add(-1, 0, 0), thisPos.Add(0, 1, 0), thisPos.Add(0, -1, 0), thisPos.Add(0, 0, 1), thisPos.Add(0, 0, -1) }; int[] facings = { 2, 0, 4, 5, 1, 3 }; int faceCounter = 0; foreach (CastCoord c in neighbors) { if (c.blockY < 0 || c.blockY > Chunk.chunkDepth - 1) { continue; } cl.budscheduler.ScheduleBUD(new BUDSignal(type, c.GetWorldX(), c.GetWorldY(), c.GetWorldZ(), thisPos.GetWorldX(), thisPos.GetWorldY(), thisPos.GetWorldZ(), facings[faceCounter]), tickOffset); faceCounter++; } }
// Turns on and off Torch public override int OnInteract(ChunkPos pos, int blockX, int blockY, int blockZ, ChunkLoader_Server cl) { ushort state = cl.chunks[pos].metadata.GetState(blockX, blockY, blockZ); ushort newState = 0; if (state == ushort.MaxValue) { return(0); } else if (state >= 4) { cl.chunks[pos].metadata.AddToState(blockX, blockY, blockZ, -4); newState = (ushort)(state - 4); } else if (state >= 0 && state < 4) { cl.chunks[pos].metadata.AddToState(blockX, blockY, blockZ, 4); newState = (ushort)(state + 4); } NetMessage message = new NetMessage(NetCode.VFXCHANGE); message.VFXChange(pos, blockX, blockY, blockZ, 0, ushort.MaxValue, newState); cl.server.SendToClients(pos, message); return(2); }
// Handles the emittion of BUD to neighboring blocks public void EmitBlockUpdate(BUDCode type, int x, int y, int z, int tickOffset, ChunkLoader_Server cl) { CastCoord thisPos = new CastCoord(new Vector3(x, y, z)); CastCoord[] neighbors = { thisPos.Add(1, 0, 0), thisPos.Add(-1, 0, 0), thisPos.Add(0, 1, 0), thisPos.Add(0, -1, 0), thisPos.Add(0, 0, 1), thisPos.Add(0, 0, -1) }; int[] facings = { 2, 0, 4, 5, 1, 3 }; int blockCode; int faceCounter = 0; foreach (CastCoord c in neighbors) { blockCode = cl.chunks[c.GetChunkPos()].data.GetCell(c.blockX, c.blockY, c.blockZ); cl.budscheduler.ScheduleBUD(new BUDSignal(type, c.GetWorldX(), c.GetWorldY(), c.GetWorldZ(), thisPos.GetWorldX(), thisPos.GetWorldY(), thisPos.GetWorldZ(), facings[faceCounter]), tickOffset); faceCounter++; } }
public void Start(ChunkLoader_Server cl) { this.SetChunkloader(cl); this.REFRESH_VISION = true; this.viewFieldBlocks = new ushort[(this.viewDistance.x + 2) * (this.viewDistance.x + 2) * (this.viewDistance.y + 2)]; this.viewFieldStates = new ushort[(this.viewDistance.x + 2) * (this.viewDistance.x + 2) * (this.viewDistance.y + 2)]; }
// Fills toDestroy and Safe list // Returns true if all blocks in currentList are connected to a stem // Returns false if all blocks in currentList doesn't connect to a stem or connects to a to-be-destroyed block private int SearchWood(CastCoord init, ChunkLoader_Server cl) { ushort blockCode; ushort state; GetAroundCoords(init, cl); // Filters only Leaf blocks for (int i = 0; i < currentList.Count; i++) { // If it's connected to a marked-to-destroy block if (toDestroy.Contains(currentList[i])) { return(1); } // If it's connected to a safe block if (safeList.Contains(currentList[i])) { return(0); } // If current block is found in initial direction if (validDirections.Contains(currentList[i])) { validDirections.Remove(currentList[i]); } // PANIC if there's too many blocks if (currentList.Count > this.maxAnalysed) { currentList.Clear(); return(2); } blockCode = cl.GetBlock(currentList[i]); state = cl.GetState(currentList[i]); // If it's a spreadable block if (blockCode == this.thisCode && state == 0) { GetAroundCoords(currentList[i], cl); } // Check if it's a root else if (cl.blockBook.CheckSolid(blockCode)) { return(0); } else { currentList.RemoveAt(i); i--; } } return(1); }
public void GenerateDesertStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata) { foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.DESERT)) { if (structCode >= 9 && structCode <= 11) // Metal veins { wgen.GenerateStructures(pos, BiomeCode.DESERT, structCode, 9, blockdata, statedata, hpdata, range: true); } } }
// Destroys FireVFX public override int OnBreak(ChunkPos pos, int x, int y, int z, ChunkLoader_Server cl) { NetMessage message = new NetMessage(NetCode.VFXBREAK); message.VFXBreak(pos, x, y, z, ushort.MaxValue, 0); cl.server.SendToClients(pos, message); EraseMetadata(pos, x, y, z, cl); return(0); }
// Activates OnBreak event -> Emits normal BUD, emits special BUD to breadt-first search leaves public override int OnBreak(ChunkPos pos, int blockX, int blockY, int blockZ, ChunkLoader_Server cl) { CastCoord thisCoord = new CastCoord(pos, blockX, blockY, blockZ); EmitBlockUpdate(BUDCode.BREAK, thisCoord.GetWorldX(), thisCoord.GetWorldY(), thisCoord.GetWorldZ(), 0, cl); TreeCheck(thisCoord, cl); GetSurroundingLeaves(thisCoord, decayDistance, cl); RunLeavesRecursion(cl, thisCoord); return(0); }
// Handles search of Wood Blocks private void RunWoodRecursion(ChunkLoader_Server cl) { CastCoord current; int exitCode; currentList.Clear(); safeList.Clear(); toDestroy.Clear(); while (validDirections.Count > 0) { current = validDirections[0]; validDirections.RemoveAt(0); // If found to-destroy blocks exitCode = SearchWood(current, cl); // Safe if (exitCode == 0) { safeList.AddRange(currentList); currentList.Clear(); } // Invalid else if (exitCode == 1) { toDestroy.AddRange(currentList); currentList.Clear(); } // PANIC else { return; } } foreach (CastCoord aux in toDestroy) { cl.chunks[aux.GetChunkPos()].data.SetCell(aux.blockX, aux.blockY, aux.blockZ, 0); cl.chunks[aux.GetChunkPos()].metadata.Reset(aux.blockX, aux.blockY, aux.blockZ); this.Update(aux, BUDCode.BREAK, 0, -1, cl); EmitBlockUpdate(BUDCode.BREAK, aux.GetWorldX(), aux.GetWorldY(), aux.GetWorldZ(), 0, cl); EmitBlockUpdate(BUDCode.DECAY, aux.GetWorldX(), aux.GetWorldY(), aux.GetWorldZ(), 0, cl); } }
public void GenerateSnowyForestStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata) { foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.FOREST)) { if (structCode == 1 || structCode == 2 || structCode == 8) // Trees { wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 0, blockdata, statedata, hpdata); } else if (structCode == 3 || structCode == 4) // Dirt Piles { wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 3, blockdata, statedata, hpdata, range: true); } else if (structCode >= 9 && structCode <= 11) // Metal veins { wgen.GenerateStructures(pos, BiomeCode.FOREST, structCode, 9, blockdata, statedata, hpdata, range: true); } } }
// Returns a filled cache list full of surrounding coords private bool GetSurroundings(CastCoord init, int currentDistance, ChunkLoader_Server cl) { // End if (currentDistance == 0) { return(false); } cache.Clear(); cache.Add(init.Add(0, 0, 1)); // North cache.Add(init.Add(0, 0, -1)); // South cache.Add(init.Add(1, 0, 0)); // East cache.Add(init.Add(-1, 0, 0)); // West cache.Add(init.Add(0, 1, 0)); // Up cache.Add(init.Add(0, -1, 0)); // Down // Filters only Leaf blocks foreach (CastCoord c in cache) { if (cl.GetBlock(c) == this.thisCode && cl.GetState(c) == 0) { // If is already in dict if (distances.ContainsKey(c)) { if (distances[c] > currentDistance) { distances[c] = currentDistance; openList.Add(c); } } else { distances.Add(c, currentDistance); openList.Add(c); } } if (cl.GetBlock(c) == this.assignedWoodCode && cl.GetState(c) == 0) { return(true); } } return(false); }
public Server(ChunkLoader_Server cl) { ParseArguments(); // Parses config file if is a Dedicated Server if (!this.isLocal) { ParseConfigFile(); } // Initiates Server data connections = new Dictionary <ulong, Socket>(); temporaryConnections = new Dictionary <ulong, Socket>(); timeoutTimers = new Dictionary <ulong, DateTime>(); lengthPacket = new Dictionary <ulong, bool>(); packetIndex = new Dictionary <ulong, int>(); packetSize = new Dictionary <ulong, int>(); dataBuffer = new Dictionary <ulong, byte[]>(); connectionGraph = new Dictionary <ulong, HashSet <ulong> >(); playersInChunk = new Dictionary <ChunkPos, HashSet <ulong> >(); receiveBuffer = new Dictionary <ulong, byte[]>(); this.cl = cl; if (!this.isLocal) { this.masterSocket = new Socket(IPAddress.Any.AddressFamily, SocketType.Stream, ProtocolType.Tcp); this.serverIP = new IPEndPoint(0, this.port); } else { this.masterSocket = new Socket(IPAddress.Loopback.AddressFamily, SocketType.Stream, ProtocolType.Tcp); this.serverIP = new IPEndPoint(0x0100007F, this.port); } Debug.Log("Starting Server"); this.masterSocket.Bind(this.serverIP); this.masterSocket.Listen(byte.MaxValue); this.masterSocket.BeginAccept(new AsyncCallback(ConnectCallback), this.masterSocket); }
// Check if there's any wood block around this block private bool CheckWoodAround(CastCoord init, ChunkLoader_Server cl) { cache.Clear(); cache.Add(init.Add(0, 0, 1)); // North cache.Add(init.Add(0, 0, -1)); // South cache.Add(init.Add(1, 0, 0)); // East cache.Add(init.Add(-1, 0, 0)); // West cache.Add(init.Add(0, 1, 0)); // Up cache.Add(init.Add(0, -1, 0)); // Down foreach (CastCoord c in cache) { if (cl.GetBlock(c) == this.thisCode && cl.GetState(c) == 0) { return(true); } } return(false); }
public void GenerateBiomeStructures(ChunkLoader_Server cl, ChunkPos pos, BiomeCode biome, ushort[] blockdata, ushort[] statedata, ushort[] hpdata) { switch (biome) { case BiomeCode.PLAINS: GeneratePlainsStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.GRASSY_HIGHLANDS: GenerateGrassyHighlandsStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.OCEAN: break; case BiomeCode.FOREST: GenerateForestStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.DESERT: GenerateDesertStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.SNOWY_PLAINS: GenerateSnowyPlainsStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.SNOWY_HIGHLANDS: GenerateSnowyHighlandsStructures(cl, pos, blockdata, statedata, hpdata); break; case BiomeCode.ICE_OCEAN: break; case BiomeCode.SNOWY_FOREST: GenerateSnowyForestStructures(cl, pos, blockdata, statedata, hpdata); break; default: break; } }
// Does Search for invalid leaves private bool RunLeavesRecursion(ChunkLoader_Server cl) { bool foundWood = false; while (openList.Count > 0 && !foundWood) { foundWood = GetSurroundings(openList[0], distances[openList[0]] - 1, cl); openList.RemoveAt(0); } distances.Clear(); if (foundWood) { return(true); } else { return(false); } }
// Creates FireVFX on Load public override int OnLoad(CastCoord coord, ChunkLoader_Server cl) { ushort state = cl.chunks[coord.GetChunkPos()].metadata.GetState(coord.blockX, coord.blockY, coord.blockZ); int facing; if (state >= 4) { facing = state - 4; } else { facing = state; } NetMessage message = new NetMessage(NetCode.VFXDATA); message.VFXData(coord.GetChunkPos(), coord.blockX, coord.blockY, coord.blockZ, facing, ushort.MaxValue, state); cl.vfx.Add(coord.GetChunkPos(), BuildVFXName(coord.GetChunkPos(), coord.blockX, coord.blockY, coord.blockZ), message); cl.server.SendToClients(coord.GetChunkPos(), message); return(1); }
// Does Search for invalid leaves private void RunLeavesRecursion(ChunkLoader_Server cl, CastCoord init) { while (openList.Count > 0) { GetSurroundingLeaves(openList[0], distances[openList[0]] - 1, cl); openList.RemoveAt(0); } // Applies DECAY BUD to distant leaves foreach (CastCoord c in distances.Keys) { if (distances[c] == 0) { EmitBUDTo(BUDCode.DECAY, c.GetWorldX(), c.GetWorldY(), c.GetWorldZ(), 1, cl); } } // Applies DECAY BUD to around blocks if there's no wood around EmitDelayedBUD(BUDCode.DECAY, init.GetWorldX(), init.GetWorldY(), init.GetWorldZ(), minDecayTime, maxDecayTime, cl); distances.Clear(); }
public void GenerateGrassyHighlandsStructures(ChunkLoader_Server cl, ChunkPos pos, ushort[] blockdata, ushort[] statedata, ushort[] hpdata) { foreach (int structCode in BiomeHandler.GetBiomeStructs(BiomeCode.GRASSY_HIGHLANDS)) { if (structCode == 2) // Tree { wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 0, blockdata, statedata, hpdata); } else if (structCode == 3 || structCode == 4) // Dirt Piles { wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 3, blockdata, statedata, hpdata, range: true); } else if (structCode == 5) // Boulder { wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 1, blockdata, statedata, hpdata); } else if (structCode >= 9 && structCode <= 11) // Metal veins { wgen.GenerateStructures(pos, BiomeCode.GRASSY_HIGHLANDS, structCode, 9, blockdata, statedata, hpdata, range: true); } } }
// Breaks Torch if broken public override void OnBlockUpdate(BUDCode type, int x, int y, int z, int budX, int budY, int budZ, int facing, ChunkLoader_Server cl) { if (facing >= 4) { return; } CastCoord aux = new CastCoord(new Vector3(x, y, z)); if (type == BUDCode.LOAD) { this.OnLoad(aux, cl); } ChunkPos thisPos = aux.GetChunkPos(); //new ChunkPos(Mathf.FloorToInt(x/Chunk.chunkWidth), Mathf.FloorToInt(z/Chunk.chunkWidth)); int X = aux.blockX; //x%Chunk.chunkWidth; int Y = aux.blockY; //y%Chunk.chunkDepth; int Z = aux.blockZ; //z%Chunk.chunkWidth; aux = new CastCoord(new Vector3(budX, budY, budZ)); ChunkPos budPos = aux.GetChunkPos(); //new ChunkPos(Mathf.FloorToInt(budX/Chunk.chunkWidth), Mathf.FloorToInt(budZ/Chunk.chunkWidth)); int bX = aux.blockX; //budX%Chunk.chunkWidth; int bY = aux.blockY; //budY%Chunk.chunkDepth; int bZ = aux.blockZ; //budZ%Chunk.chunkWidth; ushort state = cl.chunks[thisPos].metadata.GetState(X, Y, Z); // Breaks Torch if broken attached block if (type == BUDCode.BREAK && (facing == state || facing + 4 == state)) { cl.chunks[thisPos].data.SetCell(X, Y, Z, 0); this.OnBreak(thisPos, X, Y, Z, cl); NetMessage message = new NetMessage(NetCode.DIRECTBLOCKUPDATE); message.DirectBlockUpdate(BUDCode.BREAK, thisPos, X, Y, Z, facing, ushort.MaxValue, state, 0); cl.server.SendToClients(thisPos, message); EraseMetadata(thisPos, X, Y, Z, cl); } // Breaks Torch if changed block is not solid else if (type == BUDCode.CHANGE) { int blockCode = cl.chunks[budPos].data.GetCell(bX, bY, bZ); if (blockCode >= 0) { // If changed block is not solid, break if (!cl.blockBook.blocks[blockCode].solid) { cl.chunks[thisPos].data.SetCell(X, Y, Z, 0); this.OnBreak(thisPos, X, Y, Z, cl); NetMessage message = new NetMessage(NetCode.DIRECTBLOCKUPDATE); message.DirectBlockUpdate(BUDCode.BREAK, thisPos, X, Y, Z, facing, ushort.MaxValue, state, 0); cl.server.SendToClients(thisPos, message); EraseMetadata(thisPos, X, Y, Z, cl); } } else { if (!cl.blockBook.objects[ushort.MaxValue - blockCode].solid) { cl.chunks[thisPos].data.SetCell(X, Y, Z, 0); this.OnBreak(thisPos, X, Y, Z, cl); NetMessage message = new NetMessage(NetCode.DIRECTBLOCKUPDATE); message.DirectBlockUpdate(BUDCode.BREAK, thisPos, X, Y, Z, facing, ushort.MaxValue, state, 0); cl.server.SendToClients(thisPos, message); EraseMetadata(thisPos, X, Y, Z, cl); } } } }
// Only able to place torches on walls and solid blocks public override bool PlacementRule(ChunkPos pos, int x, int y, int z, int direction, ChunkLoader_Server cl) { // If is stuck to walls if (direction <= 3 && direction >= 0) { ushort blockCode; if (direction == 2) { if (x > 0) { blockCode = cl.chunks[pos].data.GetCell(x - 1, y, z); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } else { ChunkPos newPos = new ChunkPos(pos.x - 1, pos.z); blockCode = cl.chunks[newPos].data.GetCell(Chunk.chunkWidth - 1, y, z); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } } else if (direction == 0) { if (x < Chunk.chunkWidth - 1) { blockCode = cl.chunks[pos].data.GetCell(x + 1, y, z); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } else { ChunkPos newPos = new ChunkPos(pos.x + 1, pos.z); blockCode = cl.chunks[newPos].data.GetCell(0, y, z); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } } else if (direction == 3) { if (z < Chunk.chunkWidth - 1) { blockCode = cl.chunks[pos].data.GetCell(x, y, z + 1); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } else { ChunkPos newPos = new ChunkPos(pos.x, pos.z + 1); blockCode = cl.chunks[newPos].data.GetCell(x, y, 0); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } } else if (direction == 1) { if (z > 0) { blockCode = cl.chunks[pos].data.GetCell(x, y, z - 1); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } else { ChunkPos newPos = new ChunkPos(pos.x, pos.z - 1); blockCode = cl.chunks[newPos].data.GetCell(x, y, Chunk.chunkWidth - 1); if (cl.blockBook.CheckSolid(blockCode)) { return(true); } else { return(false); } } } } return(false); }
// Triggers DECAY BUD on this block public override void OnBlockUpdate(BUDCode type, int myX, int myY, int myZ, int budX, int budY, int budZ, int facing, ChunkLoader_Server cl) { if (type == BUDCode.DECAY) { CastCoord thisPos = new CastCoord(new Vector3(myX, myY, myZ)); GetSurroundings(thisPos, this.decayDistance, cl); if (!RunLeavesRecursion(cl)) { if (cl.chunks.ContainsKey(thisPos.GetChunkPos())) { cl.chunks[thisPos.GetChunkPos()].data.SetCell(thisPos.blockX, thisPos.blockY, thisPos.blockZ, 0); cl.chunks[thisPos.GetChunkPos()].metadata.Reset(thisPos.blockX, thisPos.blockY, thisPos.blockZ); this.Update(thisPos, BUDCode.BREAK, facing, cl); cl.budscheduler.ScheduleSave(thisPos.GetChunkPos()); } // Applies Decay BUD to surrounding leaves if this one is invalid GetLastSurrounding(thisPos); foreach (CastCoord c in cache) { EmitBUDTo(BUDCode.DECAY, c.GetWorldX(), c.GetWorldY(), c.GetWorldZ(), Random.Range(minDecayTime, maxDecayTime), cl); } } distances.Clear(); openList.Clear(); cache.Clear(); } }
// Makes Wood Block have state 1 when unnaturally placed public override int OnPlace(ChunkPos pos, int blockX, int blockY, int blockZ, int facing, ChunkLoader_Server cl) { cl.chunks[pos].metadata.SetState(blockX, blockY, blockZ, 1); return(0); }
// Sends a DirectBlockUpdate call to users public void Update(CastCoord c, BUDCode type, int facing, ChunkLoader_Server cl) { this.reloadMessage = new NetMessage(NetCode.DIRECTBLOCKUPDATE); this.reloadMessage.DirectBlockUpdate(type, c.GetChunkPos(), c.blockX, c.blockY, c.blockZ, facing, 0, cl.GetState(c), ushort.MaxValue); cl.server.SendToClients(c.GetChunkPos(), this.reloadMessage); }
protected void SetChunkloader(ChunkLoader_Server cl) { this.cl = cl; }
public DroppedItemAI(float3 pos, float3 rot, float3 move, ulong code, ushort itemCode, byte amount, ulong playerCode, EntityHandler_Server handler, ChunkLoader_Server cl) { this.Construct(); this.SetPosition(pos, rot); this.Install(EntityHitbox.ITEM); this.SetChunkloader(cl); this.SetHandler(handler); this.entityCode = code; this.CREATED_BY_PLAYER = true; this.playerCode = playerCode; this.its = new ItemStack((ItemID)itemCode, amount); this.Install(new ProjectileTerrainVision(cl)); this.Install(new ItemBehaviour(pos, rot, move)); }
// Adds GameObject with correct offseting in the world and returns it public GameObject PlaceObject(ChunkPos pos, int x, int y, int z, ushort blockCode, ChunkLoader_Server loader) { if (!this.needsRotation) { return(GameObject.Instantiate(loader.blockBook.objects[ushort.MaxValue - blockCode].go, new Vector3(pos.x * Chunk.chunkWidth + x, y, pos.z * Chunk.chunkWidth + z), Quaternion.identity)); } else { GameObject GO = GameObject.Instantiate(loader.blockBook.objects[ushort.MaxValue - blockCode].go, new Vector3(pos.x * Chunk.chunkWidth + x, y, pos.z * Chunk.chunkWidth + z), Quaternion.identity); loader.blockBook.objects[ushort.MaxValue - blockCode].ApplyRotation(GO, loader.chunks[pos].metadata.GetState(x, y, z), x, y, z); return(GO); } }
// Instantiates a FireVFX public override int OnPlace(ChunkPos pos, int blockX, int blockY, int blockZ, int facing, ChunkLoader_Server cl) { cl.chunks[pos].metadata.SetState(blockX, blockY, blockZ, (ushort)facing); NetMessage message = new NetMessage(NetCode.VFXDATA); message.VFXData(pos, blockX, blockY, blockZ, facing, ushort.MaxValue, (ushort)facing); cl.vfx.Add(pos, BuildVFXName(pos, blockX, blockY, blockZ), message); cl.server.SendToClients(pos, message); return(0); }
// Emits a BUD signal with no information about sender public void EmitBUDTo(BUDCode type, int x, int y, int z, int tickOffset, ChunkLoader_Server cl) { cl.budscheduler.ScheduleBUD(new BUDSignal(type, x, y, z, 0, 0, 0, 0), tickOffset); }
public override int OnInteract(ChunkPos pos, int blockX, int blockY, int blockZ, ChunkLoader_Server cl) { // Changes to Metal cl.chunks[pos].data.SetCell(blockX, blockY, blockZ, (ushort)BlockID.METAL_ORE); return(1); }
public BasicTerrainVision(ChunkLoader_Server cl) { this.viewDistance = new int2(8, 8); this.Start(cl); }