Merge devel into master (#78)

* * Turn survival back on for now.

* * Add TP command.

* * Fix fall damage reset.

* * Mob hitting works.

I've disabled entity shading though. Will get back to it at some point, promise!

* * Knockback

* * Mobs now rotate when they die.

* * Fire fix
This commit is contained in:
iProgramInCpp
2023-09-17 12:47:09 +03:00
committed by GitHub
parent e9b00e6ba1
commit 350100ac48
15 changed files with 225 additions and 8 deletions

View File

@@ -94,6 +94,7 @@ void Inventory::prepareSurvivalInventory()
addTestItem(Item::camera->m_itemID, 64);
addTestItem(Tile::ladder->m_ID, 64);
addTestItem(Tile::obsidian->m_ID, 64);
addTestItem(Tile::fire->m_ID, 64);
for (int i = 0; i < C_MAX_HOTBAR_ITEMS; i++)
m_hotbar[i] = i;
@@ -217,7 +218,11 @@ ItemInstance* Inventory::getQuickSlotItem(int slotNo)
if (slotNo < 0 || slotNo >= C_MAX_HOTBAR_ITEMS)
return nullptr;
return getItem(m_hotbar[slotNo]);
ItemInstance* pInst = getItem(m_hotbar[slotNo]);
if (pInst->m_itemID == 0)
return nullptr;
return pInst;
}
ItemInstance* Inventory::getSelectedItem()
@@ -293,3 +298,12 @@ void Inventory::selectItemById(int itemID)
LOG_W("selectItemById: %d doesn't exist", itemID);
}
int Inventory::getAttackDamage(Entity* pEnt)
{
ItemInstance* pInst = getSelected();
if (!pInst)
return 1;
return pInst->getAttackDamage(pEnt);
}