1
0

Added levels of shrapnel

This commit is contained in:
Tiger Wang 2014-03-18 20:45:10 +00:00
parent e672988577
commit 23ffaa19b7
3 changed files with 18 additions and 8 deletions

View File

@ -1832,13 +1832,17 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
}
else if (m_World->IsTNTShrapnelEnabled() && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
else if ((m_World->GetTNTShrapnelLevel() > 0) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
{
if (!cBlockInfo::FullyOccupiesVoxel(area.GetBlockType(bx + x, by + y, bz + z)))
if (!cBlockInfo::FullyOccupiesVoxel(Block))
{
break;
}
m_World->SpawnFallingBlock(bx + x, by + y + 5, bz + z, area.GetBlockType(bx + x, by + y, bz + z), area.GetBlockMeta(bx + x, by + y, bz + z));
else if ((m_World->GetTNTShrapnelLevel() == 1) && ((Block != E_BLOCK_SAND) && (Block != E_BLOCK_GRAVEL)))
{
break;
}
m_World->SpawnFallingBlock(bx + x, by + y + 5, bz + z, Block, area.GetBlockMeta(bx + x, by + y, bz + z));
}
area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR);
a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z));

View File

@ -578,13 +578,15 @@ void cWorld::Start(void)
m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false);
m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", true);
m_ShouldLavaSpawnFire = IniFile.GetValueSetB("Physics", "ShouldLavaSpawnFire", true);
m_bTNTSpawnsShrapnel = IniFile.GetValueSetB("Physics", "IsTNTShrapnelEnabled", true);
m_TNTShrapnelLevel = IniFile.GetValueSetI("Physics", "TNTShrapnelLevel", 2);
m_bCommandBlocksEnabled = IniFile.GetValueSetB("Mechanics", "CommandBlocksEnabled", false);
m_bEnabledPVP = IniFile.GetValueSetB("Mechanics", "PVPEnabled", true);
m_bUseChatPrefixes = IniFile.GetValueSetB("Mechanics", "UseChatPrefixes", true);
m_VillagersShouldHarvestCrops = IniFile.GetValueSetB("Monsters", "VillagersShouldHarvestCrops", true);
m_GameMode = (eGameMode)IniFile.GetValueSetI("General", "Gamemode", m_GameMode);
if (m_TNTShrapnelLevel > 2)
m_TNTShrapnelLevel = 2;
// Load allowed mobs:
const char * DefaultMonsters = "";

View File

@ -605,8 +605,8 @@ public:
bool AreCommandBlocksEnabled(void) const { return m_bCommandBlocksEnabled; }
void SetCommandBlocksEnabled(bool a_Flag) { m_bCommandBlocksEnabled = a_Flag; }
bool IsTNTShrapnelEnabled(void) const { return m_bTNTSpawnsShrapnel; }
void SetTNTShrapnelEnabled(bool a_Flag) { m_bTNTSpawnsShrapnel = a_Flag; }
unsigned char GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
void SetTNTShrapnelLevel(int a_Flag) { m_TNTShrapnelLevel = a_Flag; }
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
@ -866,8 +866,12 @@ private:
/** Whether prefixes such as [INFO] are prepended to SendMessageXXX() / BroadcastChatXXX() functions */
bool m_bUseChatPrefixes;
/** Whether TNT explosions, done via cWorld::DoExplosionAt(), should project random affected blocks as FallingBlock entities */
bool m_bTNTSpawnsShrapnel;
/** The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities
0 = None
1 = Only sand and gravel
2 = All blocks
*/
int m_TNTShrapnelLevel;
cChunkGenerator m_Generator;