private TaskState Consume(Dwarf d, float dt) { if (d.GetHoldingWorldObject() == null) throw new Exception("Dwarf does not carry any tool"); if (d.GetHoldingWorldObject().GetType().IsSubclassOf(typeof(Tool)) == false) throw new Exception("Dwarf tried to consume something that was not tool"); Tool tool = (Tool)d.RemoveHoldingWorldObject(); d.ConsumeTool(tool); return TaskState.PersonalSuccess; }