ENT.id = 59

if CLIENT

ENT.anims = {
	{ -- Closed by default
		{{224,16},nil,-1}
	},
	{ -- Opening/Open
		{{208,80},nil,5},
		{{224,80},nil,-1}
	},
	{ -- Closing/Closed
		{{208,80},nil,5},
		{{224,16},nil,-1}
	},
	{ -- Pain
		{{240,80},nil,-1}
	}
}

function ENT:think()
	if self.anim == 4
		-- TODO: Shake, scream in pain, etc.
		return
	end

	local in_range = false
	for id,player in pairs(self.stage.players)
		if math.abs(self.x - player.x) < 5*16 and math.abs(self.y - player.y) < 5*16
			in_range = true
			break
		end
	end
	if in_range
		self:set_anim(2)
	elseif self.anim ~= 1
		self:set_anim(3)
	end
end

end
