Add fireball interact

This commit is contained in:
Howaner 2014-03-14 23:52:51 +01:00
parent 60091bcba3
commit ccc29c7c6c
4 changed files with 33 additions and 2 deletions

View File

@ -138,6 +138,12 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
break;
}
case E_ITEM_FIRE_CHARGE:
{
// TODO: Spawn fireball entity
break;
}
default:
{
DropFromSlot(a_Chunk, a_SlotNum);

View File

@ -107,6 +107,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
case E_ITEM_EGG: return new cItemEggHandler();
case E_ITEM_EMPTY_MAP: return new cItemEmptyMapHandler();
case E_ITEM_ENDER_PEARL: return new cItemEnderPearlHandler();
case E_ITEM_FIRE_CHARGE: return new cItemLighterHandler(a_ItemType);
case E_ITEM_FIREWORK_ROCKET: return new cItemFireworkHandler();
case E_ITEM_FISHING_ROD: return new cItemFishingRodHandler(a_ItemType);
case E_ITEM_FLINT_AND_STEEL: return new cItemLighterHandler(a_ItemType);

View File

@ -34,7 +34,11 @@ public:
if (Block == E_BLOCK_AIR)
{
cItemFrame * ItemFrame = new cItemFrame(a_Dir, a_BlockX, a_BlockY, a_BlockZ);
ItemFrame->Initialize(a_World);
if (!ItemFrame->Initialize(a_World))
{
delete ItemFrame;
return false;
}
if (!a_Player->IsGameModeCreative())
{

View File

@ -26,7 +26,26 @@ public:
return false;
}
if (!a_Player->IsGameModeCreative())
{
switch (m_ItemType)
{
case E_ITEM_FLINT_AND_STEEL:
{
a_Player->UseEquippedItem();
break;
}
case E_ITEM_FIRE_CHARGE:
{
a_Player->GetInventory().RemoveOneEquippedItem();
break;
}
default:
{
ASSERT(!"Unknown Lighter Item!");
}
}
}
switch (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))
{
@ -49,6 +68,7 @@ public:
if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_AIR)
{
a_World->SetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_FIRE, 0);
a_World->BroadcastSoundEffect("fire.ignite", a_BlockX * 8, a_BlockY * 8, a_BlockZ * 8, 1.0F, 1.04F);
break;
}
}