1
0
Fork 0

ENUMified shrapnel level

This commit is contained in:
Tiger Wang 2014-03-19 23:06:39 +00:00
parent b8fe024f9d
commit 0524d70774
4 changed files with 17 additions and 15 deletions

View File

@ -852,10 +852,14 @@ enum eExplosionSource
esWitherSkullBlack,
esWitherSkullBlue,
esWitherBirth,
esPlugin,
// Obsolete constants, kept for compatibility, will be removed after some time:
esCreeper = esMonster,
esPlugin
} ;
enum eShrapnelLevel
{
slNone,
slGravityAffectedOnly,
slAll
} ;
// tolua_end

View File

@ -1834,13 +1834,13 @@ 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->GetTNTShrapnelLevel() > 0) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
{
if (!cBlockInfo::FullyOccupiesVoxel(Block))
{
break;
}
else if ((m_World->GetTNTShrapnelLevel() == 1) && ((Block != E_BLOCK_SAND) && (Block != E_BLOCK_GRAVEL)))
else if ((m_World->GetTNTShrapnelLevel() == slGravityAffectedOnly) && ((Block != E_BLOCK_SAND) && (Block != E_BLOCK_GRAVEL)))
{
break;
}

View File

@ -577,15 +577,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_TNTShrapnelLevel = IniFile.GetValueSetI("Physics", "TNTShrapnelLevel", 2);
m_TNTShrapnelLevel = (eShrapnelLevel)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;
if (m_TNTShrapnelLevel > slAll)
m_TNTShrapnelLevel = slAll;
// 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; }
unsigned char GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
void SetTNTShrapnelLevel(int a_Flag) { m_TNTShrapnelLevel = a_Flag; }
eShrapnelLevel GetTNTShrapnelLevel(void) const { return m_TNTShrapnelLevel; }
void SetTNTShrapnelLevel(eShrapnelLevel a_Flag) { m_TNTShrapnelLevel = a_Flag; }
bool ShouldUseChatPrefixes(void) const { return m_bUseChatPrefixes; }
void SetShouldUseChatPrefixes(bool a_Flag) { m_bUseChatPrefixes = a_Flag; }
@ -867,11 +867,9 @@ private:
bool m_bUseChatPrefixes;
/** The level of DoExplosionAt() projecting random affected blocks as FallingBlock entities
0 = None
1 = Only sand and gravel
2 = All blocks
See the eShrapnelLevel enumeration for details
*/
int m_TNTShrapnelLevel;
eShrapnelLevel m_TNTShrapnelLevel;
cChunkGenerator m_Generator;