diff options
-rw-r--r-- | MCServer/Plugins/APIDump/APIDesc.lua | 3 | ||||
-rw-r--r-- | MCServer/Plugins/Handy/handy_functions.lua | 4 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 32 | ||||
-rw-r--r-- | src/BlockEntities/DispenserEntity.cpp | 90 | ||||
-rw-r--r-- | src/BlockEntities/DispenserEntity.h | 26 | ||||
-rw-r--r-- | src/Generating/DistortedHeightmap.cpp | 4 | ||||
-rw-r--r-- | src/Generating/DistortedHeightmap.h | 6 | ||||
-rw-r--r-- | src/Generating/HeiGen.cpp | 89 | ||||
-rw-r--r-- | src/Generating/HeiGen.h | 21 | ||||
-rw-r--r-- | src/Generating/VillageGen.cpp | 21 | ||||
-rw-r--r-- | src/GroupManager.cpp | 2 |
12 files changed, 153 insertions, 147 deletions
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index 8442f6d80..c97e2dbf8 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -114,6 +114,7 @@ g_APIDesc = GetBlockSkyLight = { Params = "BlockX, BlockY, BlockZ", Return = "NIBBLETYPE", Notes = "Returns the skylight at the specified absolute coords" }, GetBlockType = { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified absolute coords" }, GetBlockTypeMeta = { Params = "BlockX, BlockY, BlockZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified absolute coords" }, + GetCoordRange = {Params = "", Return = "MaxX, MaxY, MaxZ", Notes = "Returns the maximum relative coords in all 3 axes. See also GetSize()." }, GetDataTypes = { Params = "", Return = "number", Notes = "Returns the mask of datatypes that the object is currently holding" }, GetOrigin = { Params = "", Return = "OriginX, OriginY, OriginZ", Notes = "Returns the origin coords of where the area was read from." }, GetOriginX = { Params = "", Return = "number", Notes = "Returns the origin x-coord" }, @@ -124,7 +125,7 @@ g_APIDesc = GetRelBlockSkyLight = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "NIBBLETYPE", Notes = "Returns the skylight at the specified relative coords" }, GetRelBlockType = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "BLOCKTYPE", Notes = "Returns the block type at the specified relative coords" }, GetRelBlockTypeMeta = { Params = "RelBlockX, RelBlockY, RelBlockZ", Return = "BLOCKTYPE, NIBBLETYPE", Notes = "Returns the block type and meta at the specified relative coords" }, - GetSize = { Params = "", Return = "SizeX, SizeY, SizeZ", Notes = "Returns the size of the area in all 3 axes." }, + GetSize = { Params = "", Return = "SizeX, SizeY, SizeZ", Notes = "Returns the size of the area in all 3 axes. See also GetCoordRange()." }, GetSizeX = { Params = "", Return = "number", Notes = "Returns the size of the held data in the x-axis" }, GetSizeY = { Params = "", Return = "number", Notes = "Returns the size of the held data in the y-axis" }, GetSizeZ = { Params = "", Return = "number", Notes = "Returns the size of the held data in the z-axis" }, diff --git a/MCServer/Plugins/Handy/handy_functions.lua b/MCServer/Plugins/Handy/handy_functions.lua index c142ffd08..af43f663a 100644 --- a/MCServer/Plugins/Handy/handy_functions.lua +++ b/MCServer/Plugins/Handy/handy_functions.lua @@ -6,7 +6,7 @@ function GetHandyVersion() return HANDY_VERSION end -- Checks if handy is in proper version -function CheckForRequiedVersion( inVersion ) +function CheckForRequiredVersion( inVersion ) if( inVersion > HANDY_VERSION ) then return false end return true end @@ -213,4 +213,4 @@ end function BoolToString( inValue ) if( inValue == true ) then return 1 end return 0 -end
\ No newline at end of file +end @@ -1,4 +1,4 @@ -MCServer [![Build Status](http://img.shields.io/travis/mc-server/MCServer.svg)](https://travis-ci.org/mc-server/MCServer) [![tip for next commit](http://tip4commit.com/projects/74.svg)](http://tip4commit.com/projects/74) +MCServer [![Build Status](http://img.shields.io/travis/mc-server/MCServer.svg)](https://travis-ci.org/mc-server/MCServer) [![Coverity Scan Build Status](https://scan.coverity.com/projects/1930/badge.svg)](https://scan.coverity.com/projects/1930) [![tip for next commit](http://tip4commit.com/projects/74.svg)](http://tip4commit.com/projects/74) ======== MCServer is a Minecraft server that is written in C++ and designed to be efficient with memory and CPU, as well as having a flexible Lua Plugin API. diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 14d9d16fc..acfd6f4f8 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2538,6 +2538,37 @@ static int tolua_cBlockArea_GetSize(lua_State * tolua_S) +static int tolua_cBlockArea_GetCoordRange(lua_State * tolua_S) +{ + // function cBlockArea::GetCoordRange() + // Returns all three sizes of the area, miuns one, so that they represent the maximum coord value + // Exported manually because there's no direct C++ equivalent, + // plus tolua would generate extra input params for the outputs + + cLuaState L(tolua_S); + if (!L.CheckParamUserType(1, "cBlockArea")) + { + return 0; + } + + cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL); + if (self == NULL) + { + tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea:GetSize'", NULL); + return 0; + } + + // Push the three origin coords: + lua_pushnumber(tolua_S, self->GetSizeX() - 1); + lua_pushnumber(tolua_S, self->GetSizeY() - 1); + lua_pushnumber(tolua_S, self->GetSizeZ() - 1); + return 3; +} + + + + + static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S) { // function cBlockArea::LoadFromSchematicFile @@ -2926,6 +2957,7 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_beginmodule(tolua_S, "cBlockArea"); tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cBlockArea_GetBlockTypeMeta); + tolua_function(tolua_S, "GetCoordRange", tolua_cBlockArea_GetCoordRange); tolua_function(tolua_S, "GetOrigin", tolua_cBlockArea_GetOrigin); tolua_function(tolua_S, "GetRelBlockTypeMeta", tolua_cBlockArea_GetRelBlockTypeMeta); tolua_function(tolua_S, "GetSize", tolua_cBlockArea_GetSize); diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp index 2a32f69d9..c02c68afa 100644 --- a/src/BlockEntities/DispenserEntity.cpp +++ b/src/BlockEntities/DispenserEntity.cpp @@ -6,6 +6,10 @@ #include "../Simulator/FluidSimulator.h" #include "../Chunk.h" +#include "../World.h" +#include "../Entities/ArrowEntity.h" +#include "../Entities/FireChargeEntity.h" +#include "../Entities/ProjectileEntity.h" @@ -33,7 +37,10 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) // Would dispense into / interact with a non-loaded chunk, ignore the tick return; } + BLOCKTYPE DispBlock = DispChunk->GetBlock(DispX, DispY, DispZ); + int BlockX = (DispX + DispChunk->GetPosX() * cChunkDef::Width); + int BlockZ = (DispZ + DispChunk->GetPosZ() * cChunkDef::Width); // Dispense the item: switch (m_Contents.GetSlot(a_SlotNum).m_ItemType) @@ -69,7 +76,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) } break; } // E_ITEM_BUCKET - + case E_ITEM_WATER_BUCKET: { LOGD("Dispensing water bucket in slot %d; DispBlock is \"%s\" (%d).", a_SlotNum, ItemTypeToString(DispBlock).c_str(), DispBlock); @@ -83,7 +90,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) } break; } - + case E_ITEM_LAVA_BUCKET: { LOGD("Dispensing lava bucket in slot %d; DispBlock is \"%s\" (%d).", a_SlotNum, ItemTypeToString(DispBlock).c_str(), DispBlock); @@ -97,7 +104,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) } break; } - + case E_ITEM_SPAWN_EGG: { double MobX = 0.5 + (DispX + DispChunk->GetPosX() * cChunkDef::Width); @@ -108,7 +115,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) } break; } - + case E_BLOCK_TNT: { // Spawn a primed TNT entity, if space allows: @@ -128,7 +135,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) if (DispChunk->GetBlock(DispX, DispY, DispZ) == E_BLOCK_AIR) { DispChunk->SetBlock(DispX, DispY, DispZ, E_BLOCK_FIRE, 0); - + bool ItemBroke = m_Contents.DamageItem(a_SlotNum, 1); if (ItemBroke) @@ -138,13 +145,41 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) } break; } - + case E_ITEM_FIRE_CHARGE: { - // TODO: Spawn fireball entity + SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkFireCharge, GetShootVector(Meta) * 20); + m_Contents.ChangeSlotCount(a_SlotNum, -1); + break; + } + + case E_ITEM_ARROW: + { + SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkArrow, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)); + m_Contents.ChangeSlotCount(a_SlotNum, -1); + break; + } + + case E_ITEM_SNOWBALL: + { + SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkSnowball, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)); + m_Contents.ChangeSlotCount(a_SlotNum, -1); + break; + } + + case E_ITEM_EGG: + { + SpawnProjectileFromDispenser(BlockX, DispY, BlockZ, cProjectileEntity::pkEgg, GetShootVector(Meta) * 20 + Vector3d(0, 1, 0)); + m_Contents.ChangeSlotCount(a_SlotNum, -1); + break; + } + + case E_ITEM_FIREWORK_ROCKET: + { + // TODO: Add the fireworks entity break; } - + default: { DropFromSlot(a_Chunk, a_SlotNum); @@ -157,6 +192,34 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) +void cDispenserEntity::SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_ShootVector) +{ + m_World->CreateProjectile((double)a_BlockX + 0.5, (double)a_BlockY + 0.5, (double)a_BlockZ + 0.5, a_Kind, NULL, NULL, &a_ShootVector); +} + + + + + +Vector3d cDispenserEntity::GetShootVector(NIBBLETYPE a_Meta) +{ + switch (a_Meta) + { + case E_META_DROPSPENSER_FACING_YP: return Vector3d( 0, 1, 0); + case E_META_DROPSPENSER_FACING_YM: return Vector3d( 0, -1, 0); + case E_META_DROPSPENSER_FACING_XM: return Vector3d(-1, 0, 0); + case E_META_DROPSPENSER_FACING_XP: return Vector3d( 1, 0, 0); + case E_META_DROPSPENSER_FACING_ZM: return Vector3d( 0, 0, -1); + case E_META_DROPSPENSER_FACING_ZP: return Vector3d( 0, 0, 1); + } + LOGWARNING("Unhandled dispenser meta: %d", a_Meta); + ASSERT(!"Unhandled dispenser facing"); + return Vector3d(0, 1, 0); +} + + + + bool cDispenserEntity::ScoopUpLiquid(int a_SlotNum, short a_BucketItemType) { @@ -167,14 +230,14 @@ bool cDispenserEntity::ScoopUpLiquid(int a_SlotNum, short a_BucketItemType) m_Contents.SetSlot(a_SlotNum, LiquidBucket); return true; } - + // There are stacked buckets at the selected slot, see if a full bucket will fit somewhere else if (m_Contents.HowManyCanFit(LiquidBucket) < 1) { // Cannot fit into m_Contents return false; } - + m_Contents.ChangeSlotCount(a_SlotNum, -1); m_Contents.AddItem(LiquidBucket); return true; @@ -195,7 +258,7 @@ bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum // Not a suitable block in front return false; } - + cItem EmptyBucket(E_ITEM_BUCKET, 1); if (m_Contents.GetSlot(a_SlotNum).m_ItemCount == 1) { @@ -203,14 +266,14 @@ bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum m_Contents.SetSlot(a_SlotNum, EmptyBucket); return true; } - + // There are full buckets stacked at this slot, check if we can fit in the empty bucket if (m_Contents.HowManyCanFit(EmptyBucket) < 1) { // The empty bucket wouldn't fit into m_Contents return false; } - + // The empty bucket fits in, remove one full bucket and add the empty one m_Contents.ChangeSlotCount(a_SlotNum, -1); m_Contents.AddItem(EmptyBucket); @@ -219,4 +282,3 @@ bool cDispenserEntity::EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum - diff --git a/src/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index fdfe4e5b4..b33d08342 100644 --- a/src/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h @@ -12,27 +12,37 @@ class cDispenserEntity : public cDropSpenserEntity { typedef cDropSpenserEntity super; - + public: // tolua_end - - /// Constructor used for normal operation + + /** Constructor used for normal operation */ cDispenserEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); static const char * GetClassStatic(void) { return "cDispenserEntity"; } + // tolua_begin + + /** Spawns a projectile of the given kind in front of the dispenser with the specified speed. */ + void SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_Speed); + + /** Returns a unit vector in the cardinal direction of where the dispenser is facing. */ + Vector3d GetShootVector(NIBBLETYPE a_Meta); + + // tolua_end + private: // cDropSpenser overrides: virtual void DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum) override; - - /// If such a bucket can fit, adds it to m_Contents and returns true + + /** If such a bucket can fit, adds it to m_Contents and returns true */ bool ScoopUpLiquid(int a_SlotNum, short a_BucketItemType); - - /// If the a_BlockInFront is liquidable and the empty bucket can fit, does the m_Contents processing and returns true + + /** If the a_BlockInFront can be washed away by liquid and the empty bucket can fit, + does the m_Contents processing and returns true. Returns false otherwise. */ bool EmptyLiquidBucket(BLOCKTYPE a_BlockInFront, int a_SlotNum); } ; // tolua_export - diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp index e50f36d57..eb9fe92ba 100644 --- a/src/Generating/DistortedHeightmap.cpp +++ b/src/Generating/DistortedHeightmap.cpp @@ -282,7 +282,7 @@ cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) : m_OceanFloorSelect(a_Seed + 3000), m_MesaFloor(a_Seed + 4000), m_BiomeGen(a_BiomeGen), - m_UnderlyingHeiGen(a_Seed), + m_UnderlyingHeiGen(a_Seed, a_BiomeGen), m_HeightGen(m_UnderlyingHeiGen, 64), m_IsInitialized(false) { @@ -308,8 +308,6 @@ void cDistortedHeightmap::Initialize(cIniFile & a_IniFile) return; } - ((cTerrainHeightGen &)m_UnderlyingHeiGen).InitializeHeightGen(a_IniFile); - // Read the params from the INI file: m_SeaLevel = a_IniFile.GetValueSetI("Generator", "DistortedHeightmapSeaLevel", 62); m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyX", 10); diff --git a/src/Generating/DistortedHeightmap.h b/src/Generating/DistortedHeightmap.h index 31fb17df2..e6b3c9d3f 100644 --- a/src/Generating/DistortedHeightmap.h +++ b/src/Generating/DistortedHeightmap.h @@ -64,9 +64,9 @@ protected: int m_CurChunkZ; NOISE_DATATYPE m_DistortedHeightmap[17 * 257 * 17]; - cBiomeGen & m_BiomeGen; - cHeiGenMesaBryce m_UnderlyingHeiGen; // This generator provides us with base heightmap (before distortion) - cHeiGenCache m_HeightGen; // Cache above m_UnderlyingHeiGen + cBiomeGen & m_BiomeGen; + cHeiGenBiomal m_UnderlyingHeiGen; // This generator provides us with base heightmap (before distortion) + cHeiGenCache m_HeightGen; // Cache above m_UnderlyingHeiGen /// Heightmap for the current chunk, before distortion (from m_HeightGen). Used for optimization. cChunkDef::HeightMap m_CurChunkHeights; diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp index dedf3fe3f..25ac912fd 100644 --- a/src/Generating/HeiGen.cpp +++ b/src/Generating/HeiGen.cpp @@ -47,10 +47,6 @@ cTerrainHeightGen * cTerrainHeightGen::CreateHeightGen(cIniFile &a_IniFile, cBio { res = new cEndGen(a_Seed); } - else if (NoCaseCompare(HeightGenName, "MesaBryce") == 0) - { - res = new cHeiGenMesaBryce(a_Seed); - } else if (NoCaseCompare(HeightGenName, "Mountains") == 0) { res = new cHeiGenMountains(a_Seed); @@ -371,91 +367,6 @@ void cHeiGenMountains::InitializeHeightGen(cIniFile & a_IniFile) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cHeiGenMesaBryce: - -cHeiGenMesaBryce::cHeiGenMesaBryce(int a_Seed) : - m_Seed(a_Seed), - m_PerlinHFHA(a_Seed), - m_PerlinLFLA(a_Seed + 10) -{ -} - - - - - -void cHeiGenMesaBryce::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - NOISE_DATATYPE StartX = (NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width); - NOISE_DATATYPE EndX = (NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + cChunkDef::Width - 1); - NOISE_DATATYPE StartZ = (NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width); - NOISE_DATATYPE EndZ = (NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width + cChunkDef::Width - 1); - NOISE_DATATYPE Workspace[16 * 16]; - NOISE_DATATYPE Noise1[16 * 16]; - NOISE_DATATYPE Noise2[16 * 16]; - NOISE_DATATYPE Noise3[16 * 16]; - m_PerlinHFHA.Generate2D(Noise1, 16, 16, StartX, EndX, StartZ, EndZ, Workspace); - m_PerlinLFLA.Generate2D(Noise2, 16, 16, StartX, EndX, StartZ, EndZ, Workspace); - m_PerlinTops.Generate2D(Noise3, 16, 16, StartX, EndX, StartZ, EndZ, Workspace); - for (int z = 0; z < cChunkDef::Width; z++) - { - int IdxZ = z * cChunkDef::Width; - for (int x = 0; x < cChunkDef::Width; x++) - { - int idx = IdxZ + x; - // int hei = 70 + (int)(std::min(Noise1[idx], Noise2[idx]) * 15); - int hei; - if (Noise1[idx] > 1.5f) - { - hei = 83 + (int)floor(Noise3[idx]); - } - else - { - hei = 63 + (int)floor(Noise2[idx]); - } - /* - NOISE_DATATYPE v1 = sqrt(sqrt(std::max(Noise1[idx], (NOISE_DATATYPE)0))) - 50; - int hei = 60 + (int)floor(std::max(v1, 5 + Noise2[idx])); - */ - if (hei < 10) - { - hei = 10; - } - if (hei > 250) - { - hei = 250; - } - cChunkDef::SetHeight(a_HeightMap, x , z, hei); - } // for x - } // for z -} - - - - - -void cHeiGenMesaBryce::InitializeHeightGen(cIniFile & a_IniFile) -{ - // TODO: Read the params from an INI file - // m_PerlinHFHA.AddOctave(0.32f, 0.1); - /* - m_PerlinHFHA.AddOctave(0.13f, 17800000); - m_PerlinHFHA.AddOctave(0.12f, 19000000); - */ - m_PerlinHFHA.AddOctave(0.13f, 2); - m_PerlinHFHA.AddOctave(0.12f, 2); - - m_PerlinLFLA.AddOctave(0.04f, 1); - m_PerlinLFLA.AddOctave(0.02f, 2); - - m_PerlinTops.AddOctave(0.1f, 8); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cHeiGenBiomal: const cHeiGenBiomal::sGenParam cHeiGenBiomal::m_GenParam[256] = diff --git a/src/Generating/HeiGen.h b/src/Generating/HeiGen.h index 5fc4f4abc..5c106c7d9 100644 --- a/src/Generating/HeiGen.h +++ b/src/Generating/HeiGen.h @@ -127,27 +127,6 @@ protected: -class cHeiGenMesaBryce : - public cTerrainHeightGen -{ -public: - cHeiGenMesaBryce(int a_Seed); - -protected: - int m_Seed; - cPerlinNoise m_PerlinHFHA; // HighFrequencyHighAmplitude, for the hills - cPerlinNoise m_PerlinLFLA; // LowFrequencyLowAmplitude, for the floor - cPerlinNoise m_PerlinTops; - - // cTerrainHeightGen overrides: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - virtual void InitializeHeightGen(cIniFile & a_IniFile) override; -} ; - - - - - class cHeiGenBiomal : public cTerrainHeightGen { diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp index b9cb056ad..9917141ed 100644 --- a/src/Generating/VillageGen.cpp +++ b/src/Generating/VillageGen.cpp @@ -116,7 +116,8 @@ public: int a_Density, cPiecePool & a_Prefabs, cTerrainHeightGen & a_HeightGen, - BLOCKTYPE a_RoadBlock + BLOCKTYPE a_RoadBlock, + BLOCKTYPE a_WaterRoadBlock ) : super(a_OriginX, a_OriginZ), m_Seed(a_Seed), @@ -126,7 +127,8 @@ public: m_Borders(a_OriginX - a_MaxSize, 0, a_OriginZ - a_MaxSize, a_OriginX + a_MaxSize, 255, a_OriginZ + a_MaxSize), m_Prefabs(a_Prefabs), m_HeightGen(a_HeightGen), - m_RoadBlock(a_RoadBlock) + m_RoadBlock(a_RoadBlock), + m_WaterRoadBlock(a_WaterRoadBlock) { // Generate the pieces for this village; don't care about the Y coord: cBFSPieceGenerator pg(*this, a_Seed); @@ -179,6 +181,9 @@ protected: /** The block to use for the roads. */ BLOCKTYPE m_RoadBlock; + + /** The block used for the roads if the road is on water. */ + BLOCKTYPE m_WaterRoadBlock; // cGridStructGen::cStructure overrides: @@ -239,7 +244,14 @@ protected: { for (int x = MinX; x <= MaxX; x++) { - a_Chunk.SetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, m_RoadBlock); + if (IsBlockWater(a_Chunk.GetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z))) + { + a_Chunk.SetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, m_WaterRoadBlock); + } + else + { + a_Chunk.SetBlockType(x, cChunkDef::GetHeight(a_HeightMap, x, z), z, m_RoadBlock); + } } } } @@ -374,6 +386,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_ // If just one is not, no village is created, because it's likely that an unfriendly biome is too close cVillagePiecePool * VillagePrefabs = NULL; BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL; + BLOCKTYPE WaterRoadBlock = E_BLOCK_PLANKS; int rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 11; cVillagePiecePool * PlainsVillage = g_PlainsVillagePools[rnd % ARRAYCOUNT(g_PlainsVillagePools)]; cVillagePiecePool * DesertVillage = g_DesertVillagePools[rnd % ARRAYCOUNT(g_DesertVillagePools)]; @@ -422,7 +435,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_OriginX, int a_ { return cStructurePtr(); } - return cStructurePtr(new cVillage(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock)); + return cStructurePtr(new cVillage(m_Seed, a_OriginX, a_OriginZ, m_MaxDepth, m_MaxSize, Density, *VillagePrefabs, m_HeightGen, RoadBlock, WaterRoadBlock)); } diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp index 523697b07..e570bb2b1 100644 --- a/src/GroupManager.cpp +++ b/src/GroupManager.cpp @@ -123,7 +123,7 @@ bool cGroupManager::LoadGroups() IniFile.SetValue("Owner", "Permissions", "*", true); IniFile.SetValue("Owner", "Color", "2", true); - IniFile.SetValue("Moderator", "Permissions", "core.time,core.item,core.teleport,core.ban,core.unban,core.save-all,core.toggledownfall"); + IniFile.SetValue("Moderator", "Permissions", "core.time,core.item,core.tpa,core.tpaccept,core.ban,core.unban,core.save-all,core.toggledownfall"); IniFile.SetValue("Moderator", "Color", "2", true); IniFile.SetValue("Moderator", "Inherits", "Player", true); |