Browse Source

fix player hand tool usage

Kolja Strohm 2 years ago
parent
commit
8786ce10bc
1 changed files with 4 additions and 2 deletions
  1. 4 2
      FactoryCraft/Entity.cpp

+ 4 - 2
FactoryCraft/Entity.cpp

@@ -157,7 +157,8 @@ Entity::Entity(
       currentDimensionId(dimensionId),
       removed(0),
       gravityMultiplier(1.f),
-      id(entityId)
+      id(entityId),
+      placeBlockCooldown(0)
 {}
 
 void Entity::onDeath()
@@ -195,7 +196,8 @@ void Entity::useItem(int typeId, Item* zItem)
             }
             if (!selected)
             {
-                selected = selected->zSkillType()->createDefaultItemSkill();
+                selected = StaticRegistry<ItemType>::INSTANCE.zElement(typeId)
+                               ->createDefaultItemSkill();
                 skills.add(selected);
             }
             target->applyItemSkillOnTarget(this, selected, zItem);