Document and Update function.cpp

Added much needed documentation as well as removed the flinching slime animation and wait_time function (which will not be used).